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.

22575 lines
600KB

  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 threshold
  315. If a signal of stream rises above this level it will affect the gain
  316. reduction.
  317. By default it is 0.125. Range is between 0.00097563 and 1.
  318. @item ratio
  319. Set a ratio by which the signal is reduced. 1:2 means that if the level
  320. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  321. Default is 2. Range is between 1 and 20.
  322. @item attack
  323. Amount of milliseconds the signal has to rise above the threshold before gain
  324. reduction starts. Default is 20. Range is between 0.01 and 2000.
  325. @item release
  326. Amount of milliseconds the signal has to fall below the threshold before
  327. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  328. @item makeup
  329. Set the amount by how much signal will be amplified after processing.
  330. Default is 1. Range is from 1 to 64.
  331. @item knee
  332. Curve the sharp knee around the threshold to enter gain reduction more softly.
  333. Default is 2.82843. Range is between 1 and 8.
  334. @item link
  335. Choose if the @code{average} level between all channels of input stream
  336. or the louder(@code{maximum}) channel of input stream affects the
  337. reduction. Default is @code{average}.
  338. @item detection
  339. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  340. of @code{rms}. Default is @code{rms} which is mostly smoother.
  341. @item mix
  342. How much to use compressed signal in output. Default is 1.
  343. Range is between 0 and 1.
  344. @end table
  345. @section acontrast
  346. Simple audio dynamic range commpression/expansion filter.
  347. The filter accepts the following options:
  348. @table @option
  349. @item contrast
  350. Set contrast. Default is 33. Allowed range is between 0 and 100.
  351. @end table
  352. @section acopy
  353. Copy the input audio source unchanged to the output. This is mainly useful for
  354. testing purposes.
  355. @section acrossfade
  356. Apply cross fade from one input audio stream to another input audio stream.
  357. The cross fade is applied for specified duration near the end of first stream.
  358. The filter accepts the following options:
  359. @table @option
  360. @item nb_samples, ns
  361. Specify the number of samples for which the cross fade effect has to last.
  362. At the end of the cross fade effect the first input audio will be completely
  363. silent. Default is 44100.
  364. @item duration, d
  365. Specify the duration of the cross fade effect. See
  366. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  367. for the accepted syntax.
  368. By default the duration is determined by @var{nb_samples}.
  369. If set this option is used instead of @var{nb_samples}.
  370. @item overlap, o
  371. Should first stream end overlap with second stream start. Default is enabled.
  372. @item curve1
  373. Set curve for cross fade transition for first stream.
  374. @item curve2
  375. Set curve for cross fade transition for second stream.
  376. For description of available curve types see @ref{afade} filter description.
  377. @end table
  378. @subsection Examples
  379. @itemize
  380. @item
  381. Cross fade from one input to another:
  382. @example
  383. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  384. @end example
  385. @item
  386. Cross fade from one input to another but without overlapping:
  387. @example
  388. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  389. @end example
  390. @end itemize
  391. @section acrossover
  392. Split audio stream into several bands.
  393. This filter splits audio stream into two or more frequency ranges.
  394. Summing all streams back will give flat output.
  395. The filter accepts the following options:
  396. @table @option
  397. @item split
  398. Set split frequencies. Those must be positive and increasing.
  399. @item order
  400. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  401. Default is @var{4th}.
  402. @end table
  403. @section acrusher
  404. Reduce audio bit resolution.
  405. This filter is bit crusher with enhanced functionality. A bit crusher
  406. is used to audibly reduce number of bits an audio signal is sampled
  407. with. This doesn't change the bit depth at all, it just produces the
  408. effect. Material reduced in bit depth sounds more harsh and "digital".
  409. This filter is able to even round to continuous values instead of discrete
  410. bit depths.
  411. Additionally it has a D/C offset which results in different crushing of
  412. the lower and the upper half of the signal.
  413. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  414. Another feature of this filter is the logarithmic mode.
  415. This setting switches from linear distances between bits to logarithmic ones.
  416. The result is a much more "natural" sounding crusher which doesn't gate low
  417. signals for example. The human ear has a logarithmic perception,
  418. so this kind of crushing is much more pleasant.
  419. Logarithmic crushing is also able to get anti-aliased.
  420. The filter accepts the following options:
  421. @table @option
  422. @item level_in
  423. Set level in.
  424. @item level_out
  425. Set level out.
  426. @item bits
  427. Set bit reduction.
  428. @item mix
  429. Set mixing amount.
  430. @item mode
  431. Can be linear: @code{lin} or logarithmic: @code{log}.
  432. @item dc
  433. Set DC.
  434. @item aa
  435. Set anti-aliasing.
  436. @item samples
  437. Set sample reduction.
  438. @item lfo
  439. Enable LFO. By default disabled.
  440. @item lforange
  441. Set LFO range.
  442. @item lforate
  443. Set LFO rate.
  444. @end table
  445. @section acue
  446. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  447. filter.
  448. @section adeclick
  449. Remove impulsive noise from input audio.
  450. Samples detected as impulsive noise are replaced by interpolated samples using
  451. autoregressive modelling.
  452. @table @option
  453. @item w
  454. Set window size, in milliseconds. Allowed range is from @code{10} to
  455. @code{100}. Default value is @code{55} milliseconds.
  456. This sets size of window which will be processed at once.
  457. @item o
  458. Set window overlap, in percentage of window size. Allowed range is from
  459. @code{50} to @code{95}. Default value is @code{75} percent.
  460. Setting this to a very high value increases impulsive noise removal but makes
  461. whole process much slower.
  462. @item a
  463. Set autoregression order, in percentage of window size. Allowed range is from
  464. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  465. controls quality of interpolated samples using neighbour good samples.
  466. @item t
  467. Set threshold value. Allowed range is from @code{1} to @code{100}.
  468. Default value is @code{2}.
  469. This controls the strength of impulsive noise which is going to be removed.
  470. The lower value, the more samples will be detected as impulsive noise.
  471. @item b
  472. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  473. @code{10}. Default value is @code{2}.
  474. If any two samples deteced as noise are spaced less than this value then any
  475. sample inbetween those two samples will be also detected as noise.
  476. @item m
  477. Set overlap method.
  478. It accepts the following values:
  479. @table @option
  480. @item a
  481. Select overlap-add method. Even not interpolated samples are slightly
  482. changed with this method.
  483. @item s
  484. Select overlap-save method. Not interpolated samples remain unchanged.
  485. @end table
  486. Default value is @code{a}.
  487. @end table
  488. @section adeclip
  489. Remove clipped samples from input audio.
  490. Samples detected as clipped are replaced by interpolated samples using
  491. autoregressive modelling.
  492. @table @option
  493. @item w
  494. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  495. Default value is @code{55} milliseconds.
  496. This sets size of window which will be processed at once.
  497. @item o
  498. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  499. to @code{95}. Default value is @code{75} percent.
  500. @item a
  501. Set autoregression order, in percentage of window size. Allowed range is from
  502. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  503. quality of interpolated samples using neighbour good samples.
  504. @item t
  505. Set threshold value. Allowed range is from @code{1} to @code{100}.
  506. Default value is @code{10}. Higher values make clip detection less aggressive.
  507. @item n
  508. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  509. Default value is @code{1000}. Higher values make clip detection less aggressive.
  510. @item m
  511. Set overlap method.
  512. It accepts the following values:
  513. @table @option
  514. @item a
  515. Select overlap-add method. Even not interpolated samples are slightly changed
  516. with this method.
  517. @item s
  518. Select overlap-save method. Not interpolated samples remain unchanged.
  519. @end table
  520. Default value is @code{a}.
  521. @end table
  522. @section adelay
  523. Delay one or more audio channels.
  524. Samples in delayed channel are filled with silence.
  525. The filter accepts the following option:
  526. @table @option
  527. @item delays
  528. Set list of delays in milliseconds for each channel separated by '|'.
  529. Unused delays will be silently ignored. If number of given delays is
  530. smaller than number of channels all remaining channels will not be delayed.
  531. If you want to delay exact number of samples, append 'S' to number.
  532. @end table
  533. @subsection Examples
  534. @itemize
  535. @item
  536. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  537. the second channel (and any other channels that may be present) unchanged.
  538. @example
  539. adelay=1500|0|500
  540. @end example
  541. @item
  542. Delay second channel by 500 samples, the third channel by 700 samples and leave
  543. the first channel (and any other channels that may be present) unchanged.
  544. @example
  545. adelay=0|500S|700S
  546. @end example
  547. @end itemize
  548. @section aderivative, aintegral
  549. Compute derivative/integral of audio stream.
  550. Applying both filters one after another produces original audio.
  551. @section aecho
  552. Apply echoing to the input audio.
  553. Echoes are reflected sound and can occur naturally amongst mountains
  554. (and sometimes large buildings) when talking or shouting; digital echo
  555. effects emulate this behaviour and are often used to help fill out the
  556. sound of a single instrument or vocal. The time difference between the
  557. original signal and the reflection is the @code{delay}, and the
  558. loudness of the reflected signal is the @code{decay}.
  559. Multiple echoes can have different delays and decays.
  560. A description of the accepted parameters follows.
  561. @table @option
  562. @item in_gain
  563. Set input gain of reflected signal. Default is @code{0.6}.
  564. @item out_gain
  565. Set output gain of reflected signal. Default is @code{0.3}.
  566. @item delays
  567. Set list of time intervals in milliseconds between original signal and reflections
  568. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  569. Default is @code{1000}.
  570. @item decays
  571. Set list of loudness of reflected signals separated by '|'.
  572. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  573. Default is @code{0.5}.
  574. @end table
  575. @subsection Examples
  576. @itemize
  577. @item
  578. Make it sound as if there are twice as many instruments as are actually playing:
  579. @example
  580. aecho=0.8:0.88:60:0.4
  581. @end example
  582. @item
  583. If delay is very short, then it sound like a (metallic) robot playing music:
  584. @example
  585. aecho=0.8:0.88:6:0.4
  586. @end example
  587. @item
  588. A longer delay will sound like an open air concert in the mountains:
  589. @example
  590. aecho=0.8:0.9:1000:0.3
  591. @end example
  592. @item
  593. Same as above but with one more mountain:
  594. @example
  595. aecho=0.8:0.9:1000|1800:0.3|0.25
  596. @end example
  597. @end itemize
  598. @section aemphasis
  599. Audio emphasis filter creates or restores material directly taken from LPs or
  600. emphased CDs with different filter curves. E.g. to store music on vinyl the
  601. signal has to be altered by a filter first to even out the disadvantages of
  602. this recording medium.
  603. Once the material is played back the inverse filter has to be applied to
  604. restore the distortion of the frequency response.
  605. The filter accepts the following options:
  606. @table @option
  607. @item level_in
  608. Set input gain.
  609. @item level_out
  610. Set output gain.
  611. @item mode
  612. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  613. use @code{production} mode. Default is @code{reproduction} mode.
  614. @item type
  615. Set filter type. Selects medium. Can be one of the following:
  616. @table @option
  617. @item col
  618. select Columbia.
  619. @item emi
  620. select EMI.
  621. @item bsi
  622. select BSI (78RPM).
  623. @item riaa
  624. select RIAA.
  625. @item cd
  626. select Compact Disc (CD).
  627. @item 50fm
  628. select 50µs (FM).
  629. @item 75fm
  630. select 75µs (FM).
  631. @item 50kf
  632. select 50µs (FM-KF).
  633. @item 75kf
  634. select 75µs (FM-KF).
  635. @end table
  636. @end table
  637. @section aeval
  638. Modify an audio signal according to the specified expressions.
  639. This filter accepts one or more expressions (one for each channel),
  640. which are evaluated and used to modify a corresponding audio signal.
  641. It accepts the following parameters:
  642. @table @option
  643. @item exprs
  644. Set the '|'-separated expressions list for each separate channel. If
  645. the number of input channels is greater than the number of
  646. expressions, the last specified expression is used for the remaining
  647. output channels.
  648. @item channel_layout, c
  649. Set output channel layout. If not specified, the channel layout is
  650. specified by the number of expressions. If set to @samp{same}, it will
  651. use by default the same input channel layout.
  652. @end table
  653. Each expression in @var{exprs} can contain the following constants and functions:
  654. @table @option
  655. @item ch
  656. channel number of the current expression
  657. @item n
  658. number of the evaluated sample, starting from 0
  659. @item s
  660. sample rate
  661. @item t
  662. time of the evaluated sample expressed in seconds
  663. @item nb_in_channels
  664. @item nb_out_channels
  665. input and output number of channels
  666. @item val(CH)
  667. the value of input channel with number @var{CH}
  668. @end table
  669. Note: this filter is slow. For faster processing you should use a
  670. dedicated filter.
  671. @subsection Examples
  672. @itemize
  673. @item
  674. Half volume:
  675. @example
  676. aeval=val(ch)/2:c=same
  677. @end example
  678. @item
  679. Invert phase of the second channel:
  680. @example
  681. aeval=val(0)|-val(1)
  682. @end example
  683. @end itemize
  684. @anchor{afade}
  685. @section afade
  686. Apply fade-in/out effect to input audio.
  687. A description of the accepted parameters follows.
  688. @table @option
  689. @item type, t
  690. Specify the effect type, can be either @code{in} for fade-in, or
  691. @code{out} for a fade-out effect. Default is @code{in}.
  692. @item start_sample, ss
  693. Specify the number of the start sample for starting to apply the fade
  694. effect. Default is 0.
  695. @item nb_samples, ns
  696. Specify the number of samples for which the fade effect has to last. At
  697. the end of the fade-in effect the output audio will have the same
  698. volume as the input audio, at the end of the fade-out transition
  699. the output audio will be silence. Default is 44100.
  700. @item start_time, st
  701. Specify the start time of the fade effect. Default is 0.
  702. The value must be specified as a time duration; see
  703. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  704. for the accepted syntax.
  705. If set this option is used instead of @var{start_sample}.
  706. @item duration, d
  707. Specify the duration of the fade effect. See
  708. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  709. for the accepted syntax.
  710. At the end of the fade-in effect the output audio will have the same
  711. volume as the input audio, at the end of the fade-out transition
  712. the output audio will be silence.
  713. By default the duration is determined by @var{nb_samples}.
  714. If set this option is used instead of @var{nb_samples}.
  715. @item curve
  716. Set curve for fade transition.
  717. It accepts the following values:
  718. @table @option
  719. @item tri
  720. select triangular, linear slope (default)
  721. @item qsin
  722. select quarter of sine wave
  723. @item hsin
  724. select half of sine wave
  725. @item esin
  726. select exponential sine wave
  727. @item log
  728. select logarithmic
  729. @item ipar
  730. select inverted parabola
  731. @item qua
  732. select quadratic
  733. @item cub
  734. select cubic
  735. @item squ
  736. select square root
  737. @item cbr
  738. select cubic root
  739. @item par
  740. select parabola
  741. @item exp
  742. select exponential
  743. @item iqsin
  744. select inverted quarter of sine wave
  745. @item ihsin
  746. select inverted half of sine wave
  747. @item dese
  748. select double-exponential seat
  749. @item desi
  750. select double-exponential sigmoid
  751. @item losi
  752. select logistic sigmoid
  753. @end table
  754. @end table
  755. @subsection Examples
  756. @itemize
  757. @item
  758. Fade in first 15 seconds of audio:
  759. @example
  760. afade=t=in:ss=0:d=15
  761. @end example
  762. @item
  763. Fade out last 25 seconds of a 900 seconds audio:
  764. @example
  765. afade=t=out:st=875:d=25
  766. @end example
  767. @end itemize
  768. @section afftdn
  769. Denoise audio samples with FFT.
  770. A description of the accepted parameters follows.
  771. @table @option
  772. @item nr
  773. Set the noise reduction in dB, allowed range is 0.01 to 97.
  774. Default value is 12 dB.
  775. @item nf
  776. Set the noise floor in dB, allowed range is -80 to -20.
  777. Default value is -50 dB.
  778. @item nt
  779. Set the noise type.
  780. It accepts the following values:
  781. @table @option
  782. @item w
  783. Select white noise.
  784. @item v
  785. Select vinyl noise.
  786. @item s
  787. Select shellac noise.
  788. @item c
  789. Select custom noise, defined in @code{bn} option.
  790. Default value is white noise.
  791. @end table
  792. @item bn
  793. Set custom band noise for every one of 15 bands.
  794. Bands are separated by ' ' or '|'.
  795. @item rf
  796. Set the residual floor in dB, allowed range is -80 to -20.
  797. Default value is -38 dB.
  798. @item tn
  799. Enable noise tracking. By default is disabled.
  800. With this enabled, noise floor is automatically adjusted.
  801. @item tr
  802. Enable residual tracking. By default is disabled.
  803. @item om
  804. Set the output mode.
  805. It accepts the following values:
  806. @table @option
  807. @item i
  808. Pass input unchanged.
  809. @item o
  810. Pass noise filtered out.
  811. @item n
  812. Pass only noise.
  813. Default value is @var{o}.
  814. @end table
  815. @end table
  816. @subsection Commands
  817. This filter supports the following commands:
  818. @table @option
  819. @item sample_noise, sn
  820. Start or stop measuring noise profile.
  821. Syntax for the command is : "start" or "stop" string.
  822. After measuring noise profile is stopped it will be
  823. automatically applied in filtering.
  824. @item noise_reduction, nr
  825. Change noise reduction. Argument is single float number.
  826. Syntax for the command is : "@var{noise_reduction}"
  827. @item noise_floor, nf
  828. Change noise floor. Argument is single float number.
  829. Syntax for the command is : "@var{noise_floor}"
  830. @item output_mode, om
  831. Change output mode operation.
  832. Syntax for the command is : "i", "o" or "n" string.
  833. @end table
  834. @section afftfilt
  835. Apply arbitrary expressions to samples in frequency domain.
  836. @table @option
  837. @item real
  838. Set frequency domain real expression for each separate channel separated
  839. by '|'. Default is "1".
  840. If the number of input channels is greater than the number of
  841. expressions, the last specified expression is used for the remaining
  842. output channels.
  843. @item imag
  844. Set frequency domain imaginary expression for each separate channel
  845. separated by '|'. If not set, @var{real} option is used.
  846. Each expression in @var{real} and @var{imag} can contain the following
  847. constants:
  848. @table @option
  849. @item sr
  850. sample rate
  851. @item b
  852. current frequency bin number
  853. @item nb
  854. number of available bins
  855. @item ch
  856. channel number of the current expression
  857. @item chs
  858. number of channels
  859. @item pts
  860. current frame pts
  861. @end table
  862. @item win_size
  863. Set window size.
  864. It accepts the following values:
  865. @table @samp
  866. @item w16
  867. @item w32
  868. @item w64
  869. @item w128
  870. @item w256
  871. @item w512
  872. @item w1024
  873. @item w2048
  874. @item w4096
  875. @item w8192
  876. @item w16384
  877. @item w32768
  878. @item w65536
  879. @end table
  880. Default is @code{w4096}
  881. @item win_func
  882. Set window function. Default is @code{hann}.
  883. @item overlap
  884. Set window overlap. If set to 1, the recommended overlap for selected
  885. window function will be picked. Default is @code{0.75}.
  886. @end table
  887. @subsection Examples
  888. @itemize
  889. @item
  890. Leave almost only low frequencies in audio:
  891. @example
  892. afftfilt="1-clip((b/nb)*b,0,1)"
  893. @end example
  894. @end itemize
  895. @anchor{afir}
  896. @section afir
  897. Apply an arbitrary Frequency Impulse Response filter.
  898. This filter is designed for applying long FIR filters,
  899. up to 60 seconds long.
  900. It can be used as component for digital crossover filters,
  901. room equalization, cross talk cancellation, wavefield synthesis,
  902. auralization, ambiophonics and ambisonics.
  903. This filter uses second stream as FIR coefficients.
  904. If second stream holds single channel, it will be used
  905. for all input channels in first stream, otherwise
  906. number of channels in second stream must be same as
  907. number of channels in first stream.
  908. It accepts the following parameters:
  909. @table @option
  910. @item dry
  911. Set dry gain. This sets input gain.
  912. @item wet
  913. Set wet gain. This sets final output gain.
  914. @item length
  915. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  916. @item gtype
  917. Enable applying gain measured from power of IR.
  918. Set which approach to use for auto gain measurement.
  919. @table @option
  920. @item none
  921. Do not apply any gain.
  922. @item peak
  923. select peak gain, very conservative approach. This is default value.
  924. @item dc
  925. select DC gain, limited application.
  926. @item gn
  927. select gain to noise approach, this is most popular one.
  928. @end table
  929. @item irgain
  930. Set gain to be applied to IR coefficients before filtering.
  931. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  932. @item irfmt
  933. Set format of IR stream. Can be @code{mono} or @code{input}.
  934. Default is @code{input}.
  935. @item maxir
  936. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  937. Allowed range is 0.1 to 60 seconds.
  938. @item response
  939. Show IR frequency reponse, magnitude(magenta) and phase(green) and group delay(yellow) in additional video stream.
  940. By default it is disabled.
  941. @item channel
  942. Set for which IR channel to display frequency response. By default is first channel
  943. displayed. This option is used only when @var{response} is enabled.
  944. @item size
  945. Set video stream size. This option is used only when @var{response} is enabled.
  946. @item rate
  947. Set video stream frame rate. This option is used only when @var{response} is enabled.
  948. @item minp
  949. Set minimal partition size used for convolution. Default is @var{16}.
  950. Allowed range is from @var{16} to @var{65536}.
  951. Lower values decreases latency at cost of higher CPU usage.
  952. @item maxp
  953. Set maximal partition size used for convolution. Default is @var{65536}.
  954. Allowed range is from @var{16} to @var{65536}.
  955. Lower values decreases latency at cost of higher CPU usage.
  956. @end table
  957. @subsection Examples
  958. @itemize
  959. @item
  960. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  961. @example
  962. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  963. @end example
  964. @end itemize
  965. @anchor{aformat}
  966. @section aformat
  967. Set output format constraints for the input audio. The framework will
  968. negotiate the most appropriate format to minimize conversions.
  969. It accepts the following parameters:
  970. @table @option
  971. @item sample_fmts
  972. A '|'-separated list of requested sample formats.
  973. @item sample_rates
  974. A '|'-separated list of requested sample rates.
  975. @item channel_layouts
  976. A '|'-separated list of requested channel layouts.
  977. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  978. for the required syntax.
  979. @end table
  980. If a parameter is omitted, all values are allowed.
  981. Force the output to either unsigned 8-bit or signed 16-bit stereo
  982. @example
  983. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  984. @end example
  985. @section agate
  986. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  987. processing reduces disturbing noise between useful signals.
  988. Gating is done by detecting the volume below a chosen level @var{threshold}
  989. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  990. floor is set via @var{range}. Because an exact manipulation of the signal
  991. would cause distortion of the waveform the reduction can be levelled over
  992. time. This is done by setting @var{attack} and @var{release}.
  993. @var{attack} determines how long the signal has to fall below the threshold
  994. before any reduction will occur and @var{release} sets the time the signal
  995. has to rise above the threshold to reduce the reduction again.
  996. Shorter signals than the chosen attack time will be left untouched.
  997. @table @option
  998. @item level_in
  999. Set input level before filtering.
  1000. Default is 1. Allowed range is from 0.015625 to 64.
  1001. @item range
  1002. Set the level of gain reduction when the signal is below the threshold.
  1003. Default is 0.06125. Allowed range is from 0 to 1.
  1004. @item threshold
  1005. If a signal rises above this level the gain reduction is released.
  1006. Default is 0.125. Allowed range is from 0 to 1.
  1007. @item ratio
  1008. Set a ratio by which the signal is reduced.
  1009. Default is 2. Allowed range is from 1 to 9000.
  1010. @item attack
  1011. Amount of milliseconds the signal has to rise above the threshold before gain
  1012. reduction stops.
  1013. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1014. @item release
  1015. Amount of milliseconds the signal has to fall below the threshold before the
  1016. reduction is increased again. Default is 250 milliseconds.
  1017. Allowed range is from 0.01 to 9000.
  1018. @item makeup
  1019. Set amount of amplification of signal after processing.
  1020. Default is 1. Allowed range is from 1 to 64.
  1021. @item knee
  1022. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1023. Default is 2.828427125. Allowed range is from 1 to 8.
  1024. @item detection
  1025. Choose if exact signal should be taken for detection or an RMS like one.
  1026. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1027. @item link
  1028. Choose if the average level between all channels or the louder channel affects
  1029. the reduction.
  1030. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1031. @end table
  1032. @section aiir
  1033. Apply an arbitrary Infinite Impulse Response filter.
  1034. It accepts the following parameters:
  1035. @table @option
  1036. @item z
  1037. Set numerator/zeros coefficients.
  1038. @item p
  1039. Set denominator/poles coefficients.
  1040. @item k
  1041. Set channels gains.
  1042. @item dry_gain
  1043. Set input gain.
  1044. @item wet_gain
  1045. Set output gain.
  1046. @item f
  1047. Set coefficients format.
  1048. @table @samp
  1049. @item tf
  1050. transfer function
  1051. @item zp
  1052. Z-plane zeros/poles, cartesian (default)
  1053. @item pr
  1054. Z-plane zeros/poles, polar radians
  1055. @item pd
  1056. Z-plane zeros/poles, polar degrees
  1057. @end table
  1058. @item r
  1059. Set kind of processing.
  1060. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  1061. @item e
  1062. Set filtering precision.
  1063. @table @samp
  1064. @item dbl
  1065. double-precision floating-point (default)
  1066. @item flt
  1067. single-precision floating-point
  1068. @item i32
  1069. 32-bit integers
  1070. @item i16
  1071. 16-bit integers
  1072. @end table
  1073. @item response
  1074. Show IR frequency reponse, magnitude and phase in additional video stream.
  1075. By default it is disabled.
  1076. @item channel
  1077. Set for which IR channel to display frequency response. By default is first channel
  1078. displayed. This option is used only when @var{response} is enabled.
  1079. @item size
  1080. Set video stream size. This option is used only when @var{response} is enabled.
  1081. @end table
  1082. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1083. order.
  1084. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1085. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1086. imaginary unit.
  1087. Different coefficients and gains can be provided for every channel, in such case
  1088. use '|' to separate coefficients or gains. Last provided coefficients will be
  1089. used for all remaining channels.
  1090. @subsection Examples
  1091. @itemize
  1092. @item
  1093. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  1094. @example
  1095. 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
  1096. @end example
  1097. @item
  1098. Same as above but in @code{zp} format:
  1099. @example
  1100. 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
  1101. @end example
  1102. @end itemize
  1103. @section alimiter
  1104. The limiter prevents an input signal from rising over a desired threshold.
  1105. This limiter uses lookahead technology to prevent your signal from distorting.
  1106. It means that there is a small delay after the signal is processed. Keep in mind
  1107. that the delay it produces is the attack time you set.
  1108. The filter accepts the following options:
  1109. @table @option
  1110. @item level_in
  1111. Set input gain. Default is 1.
  1112. @item level_out
  1113. Set output gain. Default is 1.
  1114. @item limit
  1115. Don't let signals above this level pass the limiter. Default is 1.
  1116. @item attack
  1117. The limiter will reach its attenuation level in this amount of time in
  1118. milliseconds. Default is 5 milliseconds.
  1119. @item release
  1120. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1121. Default is 50 milliseconds.
  1122. @item asc
  1123. When gain reduction is always needed ASC takes care of releasing to an
  1124. average reduction level rather than reaching a reduction of 0 in the release
  1125. time.
  1126. @item asc_level
  1127. Select how much the release time is affected by ASC, 0 means nearly no changes
  1128. in release time while 1 produces higher release times.
  1129. @item level
  1130. Auto level output signal. Default is enabled.
  1131. This normalizes audio back to 0dB if enabled.
  1132. @end table
  1133. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1134. with @ref{aresample} before applying this filter.
  1135. @section allpass
  1136. Apply a two-pole all-pass filter with central frequency (in Hz)
  1137. @var{frequency}, and filter-width @var{width}.
  1138. An all-pass filter changes the audio's frequency to phase relationship
  1139. without changing its frequency to amplitude relationship.
  1140. The filter accepts the following options:
  1141. @table @option
  1142. @item frequency, f
  1143. Set frequency in Hz.
  1144. @item width_type, t
  1145. Set method to specify band-width of filter.
  1146. @table @option
  1147. @item h
  1148. Hz
  1149. @item q
  1150. Q-Factor
  1151. @item o
  1152. octave
  1153. @item s
  1154. slope
  1155. @item k
  1156. kHz
  1157. @end table
  1158. @item width, w
  1159. Specify the band-width of a filter in width_type units.
  1160. @item channels, c
  1161. Specify which channels to filter, by default all available are filtered.
  1162. @end table
  1163. @subsection Commands
  1164. This filter supports the following commands:
  1165. @table @option
  1166. @item frequency, f
  1167. Change allpass frequency.
  1168. Syntax for the command is : "@var{frequency}"
  1169. @item width_type, t
  1170. Change allpass width_type.
  1171. Syntax for the command is : "@var{width_type}"
  1172. @item width, w
  1173. Change allpass width.
  1174. Syntax for the command is : "@var{width}"
  1175. @end table
  1176. @section aloop
  1177. Loop audio samples.
  1178. The filter accepts the following options:
  1179. @table @option
  1180. @item loop
  1181. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1182. Default is 0.
  1183. @item size
  1184. Set maximal number of samples. Default is 0.
  1185. @item start
  1186. Set first sample of loop. Default is 0.
  1187. @end table
  1188. @anchor{amerge}
  1189. @section amerge
  1190. Merge two or more audio streams into a single multi-channel stream.
  1191. The filter accepts the following options:
  1192. @table @option
  1193. @item inputs
  1194. Set the number of inputs. Default is 2.
  1195. @end table
  1196. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1197. the channel layout of the output will be set accordingly and the channels
  1198. will be reordered as necessary. If the channel layouts of the inputs are not
  1199. disjoint, the output will have all the channels of the first input then all
  1200. the channels of the second input, in that order, and the channel layout of
  1201. the output will be the default value corresponding to the total number of
  1202. channels.
  1203. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1204. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1205. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1206. first input, b1 is the first channel of the second input).
  1207. On the other hand, if both input are in stereo, the output channels will be
  1208. in the default order: a1, a2, b1, b2, and the channel layout will be
  1209. arbitrarily set to 4.0, which may or may not be the expected value.
  1210. All inputs must have the same sample rate, and format.
  1211. If inputs do not have the same duration, the output will stop with the
  1212. shortest.
  1213. @subsection Examples
  1214. @itemize
  1215. @item
  1216. Merge two mono files into a stereo stream:
  1217. @example
  1218. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1219. @end example
  1220. @item
  1221. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1222. @example
  1223. 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
  1224. @end example
  1225. @end itemize
  1226. @section amix
  1227. Mixes multiple audio inputs into a single output.
  1228. Note that this filter only supports float samples (the @var{amerge}
  1229. and @var{pan} audio filters support many formats). If the @var{amix}
  1230. input has integer samples then @ref{aresample} will be automatically
  1231. inserted to perform the conversion to float samples.
  1232. For example
  1233. @example
  1234. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1235. @end example
  1236. will mix 3 input audio streams to a single output with the same duration as the
  1237. first input and a dropout transition time of 3 seconds.
  1238. It accepts the following parameters:
  1239. @table @option
  1240. @item inputs
  1241. The number of inputs. If unspecified, it defaults to 2.
  1242. @item duration
  1243. How to determine the end-of-stream.
  1244. @table @option
  1245. @item longest
  1246. The duration of the longest input. (default)
  1247. @item shortest
  1248. The duration of the shortest input.
  1249. @item first
  1250. The duration of the first input.
  1251. @end table
  1252. @item dropout_transition
  1253. The transition time, in seconds, for volume renormalization when an input
  1254. stream ends. The default value is 2 seconds.
  1255. @item weights
  1256. Specify weight of each input audio stream as sequence.
  1257. Each weight is separated by space. By default all inputs have same weight.
  1258. @end table
  1259. @section amultiply
  1260. Multiply first audio stream with second audio stream and store result
  1261. in output audio stream. Multiplication is done by multiplying each
  1262. sample from first stream with sample at same position from second stream.
  1263. With this element-wise multiplication one can create amplitude fades and
  1264. amplitude modulations.
  1265. @section anequalizer
  1266. High-order parametric multiband equalizer for each channel.
  1267. It accepts the following parameters:
  1268. @table @option
  1269. @item params
  1270. This option string is in format:
  1271. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1272. Each equalizer band is separated by '|'.
  1273. @table @option
  1274. @item chn
  1275. Set channel number to which equalization will be applied.
  1276. If input doesn't have that channel the entry is ignored.
  1277. @item f
  1278. Set central frequency for band.
  1279. If input doesn't have that frequency the entry is ignored.
  1280. @item w
  1281. Set band width in hertz.
  1282. @item g
  1283. Set band gain in dB.
  1284. @item t
  1285. Set filter type for band, optional, can be:
  1286. @table @samp
  1287. @item 0
  1288. Butterworth, this is default.
  1289. @item 1
  1290. Chebyshev type 1.
  1291. @item 2
  1292. Chebyshev type 2.
  1293. @end table
  1294. @end table
  1295. @item curves
  1296. With this option activated frequency response of anequalizer is displayed
  1297. in video stream.
  1298. @item size
  1299. Set video stream size. Only useful if curves option is activated.
  1300. @item mgain
  1301. Set max gain that will be displayed. Only useful if curves option is activated.
  1302. Setting this to a reasonable value makes it possible to display gain which is derived from
  1303. neighbour bands which are too close to each other and thus produce higher gain
  1304. when both are activated.
  1305. @item fscale
  1306. Set frequency scale used to draw frequency response in video output.
  1307. Can be linear or logarithmic. Default is logarithmic.
  1308. @item colors
  1309. Set color for each channel curve which is going to be displayed in video stream.
  1310. This is list of color names separated by space or by '|'.
  1311. Unrecognised or missing colors will be replaced by white color.
  1312. @end table
  1313. @subsection Examples
  1314. @itemize
  1315. @item
  1316. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1317. for first 2 channels using Chebyshev type 1 filter:
  1318. @example
  1319. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1320. @end example
  1321. @end itemize
  1322. @subsection Commands
  1323. This filter supports the following commands:
  1324. @table @option
  1325. @item change
  1326. Alter existing filter parameters.
  1327. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1328. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1329. error is returned.
  1330. @var{freq} set new frequency parameter.
  1331. @var{width} set new width parameter in herz.
  1332. @var{gain} set new gain parameter in dB.
  1333. Full filter invocation with asendcmd may look like this:
  1334. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1335. @end table
  1336. @section anull
  1337. Pass the audio source unchanged to the output.
  1338. @section apad
  1339. Pad the end of an audio stream with silence.
  1340. This can be used together with @command{ffmpeg} @option{-shortest} to
  1341. extend audio streams to the same length as the video stream.
  1342. A description of the accepted options follows.
  1343. @table @option
  1344. @item packet_size
  1345. Set silence packet size. Default value is 4096.
  1346. @item pad_len
  1347. Set the number of samples of silence to add to the end. After the
  1348. value is reached, the stream is terminated. This option is mutually
  1349. exclusive with @option{whole_len}.
  1350. @item whole_len
  1351. Set the minimum total number of samples in the output audio stream. If
  1352. the value is longer than the input audio length, silence is added to
  1353. the end, until the value is reached. This option is mutually exclusive
  1354. with @option{pad_len}.
  1355. @end table
  1356. If neither the @option{pad_len} nor the @option{whole_len} option is
  1357. set, the filter will add silence to the end of the input stream
  1358. indefinitely.
  1359. @subsection Examples
  1360. @itemize
  1361. @item
  1362. Add 1024 samples of silence to the end of the input:
  1363. @example
  1364. apad=pad_len=1024
  1365. @end example
  1366. @item
  1367. Make sure the audio output will contain at least 10000 samples, pad
  1368. the input with silence if required:
  1369. @example
  1370. apad=whole_len=10000
  1371. @end example
  1372. @item
  1373. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1374. video stream will always result the shortest and will be converted
  1375. until the end in the output file when using the @option{shortest}
  1376. option:
  1377. @example
  1378. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1379. @end example
  1380. @end itemize
  1381. @section aphaser
  1382. Add a phasing effect to the input audio.
  1383. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1384. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1385. A description of the accepted parameters follows.
  1386. @table @option
  1387. @item in_gain
  1388. Set input gain. Default is 0.4.
  1389. @item out_gain
  1390. Set output gain. Default is 0.74
  1391. @item delay
  1392. Set delay in milliseconds. Default is 3.0.
  1393. @item decay
  1394. Set decay. Default is 0.4.
  1395. @item speed
  1396. Set modulation speed in Hz. Default is 0.5.
  1397. @item type
  1398. Set modulation type. Default is triangular.
  1399. It accepts the following values:
  1400. @table @samp
  1401. @item triangular, t
  1402. @item sinusoidal, s
  1403. @end table
  1404. @end table
  1405. @section apulsator
  1406. Audio pulsator is something between an autopanner and a tremolo.
  1407. But it can produce funny stereo effects as well. Pulsator changes the volume
  1408. of the left and right channel based on a LFO (low frequency oscillator) with
  1409. different waveforms and shifted phases.
  1410. This filter have the ability to define an offset between left and right
  1411. channel. An offset of 0 means that both LFO shapes match each other.
  1412. The left and right channel are altered equally - a conventional tremolo.
  1413. An offset of 50% means that the shape of the right channel is exactly shifted
  1414. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1415. an autopanner. At 1 both curves match again. Every setting in between moves the
  1416. phase shift gapless between all stages and produces some "bypassing" sounds with
  1417. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1418. the 0.5) the faster the signal passes from the left to the right speaker.
  1419. The filter accepts the following options:
  1420. @table @option
  1421. @item level_in
  1422. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1423. @item level_out
  1424. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1425. @item mode
  1426. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1427. sawup or sawdown. Default is sine.
  1428. @item amount
  1429. Set modulation. Define how much of original signal is affected by the LFO.
  1430. @item offset_l
  1431. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1432. @item offset_r
  1433. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1434. @item width
  1435. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1436. @item timing
  1437. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1438. @item bpm
  1439. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1440. is set to bpm.
  1441. @item ms
  1442. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1443. is set to ms.
  1444. @item hz
  1445. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1446. if timing is set to hz.
  1447. @end table
  1448. @anchor{aresample}
  1449. @section aresample
  1450. Resample the input audio to the specified parameters, using the
  1451. libswresample library. If none are specified then the filter will
  1452. automatically convert between its input and output.
  1453. This filter is also able to stretch/squeeze the audio data to make it match
  1454. the timestamps or to inject silence / cut out audio to make it match the
  1455. timestamps, do a combination of both or do neither.
  1456. The filter accepts the syntax
  1457. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1458. expresses a sample rate and @var{resampler_options} is a list of
  1459. @var{key}=@var{value} pairs, separated by ":". See the
  1460. @ref{Resampler Options,,"Resampler Options" section in the
  1461. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1462. for the complete list of supported options.
  1463. @subsection Examples
  1464. @itemize
  1465. @item
  1466. Resample the input audio to 44100Hz:
  1467. @example
  1468. aresample=44100
  1469. @end example
  1470. @item
  1471. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1472. samples per second compensation:
  1473. @example
  1474. aresample=async=1000
  1475. @end example
  1476. @end itemize
  1477. @section areverse
  1478. Reverse an audio clip.
  1479. Warning: This filter requires memory to buffer the entire clip, so trimming
  1480. is suggested.
  1481. @subsection Examples
  1482. @itemize
  1483. @item
  1484. Take the first 5 seconds of a clip, and reverse it.
  1485. @example
  1486. atrim=end=5,areverse
  1487. @end example
  1488. @end itemize
  1489. @section asetnsamples
  1490. Set the number of samples per each output audio frame.
  1491. The last output packet may contain a different number of samples, as
  1492. the filter will flush all the remaining samples when the input audio
  1493. signals its end.
  1494. The filter accepts the following options:
  1495. @table @option
  1496. @item nb_out_samples, n
  1497. Set the number of frames per each output audio frame. The number is
  1498. intended as the number of samples @emph{per each channel}.
  1499. Default value is 1024.
  1500. @item pad, p
  1501. If set to 1, the filter will pad the last audio frame with zeroes, so
  1502. that the last frame will contain the same number of samples as the
  1503. previous ones. Default value is 1.
  1504. @end table
  1505. For example, to set the number of per-frame samples to 1234 and
  1506. disable padding for the last frame, use:
  1507. @example
  1508. asetnsamples=n=1234:p=0
  1509. @end example
  1510. @section asetrate
  1511. Set the sample rate without altering the PCM data.
  1512. This will result in a change of speed and pitch.
  1513. The filter accepts the following options:
  1514. @table @option
  1515. @item sample_rate, r
  1516. Set the output sample rate. Default is 44100 Hz.
  1517. @end table
  1518. @section ashowinfo
  1519. Show a line containing various information for each input audio frame.
  1520. The input audio is not modified.
  1521. The shown line contains a sequence of key/value pairs of the form
  1522. @var{key}:@var{value}.
  1523. The following values are shown in the output:
  1524. @table @option
  1525. @item n
  1526. The (sequential) number of the input frame, starting from 0.
  1527. @item pts
  1528. The presentation timestamp of the input frame, in time base units; the time base
  1529. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1530. @item pts_time
  1531. The presentation timestamp of the input frame in seconds.
  1532. @item pos
  1533. position of the frame in the input stream, -1 if this information in
  1534. unavailable and/or meaningless (for example in case of synthetic audio)
  1535. @item fmt
  1536. The sample format.
  1537. @item chlayout
  1538. The channel layout.
  1539. @item rate
  1540. The sample rate for the audio frame.
  1541. @item nb_samples
  1542. The number of samples (per channel) in the frame.
  1543. @item checksum
  1544. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1545. audio, the data is treated as if all the planes were concatenated.
  1546. @item plane_checksums
  1547. A list of Adler-32 checksums for each data plane.
  1548. @end table
  1549. @anchor{astats}
  1550. @section astats
  1551. Display time domain statistical information about the audio channels.
  1552. Statistics are calculated and displayed for each audio channel and,
  1553. where applicable, an overall figure is also given.
  1554. It accepts the following option:
  1555. @table @option
  1556. @item length
  1557. Short window length in seconds, used for peak and trough RMS measurement.
  1558. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1559. @item metadata
  1560. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1561. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1562. disabled.
  1563. Available keys for each channel are:
  1564. DC_offset
  1565. Min_level
  1566. Max_level
  1567. Min_difference
  1568. Max_difference
  1569. Mean_difference
  1570. RMS_difference
  1571. Peak_level
  1572. RMS_peak
  1573. RMS_trough
  1574. Crest_factor
  1575. Flat_factor
  1576. Peak_count
  1577. Bit_depth
  1578. Dynamic_range
  1579. Zero_crossings
  1580. Zero_crossings_rate
  1581. and for Overall:
  1582. DC_offset
  1583. Min_level
  1584. Max_level
  1585. Min_difference
  1586. Max_difference
  1587. Mean_difference
  1588. RMS_difference
  1589. Peak_level
  1590. RMS_level
  1591. RMS_peak
  1592. RMS_trough
  1593. Flat_factor
  1594. Peak_count
  1595. Bit_depth
  1596. Number_of_samples
  1597. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1598. this @code{lavfi.astats.Overall.Peak_count}.
  1599. For description what each key means read below.
  1600. @item reset
  1601. Set number of frame after which stats are going to be recalculated.
  1602. Default is disabled.
  1603. @end table
  1604. A description of each shown parameter follows:
  1605. @table @option
  1606. @item DC offset
  1607. Mean amplitude displacement from zero.
  1608. @item Min level
  1609. Minimal sample level.
  1610. @item Max level
  1611. Maximal sample level.
  1612. @item Min difference
  1613. Minimal difference between two consecutive samples.
  1614. @item Max difference
  1615. Maximal difference between two consecutive samples.
  1616. @item Mean difference
  1617. Mean difference between two consecutive samples.
  1618. The average of each difference between two consecutive samples.
  1619. @item RMS difference
  1620. Root Mean Square difference between two consecutive samples.
  1621. @item Peak level dB
  1622. @item RMS level dB
  1623. Standard peak and RMS level measured in dBFS.
  1624. @item RMS peak dB
  1625. @item RMS trough dB
  1626. Peak and trough values for RMS level measured over a short window.
  1627. @item Crest factor
  1628. Standard ratio of peak to RMS level (note: not in dB).
  1629. @item Flat factor
  1630. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1631. (i.e. either @var{Min level} or @var{Max level}).
  1632. @item Peak count
  1633. Number of occasions (not the number of samples) that the signal attained either
  1634. @var{Min level} or @var{Max level}.
  1635. @item Bit depth
  1636. Overall bit depth of audio. Number of bits used for each sample.
  1637. @item Dynamic range
  1638. Measured dynamic range of audio in dB.
  1639. @item Zero crossings
  1640. Number of points where the waveform crosses the zero level axis.
  1641. @item Zero crossings rate
  1642. Rate of Zero crossings and number of audio samples.
  1643. @end table
  1644. @section atempo
  1645. Adjust audio tempo.
  1646. The filter accepts exactly one parameter, the audio tempo. If not
  1647. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1648. be in the [0.5, 100.0] range.
  1649. Note that tempo greater than 2 will skip some samples rather than
  1650. blend them in. If for any reason this is a concern it is always
  1651. possible to daisy-chain several instances of atempo to achieve the
  1652. desired product tempo.
  1653. @subsection Examples
  1654. @itemize
  1655. @item
  1656. Slow down audio to 80% tempo:
  1657. @example
  1658. atempo=0.8
  1659. @end example
  1660. @item
  1661. To speed up audio to 300% tempo:
  1662. @example
  1663. atempo=3
  1664. @end example
  1665. @item
  1666. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1667. @example
  1668. atempo=sqrt(3),atempo=sqrt(3)
  1669. @end example
  1670. @end itemize
  1671. @section atrim
  1672. Trim the input so that the output contains one continuous subpart of the input.
  1673. It accepts the following parameters:
  1674. @table @option
  1675. @item start
  1676. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1677. sample with the timestamp @var{start} will be the first sample in the output.
  1678. @item end
  1679. Specify time of the first audio sample that will be dropped, i.e. the
  1680. audio sample immediately preceding the one with the timestamp @var{end} will be
  1681. the last sample in the output.
  1682. @item start_pts
  1683. Same as @var{start}, except this option sets the start timestamp in samples
  1684. instead of seconds.
  1685. @item end_pts
  1686. Same as @var{end}, except this option sets the end timestamp in samples instead
  1687. of seconds.
  1688. @item duration
  1689. The maximum duration of the output in seconds.
  1690. @item start_sample
  1691. The number of the first sample that should be output.
  1692. @item end_sample
  1693. The number of the first sample that should be dropped.
  1694. @end table
  1695. @option{start}, @option{end}, and @option{duration} are expressed as time
  1696. duration specifications; see
  1697. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1698. Note that the first two sets of the start/end options and the @option{duration}
  1699. option look at the frame timestamp, while the _sample options simply count the
  1700. samples that pass through the filter. So start/end_pts and start/end_sample will
  1701. give different results when the timestamps are wrong, inexact or do not start at
  1702. zero. Also note that this filter does not modify the timestamps. If you wish
  1703. to have the output timestamps start at zero, insert the asetpts filter after the
  1704. atrim filter.
  1705. If multiple start or end options are set, this filter tries to be greedy and
  1706. keep all samples that match at least one of the specified constraints. To keep
  1707. only the part that matches all the constraints at once, chain multiple atrim
  1708. filters.
  1709. The defaults are such that all the input is kept. So it is possible to set e.g.
  1710. just the end values to keep everything before the specified time.
  1711. Examples:
  1712. @itemize
  1713. @item
  1714. Drop everything except the second minute of input:
  1715. @example
  1716. ffmpeg -i INPUT -af atrim=60:120
  1717. @end example
  1718. @item
  1719. Keep only the first 1000 samples:
  1720. @example
  1721. ffmpeg -i INPUT -af atrim=end_sample=1000
  1722. @end example
  1723. @end itemize
  1724. @section bandpass
  1725. Apply a two-pole Butterworth band-pass filter with central
  1726. frequency @var{frequency}, and (3dB-point) band-width width.
  1727. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1728. instead of the default: constant 0dB peak gain.
  1729. The filter roll off at 6dB per octave (20dB per decade).
  1730. The filter accepts the following options:
  1731. @table @option
  1732. @item frequency, f
  1733. Set the filter's central frequency. Default is @code{3000}.
  1734. @item csg
  1735. Constant skirt gain if set to 1. Defaults to 0.
  1736. @item width_type, t
  1737. Set method to specify band-width of filter.
  1738. @table @option
  1739. @item h
  1740. Hz
  1741. @item q
  1742. Q-Factor
  1743. @item o
  1744. octave
  1745. @item s
  1746. slope
  1747. @item k
  1748. kHz
  1749. @end table
  1750. @item width, w
  1751. Specify the band-width of a filter in width_type units.
  1752. @item channels, c
  1753. Specify which channels to filter, by default all available are filtered.
  1754. @end table
  1755. @subsection Commands
  1756. This filter supports the following commands:
  1757. @table @option
  1758. @item frequency, f
  1759. Change bandpass frequency.
  1760. Syntax for the command is : "@var{frequency}"
  1761. @item width_type, t
  1762. Change bandpass width_type.
  1763. Syntax for the command is : "@var{width_type}"
  1764. @item width, w
  1765. Change bandpass width.
  1766. Syntax for the command is : "@var{width}"
  1767. @end table
  1768. @section bandreject
  1769. Apply a two-pole Butterworth band-reject filter with central
  1770. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1771. The filter roll off at 6dB per octave (20dB per decade).
  1772. The filter accepts the following options:
  1773. @table @option
  1774. @item frequency, f
  1775. Set the filter's central frequency. Default is @code{3000}.
  1776. @item width_type, t
  1777. Set method to specify band-width of filter.
  1778. @table @option
  1779. @item h
  1780. Hz
  1781. @item q
  1782. Q-Factor
  1783. @item o
  1784. octave
  1785. @item s
  1786. slope
  1787. @item k
  1788. kHz
  1789. @end table
  1790. @item width, w
  1791. Specify the band-width of a filter in width_type units.
  1792. @item channels, c
  1793. Specify which channels to filter, by default all available are filtered.
  1794. @end table
  1795. @subsection Commands
  1796. This filter supports the following commands:
  1797. @table @option
  1798. @item frequency, f
  1799. Change bandreject frequency.
  1800. Syntax for the command is : "@var{frequency}"
  1801. @item width_type, t
  1802. Change bandreject width_type.
  1803. Syntax for the command is : "@var{width_type}"
  1804. @item width, w
  1805. Change bandreject width.
  1806. Syntax for the command is : "@var{width}"
  1807. @end table
  1808. @section bass, lowshelf
  1809. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1810. shelving filter with a response similar to that of a standard
  1811. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1812. The filter accepts the following options:
  1813. @table @option
  1814. @item gain, g
  1815. Give the gain at 0 Hz. Its useful range is about -20
  1816. (for a large cut) to +20 (for a large boost).
  1817. Beware of clipping when using a positive gain.
  1818. @item frequency, f
  1819. Set the filter's central frequency and so can be used
  1820. to extend or reduce the frequency range to be boosted or cut.
  1821. The default value is @code{100} Hz.
  1822. @item width_type, t
  1823. Set method to specify band-width of filter.
  1824. @table @option
  1825. @item h
  1826. Hz
  1827. @item q
  1828. Q-Factor
  1829. @item o
  1830. octave
  1831. @item s
  1832. slope
  1833. @item k
  1834. kHz
  1835. @end table
  1836. @item width, w
  1837. Determine how steep is the filter's shelf transition.
  1838. @item channels, c
  1839. Specify which channels to filter, by default all available are filtered.
  1840. @end table
  1841. @subsection Commands
  1842. This filter supports the following commands:
  1843. @table @option
  1844. @item frequency, f
  1845. Change bass frequency.
  1846. Syntax for the command is : "@var{frequency}"
  1847. @item width_type, t
  1848. Change bass width_type.
  1849. Syntax for the command is : "@var{width_type}"
  1850. @item width, w
  1851. Change bass width.
  1852. Syntax for the command is : "@var{width}"
  1853. @item gain, g
  1854. Change bass gain.
  1855. Syntax for the command is : "@var{gain}"
  1856. @end table
  1857. @section biquad
  1858. Apply a biquad IIR filter with the given coefficients.
  1859. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1860. are the numerator and denominator coefficients respectively.
  1861. and @var{channels}, @var{c} specify which channels to filter, by default all
  1862. available are filtered.
  1863. @subsection Commands
  1864. This filter supports the following commands:
  1865. @table @option
  1866. @item a0
  1867. @item a1
  1868. @item a2
  1869. @item b0
  1870. @item b1
  1871. @item b2
  1872. Change biquad parameter.
  1873. Syntax for the command is : "@var{value}"
  1874. @end table
  1875. @section bs2b
  1876. Bauer stereo to binaural transformation, which improves headphone listening of
  1877. stereo audio records.
  1878. To enable compilation of this filter you need to configure FFmpeg with
  1879. @code{--enable-libbs2b}.
  1880. It accepts the following parameters:
  1881. @table @option
  1882. @item profile
  1883. Pre-defined crossfeed level.
  1884. @table @option
  1885. @item default
  1886. Default level (fcut=700, feed=50).
  1887. @item cmoy
  1888. Chu Moy circuit (fcut=700, feed=60).
  1889. @item jmeier
  1890. Jan Meier circuit (fcut=650, feed=95).
  1891. @end table
  1892. @item fcut
  1893. Cut frequency (in Hz).
  1894. @item feed
  1895. Feed level (in Hz).
  1896. @end table
  1897. @section channelmap
  1898. Remap input channels to new locations.
  1899. It accepts the following parameters:
  1900. @table @option
  1901. @item map
  1902. Map channels from input to output. The argument is a '|'-separated list of
  1903. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1904. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1905. channel (e.g. FL for front left) or its index in the input channel layout.
  1906. @var{out_channel} is the name of the output channel or its index in the output
  1907. channel layout. If @var{out_channel} is not given then it is implicitly an
  1908. index, starting with zero and increasing by one for each mapping.
  1909. @item channel_layout
  1910. The channel layout of the output stream.
  1911. @end table
  1912. If no mapping is present, the filter will implicitly map input channels to
  1913. output channels, preserving indices.
  1914. @subsection Examples
  1915. @itemize
  1916. @item
  1917. For example, assuming a 5.1+downmix input MOV file,
  1918. @example
  1919. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1920. @end example
  1921. will create an output WAV file tagged as stereo from the downmix channels of
  1922. the input.
  1923. @item
  1924. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1925. @example
  1926. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1927. @end example
  1928. @end itemize
  1929. @section channelsplit
  1930. Split each channel from an input audio stream into a separate output stream.
  1931. It accepts the following parameters:
  1932. @table @option
  1933. @item channel_layout
  1934. The channel layout of the input stream. The default is "stereo".
  1935. @item channels
  1936. A channel layout describing the channels to be extracted as separate output streams
  1937. or "all" to extract each input channel as a separate stream. The default is "all".
  1938. Choosing channels not present in channel layout in the input will result in an error.
  1939. @end table
  1940. @subsection Examples
  1941. @itemize
  1942. @item
  1943. For example, assuming a stereo input MP3 file,
  1944. @example
  1945. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1946. @end example
  1947. will create an output Matroska file with two audio streams, one containing only
  1948. the left channel and the other the right channel.
  1949. @item
  1950. Split a 5.1 WAV file into per-channel files:
  1951. @example
  1952. ffmpeg -i in.wav -filter_complex
  1953. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1954. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1955. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1956. side_right.wav
  1957. @end example
  1958. @item
  1959. Extract only LFE from a 5.1 WAV file:
  1960. @example
  1961. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1962. -map '[LFE]' lfe.wav
  1963. @end example
  1964. @end itemize
  1965. @section chorus
  1966. Add a chorus effect to the audio.
  1967. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1968. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1969. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1970. The modulation depth defines the range the modulated delay is played before or after
  1971. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1972. sound tuned around the original one, like in a chorus where some vocals are slightly
  1973. off key.
  1974. It accepts the following parameters:
  1975. @table @option
  1976. @item in_gain
  1977. Set input gain. Default is 0.4.
  1978. @item out_gain
  1979. Set output gain. Default is 0.4.
  1980. @item delays
  1981. Set delays. A typical delay is around 40ms to 60ms.
  1982. @item decays
  1983. Set decays.
  1984. @item speeds
  1985. Set speeds.
  1986. @item depths
  1987. Set depths.
  1988. @end table
  1989. @subsection Examples
  1990. @itemize
  1991. @item
  1992. A single delay:
  1993. @example
  1994. chorus=0.7:0.9:55:0.4:0.25:2
  1995. @end example
  1996. @item
  1997. Two delays:
  1998. @example
  1999. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2000. @end example
  2001. @item
  2002. Fuller sounding chorus with three delays:
  2003. @example
  2004. 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
  2005. @end example
  2006. @end itemize
  2007. @section compand
  2008. Compress or expand the audio's dynamic range.
  2009. It accepts the following parameters:
  2010. @table @option
  2011. @item attacks
  2012. @item decays
  2013. A list of times in seconds for each channel over which the instantaneous level
  2014. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2015. increase of volume and @var{decays} refers to decrease of volume. For most
  2016. situations, the attack time (response to the audio getting louder) should be
  2017. shorter than the decay time, because the human ear is more sensitive to sudden
  2018. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2019. a typical value for decay is 0.8 seconds.
  2020. If specified number of attacks & decays is lower than number of channels, the last
  2021. set attack/decay will be used for all remaining channels.
  2022. @item points
  2023. A list of points for the transfer function, specified in dB relative to the
  2024. maximum possible signal amplitude. Each key points list must be defined using
  2025. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2026. @code{x0/y0 x1/y1 x2/y2 ....}
  2027. The input values must be in strictly increasing order but the transfer function
  2028. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2029. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2030. function are @code{-70/-70|-60/-20|1/0}.
  2031. @item soft-knee
  2032. Set the curve radius in dB for all joints. It defaults to 0.01.
  2033. @item gain
  2034. Set the additional gain in dB to be applied at all points on the transfer
  2035. function. This allows for easy adjustment of the overall gain.
  2036. It defaults to 0.
  2037. @item volume
  2038. Set an initial volume, in dB, to be assumed for each channel when filtering
  2039. starts. This permits the user to supply a nominal level initially, so that, for
  2040. example, a very large gain is not applied to initial signal levels before the
  2041. companding has begun to operate. A typical value for audio which is initially
  2042. quiet is -90 dB. It defaults to 0.
  2043. @item delay
  2044. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2045. delayed before being fed to the volume adjuster. Specifying a delay
  2046. approximately equal to the attack/decay times allows the filter to effectively
  2047. operate in predictive rather than reactive mode. It defaults to 0.
  2048. @end table
  2049. @subsection Examples
  2050. @itemize
  2051. @item
  2052. Make music with both quiet and loud passages suitable for listening to in a
  2053. noisy environment:
  2054. @example
  2055. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2056. @end example
  2057. Another example for audio with whisper and explosion parts:
  2058. @example
  2059. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2060. @end example
  2061. @item
  2062. A noise gate for when the noise is at a lower level than the signal:
  2063. @example
  2064. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2065. @end example
  2066. @item
  2067. Here is another noise gate, this time for when the noise is at a higher level
  2068. than the signal (making it, in some ways, similar to squelch):
  2069. @example
  2070. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2071. @end example
  2072. @item
  2073. 2:1 compression starting at -6dB:
  2074. @example
  2075. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2076. @end example
  2077. @item
  2078. 2:1 compression starting at -9dB:
  2079. @example
  2080. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2081. @end example
  2082. @item
  2083. 2:1 compression starting at -12dB:
  2084. @example
  2085. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2086. @end example
  2087. @item
  2088. 2:1 compression starting at -18dB:
  2089. @example
  2090. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2091. @end example
  2092. @item
  2093. 3:1 compression starting at -15dB:
  2094. @example
  2095. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2096. @end example
  2097. @item
  2098. Compressor/Gate:
  2099. @example
  2100. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2101. @end example
  2102. @item
  2103. Expander:
  2104. @example
  2105. 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
  2106. @end example
  2107. @item
  2108. Hard limiter at -6dB:
  2109. @example
  2110. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2111. @end example
  2112. @item
  2113. Hard limiter at -12dB:
  2114. @example
  2115. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2116. @end example
  2117. @item
  2118. Hard noise gate at -35 dB:
  2119. @example
  2120. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2121. @end example
  2122. @item
  2123. Soft limiter:
  2124. @example
  2125. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2126. @end example
  2127. @end itemize
  2128. @section compensationdelay
  2129. Compensation Delay Line is a metric based delay to compensate differing
  2130. positions of microphones or speakers.
  2131. For example, you have recorded guitar with two microphones placed in
  2132. different location. Because the front of sound wave has fixed speed in
  2133. normal conditions, the phasing of microphones can vary and depends on
  2134. their location and interposition. The best sound mix can be achieved when
  2135. these microphones are in phase (synchronized). Note that distance of
  2136. ~30 cm between microphones makes one microphone to capture signal in
  2137. antiphase to another microphone. That makes the final mix sounding moody.
  2138. This filter helps to solve phasing problems by adding different delays
  2139. to each microphone track and make them synchronized.
  2140. The best result can be reached when you take one track as base and
  2141. synchronize other tracks one by one with it.
  2142. Remember that synchronization/delay tolerance depends on sample rate, too.
  2143. Higher sample rates will give more tolerance.
  2144. It accepts the following parameters:
  2145. @table @option
  2146. @item mm
  2147. Set millimeters distance. This is compensation distance for fine tuning.
  2148. Default is 0.
  2149. @item cm
  2150. Set cm distance. This is compensation distance for tightening distance setup.
  2151. Default is 0.
  2152. @item m
  2153. Set meters distance. This is compensation distance for hard distance setup.
  2154. Default is 0.
  2155. @item dry
  2156. Set dry amount. Amount of unprocessed (dry) signal.
  2157. Default is 0.
  2158. @item wet
  2159. Set wet amount. Amount of processed (wet) signal.
  2160. Default is 1.
  2161. @item temp
  2162. Set temperature degree in Celsius. This is the temperature of the environment.
  2163. Default is 20.
  2164. @end table
  2165. @section crossfeed
  2166. Apply headphone crossfeed filter.
  2167. Crossfeed is the process of blending the left and right channels of stereo
  2168. audio recording.
  2169. It is mainly used to reduce extreme stereo separation of low frequencies.
  2170. The intent is to produce more speaker like sound to the listener.
  2171. The filter accepts the following options:
  2172. @table @option
  2173. @item strength
  2174. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2175. This sets gain of low shelf filter for side part of stereo image.
  2176. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2177. @item range
  2178. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2179. This sets cut off frequency of low shelf filter. Default is cut off near
  2180. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2181. @item level_in
  2182. Set input gain. Default is 0.9.
  2183. @item level_out
  2184. Set output gain. Default is 1.
  2185. @end table
  2186. @section crystalizer
  2187. Simple algorithm to expand audio dynamic range.
  2188. The filter accepts the following options:
  2189. @table @option
  2190. @item i
  2191. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2192. (unchanged sound) to 10.0 (maximum effect).
  2193. @item c
  2194. Enable clipping. By default is enabled.
  2195. @end table
  2196. @section dcshift
  2197. Apply a DC shift to the audio.
  2198. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2199. in the recording chain) from the audio. The effect of a DC offset is reduced
  2200. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2201. a signal has a DC offset.
  2202. @table @option
  2203. @item shift
  2204. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2205. the audio.
  2206. @item limitergain
  2207. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2208. used to prevent clipping.
  2209. @end table
  2210. @section drmeter
  2211. Measure audio dynamic range.
  2212. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2213. is found in transition material. And anything less that 8 have very poor dynamics
  2214. and is very compressed.
  2215. The filter accepts the following options:
  2216. @table @option
  2217. @item length
  2218. Set window length in seconds used to split audio into segments of equal length.
  2219. Default is 3 seconds.
  2220. @end table
  2221. @section dynaudnorm
  2222. Dynamic Audio Normalizer.
  2223. This filter applies a certain amount of gain to the input audio in order
  2224. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2225. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2226. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2227. This allows for applying extra gain to the "quiet" sections of the audio
  2228. while avoiding distortions or clipping the "loud" sections. In other words:
  2229. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2230. sections, in the sense that the volume of each section is brought to the
  2231. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2232. this goal *without* applying "dynamic range compressing". It will retain 100%
  2233. of the dynamic range *within* each section of the audio file.
  2234. @table @option
  2235. @item f
  2236. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2237. Default is 500 milliseconds.
  2238. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2239. referred to as frames. This is required, because a peak magnitude has no
  2240. meaning for just a single sample value. Instead, we need to determine the
  2241. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2242. normalizer would simply use the peak magnitude of the complete file, the
  2243. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2244. frame. The length of a frame is specified in milliseconds. By default, the
  2245. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2246. been found to give good results with most files.
  2247. Note that the exact frame length, in number of samples, will be determined
  2248. automatically, based on the sampling rate of the individual input audio file.
  2249. @item g
  2250. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2251. number. Default is 31.
  2252. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2253. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2254. is specified in frames, centered around the current frame. For the sake of
  2255. simplicity, this must be an odd number. Consequently, the default value of 31
  2256. takes into account the current frame, as well as the 15 preceding frames and
  2257. the 15 subsequent frames. Using a larger window results in a stronger
  2258. smoothing effect and thus in less gain variation, i.e. slower gain
  2259. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2260. effect and thus in more gain variation, i.e. faster gain adaptation.
  2261. In other words, the more you increase this value, the more the Dynamic Audio
  2262. Normalizer will behave like a "traditional" normalization filter. On the
  2263. contrary, the more you decrease this value, the more the Dynamic Audio
  2264. Normalizer will behave like a dynamic range compressor.
  2265. @item p
  2266. Set the target peak value. This specifies the highest permissible magnitude
  2267. level for the normalized audio input. This filter will try to approach the
  2268. target peak magnitude as closely as possible, but at the same time it also
  2269. makes sure that the normalized signal will never exceed the peak magnitude.
  2270. A frame's maximum local gain factor is imposed directly by the target peak
  2271. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2272. It is not recommended to go above this value.
  2273. @item m
  2274. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2275. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2276. factor for each input frame, i.e. the maximum gain factor that does not
  2277. result in clipping or distortion. The maximum gain factor is determined by
  2278. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2279. additionally bounds the frame's maximum gain factor by a predetermined
  2280. (global) maximum gain factor. This is done in order to avoid excessive gain
  2281. factors in "silent" or almost silent frames. By default, the maximum gain
  2282. factor is 10.0, For most inputs the default value should be sufficient and
  2283. it usually is not recommended to increase this value. Though, for input
  2284. with an extremely low overall volume level, it may be necessary to allow even
  2285. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2286. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2287. Instead, a "sigmoid" threshold function will be applied. This way, the
  2288. gain factors will smoothly approach the threshold value, but never exceed that
  2289. value.
  2290. @item r
  2291. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2292. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2293. This means that the maximum local gain factor for each frame is defined
  2294. (only) by the frame's highest magnitude sample. This way, the samples can
  2295. be amplified as much as possible without exceeding the maximum signal
  2296. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2297. Normalizer can also take into account the frame's root mean square,
  2298. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2299. determine the power of a time-varying signal. It is therefore considered
  2300. that the RMS is a better approximation of the "perceived loudness" than
  2301. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2302. frames to a constant RMS value, a uniform "perceived loudness" can be
  2303. established. If a target RMS value has been specified, a frame's local gain
  2304. factor is defined as the factor that would result in exactly that RMS value.
  2305. Note, however, that the maximum local gain factor is still restricted by the
  2306. frame's highest magnitude sample, in order to prevent clipping.
  2307. @item n
  2308. Enable channels coupling. By default is enabled.
  2309. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2310. amount. This means the same gain factor will be applied to all channels, i.e.
  2311. the maximum possible gain factor is determined by the "loudest" channel.
  2312. However, in some recordings, it may happen that the volume of the different
  2313. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2314. In this case, this option can be used to disable the channel coupling. This way,
  2315. the gain factor will be determined independently for each channel, depending
  2316. only on the individual channel's highest magnitude sample. This allows for
  2317. harmonizing the volume of the different channels.
  2318. @item c
  2319. Enable DC bias correction. By default is disabled.
  2320. An audio signal (in the time domain) is a sequence of sample values.
  2321. In the Dynamic Audio Normalizer these sample values are represented in the
  2322. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2323. audio signal, or "waveform", should be centered around the zero point.
  2324. That means if we calculate the mean value of all samples in a file, or in a
  2325. single frame, then the result should be 0.0 or at least very close to that
  2326. value. If, however, there is a significant deviation of the mean value from
  2327. 0.0, in either positive or negative direction, this is referred to as a
  2328. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2329. Audio Normalizer provides optional DC bias correction.
  2330. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2331. the mean value, or "DC correction" offset, of each input frame and subtract
  2332. that value from all of the frame's sample values which ensures those samples
  2333. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2334. boundaries, the DC correction offset values will be interpolated smoothly
  2335. between neighbouring frames.
  2336. @item b
  2337. Enable alternative boundary mode. By default is disabled.
  2338. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2339. around each frame. This includes the preceding frames as well as the
  2340. subsequent frames. However, for the "boundary" frames, located at the very
  2341. beginning and at the very end of the audio file, not all neighbouring
  2342. frames are available. In particular, for the first few frames in the audio
  2343. file, the preceding frames are not known. And, similarly, for the last few
  2344. frames in the audio file, the subsequent frames are not known. Thus, the
  2345. question arises which gain factors should be assumed for the missing frames
  2346. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2347. to deal with this situation. The default boundary mode assumes a gain factor
  2348. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2349. "fade out" at the beginning and at the end of the input, respectively.
  2350. @item s
  2351. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2352. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2353. compression. This means that signal peaks will not be pruned and thus the
  2354. full dynamic range will be retained within each local neighbourhood. However,
  2355. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2356. normalization algorithm with a more "traditional" compression.
  2357. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2358. (thresholding) function. If (and only if) the compression feature is enabled,
  2359. all input frames will be processed by a soft knee thresholding function prior
  2360. to the actual normalization process. Put simply, the thresholding function is
  2361. going to prune all samples whose magnitude exceeds a certain threshold value.
  2362. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2363. value. Instead, the threshold value will be adjusted for each individual
  2364. frame.
  2365. In general, smaller parameters result in stronger compression, and vice versa.
  2366. Values below 3.0 are not recommended, because audible distortion may appear.
  2367. @end table
  2368. @section earwax
  2369. Make audio easier to listen to on headphones.
  2370. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2371. so that when listened to on headphones the stereo image is moved from
  2372. inside your head (standard for headphones) to outside and in front of
  2373. the listener (standard for speakers).
  2374. Ported from SoX.
  2375. @section equalizer
  2376. Apply a two-pole peaking equalisation (EQ) filter. With this
  2377. filter, the signal-level at and around a selected frequency can
  2378. be increased or decreased, whilst (unlike bandpass and bandreject
  2379. filters) that at all other frequencies is unchanged.
  2380. In order to produce complex equalisation curves, this filter can
  2381. be given several times, each with a different central frequency.
  2382. The filter accepts the following options:
  2383. @table @option
  2384. @item frequency, f
  2385. Set the filter's central frequency in Hz.
  2386. @item width_type, t
  2387. Set method to specify band-width of filter.
  2388. @table @option
  2389. @item h
  2390. Hz
  2391. @item q
  2392. Q-Factor
  2393. @item o
  2394. octave
  2395. @item s
  2396. slope
  2397. @item k
  2398. kHz
  2399. @end table
  2400. @item width, w
  2401. Specify the band-width of a filter in width_type units.
  2402. @item gain, g
  2403. Set the required gain or attenuation in dB.
  2404. Beware of clipping when using a positive gain.
  2405. @item channels, c
  2406. Specify which channels to filter, by default all available are filtered.
  2407. @end table
  2408. @subsection Examples
  2409. @itemize
  2410. @item
  2411. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2412. @example
  2413. equalizer=f=1000:t=h:width=200:g=-10
  2414. @end example
  2415. @item
  2416. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2417. @example
  2418. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2419. @end example
  2420. @end itemize
  2421. @subsection Commands
  2422. This filter supports the following commands:
  2423. @table @option
  2424. @item frequency, f
  2425. Change equalizer frequency.
  2426. Syntax for the command is : "@var{frequency}"
  2427. @item width_type, t
  2428. Change equalizer width_type.
  2429. Syntax for the command is : "@var{width_type}"
  2430. @item width, w
  2431. Change equalizer width.
  2432. Syntax for the command is : "@var{width}"
  2433. @item gain, g
  2434. Change equalizer gain.
  2435. Syntax for the command is : "@var{gain}"
  2436. @end table
  2437. @section extrastereo
  2438. Linearly increases the difference between left and right channels which
  2439. adds some sort of "live" effect to playback.
  2440. The filter accepts the following options:
  2441. @table @option
  2442. @item m
  2443. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2444. (average of both channels), with 1.0 sound will be unchanged, with
  2445. -1.0 left and right channels will be swapped.
  2446. @item c
  2447. Enable clipping. By default is enabled.
  2448. @end table
  2449. @section firequalizer
  2450. Apply FIR Equalization using arbitrary frequency response.
  2451. The filter accepts the following option:
  2452. @table @option
  2453. @item gain
  2454. Set gain curve equation (in dB). The expression can contain variables:
  2455. @table @option
  2456. @item f
  2457. the evaluated frequency
  2458. @item sr
  2459. sample rate
  2460. @item ch
  2461. channel number, set to 0 when multichannels evaluation is disabled
  2462. @item chid
  2463. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2464. multichannels evaluation is disabled
  2465. @item chs
  2466. number of channels
  2467. @item chlayout
  2468. channel_layout, see libavutil/channel_layout.h
  2469. @end table
  2470. and functions:
  2471. @table @option
  2472. @item gain_interpolate(f)
  2473. interpolate gain on frequency f based on gain_entry
  2474. @item cubic_interpolate(f)
  2475. same as gain_interpolate, but smoother
  2476. @end table
  2477. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2478. @item gain_entry
  2479. Set gain entry for gain_interpolate function. The expression can
  2480. contain functions:
  2481. @table @option
  2482. @item entry(f, g)
  2483. store gain entry at frequency f with value g
  2484. @end table
  2485. This option is also available as command.
  2486. @item delay
  2487. Set filter delay in seconds. Higher value means more accurate.
  2488. Default is @code{0.01}.
  2489. @item accuracy
  2490. Set filter accuracy in Hz. Lower value means more accurate.
  2491. Default is @code{5}.
  2492. @item wfunc
  2493. Set window function. Acceptable values are:
  2494. @table @option
  2495. @item rectangular
  2496. rectangular window, useful when gain curve is already smooth
  2497. @item hann
  2498. hann window (default)
  2499. @item hamming
  2500. hamming window
  2501. @item blackman
  2502. blackman window
  2503. @item nuttall3
  2504. 3-terms continuous 1st derivative nuttall window
  2505. @item mnuttall3
  2506. minimum 3-terms discontinuous nuttall window
  2507. @item nuttall
  2508. 4-terms continuous 1st derivative nuttall window
  2509. @item bnuttall
  2510. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2511. @item bharris
  2512. blackman-harris window
  2513. @item tukey
  2514. tukey window
  2515. @end table
  2516. @item fixed
  2517. If enabled, use fixed number of audio samples. This improves speed when
  2518. filtering with large delay. Default is disabled.
  2519. @item multi
  2520. Enable multichannels evaluation on gain. Default is disabled.
  2521. @item zero_phase
  2522. Enable zero phase mode by subtracting timestamp to compensate delay.
  2523. Default is disabled.
  2524. @item scale
  2525. Set scale used by gain. Acceptable values are:
  2526. @table @option
  2527. @item linlin
  2528. linear frequency, linear gain
  2529. @item linlog
  2530. linear frequency, logarithmic (in dB) gain (default)
  2531. @item loglin
  2532. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2533. @item loglog
  2534. logarithmic frequency, logarithmic gain
  2535. @end table
  2536. @item dumpfile
  2537. Set file for dumping, suitable for gnuplot.
  2538. @item dumpscale
  2539. Set scale for dumpfile. Acceptable values are same with scale option.
  2540. Default is linlog.
  2541. @item fft2
  2542. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2543. Default is disabled.
  2544. @item min_phase
  2545. Enable minimum phase impulse response. Default is disabled.
  2546. @end table
  2547. @subsection Examples
  2548. @itemize
  2549. @item
  2550. lowpass at 1000 Hz:
  2551. @example
  2552. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2553. @end example
  2554. @item
  2555. lowpass at 1000 Hz with gain_entry:
  2556. @example
  2557. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2558. @end example
  2559. @item
  2560. custom equalization:
  2561. @example
  2562. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2563. @end example
  2564. @item
  2565. higher delay with zero phase to compensate delay:
  2566. @example
  2567. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2568. @end example
  2569. @item
  2570. lowpass on left channel, highpass on right channel:
  2571. @example
  2572. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2573. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2574. @end example
  2575. @end itemize
  2576. @section flanger
  2577. Apply a flanging effect to the audio.
  2578. The filter accepts the following options:
  2579. @table @option
  2580. @item delay
  2581. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2582. @item depth
  2583. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2584. @item regen
  2585. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2586. Default value is 0.
  2587. @item width
  2588. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2589. Default value is 71.
  2590. @item speed
  2591. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2592. @item shape
  2593. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2594. Default value is @var{sinusoidal}.
  2595. @item phase
  2596. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2597. Default value is 25.
  2598. @item interp
  2599. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2600. Default is @var{linear}.
  2601. @end table
  2602. @section haas
  2603. Apply Haas effect to audio.
  2604. Note that this makes most sense to apply on mono signals.
  2605. With this filter applied to mono signals it give some directionality and
  2606. stretches its stereo image.
  2607. The filter accepts the following options:
  2608. @table @option
  2609. @item level_in
  2610. Set input level. By default is @var{1}, or 0dB
  2611. @item level_out
  2612. Set output level. By default is @var{1}, or 0dB.
  2613. @item side_gain
  2614. Set gain applied to side part of signal. By default is @var{1}.
  2615. @item middle_source
  2616. Set kind of middle source. Can be one of the following:
  2617. @table @samp
  2618. @item left
  2619. Pick left channel.
  2620. @item right
  2621. Pick right channel.
  2622. @item mid
  2623. Pick middle part signal of stereo image.
  2624. @item side
  2625. Pick side part signal of stereo image.
  2626. @end table
  2627. @item middle_phase
  2628. Change middle phase. By default is disabled.
  2629. @item left_delay
  2630. Set left channel delay. By default is @var{2.05} milliseconds.
  2631. @item left_balance
  2632. Set left channel balance. By default is @var{-1}.
  2633. @item left_gain
  2634. Set left channel gain. By default is @var{1}.
  2635. @item left_phase
  2636. Change left phase. By default is disabled.
  2637. @item right_delay
  2638. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2639. @item right_balance
  2640. Set right channel balance. By default is @var{1}.
  2641. @item right_gain
  2642. Set right channel gain. By default is @var{1}.
  2643. @item right_phase
  2644. Change right phase. By default is enabled.
  2645. @end table
  2646. @section hdcd
  2647. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2648. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2649. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2650. of HDCD, and detects the Transient Filter flag.
  2651. @example
  2652. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2653. @end example
  2654. When using the filter with wav, note the default encoding for wav is 16-bit,
  2655. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2656. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2657. @example
  2658. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2659. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2660. @end example
  2661. The filter accepts the following options:
  2662. @table @option
  2663. @item disable_autoconvert
  2664. Disable any automatic format conversion or resampling in the filter graph.
  2665. @item process_stereo
  2666. Process the stereo channels together. If target_gain does not match between
  2667. channels, consider it invalid and use the last valid target_gain.
  2668. @item cdt_ms
  2669. Set the code detect timer period in ms.
  2670. @item force_pe
  2671. Always extend peaks above -3dBFS even if PE isn't signaled.
  2672. @item analyze_mode
  2673. Replace audio with a solid tone and adjust the amplitude to signal some
  2674. specific aspect of the decoding process. The output file can be loaded in
  2675. an audio editor alongside the original to aid analysis.
  2676. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2677. Modes are:
  2678. @table @samp
  2679. @item 0, off
  2680. Disabled
  2681. @item 1, lle
  2682. Gain adjustment level at each sample
  2683. @item 2, pe
  2684. Samples where peak extend occurs
  2685. @item 3, cdt
  2686. Samples where the code detect timer is active
  2687. @item 4, tgm
  2688. Samples where the target gain does not match between channels
  2689. @end table
  2690. @end table
  2691. @section headphone
  2692. Apply head-related transfer functions (HRTFs) to create virtual
  2693. loudspeakers around the user for binaural listening via headphones.
  2694. The HRIRs are provided via additional streams, for each channel
  2695. one stereo input stream is needed.
  2696. The filter accepts the following options:
  2697. @table @option
  2698. @item map
  2699. Set mapping of input streams for convolution.
  2700. The argument is a '|'-separated list of channel names in order as they
  2701. are given as additional stream inputs for filter.
  2702. This also specify number of input streams. Number of input streams
  2703. must be not less than number of channels in first stream plus one.
  2704. @item gain
  2705. Set gain applied to audio. Value is in dB. Default is 0.
  2706. @item type
  2707. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2708. processing audio in time domain which is slow.
  2709. @var{freq} is processing audio in frequency domain which is fast.
  2710. Default is @var{freq}.
  2711. @item lfe
  2712. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2713. @item size
  2714. Set size of frame in number of samples which will be processed at once.
  2715. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2716. @item hrir
  2717. Set format of hrir stream.
  2718. Default value is @var{stereo}. Alternative value is @var{multich}.
  2719. If value is set to @var{stereo}, number of additional streams should
  2720. be greater or equal to number of input channels in first input stream.
  2721. Also each additional stream should have stereo number of channels.
  2722. If value is set to @var{multich}, number of additional streams should
  2723. be exactly one. Also number of input channels of additional stream
  2724. should be equal or greater than twice number of channels of first input
  2725. stream.
  2726. @end table
  2727. @subsection Examples
  2728. @itemize
  2729. @item
  2730. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2731. each amovie filter use stereo file with IR coefficients as input.
  2732. The files give coefficients for each position of virtual loudspeaker:
  2733. @example
  2734. ffmpeg -i input.wav -lavfi-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],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2735. output.wav
  2736. @end example
  2737. @item
  2738. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2739. but now in @var{multich} @var{hrir} format.
  2740. @example
  2741. ffmpeg -i input.wav -lavfi-complex "amovie=minp.wav[hrirs],[a:0][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  2742. output.wav
  2743. @end example
  2744. @end itemize
  2745. @section highpass
  2746. Apply a high-pass filter with 3dB point frequency.
  2747. The filter can be either single-pole, or double-pole (the default).
  2748. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2749. The filter accepts the following options:
  2750. @table @option
  2751. @item frequency, f
  2752. Set frequency in Hz. Default is 3000.
  2753. @item poles, p
  2754. Set number of poles. Default is 2.
  2755. @item width_type, t
  2756. Set method to specify band-width of filter.
  2757. @table @option
  2758. @item h
  2759. Hz
  2760. @item q
  2761. Q-Factor
  2762. @item o
  2763. octave
  2764. @item s
  2765. slope
  2766. @item k
  2767. kHz
  2768. @end table
  2769. @item width, w
  2770. Specify the band-width of a filter in width_type units.
  2771. Applies only to double-pole filter.
  2772. The default is 0.707q and gives a Butterworth response.
  2773. @item channels, c
  2774. Specify which channels to filter, by default all available are filtered.
  2775. @end table
  2776. @subsection Commands
  2777. This filter supports the following commands:
  2778. @table @option
  2779. @item frequency, f
  2780. Change highpass frequency.
  2781. Syntax for the command is : "@var{frequency}"
  2782. @item width_type, t
  2783. Change highpass width_type.
  2784. Syntax for the command is : "@var{width_type}"
  2785. @item width, w
  2786. Change highpass width.
  2787. Syntax for the command is : "@var{width}"
  2788. @end table
  2789. @section join
  2790. Join multiple input streams into one multi-channel stream.
  2791. It accepts the following parameters:
  2792. @table @option
  2793. @item inputs
  2794. The number of input streams. It defaults to 2.
  2795. @item channel_layout
  2796. The desired output channel layout. It defaults to stereo.
  2797. @item map
  2798. Map channels from inputs to output. The argument is a '|'-separated list of
  2799. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2800. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2801. can be either the name of the input channel (e.g. FL for front left) or its
  2802. index in the specified input stream. @var{out_channel} is the name of the output
  2803. channel.
  2804. @end table
  2805. The filter will attempt to guess the mappings when they are not specified
  2806. explicitly. It does so by first trying to find an unused matching input channel
  2807. and if that fails it picks the first unused input channel.
  2808. Join 3 inputs (with properly set channel layouts):
  2809. @example
  2810. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2811. @end example
  2812. Build a 5.1 output from 6 single-channel streams:
  2813. @example
  2814. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2815. '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'
  2816. out
  2817. @end example
  2818. @section ladspa
  2819. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2820. To enable compilation of this filter you need to configure FFmpeg with
  2821. @code{--enable-ladspa}.
  2822. @table @option
  2823. @item file, f
  2824. Specifies the name of LADSPA plugin library to load. If the environment
  2825. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2826. each one of the directories specified by the colon separated list in
  2827. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2828. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2829. @file{/usr/lib/ladspa/}.
  2830. @item plugin, p
  2831. Specifies the plugin within the library. Some libraries contain only
  2832. one plugin, but others contain many of them. If this is not set filter
  2833. will list all available plugins within the specified library.
  2834. @item controls, c
  2835. Set the '|' separated list of controls which are zero or more floating point
  2836. values that determine the behavior of the loaded plugin (for example delay,
  2837. threshold or gain).
  2838. Controls need to be defined using the following syntax:
  2839. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2840. @var{valuei} is the value set on the @var{i}-th control.
  2841. Alternatively they can be also defined using the following syntax:
  2842. @var{value0}|@var{value1}|@var{value2}|..., where
  2843. @var{valuei} is the value set on the @var{i}-th control.
  2844. If @option{controls} is set to @code{help}, all available controls and
  2845. their valid ranges are printed.
  2846. @item sample_rate, s
  2847. Specify the sample rate, default to 44100. Only used if plugin have
  2848. zero inputs.
  2849. @item nb_samples, n
  2850. Set the number of samples per channel per each output frame, default
  2851. is 1024. Only used if plugin have zero inputs.
  2852. @item duration, d
  2853. Set the minimum duration of the sourced audio. See
  2854. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2855. for the accepted syntax.
  2856. Note that the resulting duration may be greater than the specified duration,
  2857. as the generated audio is always cut at the end of a complete frame.
  2858. If not specified, or the expressed duration is negative, the audio is
  2859. supposed to be generated forever.
  2860. Only used if plugin have zero inputs.
  2861. @end table
  2862. @subsection Examples
  2863. @itemize
  2864. @item
  2865. List all available plugins within amp (LADSPA example plugin) library:
  2866. @example
  2867. ladspa=file=amp
  2868. @end example
  2869. @item
  2870. List all available controls and their valid ranges for @code{vcf_notch}
  2871. plugin from @code{VCF} library:
  2872. @example
  2873. ladspa=f=vcf:p=vcf_notch:c=help
  2874. @end example
  2875. @item
  2876. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2877. plugin library:
  2878. @example
  2879. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2880. @end example
  2881. @item
  2882. Add reverberation to the audio using TAP-plugins
  2883. (Tom's Audio Processing plugins):
  2884. @example
  2885. ladspa=file=tap_reverb:tap_reverb
  2886. @end example
  2887. @item
  2888. Generate white noise, with 0.2 amplitude:
  2889. @example
  2890. ladspa=file=cmt:noise_source_white:c=c0=.2
  2891. @end example
  2892. @item
  2893. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2894. @code{C* Audio Plugin Suite} (CAPS) library:
  2895. @example
  2896. ladspa=file=caps:Click:c=c1=20'
  2897. @end example
  2898. @item
  2899. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2900. @example
  2901. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2902. @end example
  2903. @item
  2904. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2905. @code{SWH Plugins} collection:
  2906. @example
  2907. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2908. @end example
  2909. @item
  2910. Attenuate low frequencies using Multiband EQ from Steve Harris
  2911. @code{SWH Plugins} collection:
  2912. @example
  2913. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2914. @end example
  2915. @item
  2916. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2917. (CAPS) library:
  2918. @example
  2919. ladspa=caps:Narrower
  2920. @end example
  2921. @item
  2922. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2923. @example
  2924. ladspa=caps:White:.2
  2925. @end example
  2926. @item
  2927. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2928. @example
  2929. ladspa=caps:Fractal:c=c1=1
  2930. @end example
  2931. @item
  2932. Dynamic volume normalization using @code{VLevel} plugin:
  2933. @example
  2934. ladspa=vlevel-ladspa:vlevel_mono
  2935. @end example
  2936. @end itemize
  2937. @subsection Commands
  2938. This filter supports the following commands:
  2939. @table @option
  2940. @item cN
  2941. Modify the @var{N}-th control value.
  2942. If the specified value is not valid, it is ignored and prior one is kept.
  2943. @end table
  2944. @section loudnorm
  2945. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2946. Support for both single pass (livestreams, files) and double pass (files) modes.
  2947. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2948. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2949. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2950. The filter accepts the following options:
  2951. @table @option
  2952. @item I, i
  2953. Set integrated loudness target.
  2954. Range is -70.0 - -5.0. Default value is -24.0.
  2955. @item LRA, lra
  2956. Set loudness range target.
  2957. Range is 1.0 - 20.0. Default value is 7.0.
  2958. @item TP, tp
  2959. Set maximum true peak.
  2960. Range is -9.0 - +0.0. Default value is -2.0.
  2961. @item measured_I, measured_i
  2962. Measured IL of input file.
  2963. Range is -99.0 - +0.0.
  2964. @item measured_LRA, measured_lra
  2965. Measured LRA of input file.
  2966. Range is 0.0 - 99.0.
  2967. @item measured_TP, measured_tp
  2968. Measured true peak of input file.
  2969. Range is -99.0 - +99.0.
  2970. @item measured_thresh
  2971. Measured threshold of input file.
  2972. Range is -99.0 - +0.0.
  2973. @item offset
  2974. Set offset gain. Gain is applied before the true-peak limiter.
  2975. Range is -99.0 - +99.0. Default is +0.0.
  2976. @item linear
  2977. Normalize linearly if possible.
  2978. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2979. to be specified in order to use this mode.
  2980. Options are true or false. Default is true.
  2981. @item dual_mono
  2982. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2983. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2984. If set to @code{true}, this option will compensate for this effect.
  2985. Multi-channel input files are not affected by this option.
  2986. Options are true or false. Default is false.
  2987. @item print_format
  2988. Set print format for stats. Options are summary, json, or none.
  2989. Default value is none.
  2990. @end table
  2991. @section lowpass
  2992. Apply a low-pass filter with 3dB point frequency.
  2993. The filter can be either single-pole or double-pole (the default).
  2994. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2995. The filter accepts the following options:
  2996. @table @option
  2997. @item frequency, f
  2998. Set frequency in Hz. Default is 500.
  2999. @item poles, p
  3000. Set number of poles. Default is 2.
  3001. @item width_type, t
  3002. Set method to specify band-width of filter.
  3003. @table @option
  3004. @item h
  3005. Hz
  3006. @item q
  3007. Q-Factor
  3008. @item o
  3009. octave
  3010. @item s
  3011. slope
  3012. @item k
  3013. kHz
  3014. @end table
  3015. @item width, w
  3016. Specify the band-width of a filter in width_type units.
  3017. Applies only to double-pole filter.
  3018. The default is 0.707q and gives a Butterworth response.
  3019. @item channels, c
  3020. Specify which channels to filter, by default all available are filtered.
  3021. @end table
  3022. @subsection Examples
  3023. @itemize
  3024. @item
  3025. Lowpass only LFE channel, it LFE is not present it does nothing:
  3026. @example
  3027. lowpass=c=LFE
  3028. @end example
  3029. @end itemize
  3030. @subsection Commands
  3031. This filter supports the following commands:
  3032. @table @option
  3033. @item frequency, f
  3034. Change lowpass frequency.
  3035. Syntax for the command is : "@var{frequency}"
  3036. @item width_type, t
  3037. Change lowpass width_type.
  3038. Syntax for the command is : "@var{width_type}"
  3039. @item width, w
  3040. Change lowpass width.
  3041. Syntax for the command is : "@var{width}"
  3042. @end table
  3043. @section lv2
  3044. Load a LV2 (LADSPA Version 2) plugin.
  3045. To enable compilation of this filter you need to configure FFmpeg with
  3046. @code{--enable-lv2}.
  3047. @table @option
  3048. @item plugin, p
  3049. Specifies the plugin URI. You may need to escape ':'.
  3050. @item controls, c
  3051. Set the '|' separated list of controls which are zero or more floating point
  3052. values that determine the behavior of the loaded plugin (for example delay,
  3053. threshold or gain).
  3054. If @option{controls} is set to @code{help}, all available controls and
  3055. their valid ranges are printed.
  3056. @item sample_rate, s
  3057. Specify the sample rate, default to 44100. Only used if plugin have
  3058. zero inputs.
  3059. @item nb_samples, n
  3060. Set the number of samples per channel per each output frame, default
  3061. is 1024. Only used if plugin have zero inputs.
  3062. @item duration, d
  3063. Set the minimum duration of the sourced audio. See
  3064. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3065. for the accepted syntax.
  3066. Note that the resulting duration may be greater than the specified duration,
  3067. as the generated audio is always cut at the end of a complete frame.
  3068. If not specified, or the expressed duration is negative, the audio is
  3069. supposed to be generated forever.
  3070. Only used if plugin have zero inputs.
  3071. @end table
  3072. @subsection Examples
  3073. @itemize
  3074. @item
  3075. Apply bass enhancer plugin from Calf:
  3076. @example
  3077. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3078. @end example
  3079. @item
  3080. Apply vinyl plugin from Calf:
  3081. @example
  3082. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3083. @end example
  3084. @item
  3085. Apply bit crusher plugin from ArtyFX:
  3086. @example
  3087. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3088. @end example
  3089. @end itemize
  3090. @section mcompand
  3091. Multiband Compress or expand the audio's dynamic range.
  3092. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3093. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3094. response when absent compander action.
  3095. It accepts the following parameters:
  3096. @table @option
  3097. @item args
  3098. This option syntax is:
  3099. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3100. For explanation of each item refer to compand filter documentation.
  3101. @end table
  3102. @anchor{pan}
  3103. @section pan
  3104. Mix channels with specific gain levels. The filter accepts the output
  3105. channel layout followed by a set of channels definitions.
  3106. This filter is also designed to efficiently remap the channels of an audio
  3107. stream.
  3108. The filter accepts parameters of the form:
  3109. "@var{l}|@var{outdef}|@var{outdef}|..."
  3110. @table @option
  3111. @item l
  3112. output channel layout or number of channels
  3113. @item outdef
  3114. output channel specification, of the form:
  3115. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3116. @item out_name
  3117. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3118. number (c0, c1, etc.)
  3119. @item gain
  3120. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3121. @item in_name
  3122. input channel to use, see out_name for details; it is not possible to mix
  3123. named and numbered input channels
  3124. @end table
  3125. If the `=' in a channel specification is replaced by `<', then the gains for
  3126. that specification will be renormalized so that the total is 1, thus
  3127. avoiding clipping noise.
  3128. @subsection Mixing examples
  3129. For example, if you want to down-mix from stereo to mono, but with a bigger
  3130. factor for the left channel:
  3131. @example
  3132. pan=1c|c0=0.9*c0+0.1*c1
  3133. @end example
  3134. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3135. 7-channels surround:
  3136. @example
  3137. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3138. @end example
  3139. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3140. that should be preferred (see "-ac" option) unless you have very specific
  3141. needs.
  3142. @subsection Remapping examples
  3143. The channel remapping will be effective if, and only if:
  3144. @itemize
  3145. @item gain coefficients are zeroes or ones,
  3146. @item only one input per channel output,
  3147. @end itemize
  3148. If all these conditions are satisfied, the filter will notify the user ("Pure
  3149. channel mapping detected"), and use an optimized and lossless method to do the
  3150. remapping.
  3151. For example, if you have a 5.1 source and want a stereo audio stream by
  3152. dropping the extra channels:
  3153. @example
  3154. pan="stereo| c0=FL | c1=FR"
  3155. @end example
  3156. Given the same source, you can also switch front left and front right channels
  3157. and keep the input channel layout:
  3158. @example
  3159. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3160. @end example
  3161. If the input is a stereo audio stream, you can mute the front left channel (and
  3162. still keep the stereo channel layout) with:
  3163. @example
  3164. pan="stereo|c1=c1"
  3165. @end example
  3166. Still with a stereo audio stream input, you can copy the right channel in both
  3167. front left and right:
  3168. @example
  3169. pan="stereo| c0=FR | c1=FR"
  3170. @end example
  3171. @section replaygain
  3172. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3173. outputs it unchanged.
  3174. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3175. @section resample
  3176. Convert the audio sample format, sample rate and channel layout. It is
  3177. not meant to be used directly.
  3178. @section rubberband
  3179. Apply time-stretching and pitch-shifting with librubberband.
  3180. To enable compilation of this filter, you need to configure FFmpeg with
  3181. @code{--enable-librubberband}.
  3182. The filter accepts the following options:
  3183. @table @option
  3184. @item tempo
  3185. Set tempo scale factor.
  3186. @item pitch
  3187. Set pitch scale factor.
  3188. @item transients
  3189. Set transients detector.
  3190. Possible values are:
  3191. @table @var
  3192. @item crisp
  3193. @item mixed
  3194. @item smooth
  3195. @end table
  3196. @item detector
  3197. Set detector.
  3198. Possible values are:
  3199. @table @var
  3200. @item compound
  3201. @item percussive
  3202. @item soft
  3203. @end table
  3204. @item phase
  3205. Set phase.
  3206. Possible values are:
  3207. @table @var
  3208. @item laminar
  3209. @item independent
  3210. @end table
  3211. @item window
  3212. Set processing window size.
  3213. Possible values are:
  3214. @table @var
  3215. @item standard
  3216. @item short
  3217. @item long
  3218. @end table
  3219. @item smoothing
  3220. Set smoothing.
  3221. Possible values are:
  3222. @table @var
  3223. @item off
  3224. @item on
  3225. @end table
  3226. @item formant
  3227. Enable formant preservation when shift pitching.
  3228. Possible values are:
  3229. @table @var
  3230. @item shifted
  3231. @item preserved
  3232. @end table
  3233. @item pitchq
  3234. Set pitch quality.
  3235. Possible values are:
  3236. @table @var
  3237. @item quality
  3238. @item speed
  3239. @item consistency
  3240. @end table
  3241. @item channels
  3242. Set channels.
  3243. Possible values are:
  3244. @table @var
  3245. @item apart
  3246. @item together
  3247. @end table
  3248. @end table
  3249. @section sidechaincompress
  3250. This filter acts like normal compressor but has the ability to compress
  3251. detected signal using second input signal.
  3252. It needs two input streams and returns one output stream.
  3253. First input stream will be processed depending on second stream signal.
  3254. The filtered signal then can be filtered with other filters in later stages of
  3255. processing. See @ref{pan} and @ref{amerge} filter.
  3256. The filter accepts the following options:
  3257. @table @option
  3258. @item level_in
  3259. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3260. @item threshold
  3261. If a signal of second stream raises above this level it will affect the gain
  3262. reduction of first stream.
  3263. By default is 0.125. Range is between 0.00097563 and 1.
  3264. @item ratio
  3265. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3266. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3267. Default is 2. Range is between 1 and 20.
  3268. @item attack
  3269. Amount of milliseconds the signal has to rise above the threshold before gain
  3270. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3271. @item release
  3272. Amount of milliseconds the signal has to fall below the threshold before
  3273. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3274. @item makeup
  3275. Set the amount by how much signal will be amplified after processing.
  3276. Default is 1. Range is from 1 to 64.
  3277. @item knee
  3278. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3279. Default is 2.82843. Range is between 1 and 8.
  3280. @item link
  3281. Choose if the @code{average} level between all channels of side-chain stream
  3282. or the louder(@code{maximum}) channel of side-chain stream affects the
  3283. reduction. Default is @code{average}.
  3284. @item detection
  3285. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3286. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3287. @item level_sc
  3288. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3289. @item mix
  3290. How much to use compressed signal in output. Default is 1.
  3291. Range is between 0 and 1.
  3292. @end table
  3293. @subsection Examples
  3294. @itemize
  3295. @item
  3296. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3297. depending on the signal of 2nd input and later compressed signal to be
  3298. merged with 2nd input:
  3299. @example
  3300. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3301. @end example
  3302. @end itemize
  3303. @section sidechaingate
  3304. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3305. filter the detected signal before sending it to the gain reduction stage.
  3306. Normally a gate uses the full range signal to detect a level above the
  3307. threshold.
  3308. For example: If you cut all lower frequencies from your sidechain signal
  3309. the gate will decrease the volume of your track only if not enough highs
  3310. appear. With this technique you are able to reduce the resonation of a
  3311. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3312. guitar.
  3313. It needs two input streams and returns one output stream.
  3314. First input stream will be processed depending on second stream signal.
  3315. The filter accepts the following options:
  3316. @table @option
  3317. @item level_in
  3318. Set input level before filtering.
  3319. Default is 1. Allowed range is from 0.015625 to 64.
  3320. @item range
  3321. Set the level of gain reduction when the signal is below the threshold.
  3322. Default is 0.06125. Allowed range is from 0 to 1.
  3323. @item threshold
  3324. If a signal rises above this level the gain reduction is released.
  3325. Default is 0.125. Allowed range is from 0 to 1.
  3326. @item ratio
  3327. Set a ratio about which the signal is reduced.
  3328. Default is 2. Allowed range is from 1 to 9000.
  3329. @item attack
  3330. Amount of milliseconds the signal has to rise above the threshold before gain
  3331. reduction stops.
  3332. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3333. @item release
  3334. Amount of milliseconds the signal has to fall below the threshold before the
  3335. reduction is increased again. Default is 250 milliseconds.
  3336. Allowed range is from 0.01 to 9000.
  3337. @item makeup
  3338. Set amount of amplification of signal after processing.
  3339. Default is 1. Allowed range is from 1 to 64.
  3340. @item knee
  3341. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3342. Default is 2.828427125. Allowed range is from 1 to 8.
  3343. @item detection
  3344. Choose if exact signal should be taken for detection or an RMS like one.
  3345. Default is rms. Can be peak or rms.
  3346. @item link
  3347. Choose if the average level between all channels or the louder channel affects
  3348. the reduction.
  3349. Default is average. Can be average or maximum.
  3350. @item level_sc
  3351. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3352. @end table
  3353. @section silencedetect
  3354. Detect silence in an audio stream.
  3355. This filter logs a message when it detects that the input audio volume is less
  3356. or equal to a noise tolerance value for a duration greater or equal to the
  3357. minimum detected noise duration.
  3358. The printed times and duration are expressed in seconds.
  3359. The filter accepts the following options:
  3360. @table @option
  3361. @item noise, n
  3362. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3363. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3364. @item duration, d
  3365. Set silence duration until notification (default is 2 seconds).
  3366. @item mono, m
  3367. Process each channel separately, instead of combined. By default is disabled.
  3368. @end table
  3369. @subsection Examples
  3370. @itemize
  3371. @item
  3372. Detect 5 seconds of silence with -50dB noise tolerance:
  3373. @example
  3374. silencedetect=n=-50dB:d=5
  3375. @end example
  3376. @item
  3377. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3378. tolerance in @file{silence.mp3}:
  3379. @example
  3380. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3381. @end example
  3382. @end itemize
  3383. @section silenceremove
  3384. Remove silence from the beginning, middle or end of the audio.
  3385. The filter accepts the following options:
  3386. @table @option
  3387. @item start_periods
  3388. This value is used to indicate if audio should be trimmed at beginning of
  3389. the audio. A value of zero indicates no silence should be trimmed from the
  3390. beginning. When specifying a non-zero value, it trims audio up until it
  3391. finds non-silence. Normally, when trimming silence from beginning of audio
  3392. the @var{start_periods} will be @code{1} but it can be increased to higher
  3393. values to trim all audio up to specific count of non-silence periods.
  3394. Default value is @code{0}.
  3395. @item start_duration
  3396. Specify the amount of time that non-silence must be detected before it stops
  3397. trimming audio. By increasing the duration, bursts of noises can be treated
  3398. as silence and trimmed off. Default value is @code{0}.
  3399. @item start_threshold
  3400. This indicates what sample value should be treated as silence. For digital
  3401. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3402. you may wish to increase the value to account for background noise.
  3403. Can be specified in dB (in case "dB" is appended to the specified value)
  3404. or amplitude ratio. Default value is @code{0}.
  3405. @item start_silence
  3406. Specify max duration of silence at beginning that will be kept after
  3407. trimming. Default is 0, which is equal to trimming all samples detected
  3408. as silence.
  3409. @item start_mode
  3410. Specify mode of detection of silence end in start of multi-channel audio.
  3411. Can be @var{any} or @var{all}. Default is @var{any}.
  3412. With @var{any}, any sample that is detected as non-silence will cause
  3413. stopped trimming of silence.
  3414. With @var{all}, only if all channels are detected as non-silence will cause
  3415. stopped trimming of silence.
  3416. @item stop_periods
  3417. Set the count for trimming silence from the end of audio.
  3418. To remove silence from the middle of a file, specify a @var{stop_periods}
  3419. that is negative. This value is then treated as a positive value and is
  3420. used to indicate the effect should restart processing as specified by
  3421. @var{start_periods}, making it suitable for removing periods of silence
  3422. in the middle of the audio.
  3423. Default value is @code{0}.
  3424. @item stop_duration
  3425. Specify a duration of silence that must exist before audio is not copied any
  3426. more. By specifying a higher duration, silence that is wanted can be left in
  3427. the audio.
  3428. Default value is @code{0}.
  3429. @item stop_threshold
  3430. This is the same as @option{start_threshold} but for trimming silence from
  3431. the end of audio.
  3432. Can be specified in dB (in case "dB" is appended to the specified value)
  3433. or amplitude ratio. Default value is @code{0}.
  3434. @item stop_silence
  3435. Specify max duration of silence at end that will be kept after
  3436. trimming. Default is 0, which is equal to trimming all samples detected
  3437. as silence.
  3438. @item stop_mode
  3439. Specify mode of detection of silence start in end of multi-channel audio.
  3440. Can be @var{any} or @var{all}. Default is @var{any}.
  3441. With @var{any}, any sample that is detected as non-silence will cause
  3442. stopped trimming of silence.
  3443. With @var{all}, only if all channels are detected as non-silence will cause
  3444. stopped trimming of silence.
  3445. @item detection
  3446. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3447. and works better with digital silence which is exactly 0.
  3448. Default value is @code{rms}.
  3449. @item window
  3450. Set duration in number of seconds used to calculate size of window in number
  3451. of samples for detecting silence.
  3452. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3453. @end table
  3454. @subsection Examples
  3455. @itemize
  3456. @item
  3457. The following example shows how this filter can be used to start a recording
  3458. that does not contain the delay at the start which usually occurs between
  3459. pressing the record button and the start of the performance:
  3460. @example
  3461. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3462. @end example
  3463. @item
  3464. Trim all silence encountered from beginning to end where there is more than 1
  3465. second of silence in audio:
  3466. @example
  3467. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3468. @end example
  3469. @end itemize
  3470. @section sofalizer
  3471. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3472. loudspeakers around the user for binaural listening via headphones (audio
  3473. formats up to 9 channels supported).
  3474. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3475. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3476. Austrian Academy of Sciences.
  3477. To enable compilation of this filter you need to configure FFmpeg with
  3478. @code{--enable-libmysofa}.
  3479. The filter accepts the following options:
  3480. @table @option
  3481. @item sofa
  3482. Set the SOFA file used for rendering.
  3483. @item gain
  3484. Set gain applied to audio. Value is in dB. Default is 0.
  3485. @item rotation
  3486. Set rotation of virtual loudspeakers in deg. Default is 0.
  3487. @item elevation
  3488. Set elevation of virtual speakers in deg. Default is 0.
  3489. @item radius
  3490. Set distance in meters between loudspeakers and the listener with near-field
  3491. HRTFs. Default is 1.
  3492. @item type
  3493. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3494. processing audio in time domain which is slow.
  3495. @var{freq} is processing audio in frequency domain which is fast.
  3496. Default is @var{freq}.
  3497. @item speakers
  3498. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3499. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3500. Each virtual loudspeaker is described with short channel name following with
  3501. azimuth and elevation in degrees.
  3502. Each virtual loudspeaker description is separated by '|'.
  3503. For example to override front left and front right channel positions use:
  3504. 'speakers=FL 45 15|FR 345 15'.
  3505. Descriptions with unrecognised channel names are ignored.
  3506. @item lfegain
  3507. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3508. @end table
  3509. @subsection Examples
  3510. @itemize
  3511. @item
  3512. Using ClubFritz6 sofa file:
  3513. @example
  3514. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3515. @end example
  3516. @item
  3517. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3518. @example
  3519. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3520. @end example
  3521. @item
  3522. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3523. and also with custom gain:
  3524. @example
  3525. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3526. @end example
  3527. @end itemize
  3528. @section stereotools
  3529. This filter has some handy utilities to manage stereo signals, for converting
  3530. M/S stereo recordings to L/R signal while having control over the parameters
  3531. or spreading the stereo image of master track.
  3532. The filter accepts the following options:
  3533. @table @option
  3534. @item level_in
  3535. Set input level before filtering for both channels. Defaults is 1.
  3536. Allowed range is from 0.015625 to 64.
  3537. @item level_out
  3538. Set output level after filtering for both channels. Defaults is 1.
  3539. Allowed range is from 0.015625 to 64.
  3540. @item balance_in
  3541. Set input balance between both channels. Default is 0.
  3542. Allowed range is from -1 to 1.
  3543. @item balance_out
  3544. Set output balance between both channels. Default is 0.
  3545. Allowed range is from -1 to 1.
  3546. @item softclip
  3547. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3548. clipping. Disabled by default.
  3549. @item mutel
  3550. Mute the left channel. Disabled by default.
  3551. @item muter
  3552. Mute the right channel. Disabled by default.
  3553. @item phasel
  3554. Change the phase of the left channel. Disabled by default.
  3555. @item phaser
  3556. Change the phase of the right channel. Disabled by default.
  3557. @item mode
  3558. Set stereo mode. Available values are:
  3559. @table @samp
  3560. @item lr>lr
  3561. Left/Right to Left/Right, this is default.
  3562. @item lr>ms
  3563. Left/Right to Mid/Side.
  3564. @item ms>lr
  3565. Mid/Side to Left/Right.
  3566. @item lr>ll
  3567. Left/Right to Left/Left.
  3568. @item lr>rr
  3569. Left/Right to Right/Right.
  3570. @item lr>l+r
  3571. Left/Right to Left + Right.
  3572. @item lr>rl
  3573. Left/Right to Right/Left.
  3574. @item ms>ll
  3575. Mid/Side to Left/Left.
  3576. @item ms>rr
  3577. Mid/Side to Right/Right.
  3578. @end table
  3579. @item slev
  3580. Set level of side signal. Default is 1.
  3581. Allowed range is from 0.015625 to 64.
  3582. @item sbal
  3583. Set balance of side signal. Default is 0.
  3584. Allowed range is from -1 to 1.
  3585. @item mlev
  3586. Set level of the middle signal. Default is 1.
  3587. Allowed range is from 0.015625 to 64.
  3588. @item mpan
  3589. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3590. @item base
  3591. Set stereo base between mono and inversed channels. Default is 0.
  3592. Allowed range is from -1 to 1.
  3593. @item delay
  3594. Set delay in milliseconds how much to delay left from right channel and
  3595. vice versa. Default is 0. Allowed range is from -20 to 20.
  3596. @item sclevel
  3597. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3598. @item phase
  3599. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3600. @item bmode_in, bmode_out
  3601. Set balance mode for balance_in/balance_out option.
  3602. Can be one of the following:
  3603. @table @samp
  3604. @item balance
  3605. Classic balance mode. Attenuate one channel at time.
  3606. Gain is raised up to 1.
  3607. @item amplitude
  3608. Similar as classic mode above but gain is raised up to 2.
  3609. @item power
  3610. Equal power distribution, from -6dB to +6dB range.
  3611. @end table
  3612. @end table
  3613. @subsection Examples
  3614. @itemize
  3615. @item
  3616. Apply karaoke like effect:
  3617. @example
  3618. stereotools=mlev=0.015625
  3619. @end example
  3620. @item
  3621. Convert M/S signal to L/R:
  3622. @example
  3623. "stereotools=mode=ms>lr"
  3624. @end example
  3625. @end itemize
  3626. @section stereowiden
  3627. This filter enhance the stereo effect by suppressing signal common to both
  3628. channels and by delaying the signal of left into right and vice versa,
  3629. thereby widening the stereo effect.
  3630. The filter accepts the following options:
  3631. @table @option
  3632. @item delay
  3633. Time in milliseconds of the delay of left signal into right and vice versa.
  3634. Default is 20 milliseconds.
  3635. @item feedback
  3636. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3637. effect of left signal in right output and vice versa which gives widening
  3638. effect. Default is 0.3.
  3639. @item crossfeed
  3640. Cross feed of left into right with inverted phase. This helps in suppressing
  3641. the mono. If the value is 1 it will cancel all the signal common to both
  3642. channels. Default is 0.3.
  3643. @item drymix
  3644. Set level of input signal of original channel. Default is 0.8.
  3645. @end table
  3646. @section superequalizer
  3647. Apply 18 band equalizer.
  3648. The filter accepts the following options:
  3649. @table @option
  3650. @item 1b
  3651. Set 65Hz band gain.
  3652. @item 2b
  3653. Set 92Hz band gain.
  3654. @item 3b
  3655. Set 131Hz band gain.
  3656. @item 4b
  3657. Set 185Hz band gain.
  3658. @item 5b
  3659. Set 262Hz band gain.
  3660. @item 6b
  3661. Set 370Hz band gain.
  3662. @item 7b
  3663. Set 523Hz band gain.
  3664. @item 8b
  3665. Set 740Hz band gain.
  3666. @item 9b
  3667. Set 1047Hz band gain.
  3668. @item 10b
  3669. Set 1480Hz band gain.
  3670. @item 11b
  3671. Set 2093Hz band gain.
  3672. @item 12b
  3673. Set 2960Hz band gain.
  3674. @item 13b
  3675. Set 4186Hz band gain.
  3676. @item 14b
  3677. Set 5920Hz band gain.
  3678. @item 15b
  3679. Set 8372Hz band gain.
  3680. @item 16b
  3681. Set 11840Hz band gain.
  3682. @item 17b
  3683. Set 16744Hz band gain.
  3684. @item 18b
  3685. Set 20000Hz band gain.
  3686. @end table
  3687. @section surround
  3688. Apply audio surround upmix filter.
  3689. This filter allows to produce multichannel output from audio stream.
  3690. The filter accepts the following options:
  3691. @table @option
  3692. @item chl_out
  3693. Set output channel layout. By default, this is @var{5.1}.
  3694. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3695. for the required syntax.
  3696. @item chl_in
  3697. Set input channel layout. By default, this is @var{stereo}.
  3698. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3699. for the required syntax.
  3700. @item level_in
  3701. Set input volume level. By default, this is @var{1}.
  3702. @item level_out
  3703. Set output volume level. By default, this is @var{1}.
  3704. @item lfe
  3705. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3706. @item lfe_low
  3707. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3708. @item lfe_high
  3709. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3710. @item fc_in
  3711. Set front center input volume. By default, this is @var{1}.
  3712. @item fc_out
  3713. Set front center output volume. By default, this is @var{1}.
  3714. @item lfe_in
  3715. Set LFE input volume. By default, this is @var{1}.
  3716. @item lfe_out
  3717. Set LFE output volume. By default, this is @var{1}.
  3718. @end table
  3719. @section treble, highshelf
  3720. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3721. shelving filter with a response similar to that of a standard
  3722. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3723. The filter accepts the following options:
  3724. @table @option
  3725. @item gain, g
  3726. Give the gain at whichever is the lower of ~22 kHz and the
  3727. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3728. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3729. @item frequency, f
  3730. Set the filter's central frequency and so can be used
  3731. to extend or reduce the frequency range to be boosted or cut.
  3732. The default value is @code{3000} Hz.
  3733. @item width_type, t
  3734. Set method to specify band-width of filter.
  3735. @table @option
  3736. @item h
  3737. Hz
  3738. @item q
  3739. Q-Factor
  3740. @item o
  3741. octave
  3742. @item s
  3743. slope
  3744. @item k
  3745. kHz
  3746. @end table
  3747. @item width, w
  3748. Determine how steep is the filter's shelf transition.
  3749. @item channels, c
  3750. Specify which channels to filter, by default all available are filtered.
  3751. @end table
  3752. @subsection Commands
  3753. This filter supports the following commands:
  3754. @table @option
  3755. @item frequency, f
  3756. Change treble frequency.
  3757. Syntax for the command is : "@var{frequency}"
  3758. @item width_type, t
  3759. Change treble width_type.
  3760. Syntax for the command is : "@var{width_type}"
  3761. @item width, w
  3762. Change treble width.
  3763. Syntax for the command is : "@var{width}"
  3764. @item gain, g
  3765. Change treble gain.
  3766. Syntax for the command is : "@var{gain}"
  3767. @end table
  3768. @section tremolo
  3769. Sinusoidal amplitude modulation.
  3770. The filter accepts the following options:
  3771. @table @option
  3772. @item f
  3773. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3774. (20 Hz or lower) will result in a tremolo effect.
  3775. This filter may also be used as a ring modulator by specifying
  3776. a modulation frequency higher than 20 Hz.
  3777. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3778. @item d
  3779. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3780. Default value is 0.5.
  3781. @end table
  3782. @section vibrato
  3783. Sinusoidal phase modulation.
  3784. The filter accepts the following options:
  3785. @table @option
  3786. @item f
  3787. Modulation frequency in Hertz.
  3788. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3789. @item d
  3790. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3791. Default value is 0.5.
  3792. @end table
  3793. @section volume
  3794. Adjust the input audio volume.
  3795. It accepts the following parameters:
  3796. @table @option
  3797. @item volume
  3798. Set audio volume expression.
  3799. Output values are clipped to the maximum value.
  3800. The output audio volume is given by the relation:
  3801. @example
  3802. @var{output_volume} = @var{volume} * @var{input_volume}
  3803. @end example
  3804. The default value for @var{volume} is "1.0".
  3805. @item precision
  3806. This parameter represents the mathematical precision.
  3807. It determines which input sample formats will be allowed, which affects the
  3808. precision of the volume scaling.
  3809. @table @option
  3810. @item fixed
  3811. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3812. @item float
  3813. 32-bit floating-point; this limits input sample format to FLT. (default)
  3814. @item double
  3815. 64-bit floating-point; this limits input sample format to DBL.
  3816. @end table
  3817. @item replaygain
  3818. Choose the behaviour on encountering ReplayGain side data in input frames.
  3819. @table @option
  3820. @item drop
  3821. Remove ReplayGain side data, ignoring its contents (the default).
  3822. @item ignore
  3823. Ignore ReplayGain side data, but leave it in the frame.
  3824. @item track
  3825. Prefer the track gain, if present.
  3826. @item album
  3827. Prefer the album gain, if present.
  3828. @end table
  3829. @item replaygain_preamp
  3830. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3831. Default value for @var{replaygain_preamp} is 0.0.
  3832. @item eval
  3833. Set when the volume expression is evaluated.
  3834. It accepts the following values:
  3835. @table @samp
  3836. @item once
  3837. only evaluate expression once during the filter initialization, or
  3838. when the @samp{volume} command is sent
  3839. @item frame
  3840. evaluate expression for each incoming frame
  3841. @end table
  3842. Default value is @samp{once}.
  3843. @end table
  3844. The volume expression can contain the following parameters.
  3845. @table @option
  3846. @item n
  3847. frame number (starting at zero)
  3848. @item nb_channels
  3849. number of channels
  3850. @item nb_consumed_samples
  3851. number of samples consumed by the filter
  3852. @item nb_samples
  3853. number of samples in the current frame
  3854. @item pos
  3855. original frame position in the file
  3856. @item pts
  3857. frame PTS
  3858. @item sample_rate
  3859. sample rate
  3860. @item startpts
  3861. PTS at start of stream
  3862. @item startt
  3863. time at start of stream
  3864. @item t
  3865. frame time
  3866. @item tb
  3867. timestamp timebase
  3868. @item volume
  3869. last set volume value
  3870. @end table
  3871. Note that when @option{eval} is set to @samp{once} only the
  3872. @var{sample_rate} and @var{tb} variables are available, all other
  3873. variables will evaluate to NAN.
  3874. @subsection Commands
  3875. This filter supports the following commands:
  3876. @table @option
  3877. @item volume
  3878. Modify the volume expression.
  3879. The command accepts the same syntax of the corresponding option.
  3880. If the specified expression is not valid, it is kept at its current
  3881. value.
  3882. @item replaygain_noclip
  3883. Prevent clipping by limiting the gain applied.
  3884. Default value for @var{replaygain_noclip} is 1.
  3885. @end table
  3886. @subsection Examples
  3887. @itemize
  3888. @item
  3889. Halve the input audio volume:
  3890. @example
  3891. volume=volume=0.5
  3892. volume=volume=1/2
  3893. volume=volume=-6.0206dB
  3894. @end example
  3895. In all the above example the named key for @option{volume} can be
  3896. omitted, for example like in:
  3897. @example
  3898. volume=0.5
  3899. @end example
  3900. @item
  3901. Increase input audio power by 6 decibels using fixed-point precision:
  3902. @example
  3903. volume=volume=6dB:precision=fixed
  3904. @end example
  3905. @item
  3906. Fade volume after time 10 with an annihilation period of 5 seconds:
  3907. @example
  3908. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3909. @end example
  3910. @end itemize
  3911. @section volumedetect
  3912. Detect the volume of the input video.
  3913. The filter has no parameters. The input is not modified. Statistics about
  3914. the volume will be printed in the log when the input stream end is reached.
  3915. In particular it will show the mean volume (root mean square), maximum
  3916. volume (on a per-sample basis), and the beginning of a histogram of the
  3917. registered volume values (from the maximum value to a cumulated 1/1000 of
  3918. the samples).
  3919. All volumes are in decibels relative to the maximum PCM value.
  3920. @subsection Examples
  3921. Here is an excerpt of the output:
  3922. @example
  3923. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3924. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3925. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3926. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3927. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3928. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3929. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3930. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3931. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3932. @end example
  3933. It means that:
  3934. @itemize
  3935. @item
  3936. The mean square energy is approximately -27 dB, or 10^-2.7.
  3937. @item
  3938. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3939. @item
  3940. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3941. @end itemize
  3942. In other words, raising the volume by +4 dB does not cause any clipping,
  3943. raising it by +5 dB causes clipping for 6 samples, etc.
  3944. @c man end AUDIO FILTERS
  3945. @chapter Audio Sources
  3946. @c man begin AUDIO SOURCES
  3947. Below is a description of the currently available audio sources.
  3948. @section abuffer
  3949. Buffer audio frames, and make them available to the filter chain.
  3950. This source is mainly intended for a programmatic use, in particular
  3951. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3952. It accepts the following parameters:
  3953. @table @option
  3954. @item time_base
  3955. The timebase which will be used for timestamps of submitted frames. It must be
  3956. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3957. @item sample_rate
  3958. The sample rate of the incoming audio buffers.
  3959. @item sample_fmt
  3960. The sample format of the incoming audio buffers.
  3961. Either a sample format name or its corresponding integer representation from
  3962. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3963. @item channel_layout
  3964. The channel layout of the incoming audio buffers.
  3965. Either a channel layout name from channel_layout_map in
  3966. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3967. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3968. @item channels
  3969. The number of channels of the incoming audio buffers.
  3970. If both @var{channels} and @var{channel_layout} are specified, then they
  3971. must be consistent.
  3972. @end table
  3973. @subsection Examples
  3974. @example
  3975. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3976. @end example
  3977. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3978. Since the sample format with name "s16p" corresponds to the number
  3979. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3980. equivalent to:
  3981. @example
  3982. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3983. @end example
  3984. @section aevalsrc
  3985. Generate an audio signal specified by an expression.
  3986. This source accepts in input one or more expressions (one for each
  3987. channel), which are evaluated and used to generate a corresponding
  3988. audio signal.
  3989. This source accepts the following options:
  3990. @table @option
  3991. @item exprs
  3992. Set the '|'-separated expressions list for each separate channel. In case the
  3993. @option{channel_layout} option is not specified, the selected channel layout
  3994. depends on the number of provided expressions. Otherwise the last
  3995. specified expression is applied to the remaining output channels.
  3996. @item channel_layout, c
  3997. Set the channel layout. The number of channels in the specified layout
  3998. must be equal to the number of specified expressions.
  3999. @item duration, d
  4000. Set the minimum duration of the sourced audio. See
  4001. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4002. for the accepted syntax.
  4003. Note that the resulting duration may be greater than the specified
  4004. duration, as the generated audio is always cut at the end of a
  4005. complete frame.
  4006. If not specified, or the expressed duration is negative, the audio is
  4007. supposed to be generated forever.
  4008. @item nb_samples, n
  4009. Set the number of samples per channel per each output frame,
  4010. default to 1024.
  4011. @item sample_rate, s
  4012. Specify the sample rate, default to 44100.
  4013. @end table
  4014. Each expression in @var{exprs} can contain the following constants:
  4015. @table @option
  4016. @item n
  4017. number of the evaluated sample, starting from 0
  4018. @item t
  4019. time of the evaluated sample expressed in seconds, starting from 0
  4020. @item s
  4021. sample rate
  4022. @end table
  4023. @subsection Examples
  4024. @itemize
  4025. @item
  4026. Generate silence:
  4027. @example
  4028. aevalsrc=0
  4029. @end example
  4030. @item
  4031. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4032. 8000 Hz:
  4033. @example
  4034. aevalsrc="sin(440*2*PI*t):s=8000"
  4035. @end example
  4036. @item
  4037. Generate a two channels signal, specify the channel layout (Front
  4038. Center + Back Center) explicitly:
  4039. @example
  4040. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4041. @end example
  4042. @item
  4043. Generate white noise:
  4044. @example
  4045. aevalsrc="-2+random(0)"
  4046. @end example
  4047. @item
  4048. Generate an amplitude modulated signal:
  4049. @example
  4050. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4051. @end example
  4052. @item
  4053. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4054. @example
  4055. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4056. @end example
  4057. @end itemize
  4058. @section anullsrc
  4059. The null audio source, return unprocessed audio frames. It is mainly useful
  4060. as a template and to be employed in analysis / debugging tools, or as
  4061. the source for filters which ignore the input data (for example the sox
  4062. synth filter).
  4063. This source accepts the following options:
  4064. @table @option
  4065. @item channel_layout, cl
  4066. Specifies the channel layout, and can be either an integer or a string
  4067. representing a channel layout. The default value of @var{channel_layout}
  4068. is "stereo".
  4069. Check the channel_layout_map definition in
  4070. @file{libavutil/channel_layout.c} for the mapping between strings and
  4071. channel layout values.
  4072. @item sample_rate, r
  4073. Specifies the sample rate, and defaults to 44100.
  4074. @item nb_samples, n
  4075. Set the number of samples per requested frames.
  4076. @end table
  4077. @subsection Examples
  4078. @itemize
  4079. @item
  4080. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4081. @example
  4082. anullsrc=r=48000:cl=4
  4083. @end example
  4084. @item
  4085. Do the same operation with a more obvious syntax:
  4086. @example
  4087. anullsrc=r=48000:cl=mono
  4088. @end example
  4089. @end itemize
  4090. All the parameters need to be explicitly defined.
  4091. @section flite
  4092. Synthesize a voice utterance using the libflite library.
  4093. To enable compilation of this filter you need to configure FFmpeg with
  4094. @code{--enable-libflite}.
  4095. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4096. The filter accepts the following options:
  4097. @table @option
  4098. @item list_voices
  4099. If set to 1, list the names of the available voices and exit
  4100. immediately. Default value is 0.
  4101. @item nb_samples, n
  4102. Set the maximum number of samples per frame. Default value is 512.
  4103. @item textfile
  4104. Set the filename containing the text to speak.
  4105. @item text
  4106. Set the text to speak.
  4107. @item voice, v
  4108. Set the voice to use for the speech synthesis. Default value is
  4109. @code{kal}. See also the @var{list_voices} option.
  4110. @end table
  4111. @subsection Examples
  4112. @itemize
  4113. @item
  4114. Read from file @file{speech.txt}, and synthesize the text using the
  4115. standard flite voice:
  4116. @example
  4117. flite=textfile=speech.txt
  4118. @end example
  4119. @item
  4120. Read the specified text selecting the @code{slt} voice:
  4121. @example
  4122. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4123. @end example
  4124. @item
  4125. Input text to ffmpeg:
  4126. @example
  4127. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4128. @end example
  4129. @item
  4130. Make @file{ffplay} speak the specified text, using @code{flite} and
  4131. the @code{lavfi} device:
  4132. @example
  4133. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4134. @end example
  4135. @end itemize
  4136. For more information about libflite, check:
  4137. @url{http://www.festvox.org/flite/}
  4138. @section anoisesrc
  4139. Generate a noise audio signal.
  4140. The filter accepts the following options:
  4141. @table @option
  4142. @item sample_rate, r
  4143. Specify the sample rate. Default value is 48000 Hz.
  4144. @item amplitude, a
  4145. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4146. is 1.0.
  4147. @item duration, d
  4148. Specify the duration of the generated audio stream. Not specifying this option
  4149. results in noise with an infinite length.
  4150. @item color, colour, c
  4151. Specify the color of noise. Available noise colors are white, pink, brown,
  4152. blue and violet. Default color is white.
  4153. @item seed, s
  4154. Specify a value used to seed the PRNG.
  4155. @item nb_samples, n
  4156. Set the number of samples per each output frame, default is 1024.
  4157. @end table
  4158. @subsection Examples
  4159. @itemize
  4160. @item
  4161. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4162. @example
  4163. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4164. @end example
  4165. @end itemize
  4166. @section hilbert
  4167. Generate odd-tap Hilbert transform FIR coefficients.
  4168. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4169. the signal by 90 degrees.
  4170. This is used in many matrix coding schemes and for analytic signal generation.
  4171. The process is often written as a multiplication by i (or j), the imaginary unit.
  4172. The filter accepts the following options:
  4173. @table @option
  4174. @item sample_rate, s
  4175. Set sample rate, default is 44100.
  4176. @item taps, t
  4177. Set length of FIR filter, default is 22051.
  4178. @item nb_samples, n
  4179. Set number of samples per each frame.
  4180. @item win_func, w
  4181. Set window function to be used when generating FIR coefficients.
  4182. @end table
  4183. @section sinc
  4184. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4185. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4186. The filter accepts the following options:
  4187. @table @option
  4188. @item sample_rate, r
  4189. Set sample rate, default is 44100.
  4190. @item nb_samples, n
  4191. Set number of samples per each frame. Default is 1024.
  4192. @item hp
  4193. Set high-pass frequency. Default is 0.
  4194. @item lp
  4195. Set low-pass frequency. Default is 0.
  4196. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4197. is higher than 0 then filter will create band-pass filter coefficients,
  4198. otherwise band-reject filter coefficients.
  4199. @item phase
  4200. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4201. @item beta
  4202. Set Kaiser window beta.
  4203. @item att
  4204. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4205. @item round
  4206. Enable rounding, by default is disabled.
  4207. @item hptaps
  4208. Set number of taps for high-pass filter.
  4209. @item lptaps
  4210. Set number of taps for low-pass filter.
  4211. @end table
  4212. @section sine
  4213. Generate an audio signal made of a sine wave with amplitude 1/8.
  4214. The audio signal is bit-exact.
  4215. The filter accepts the following options:
  4216. @table @option
  4217. @item frequency, f
  4218. Set the carrier frequency. Default is 440 Hz.
  4219. @item beep_factor, b
  4220. Enable a periodic beep every second with frequency @var{beep_factor} times
  4221. the carrier frequency. Default is 0, meaning the beep is disabled.
  4222. @item sample_rate, r
  4223. Specify the sample rate, default is 44100.
  4224. @item duration, d
  4225. Specify the duration of the generated audio stream.
  4226. @item samples_per_frame
  4227. Set the number of samples per output frame.
  4228. The expression can contain the following constants:
  4229. @table @option
  4230. @item n
  4231. The (sequential) number of the output audio frame, starting from 0.
  4232. @item pts
  4233. The PTS (Presentation TimeStamp) of the output audio frame,
  4234. expressed in @var{TB} units.
  4235. @item t
  4236. The PTS of the output audio frame, expressed in seconds.
  4237. @item TB
  4238. The timebase of the output audio frames.
  4239. @end table
  4240. Default is @code{1024}.
  4241. @end table
  4242. @subsection Examples
  4243. @itemize
  4244. @item
  4245. Generate a simple 440 Hz sine wave:
  4246. @example
  4247. sine
  4248. @end example
  4249. @item
  4250. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4251. @example
  4252. sine=220:4:d=5
  4253. sine=f=220:b=4:d=5
  4254. sine=frequency=220:beep_factor=4:duration=5
  4255. @end example
  4256. @item
  4257. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4258. pattern:
  4259. @example
  4260. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4261. @end example
  4262. @end itemize
  4263. @c man end AUDIO SOURCES
  4264. @chapter Audio Sinks
  4265. @c man begin AUDIO SINKS
  4266. Below is a description of the currently available audio sinks.
  4267. @section abuffersink
  4268. Buffer audio frames, and make them available to the end of filter chain.
  4269. This sink is mainly intended for programmatic use, in particular
  4270. through the interface defined in @file{libavfilter/buffersink.h}
  4271. or the options system.
  4272. It accepts a pointer to an AVABufferSinkContext structure, which
  4273. defines the incoming buffers' formats, to be passed as the opaque
  4274. parameter to @code{avfilter_init_filter} for initialization.
  4275. @section anullsink
  4276. Null audio sink; do absolutely nothing with the input audio. It is
  4277. mainly useful as a template and for use in analysis / debugging
  4278. tools.
  4279. @c man end AUDIO SINKS
  4280. @chapter Video Filters
  4281. @c man begin VIDEO FILTERS
  4282. When you configure your FFmpeg build, you can disable any of the
  4283. existing filters using @code{--disable-filters}.
  4284. The configure output will show the video filters included in your
  4285. build.
  4286. Below is a description of the currently available video filters.
  4287. @section alphaextract
  4288. Extract the alpha component from the input as a grayscale video. This
  4289. is especially useful with the @var{alphamerge} filter.
  4290. @section alphamerge
  4291. Add or replace the alpha component of the primary input with the
  4292. grayscale value of a second input. This is intended for use with
  4293. @var{alphaextract} to allow the transmission or storage of frame
  4294. sequences that have alpha in a format that doesn't support an alpha
  4295. channel.
  4296. For example, to reconstruct full frames from a normal YUV-encoded video
  4297. and a separate video created with @var{alphaextract}, you might use:
  4298. @example
  4299. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4300. @end example
  4301. Since this filter is designed for reconstruction, it operates on frame
  4302. sequences without considering timestamps, and terminates when either
  4303. input reaches end of stream. This will cause problems if your encoding
  4304. pipeline drops frames. If you're trying to apply an image as an
  4305. overlay to a video stream, consider the @var{overlay} filter instead.
  4306. @section amplify
  4307. Amplify differences between current pixel and pixels of adjacent frames in
  4308. same pixel location.
  4309. This filter accepts the following options:
  4310. @table @option
  4311. @item radius
  4312. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4313. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4314. @item factor
  4315. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4316. @item threshold
  4317. Set threshold for difference amplification. Any differrence greater or equal to
  4318. this value will not alter source pixel. Default is 10.
  4319. Allowed range is from 0 to 65535.
  4320. @item low
  4321. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4322. This option controls maximum possible value that will decrease source pixel value.
  4323. @item high
  4324. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4325. This option controls maximum possible value that will increase source pixel value.
  4326. @item planes
  4327. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4328. @end table
  4329. @section ass
  4330. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4331. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4332. Substation Alpha) subtitles files.
  4333. This filter accepts the following option in addition to the common options from
  4334. the @ref{subtitles} filter:
  4335. @table @option
  4336. @item shaping
  4337. Set the shaping engine
  4338. Available values are:
  4339. @table @samp
  4340. @item auto
  4341. The default libass shaping engine, which is the best available.
  4342. @item simple
  4343. Fast, font-agnostic shaper that can do only substitutions
  4344. @item complex
  4345. Slower shaper using OpenType for substitutions and positioning
  4346. @end table
  4347. The default is @code{auto}.
  4348. @end table
  4349. @section atadenoise
  4350. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4351. The filter accepts the following options:
  4352. @table @option
  4353. @item 0a
  4354. Set threshold A for 1st plane. Default is 0.02.
  4355. Valid range is 0 to 0.3.
  4356. @item 0b
  4357. Set threshold B for 1st plane. Default is 0.04.
  4358. Valid range is 0 to 5.
  4359. @item 1a
  4360. Set threshold A for 2nd plane. Default is 0.02.
  4361. Valid range is 0 to 0.3.
  4362. @item 1b
  4363. Set threshold B for 2nd plane. Default is 0.04.
  4364. Valid range is 0 to 5.
  4365. @item 2a
  4366. Set threshold A for 3rd plane. Default is 0.02.
  4367. Valid range is 0 to 0.3.
  4368. @item 2b
  4369. Set threshold B for 3rd plane. Default is 0.04.
  4370. Valid range is 0 to 5.
  4371. Threshold A is designed to react on abrupt changes in the input signal and
  4372. threshold B is designed to react on continuous changes in the input signal.
  4373. @item s
  4374. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4375. number in range [5, 129].
  4376. @item p
  4377. Set what planes of frame filter will use for averaging. Default is all.
  4378. @end table
  4379. @section avgblur
  4380. Apply average blur filter.
  4381. The filter accepts the following options:
  4382. @table @option
  4383. @item sizeX
  4384. Set horizontal radius size.
  4385. @item planes
  4386. Set which planes to filter. By default all planes are filtered.
  4387. @item sizeY
  4388. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4389. Default is @code{0}.
  4390. @end table
  4391. @section bbox
  4392. Compute the bounding box for the non-black pixels in the input frame
  4393. luminance plane.
  4394. This filter computes the bounding box containing all the pixels with a
  4395. luminance value greater than the minimum allowed value.
  4396. The parameters describing the bounding box are printed on the filter
  4397. log.
  4398. The filter accepts the following option:
  4399. @table @option
  4400. @item min_val
  4401. Set the minimal luminance value. Default is @code{16}.
  4402. @end table
  4403. @section bitplanenoise
  4404. Show and measure bit plane noise.
  4405. The filter accepts the following options:
  4406. @table @option
  4407. @item bitplane
  4408. Set which plane to analyze. Default is @code{1}.
  4409. @item filter
  4410. Filter out noisy pixels from @code{bitplane} set above.
  4411. Default is disabled.
  4412. @end table
  4413. @section blackdetect
  4414. Detect video intervals that are (almost) completely black. Can be
  4415. useful to detect chapter transitions, commercials, or invalid
  4416. recordings. Output lines contains the time for the start, end and
  4417. duration of the detected black interval expressed in seconds.
  4418. In order to display the output lines, you need to set the loglevel at
  4419. least to the AV_LOG_INFO value.
  4420. The filter accepts the following options:
  4421. @table @option
  4422. @item black_min_duration, d
  4423. Set the minimum detected black duration expressed in seconds. It must
  4424. be a non-negative floating point number.
  4425. Default value is 2.0.
  4426. @item picture_black_ratio_th, pic_th
  4427. Set the threshold for considering a picture "black".
  4428. Express the minimum value for the ratio:
  4429. @example
  4430. @var{nb_black_pixels} / @var{nb_pixels}
  4431. @end example
  4432. for which a picture is considered black.
  4433. Default value is 0.98.
  4434. @item pixel_black_th, pix_th
  4435. Set the threshold for considering a pixel "black".
  4436. The threshold expresses the maximum pixel luminance value for which a
  4437. pixel is considered "black". The provided value is scaled according to
  4438. the following equation:
  4439. @example
  4440. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4441. @end example
  4442. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4443. the input video format, the range is [0-255] for YUV full-range
  4444. formats and [16-235] for YUV non full-range formats.
  4445. Default value is 0.10.
  4446. @end table
  4447. The following example sets the maximum pixel threshold to the minimum
  4448. value, and detects only black intervals of 2 or more seconds:
  4449. @example
  4450. blackdetect=d=2:pix_th=0.00
  4451. @end example
  4452. @section blackframe
  4453. Detect frames that are (almost) completely black. Can be useful to
  4454. detect chapter transitions or commercials. Output lines consist of
  4455. the frame number of the detected frame, the percentage of blackness,
  4456. the position in the file if known or -1 and the timestamp in seconds.
  4457. In order to display the output lines, you need to set the loglevel at
  4458. least to the AV_LOG_INFO value.
  4459. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4460. The value represents the percentage of pixels in the picture that
  4461. are below the threshold value.
  4462. It accepts the following parameters:
  4463. @table @option
  4464. @item amount
  4465. The percentage of the pixels that have to be below the threshold; it defaults to
  4466. @code{98}.
  4467. @item threshold, thresh
  4468. The threshold below which a pixel value is considered black; it defaults to
  4469. @code{32}.
  4470. @end table
  4471. @section blend, tblend
  4472. Blend two video frames into each other.
  4473. The @code{blend} filter takes two input streams and outputs one
  4474. stream, the first input is the "top" layer and second input is
  4475. "bottom" layer. By default, the output terminates when the longest input terminates.
  4476. The @code{tblend} (time blend) filter takes two consecutive frames
  4477. from one single stream, and outputs the result obtained by blending
  4478. the new frame on top of the old frame.
  4479. A description of the accepted options follows.
  4480. @table @option
  4481. @item c0_mode
  4482. @item c1_mode
  4483. @item c2_mode
  4484. @item c3_mode
  4485. @item all_mode
  4486. Set blend mode for specific pixel component or all pixel components in case
  4487. of @var{all_mode}. Default value is @code{normal}.
  4488. Available values for component modes are:
  4489. @table @samp
  4490. @item addition
  4491. @item grainmerge
  4492. @item and
  4493. @item average
  4494. @item burn
  4495. @item darken
  4496. @item difference
  4497. @item grainextract
  4498. @item divide
  4499. @item dodge
  4500. @item freeze
  4501. @item exclusion
  4502. @item extremity
  4503. @item glow
  4504. @item hardlight
  4505. @item hardmix
  4506. @item heat
  4507. @item lighten
  4508. @item linearlight
  4509. @item multiply
  4510. @item multiply128
  4511. @item negation
  4512. @item normal
  4513. @item or
  4514. @item overlay
  4515. @item phoenix
  4516. @item pinlight
  4517. @item reflect
  4518. @item screen
  4519. @item softlight
  4520. @item subtract
  4521. @item vividlight
  4522. @item xor
  4523. @end table
  4524. @item c0_opacity
  4525. @item c1_opacity
  4526. @item c2_opacity
  4527. @item c3_opacity
  4528. @item all_opacity
  4529. Set blend opacity for specific pixel component or all pixel components in case
  4530. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4531. @item c0_expr
  4532. @item c1_expr
  4533. @item c2_expr
  4534. @item c3_expr
  4535. @item all_expr
  4536. Set blend expression for specific pixel component or all pixel components in case
  4537. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4538. The expressions can use the following variables:
  4539. @table @option
  4540. @item N
  4541. The sequential number of the filtered frame, starting from @code{0}.
  4542. @item X
  4543. @item Y
  4544. the coordinates of the current sample
  4545. @item W
  4546. @item H
  4547. the width and height of currently filtered plane
  4548. @item SW
  4549. @item SH
  4550. Width and height scale for the plane being filtered. It is the
  4551. ratio between the dimensions of the current plane to the luma plane,
  4552. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4553. the luma plane and @code{0.5,0.5} for the chroma planes.
  4554. @item T
  4555. Time of the current frame, expressed in seconds.
  4556. @item TOP, A
  4557. Value of pixel component at current location for first video frame (top layer).
  4558. @item BOTTOM, B
  4559. Value of pixel component at current location for second video frame (bottom layer).
  4560. @end table
  4561. @end table
  4562. The @code{blend} filter also supports the @ref{framesync} options.
  4563. @subsection Examples
  4564. @itemize
  4565. @item
  4566. Apply transition from bottom layer to top layer in first 10 seconds:
  4567. @example
  4568. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4569. @end example
  4570. @item
  4571. Apply linear horizontal transition from top layer to bottom layer:
  4572. @example
  4573. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4574. @end example
  4575. @item
  4576. Apply 1x1 checkerboard effect:
  4577. @example
  4578. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4579. @end example
  4580. @item
  4581. Apply uncover left effect:
  4582. @example
  4583. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4584. @end example
  4585. @item
  4586. Apply uncover down effect:
  4587. @example
  4588. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4589. @end example
  4590. @item
  4591. Apply uncover up-left effect:
  4592. @example
  4593. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4594. @end example
  4595. @item
  4596. Split diagonally video and shows top and bottom layer on each side:
  4597. @example
  4598. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4599. @end example
  4600. @item
  4601. Display differences between the current and the previous frame:
  4602. @example
  4603. tblend=all_mode=grainextract
  4604. @end example
  4605. @end itemize
  4606. @section bm3d
  4607. Denoise frames using Block-Matching 3D algorithm.
  4608. The filter accepts the following options.
  4609. @table @option
  4610. @item sigma
  4611. Set denoising strength. Default value is 1.
  4612. Allowed range is from 0 to 999.9.
  4613. The denoising algorith is very sensitive to sigma, so adjust it
  4614. according to the source.
  4615. @item block
  4616. Set local patch size. This sets dimensions in 2D.
  4617. @item bstep
  4618. Set sliding step for processing blocks. Default value is 4.
  4619. Allowed range is from 1 to 64.
  4620. Smaller values allows processing more reference blocks and is slower.
  4621. @item group
  4622. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4623. When set to 1, no block matching is done. Larger values allows more blocks
  4624. in single group.
  4625. Allowed range is from 1 to 256.
  4626. @item range
  4627. Set radius for search block matching. Default is 9.
  4628. Allowed range is from 1 to INT32_MAX.
  4629. @item mstep
  4630. Set step between two search locations for block matching. Default is 1.
  4631. Allowed range is from 1 to 64. Smaller is slower.
  4632. @item thmse
  4633. Set threshold of mean square error for block matching. Valid range is 0 to
  4634. INT32_MAX.
  4635. @item hdthr
  4636. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4637. Larger values results in stronger hard-thresholding filtering in frequency
  4638. domain.
  4639. @item estim
  4640. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4641. Default is @code{basic}.
  4642. @item ref
  4643. If enabled, filter will use 2nd stream for block matching.
  4644. Default is disabled for @code{basic} value of @var{estim} option,
  4645. and always enabled if value of @var{estim} is @code{final}.
  4646. @item planes
  4647. Set planes to filter. Default is all available except alpha.
  4648. @end table
  4649. @subsection Examples
  4650. @itemize
  4651. @item
  4652. Basic filtering with bm3d:
  4653. @example
  4654. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4655. @end example
  4656. @item
  4657. Same as above, but filtering only luma:
  4658. @example
  4659. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4660. @end example
  4661. @item
  4662. Same as above, but with both estimation modes:
  4663. @example
  4664. 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
  4665. @end example
  4666. @item
  4667. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4668. @example
  4669. 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
  4670. @end example
  4671. @end itemize
  4672. @section boxblur
  4673. Apply a boxblur algorithm to the input video.
  4674. It accepts the following parameters:
  4675. @table @option
  4676. @item luma_radius, lr
  4677. @item luma_power, lp
  4678. @item chroma_radius, cr
  4679. @item chroma_power, cp
  4680. @item alpha_radius, ar
  4681. @item alpha_power, ap
  4682. @end table
  4683. A description of the accepted options follows.
  4684. @table @option
  4685. @item luma_radius, lr
  4686. @item chroma_radius, cr
  4687. @item alpha_radius, ar
  4688. Set an expression for the box radius in pixels used for blurring the
  4689. corresponding input plane.
  4690. The radius value must be a non-negative number, and must not be
  4691. greater than the value of the expression @code{min(w,h)/2} for the
  4692. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4693. planes.
  4694. Default value for @option{luma_radius} is "2". If not specified,
  4695. @option{chroma_radius} and @option{alpha_radius} default to the
  4696. corresponding value set for @option{luma_radius}.
  4697. The expressions can contain the following constants:
  4698. @table @option
  4699. @item w
  4700. @item h
  4701. The input width and height in pixels.
  4702. @item cw
  4703. @item ch
  4704. The input chroma image width and height in pixels.
  4705. @item hsub
  4706. @item vsub
  4707. The horizontal and vertical chroma subsample values. For example, for the
  4708. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4709. @end table
  4710. @item luma_power, lp
  4711. @item chroma_power, cp
  4712. @item alpha_power, ap
  4713. Specify how many times the boxblur filter is applied to the
  4714. corresponding plane.
  4715. Default value for @option{luma_power} is 2. If not specified,
  4716. @option{chroma_power} and @option{alpha_power} default to the
  4717. corresponding value set for @option{luma_power}.
  4718. A value of 0 will disable the effect.
  4719. @end table
  4720. @subsection Examples
  4721. @itemize
  4722. @item
  4723. Apply a boxblur filter with the luma, chroma, and alpha radii
  4724. set to 2:
  4725. @example
  4726. boxblur=luma_radius=2:luma_power=1
  4727. boxblur=2:1
  4728. @end example
  4729. @item
  4730. Set the luma radius to 2, and alpha and chroma radius to 0:
  4731. @example
  4732. boxblur=2:1:cr=0:ar=0
  4733. @end example
  4734. @item
  4735. Set the luma and chroma radii to a fraction of the video dimension:
  4736. @example
  4737. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4738. @end example
  4739. @end itemize
  4740. @section bwdif
  4741. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4742. Deinterlacing Filter").
  4743. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4744. interpolation algorithms.
  4745. It accepts the following parameters:
  4746. @table @option
  4747. @item mode
  4748. The interlacing mode to adopt. It accepts one of the following values:
  4749. @table @option
  4750. @item 0, send_frame
  4751. Output one frame for each frame.
  4752. @item 1, send_field
  4753. Output one frame for each field.
  4754. @end table
  4755. The default value is @code{send_field}.
  4756. @item parity
  4757. The picture field parity assumed for the input interlaced video. It accepts one
  4758. of the following values:
  4759. @table @option
  4760. @item 0, tff
  4761. Assume the top field is first.
  4762. @item 1, bff
  4763. Assume the bottom field is first.
  4764. @item -1, auto
  4765. Enable automatic detection of field parity.
  4766. @end table
  4767. The default value is @code{auto}.
  4768. If the interlacing is unknown or the decoder does not export this information,
  4769. top field first will be assumed.
  4770. @item deint
  4771. Specify which frames to deinterlace. Accept one of the following
  4772. values:
  4773. @table @option
  4774. @item 0, all
  4775. Deinterlace all frames.
  4776. @item 1, interlaced
  4777. Only deinterlace frames marked as interlaced.
  4778. @end table
  4779. The default value is @code{all}.
  4780. @end table
  4781. @section chromahold
  4782. Remove all color information for all colors except for certain one.
  4783. The filter accepts the following options:
  4784. @table @option
  4785. @item color
  4786. The color which will not be replaced with neutral chroma.
  4787. @item similarity
  4788. Similarity percentage with the above color.
  4789. 0.01 matches only the exact key color, while 1.0 matches everything.
  4790. @item yuv
  4791. Signals that the color passed is already in YUV instead of RGB.
  4792. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4793. This can be used to pass exact YUV values as hexadecimal numbers.
  4794. @end table
  4795. @section chromakey
  4796. YUV colorspace color/chroma keying.
  4797. The filter accepts the following options:
  4798. @table @option
  4799. @item color
  4800. The color which will be replaced with transparency.
  4801. @item similarity
  4802. Similarity percentage with the key color.
  4803. 0.01 matches only the exact key color, while 1.0 matches everything.
  4804. @item blend
  4805. Blend percentage.
  4806. 0.0 makes pixels either fully transparent, or not transparent at all.
  4807. Higher values result in semi-transparent pixels, with a higher transparency
  4808. the more similar the pixels color is to the key color.
  4809. @item yuv
  4810. Signals that the color passed is already in YUV instead of RGB.
  4811. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4812. This can be used to pass exact YUV values as hexadecimal numbers.
  4813. @end table
  4814. @subsection Examples
  4815. @itemize
  4816. @item
  4817. Make every green pixel in the input image transparent:
  4818. @example
  4819. ffmpeg -i input.png -vf chromakey=green out.png
  4820. @end example
  4821. @item
  4822. Overlay a greenscreen-video on top of a static black background.
  4823. @example
  4824. 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
  4825. @end example
  4826. @end itemize
  4827. @section ciescope
  4828. Display CIE color diagram with pixels overlaid onto it.
  4829. The filter accepts the following options:
  4830. @table @option
  4831. @item system
  4832. Set color system.
  4833. @table @samp
  4834. @item ntsc, 470m
  4835. @item ebu, 470bg
  4836. @item smpte
  4837. @item 240m
  4838. @item apple
  4839. @item widergb
  4840. @item cie1931
  4841. @item rec709, hdtv
  4842. @item uhdtv, rec2020
  4843. @end table
  4844. @item cie
  4845. Set CIE system.
  4846. @table @samp
  4847. @item xyy
  4848. @item ucs
  4849. @item luv
  4850. @end table
  4851. @item gamuts
  4852. Set what gamuts to draw.
  4853. See @code{system} option for available values.
  4854. @item size, s
  4855. Set ciescope size, by default set to 512.
  4856. @item intensity, i
  4857. Set intensity used to map input pixel values to CIE diagram.
  4858. @item contrast
  4859. Set contrast used to draw tongue colors that are out of active color system gamut.
  4860. @item corrgamma
  4861. Correct gamma displayed on scope, by default enabled.
  4862. @item showwhite
  4863. Show white point on CIE diagram, by default disabled.
  4864. @item gamma
  4865. Set input gamma. Used only with XYZ input color space.
  4866. @end table
  4867. @section codecview
  4868. Visualize information exported by some codecs.
  4869. Some codecs can export information through frames using side-data or other
  4870. means. For example, some MPEG based codecs export motion vectors through the
  4871. @var{export_mvs} flag in the codec @option{flags2} option.
  4872. The filter accepts the following option:
  4873. @table @option
  4874. @item mv
  4875. Set motion vectors to visualize.
  4876. Available flags for @var{mv} are:
  4877. @table @samp
  4878. @item pf
  4879. forward predicted MVs of P-frames
  4880. @item bf
  4881. forward predicted MVs of B-frames
  4882. @item bb
  4883. backward predicted MVs of B-frames
  4884. @end table
  4885. @item qp
  4886. Display quantization parameters using the chroma planes.
  4887. @item mv_type, mvt
  4888. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4889. Available flags for @var{mv_type} are:
  4890. @table @samp
  4891. @item fp
  4892. forward predicted MVs
  4893. @item bp
  4894. backward predicted MVs
  4895. @end table
  4896. @item frame_type, ft
  4897. Set frame type to visualize motion vectors of.
  4898. Available flags for @var{frame_type} are:
  4899. @table @samp
  4900. @item if
  4901. intra-coded frames (I-frames)
  4902. @item pf
  4903. predicted frames (P-frames)
  4904. @item bf
  4905. bi-directionally predicted frames (B-frames)
  4906. @end table
  4907. @end table
  4908. @subsection Examples
  4909. @itemize
  4910. @item
  4911. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4912. @example
  4913. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4914. @end example
  4915. @item
  4916. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4917. @example
  4918. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4919. @end example
  4920. @end itemize
  4921. @section colorbalance
  4922. Modify intensity of primary colors (red, green and blue) of input frames.
  4923. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4924. regions for the red-cyan, green-magenta or blue-yellow balance.
  4925. A positive adjustment value shifts the balance towards the primary color, a negative
  4926. value towards the complementary color.
  4927. The filter accepts the following options:
  4928. @table @option
  4929. @item rs
  4930. @item gs
  4931. @item bs
  4932. Adjust red, green and blue shadows (darkest pixels).
  4933. @item rm
  4934. @item gm
  4935. @item bm
  4936. Adjust red, green and blue midtones (medium pixels).
  4937. @item rh
  4938. @item gh
  4939. @item bh
  4940. Adjust red, green and blue highlights (brightest pixels).
  4941. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4942. @end table
  4943. @subsection Examples
  4944. @itemize
  4945. @item
  4946. Add red color cast to shadows:
  4947. @example
  4948. colorbalance=rs=.3
  4949. @end example
  4950. @end itemize
  4951. @section colorkey
  4952. RGB colorspace color keying.
  4953. The filter accepts the following options:
  4954. @table @option
  4955. @item color
  4956. The color which will be replaced with transparency.
  4957. @item similarity
  4958. Similarity percentage with the key color.
  4959. 0.01 matches only the exact key color, while 1.0 matches everything.
  4960. @item blend
  4961. Blend percentage.
  4962. 0.0 makes pixels either fully transparent, or not transparent at all.
  4963. Higher values result in semi-transparent pixels, with a higher transparency
  4964. the more similar the pixels color is to the key color.
  4965. @end table
  4966. @subsection Examples
  4967. @itemize
  4968. @item
  4969. Make every green pixel in the input image transparent:
  4970. @example
  4971. ffmpeg -i input.png -vf colorkey=green out.png
  4972. @end example
  4973. @item
  4974. Overlay a greenscreen-video on top of a static background image.
  4975. @example
  4976. 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
  4977. @end example
  4978. @end itemize
  4979. @section colorlevels
  4980. Adjust video input frames using levels.
  4981. The filter accepts the following options:
  4982. @table @option
  4983. @item rimin
  4984. @item gimin
  4985. @item bimin
  4986. @item aimin
  4987. Adjust red, green, blue and alpha input black point.
  4988. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4989. @item rimax
  4990. @item gimax
  4991. @item bimax
  4992. @item aimax
  4993. Adjust red, green, blue and alpha input white point.
  4994. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4995. Input levels are used to lighten highlights (bright tones), darken shadows
  4996. (dark tones), change the balance of bright and dark tones.
  4997. @item romin
  4998. @item gomin
  4999. @item bomin
  5000. @item aomin
  5001. Adjust red, green, blue and alpha output black point.
  5002. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5003. @item romax
  5004. @item gomax
  5005. @item bomax
  5006. @item aomax
  5007. Adjust red, green, blue and alpha output white point.
  5008. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5009. Output levels allows manual selection of a constrained output level range.
  5010. @end table
  5011. @subsection Examples
  5012. @itemize
  5013. @item
  5014. Make video output darker:
  5015. @example
  5016. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5017. @end example
  5018. @item
  5019. Increase contrast:
  5020. @example
  5021. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5022. @end example
  5023. @item
  5024. Make video output lighter:
  5025. @example
  5026. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5027. @end example
  5028. @item
  5029. Increase brightness:
  5030. @example
  5031. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5032. @end example
  5033. @end itemize
  5034. @section colorchannelmixer
  5035. Adjust video input frames by re-mixing color channels.
  5036. This filter modifies a color channel by adding the values associated to
  5037. the other channels of the same pixels. For example if the value to
  5038. modify is red, the output value will be:
  5039. @example
  5040. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5041. @end example
  5042. The filter accepts the following options:
  5043. @table @option
  5044. @item rr
  5045. @item rg
  5046. @item rb
  5047. @item ra
  5048. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5049. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5050. @item gr
  5051. @item gg
  5052. @item gb
  5053. @item ga
  5054. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5055. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5056. @item br
  5057. @item bg
  5058. @item bb
  5059. @item ba
  5060. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5061. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5062. @item ar
  5063. @item ag
  5064. @item ab
  5065. @item aa
  5066. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5067. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5068. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5069. @end table
  5070. @subsection Examples
  5071. @itemize
  5072. @item
  5073. Convert source to grayscale:
  5074. @example
  5075. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5076. @end example
  5077. @item
  5078. Simulate sepia tones:
  5079. @example
  5080. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5081. @end example
  5082. @end itemize
  5083. @section colormatrix
  5084. Convert color matrix.
  5085. The filter accepts the following options:
  5086. @table @option
  5087. @item src
  5088. @item dst
  5089. Specify the source and destination color matrix. Both values must be
  5090. specified.
  5091. The accepted values are:
  5092. @table @samp
  5093. @item bt709
  5094. BT.709
  5095. @item fcc
  5096. FCC
  5097. @item bt601
  5098. BT.601
  5099. @item bt470
  5100. BT.470
  5101. @item bt470bg
  5102. BT.470BG
  5103. @item smpte170m
  5104. SMPTE-170M
  5105. @item smpte240m
  5106. SMPTE-240M
  5107. @item bt2020
  5108. BT.2020
  5109. @end table
  5110. @end table
  5111. For example to convert from BT.601 to SMPTE-240M, use the command:
  5112. @example
  5113. colormatrix=bt601:smpte240m
  5114. @end example
  5115. @section colorspace
  5116. Convert colorspace, transfer characteristics or color primaries.
  5117. Input video needs to have an even size.
  5118. The filter accepts the following options:
  5119. @table @option
  5120. @anchor{all}
  5121. @item all
  5122. Specify all color properties at once.
  5123. The accepted values are:
  5124. @table @samp
  5125. @item bt470m
  5126. BT.470M
  5127. @item bt470bg
  5128. BT.470BG
  5129. @item bt601-6-525
  5130. BT.601-6 525
  5131. @item bt601-6-625
  5132. BT.601-6 625
  5133. @item bt709
  5134. BT.709
  5135. @item smpte170m
  5136. SMPTE-170M
  5137. @item smpte240m
  5138. SMPTE-240M
  5139. @item bt2020
  5140. BT.2020
  5141. @end table
  5142. @anchor{space}
  5143. @item space
  5144. Specify output colorspace.
  5145. The accepted values are:
  5146. @table @samp
  5147. @item bt709
  5148. BT.709
  5149. @item fcc
  5150. FCC
  5151. @item bt470bg
  5152. BT.470BG or BT.601-6 625
  5153. @item smpte170m
  5154. SMPTE-170M or BT.601-6 525
  5155. @item smpte240m
  5156. SMPTE-240M
  5157. @item ycgco
  5158. YCgCo
  5159. @item bt2020ncl
  5160. BT.2020 with non-constant luminance
  5161. @end table
  5162. @anchor{trc}
  5163. @item trc
  5164. Specify output transfer characteristics.
  5165. The accepted values are:
  5166. @table @samp
  5167. @item bt709
  5168. BT.709
  5169. @item bt470m
  5170. BT.470M
  5171. @item bt470bg
  5172. BT.470BG
  5173. @item gamma22
  5174. Constant gamma of 2.2
  5175. @item gamma28
  5176. Constant gamma of 2.8
  5177. @item smpte170m
  5178. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5179. @item smpte240m
  5180. SMPTE-240M
  5181. @item srgb
  5182. SRGB
  5183. @item iec61966-2-1
  5184. iec61966-2-1
  5185. @item iec61966-2-4
  5186. iec61966-2-4
  5187. @item xvycc
  5188. xvycc
  5189. @item bt2020-10
  5190. BT.2020 for 10-bits content
  5191. @item bt2020-12
  5192. BT.2020 for 12-bits content
  5193. @end table
  5194. @anchor{primaries}
  5195. @item primaries
  5196. Specify output color primaries.
  5197. The accepted values are:
  5198. @table @samp
  5199. @item bt709
  5200. BT.709
  5201. @item bt470m
  5202. BT.470M
  5203. @item bt470bg
  5204. BT.470BG or BT.601-6 625
  5205. @item smpte170m
  5206. SMPTE-170M or BT.601-6 525
  5207. @item smpte240m
  5208. SMPTE-240M
  5209. @item film
  5210. film
  5211. @item smpte431
  5212. SMPTE-431
  5213. @item smpte432
  5214. SMPTE-432
  5215. @item bt2020
  5216. BT.2020
  5217. @item jedec-p22
  5218. JEDEC P22 phosphors
  5219. @end table
  5220. @anchor{range}
  5221. @item range
  5222. Specify output color range.
  5223. The accepted values are:
  5224. @table @samp
  5225. @item tv
  5226. TV (restricted) range
  5227. @item mpeg
  5228. MPEG (restricted) range
  5229. @item pc
  5230. PC (full) range
  5231. @item jpeg
  5232. JPEG (full) range
  5233. @end table
  5234. @item format
  5235. Specify output color format.
  5236. The accepted values are:
  5237. @table @samp
  5238. @item yuv420p
  5239. YUV 4:2:0 planar 8-bits
  5240. @item yuv420p10
  5241. YUV 4:2:0 planar 10-bits
  5242. @item yuv420p12
  5243. YUV 4:2:0 planar 12-bits
  5244. @item yuv422p
  5245. YUV 4:2:2 planar 8-bits
  5246. @item yuv422p10
  5247. YUV 4:2:2 planar 10-bits
  5248. @item yuv422p12
  5249. YUV 4:2:2 planar 12-bits
  5250. @item yuv444p
  5251. YUV 4:4:4 planar 8-bits
  5252. @item yuv444p10
  5253. YUV 4:4:4 planar 10-bits
  5254. @item yuv444p12
  5255. YUV 4:4:4 planar 12-bits
  5256. @end table
  5257. @item fast
  5258. Do a fast conversion, which skips gamma/primary correction. This will take
  5259. significantly less CPU, but will be mathematically incorrect. To get output
  5260. compatible with that produced by the colormatrix filter, use fast=1.
  5261. @item dither
  5262. Specify dithering mode.
  5263. The accepted values are:
  5264. @table @samp
  5265. @item none
  5266. No dithering
  5267. @item fsb
  5268. Floyd-Steinberg dithering
  5269. @end table
  5270. @item wpadapt
  5271. Whitepoint adaptation mode.
  5272. The accepted values are:
  5273. @table @samp
  5274. @item bradford
  5275. Bradford whitepoint adaptation
  5276. @item vonkries
  5277. von Kries whitepoint adaptation
  5278. @item identity
  5279. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5280. @end table
  5281. @item iall
  5282. Override all input properties at once. Same accepted values as @ref{all}.
  5283. @item ispace
  5284. Override input colorspace. Same accepted values as @ref{space}.
  5285. @item iprimaries
  5286. Override input color primaries. Same accepted values as @ref{primaries}.
  5287. @item itrc
  5288. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5289. @item irange
  5290. Override input color range. Same accepted values as @ref{range}.
  5291. @end table
  5292. The filter converts the transfer characteristics, color space and color
  5293. primaries to the specified user values. The output value, if not specified,
  5294. is set to a default value based on the "all" property. If that property is
  5295. also not specified, the filter will log an error. The output color range and
  5296. format default to the same value as the input color range and format. The
  5297. input transfer characteristics, color space, color primaries and color range
  5298. should be set on the input data. If any of these are missing, the filter will
  5299. log an error and no conversion will take place.
  5300. For example to convert the input to SMPTE-240M, use the command:
  5301. @example
  5302. colorspace=smpte240m
  5303. @end example
  5304. @section convolution
  5305. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5306. The filter accepts the following options:
  5307. @table @option
  5308. @item 0m
  5309. @item 1m
  5310. @item 2m
  5311. @item 3m
  5312. Set matrix for each plane.
  5313. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5314. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5315. @item 0rdiv
  5316. @item 1rdiv
  5317. @item 2rdiv
  5318. @item 3rdiv
  5319. Set multiplier for calculated value for each plane.
  5320. If unset or 0, it will be sum of all matrix elements.
  5321. @item 0bias
  5322. @item 1bias
  5323. @item 2bias
  5324. @item 3bias
  5325. Set bias for each plane. This value is added to the result of the multiplication.
  5326. Useful for making the overall image brighter or darker. Default is 0.0.
  5327. @item 0mode
  5328. @item 1mode
  5329. @item 2mode
  5330. @item 3mode
  5331. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5332. Default is @var{square}.
  5333. @end table
  5334. @subsection Examples
  5335. @itemize
  5336. @item
  5337. Apply sharpen:
  5338. @example
  5339. 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"
  5340. @end example
  5341. @item
  5342. Apply blur:
  5343. @example
  5344. 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"
  5345. @end example
  5346. @item
  5347. Apply edge enhance:
  5348. @example
  5349. 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"
  5350. @end example
  5351. @item
  5352. Apply edge detect:
  5353. @example
  5354. 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"
  5355. @end example
  5356. @item
  5357. Apply laplacian edge detector which includes diagonals:
  5358. @example
  5359. 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"
  5360. @end example
  5361. @item
  5362. Apply emboss:
  5363. @example
  5364. 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"
  5365. @end example
  5366. @end itemize
  5367. @section convolve
  5368. Apply 2D convolution of video stream in frequency domain using second stream
  5369. as impulse.
  5370. The filter accepts the following options:
  5371. @table @option
  5372. @item planes
  5373. Set which planes to process.
  5374. @item impulse
  5375. Set which impulse video frames will be processed, can be @var{first}
  5376. or @var{all}. Default is @var{all}.
  5377. @end table
  5378. The @code{convolve} filter also supports the @ref{framesync} options.
  5379. @section copy
  5380. Copy the input video source unchanged to the output. This is mainly useful for
  5381. testing purposes.
  5382. @anchor{coreimage}
  5383. @section coreimage
  5384. Video filtering on GPU using Apple's CoreImage API on OSX.
  5385. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5386. processed by video hardware. However, software-based OpenGL implementations
  5387. exist which means there is no guarantee for hardware processing. It depends on
  5388. the respective OSX.
  5389. There are many filters and image generators provided by Apple that come with a
  5390. large variety of options. The filter has to be referenced by its name along
  5391. with its options.
  5392. The coreimage filter accepts the following options:
  5393. @table @option
  5394. @item list_filters
  5395. List all available filters and generators along with all their respective
  5396. options as well as possible minimum and maximum values along with the default
  5397. values.
  5398. @example
  5399. list_filters=true
  5400. @end example
  5401. @item filter
  5402. Specify all filters by their respective name and options.
  5403. Use @var{list_filters} to determine all valid filter names and options.
  5404. Numerical options are specified by a float value and are automatically clamped
  5405. to their respective value range. Vector and color options have to be specified
  5406. by a list of space separated float values. Character escaping has to be done.
  5407. A special option name @code{default} is available to use default options for a
  5408. filter.
  5409. It is required to specify either @code{default} or at least one of the filter options.
  5410. All omitted options are used with their default values.
  5411. The syntax of the filter string is as follows:
  5412. @example
  5413. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5414. @end example
  5415. @item output_rect
  5416. Specify a rectangle where the output of the filter chain is copied into the
  5417. input image. It is given by a list of space separated float values:
  5418. @example
  5419. output_rect=x\ y\ width\ height
  5420. @end example
  5421. If not given, the output rectangle equals the dimensions of the input image.
  5422. The output rectangle is automatically cropped at the borders of the input
  5423. image. Negative values are valid for each component.
  5424. @example
  5425. output_rect=25\ 25\ 100\ 100
  5426. @end example
  5427. @end table
  5428. Several filters can be chained for successive processing without GPU-HOST
  5429. transfers allowing for fast processing of complex filter chains.
  5430. Currently, only filters with zero (generators) or exactly one (filters) input
  5431. image and one output image are supported. Also, transition filters are not yet
  5432. usable as intended.
  5433. Some filters generate output images with additional padding depending on the
  5434. respective filter kernel. The padding is automatically removed to ensure the
  5435. filter output has the same size as the input image.
  5436. For image generators, the size of the output image is determined by the
  5437. previous output image of the filter chain or the input image of the whole
  5438. filterchain, respectively. The generators do not use the pixel information of
  5439. this image to generate their output. However, the generated output is
  5440. blended onto this image, resulting in partial or complete coverage of the
  5441. output image.
  5442. The @ref{coreimagesrc} video source can be used for generating input images
  5443. which are directly fed into the filter chain. By using it, providing input
  5444. images by another video source or an input video is not required.
  5445. @subsection Examples
  5446. @itemize
  5447. @item
  5448. List all filters available:
  5449. @example
  5450. coreimage=list_filters=true
  5451. @end example
  5452. @item
  5453. Use the CIBoxBlur filter with default options to blur an image:
  5454. @example
  5455. coreimage=filter=CIBoxBlur@@default
  5456. @end example
  5457. @item
  5458. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5459. its center at 100x100 and a radius of 50 pixels:
  5460. @example
  5461. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5462. @end example
  5463. @item
  5464. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5465. given as complete and escaped command-line for Apple's standard bash shell:
  5466. @example
  5467. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5468. @end example
  5469. @end itemize
  5470. @section crop
  5471. Crop the input video to given dimensions.
  5472. It accepts the following parameters:
  5473. @table @option
  5474. @item w, out_w
  5475. The width of the output video. It defaults to @code{iw}.
  5476. This expression is evaluated only once during the filter
  5477. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5478. @item h, out_h
  5479. The height of the output video. It defaults to @code{ih}.
  5480. This expression is evaluated only once during the filter
  5481. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5482. @item x
  5483. The horizontal position, in the input video, of the left edge of the output
  5484. video. It defaults to @code{(in_w-out_w)/2}.
  5485. This expression is evaluated per-frame.
  5486. @item y
  5487. The vertical position, in the input video, of the top edge of the output video.
  5488. It defaults to @code{(in_h-out_h)/2}.
  5489. This expression is evaluated per-frame.
  5490. @item keep_aspect
  5491. If set to 1 will force the output display aspect ratio
  5492. to be the same of the input, by changing the output sample aspect
  5493. ratio. It defaults to 0.
  5494. @item exact
  5495. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5496. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5497. It defaults to 0.
  5498. @end table
  5499. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5500. expressions containing the following constants:
  5501. @table @option
  5502. @item x
  5503. @item y
  5504. The computed values for @var{x} and @var{y}. They are evaluated for
  5505. each new frame.
  5506. @item in_w
  5507. @item in_h
  5508. The input width and height.
  5509. @item iw
  5510. @item ih
  5511. These are the same as @var{in_w} and @var{in_h}.
  5512. @item out_w
  5513. @item out_h
  5514. The output (cropped) width and height.
  5515. @item ow
  5516. @item oh
  5517. These are the same as @var{out_w} and @var{out_h}.
  5518. @item a
  5519. same as @var{iw} / @var{ih}
  5520. @item sar
  5521. input sample aspect ratio
  5522. @item dar
  5523. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5524. @item hsub
  5525. @item vsub
  5526. horizontal and vertical chroma subsample values. For example for the
  5527. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5528. @item n
  5529. The number of the input frame, starting from 0.
  5530. @item pos
  5531. the position in the file of the input frame, NAN if unknown
  5532. @item t
  5533. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5534. @end table
  5535. The expression for @var{out_w} may depend on the value of @var{out_h},
  5536. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5537. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5538. evaluated after @var{out_w} and @var{out_h}.
  5539. The @var{x} and @var{y} parameters specify the expressions for the
  5540. position of the top-left corner of the output (non-cropped) area. They
  5541. are evaluated for each frame. If the evaluated value is not valid, it
  5542. is approximated to the nearest valid value.
  5543. The expression for @var{x} may depend on @var{y}, and the expression
  5544. for @var{y} may depend on @var{x}.
  5545. @subsection Examples
  5546. @itemize
  5547. @item
  5548. Crop area with size 100x100 at position (12,34).
  5549. @example
  5550. crop=100:100:12:34
  5551. @end example
  5552. Using named options, the example above becomes:
  5553. @example
  5554. crop=w=100:h=100:x=12:y=34
  5555. @end example
  5556. @item
  5557. Crop the central input area with size 100x100:
  5558. @example
  5559. crop=100:100
  5560. @end example
  5561. @item
  5562. Crop the central input area with size 2/3 of the input video:
  5563. @example
  5564. crop=2/3*in_w:2/3*in_h
  5565. @end example
  5566. @item
  5567. Crop the input video central square:
  5568. @example
  5569. crop=out_w=in_h
  5570. crop=in_h
  5571. @end example
  5572. @item
  5573. Delimit the rectangle with the top-left corner placed at position
  5574. 100:100 and the right-bottom corner corresponding to the right-bottom
  5575. corner of the input image.
  5576. @example
  5577. crop=in_w-100:in_h-100:100:100
  5578. @end example
  5579. @item
  5580. Crop 10 pixels from the left and right borders, and 20 pixels from
  5581. the top and bottom borders
  5582. @example
  5583. crop=in_w-2*10:in_h-2*20
  5584. @end example
  5585. @item
  5586. Keep only the bottom right quarter of the input image:
  5587. @example
  5588. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5589. @end example
  5590. @item
  5591. Crop height for getting Greek harmony:
  5592. @example
  5593. crop=in_w:1/PHI*in_w
  5594. @end example
  5595. @item
  5596. Apply trembling effect:
  5597. @example
  5598. 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)
  5599. @end example
  5600. @item
  5601. Apply erratic camera effect depending on timestamp:
  5602. @example
  5603. 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)"
  5604. @end example
  5605. @item
  5606. Set x depending on the value of y:
  5607. @example
  5608. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5609. @end example
  5610. @end itemize
  5611. @subsection Commands
  5612. This filter supports the following commands:
  5613. @table @option
  5614. @item w, out_w
  5615. @item h, out_h
  5616. @item x
  5617. @item y
  5618. Set width/height of the output video and the horizontal/vertical position
  5619. in the input video.
  5620. The command accepts the same syntax of the corresponding option.
  5621. If the specified expression is not valid, it is kept at its current
  5622. value.
  5623. @end table
  5624. @section cropdetect
  5625. Auto-detect the crop size.
  5626. It calculates the necessary cropping parameters and prints the
  5627. recommended parameters via the logging system. The detected dimensions
  5628. correspond to the non-black area of the input video.
  5629. It accepts the following parameters:
  5630. @table @option
  5631. @item limit
  5632. Set higher black value threshold, which can be optionally specified
  5633. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5634. value greater to the set value is considered non-black. It defaults to 24.
  5635. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5636. on the bitdepth of the pixel format.
  5637. @item round
  5638. The value which the width/height should be divisible by. It defaults to
  5639. 16. The offset is automatically adjusted to center the video. Use 2 to
  5640. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5641. encoding to most video codecs.
  5642. @item reset_count, reset
  5643. Set the counter that determines after how many frames cropdetect will
  5644. reset the previously detected largest video area and start over to
  5645. detect the current optimal crop area. Default value is 0.
  5646. This can be useful when channel logos distort the video area. 0
  5647. indicates 'never reset', and returns the largest area encountered during
  5648. playback.
  5649. @end table
  5650. @anchor{cue}
  5651. @section cue
  5652. Delay video filtering until a given wallclock timestamp. The filter first
  5653. passes on @option{preroll} amount of frames, then it buffers at most
  5654. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5655. it forwards the buffered frames and also any subsequent frames coming in its
  5656. input.
  5657. The filter can be used synchronize the output of multiple ffmpeg processes for
  5658. realtime output devices like decklink. By putting the delay in the filtering
  5659. chain and pre-buffering frames the process can pass on data to output almost
  5660. immediately after the target wallclock timestamp is reached.
  5661. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5662. some use cases.
  5663. @table @option
  5664. @item cue
  5665. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5666. @item preroll
  5667. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5668. @item buffer
  5669. The maximum duration of content to buffer before waiting for the cue expressed
  5670. in seconds. Default is 0.
  5671. @end table
  5672. @anchor{curves}
  5673. @section curves
  5674. Apply color adjustments using curves.
  5675. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5676. component (red, green and blue) has its values defined by @var{N} key points
  5677. tied from each other using a smooth curve. The x-axis represents the pixel
  5678. values from the input frame, and the y-axis the new pixel values to be set for
  5679. the output frame.
  5680. By default, a component curve is defined by the two points @var{(0;0)} and
  5681. @var{(1;1)}. This creates a straight line where each original pixel value is
  5682. "adjusted" to its own value, which means no change to the image.
  5683. The filter allows you to redefine these two points and add some more. A new
  5684. curve (using a natural cubic spline interpolation) will be define to pass
  5685. smoothly through all these new coordinates. The new defined points needs to be
  5686. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5687. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5688. the vector spaces, the values will be clipped accordingly.
  5689. The filter accepts the following options:
  5690. @table @option
  5691. @item preset
  5692. Select one of the available color presets. This option can be used in addition
  5693. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5694. options takes priority on the preset values.
  5695. Available presets are:
  5696. @table @samp
  5697. @item none
  5698. @item color_negative
  5699. @item cross_process
  5700. @item darker
  5701. @item increase_contrast
  5702. @item lighter
  5703. @item linear_contrast
  5704. @item medium_contrast
  5705. @item negative
  5706. @item strong_contrast
  5707. @item vintage
  5708. @end table
  5709. Default is @code{none}.
  5710. @item master, m
  5711. Set the master key points. These points will define a second pass mapping. It
  5712. is sometimes called a "luminance" or "value" mapping. It can be used with
  5713. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5714. post-processing LUT.
  5715. @item red, r
  5716. Set the key points for the red component.
  5717. @item green, g
  5718. Set the key points for the green component.
  5719. @item blue, b
  5720. Set the key points for the blue component.
  5721. @item all
  5722. Set the key points for all components (not including master).
  5723. Can be used in addition to the other key points component
  5724. options. In this case, the unset component(s) will fallback on this
  5725. @option{all} setting.
  5726. @item psfile
  5727. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5728. @item plot
  5729. Save Gnuplot script of the curves in specified file.
  5730. @end table
  5731. To avoid some filtergraph syntax conflicts, each key points list need to be
  5732. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5733. @subsection Examples
  5734. @itemize
  5735. @item
  5736. Increase slightly the middle level of blue:
  5737. @example
  5738. curves=blue='0/0 0.5/0.58 1/1'
  5739. @end example
  5740. @item
  5741. Vintage effect:
  5742. @example
  5743. 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'
  5744. @end example
  5745. Here we obtain the following coordinates for each components:
  5746. @table @var
  5747. @item red
  5748. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5749. @item green
  5750. @code{(0;0) (0.50;0.48) (1;1)}
  5751. @item blue
  5752. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5753. @end table
  5754. @item
  5755. The previous example can also be achieved with the associated built-in preset:
  5756. @example
  5757. curves=preset=vintage
  5758. @end example
  5759. @item
  5760. Or simply:
  5761. @example
  5762. curves=vintage
  5763. @end example
  5764. @item
  5765. Use a Photoshop preset and redefine the points of the green component:
  5766. @example
  5767. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5768. @end example
  5769. @item
  5770. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5771. and @command{gnuplot}:
  5772. @example
  5773. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5774. gnuplot -p /tmp/curves.plt
  5775. @end example
  5776. @end itemize
  5777. @section datascope
  5778. Video data analysis filter.
  5779. This filter shows hexadecimal pixel values of part of video.
  5780. The filter accepts the following options:
  5781. @table @option
  5782. @item size, s
  5783. Set output video size.
  5784. @item x
  5785. Set x offset from where to pick pixels.
  5786. @item y
  5787. Set y offset from where to pick pixels.
  5788. @item mode
  5789. Set scope mode, can be one of the following:
  5790. @table @samp
  5791. @item mono
  5792. Draw hexadecimal pixel values with white color on black background.
  5793. @item color
  5794. Draw hexadecimal pixel values with input video pixel color on black
  5795. background.
  5796. @item color2
  5797. Draw hexadecimal pixel values on color background picked from input video,
  5798. the text color is picked in such way so its always visible.
  5799. @end table
  5800. @item axis
  5801. Draw rows and columns numbers on left and top of video.
  5802. @item opacity
  5803. Set background opacity.
  5804. @end table
  5805. @section dctdnoiz
  5806. Denoise frames using 2D DCT (frequency domain filtering).
  5807. This filter is not designed for real time.
  5808. The filter accepts the following options:
  5809. @table @option
  5810. @item sigma, s
  5811. Set the noise sigma constant.
  5812. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5813. coefficient (absolute value) below this threshold with be dropped.
  5814. If you need a more advanced filtering, see @option{expr}.
  5815. Default is @code{0}.
  5816. @item overlap
  5817. Set number overlapping pixels for each block. Since the filter can be slow, you
  5818. may want to reduce this value, at the cost of a less effective filter and the
  5819. risk of various artefacts.
  5820. If the overlapping value doesn't permit processing the whole input width or
  5821. height, a warning will be displayed and according borders won't be denoised.
  5822. Default value is @var{blocksize}-1, which is the best possible setting.
  5823. @item expr, e
  5824. Set the coefficient factor expression.
  5825. For each coefficient of a DCT block, this expression will be evaluated as a
  5826. multiplier value for the coefficient.
  5827. If this is option is set, the @option{sigma} option will be ignored.
  5828. The absolute value of the coefficient can be accessed through the @var{c}
  5829. variable.
  5830. @item n
  5831. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5832. @var{blocksize}, which is the width and height of the processed blocks.
  5833. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5834. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5835. on the speed processing. Also, a larger block size does not necessarily means a
  5836. better de-noising.
  5837. @end table
  5838. @subsection Examples
  5839. Apply a denoise with a @option{sigma} of @code{4.5}:
  5840. @example
  5841. dctdnoiz=4.5
  5842. @end example
  5843. The same operation can be achieved using the expression system:
  5844. @example
  5845. dctdnoiz=e='gte(c, 4.5*3)'
  5846. @end example
  5847. Violent denoise using a block size of @code{16x16}:
  5848. @example
  5849. dctdnoiz=15:n=4
  5850. @end example
  5851. @section deband
  5852. Remove banding artifacts from input video.
  5853. It works by replacing banded pixels with average value of referenced pixels.
  5854. The filter accepts the following options:
  5855. @table @option
  5856. @item 1thr
  5857. @item 2thr
  5858. @item 3thr
  5859. @item 4thr
  5860. Set banding detection threshold for each plane. Default is 0.02.
  5861. Valid range is 0.00003 to 0.5.
  5862. If difference between current pixel and reference pixel is less than threshold,
  5863. it will be considered as banded.
  5864. @item range, r
  5865. Banding detection range in pixels. Default is 16. If positive, random number
  5866. in range 0 to set value will be used. If negative, exact absolute value
  5867. will be used.
  5868. The range defines square of four pixels around current pixel.
  5869. @item direction, d
  5870. Set direction in radians from which four pixel will be compared. If positive,
  5871. random direction from 0 to set direction will be picked. If negative, exact of
  5872. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5873. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5874. column.
  5875. @item blur, b
  5876. If enabled, current pixel is compared with average value of all four
  5877. surrounding pixels. The default is enabled. If disabled current pixel is
  5878. compared with all four surrounding pixels. The pixel is considered banded
  5879. if only all four differences with surrounding pixels are less than threshold.
  5880. @item coupling, c
  5881. If enabled, current pixel is changed if and only if all pixel components are banded,
  5882. e.g. banding detection threshold is triggered for all color components.
  5883. The default is disabled.
  5884. @end table
  5885. @section deblock
  5886. Remove blocking artifacts from input video.
  5887. The filter accepts the following options:
  5888. @table @option
  5889. @item filter
  5890. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  5891. This controls what kind of deblocking is applied.
  5892. @item block
  5893. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  5894. @item alpha
  5895. @item beta
  5896. @item gamma
  5897. @item delta
  5898. Set blocking detection thresholds. Allowed range is 0 to 1.
  5899. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  5900. Using higher threshold gives more deblocking strength.
  5901. Setting @var{alpha} controls threshold detection at exact edge of block.
  5902. Remaining options controls threshold detection near the edge. Each one for
  5903. below/above or left/right. Setting any of those to @var{0} disables
  5904. deblocking.
  5905. @item planes
  5906. Set planes to filter. Default is to filter all available planes.
  5907. @end table
  5908. @subsection Examples
  5909. @itemize
  5910. @item
  5911. Deblock using weak filter and block size of 4 pixels.
  5912. @example
  5913. deblock=filter=weak:block=4
  5914. @end example
  5915. @item
  5916. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  5917. deblocking more edges.
  5918. @example
  5919. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  5920. @end example
  5921. @item
  5922. Similar as above, but filter only first plane.
  5923. @example
  5924. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  5925. @end example
  5926. @item
  5927. Similar as above, but filter only second and third plane.
  5928. @example
  5929. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  5930. @end example
  5931. @end itemize
  5932. @anchor{decimate}
  5933. @section decimate
  5934. Drop duplicated frames at regular intervals.
  5935. The filter accepts the following options:
  5936. @table @option
  5937. @item cycle
  5938. Set the number of frames from which one will be dropped. Setting this to
  5939. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5940. Default is @code{5}.
  5941. @item dupthresh
  5942. Set the threshold for duplicate detection. If the difference metric for a frame
  5943. is less than or equal to this value, then it is declared as duplicate. Default
  5944. is @code{1.1}
  5945. @item scthresh
  5946. Set scene change threshold. Default is @code{15}.
  5947. @item blockx
  5948. @item blocky
  5949. Set the size of the x and y-axis blocks used during metric calculations.
  5950. Larger blocks give better noise suppression, but also give worse detection of
  5951. small movements. Must be a power of two. Default is @code{32}.
  5952. @item ppsrc
  5953. Mark main input as a pre-processed input and activate clean source input
  5954. stream. This allows the input to be pre-processed with various filters to help
  5955. the metrics calculation while keeping the frame selection lossless. When set to
  5956. @code{1}, the first stream is for the pre-processed input, and the second
  5957. stream is the clean source from where the kept frames are chosen. Default is
  5958. @code{0}.
  5959. @item chroma
  5960. Set whether or not chroma is considered in the metric calculations. Default is
  5961. @code{1}.
  5962. @end table
  5963. @section deconvolve
  5964. Apply 2D deconvolution of video stream in frequency domain using second stream
  5965. as impulse.
  5966. The filter accepts the following options:
  5967. @table @option
  5968. @item planes
  5969. Set which planes to process.
  5970. @item impulse
  5971. Set which impulse video frames will be processed, can be @var{first}
  5972. or @var{all}. Default is @var{all}.
  5973. @item noise
  5974. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5975. and height are not same and not power of 2 or if stream prior to convolving
  5976. had noise.
  5977. @end table
  5978. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5979. @section deflate
  5980. Apply deflate effect to the video.
  5981. This filter replaces the pixel by the local(3x3) average by taking into account
  5982. only values lower than the pixel.
  5983. It accepts the following options:
  5984. @table @option
  5985. @item threshold0
  5986. @item threshold1
  5987. @item threshold2
  5988. @item threshold3
  5989. Limit the maximum change for each plane, default is 65535.
  5990. If 0, plane will remain unchanged.
  5991. @end table
  5992. @section deflicker
  5993. Remove temporal frame luminance variations.
  5994. It accepts the following options:
  5995. @table @option
  5996. @item size, s
  5997. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5998. @item mode, m
  5999. Set averaging mode to smooth temporal luminance variations.
  6000. Available values are:
  6001. @table @samp
  6002. @item am
  6003. Arithmetic mean
  6004. @item gm
  6005. Geometric mean
  6006. @item hm
  6007. Harmonic mean
  6008. @item qm
  6009. Quadratic mean
  6010. @item cm
  6011. Cubic mean
  6012. @item pm
  6013. Power mean
  6014. @item median
  6015. Median
  6016. @end table
  6017. @item bypass
  6018. Do not actually modify frame. Useful when one only wants metadata.
  6019. @end table
  6020. @section dejudder
  6021. Remove judder produced by partially interlaced telecined content.
  6022. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6023. source was partially telecined content then the output of @code{pullup,dejudder}
  6024. will have a variable frame rate. May change the recorded frame rate of the
  6025. container. Aside from that change, this filter will not affect constant frame
  6026. rate video.
  6027. The option available in this filter is:
  6028. @table @option
  6029. @item cycle
  6030. Specify the length of the window over which the judder repeats.
  6031. Accepts any integer greater than 1. Useful values are:
  6032. @table @samp
  6033. @item 4
  6034. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6035. @item 5
  6036. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6037. @item 20
  6038. If a mixture of the two.
  6039. @end table
  6040. The default is @samp{4}.
  6041. @end table
  6042. @section delogo
  6043. Suppress a TV station logo by a simple interpolation of the surrounding
  6044. pixels. Just set a rectangle covering the logo and watch it disappear
  6045. (and sometimes something even uglier appear - your mileage may vary).
  6046. It accepts the following parameters:
  6047. @table @option
  6048. @item x
  6049. @item y
  6050. Specify the top left corner coordinates of the logo. They must be
  6051. specified.
  6052. @item w
  6053. @item h
  6054. Specify the width and height of the logo to clear. They must be
  6055. specified.
  6056. @item band, t
  6057. Specify the thickness of the fuzzy edge of the rectangle (added to
  6058. @var{w} and @var{h}). The default value is 1. This option is
  6059. deprecated, setting higher values should no longer be necessary and
  6060. is not recommended.
  6061. @item show
  6062. When set to 1, a green rectangle is drawn on the screen to simplify
  6063. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6064. The default value is 0.
  6065. The rectangle is drawn on the outermost pixels which will be (partly)
  6066. replaced with interpolated values. The values of the next pixels
  6067. immediately outside this rectangle in each direction will be used to
  6068. compute the interpolated pixel values inside the rectangle.
  6069. @end table
  6070. @subsection Examples
  6071. @itemize
  6072. @item
  6073. Set a rectangle covering the area with top left corner coordinates 0,0
  6074. and size 100x77, and a band of size 10:
  6075. @example
  6076. delogo=x=0:y=0:w=100:h=77:band=10
  6077. @end example
  6078. @end itemize
  6079. @section deshake
  6080. Attempt to fix small changes in horizontal and/or vertical shift. This
  6081. filter helps remove camera shake from hand-holding a camera, bumping a
  6082. tripod, moving on a vehicle, etc.
  6083. The filter accepts the following options:
  6084. @table @option
  6085. @item x
  6086. @item y
  6087. @item w
  6088. @item h
  6089. Specify a rectangular area where to limit the search for motion
  6090. vectors.
  6091. If desired the search for motion vectors can be limited to a
  6092. rectangular area of the frame defined by its top left corner, width
  6093. and height. These parameters have the same meaning as the drawbox
  6094. filter which can be used to visualise the position of the bounding
  6095. box.
  6096. This is useful when simultaneous movement of subjects within the frame
  6097. might be confused for camera motion by the motion vector search.
  6098. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6099. then the full frame is used. This allows later options to be set
  6100. without specifying the bounding box for the motion vector search.
  6101. Default - search the whole frame.
  6102. @item rx
  6103. @item ry
  6104. Specify the maximum extent of movement in x and y directions in the
  6105. range 0-64 pixels. Default 16.
  6106. @item edge
  6107. Specify how to generate pixels to fill blanks at the edge of the
  6108. frame. Available values are:
  6109. @table @samp
  6110. @item blank, 0
  6111. Fill zeroes at blank locations
  6112. @item original, 1
  6113. Original image at blank locations
  6114. @item clamp, 2
  6115. Extruded edge value at blank locations
  6116. @item mirror, 3
  6117. Mirrored edge at blank locations
  6118. @end table
  6119. Default value is @samp{mirror}.
  6120. @item blocksize
  6121. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6122. default 8.
  6123. @item contrast
  6124. Specify the contrast threshold for blocks. Only blocks with more than
  6125. the specified contrast (difference between darkest and lightest
  6126. pixels) will be considered. Range 1-255, default 125.
  6127. @item search
  6128. Specify the search strategy. Available values are:
  6129. @table @samp
  6130. @item exhaustive, 0
  6131. Set exhaustive search
  6132. @item less, 1
  6133. Set less exhaustive search.
  6134. @end table
  6135. Default value is @samp{exhaustive}.
  6136. @item filename
  6137. If set then a detailed log of the motion search is written to the
  6138. specified file.
  6139. @end table
  6140. @section despill
  6141. Remove unwanted contamination of foreground colors, caused by reflected color of
  6142. greenscreen or bluescreen.
  6143. This filter accepts the following options:
  6144. @table @option
  6145. @item type
  6146. Set what type of despill to use.
  6147. @item mix
  6148. Set how spillmap will be generated.
  6149. @item expand
  6150. Set how much to get rid of still remaining spill.
  6151. @item red
  6152. Controls amount of red in spill area.
  6153. @item green
  6154. Controls amount of green in spill area.
  6155. Should be -1 for greenscreen.
  6156. @item blue
  6157. Controls amount of blue in spill area.
  6158. Should be -1 for bluescreen.
  6159. @item brightness
  6160. Controls brightness of spill area, preserving colors.
  6161. @item alpha
  6162. Modify alpha from generated spillmap.
  6163. @end table
  6164. @section detelecine
  6165. Apply an exact inverse of the telecine operation. It requires a predefined
  6166. pattern specified using the pattern option which must be the same as that passed
  6167. to the telecine filter.
  6168. This filter accepts the following options:
  6169. @table @option
  6170. @item first_field
  6171. @table @samp
  6172. @item top, t
  6173. top field first
  6174. @item bottom, b
  6175. bottom field first
  6176. The default value is @code{top}.
  6177. @end table
  6178. @item pattern
  6179. A string of numbers representing the pulldown pattern you wish to apply.
  6180. The default value is @code{23}.
  6181. @item start_frame
  6182. A number representing position of the first frame with respect to the telecine
  6183. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6184. @end table
  6185. @section dilation
  6186. Apply dilation effect to the video.
  6187. This filter replaces the pixel by the local(3x3) maximum.
  6188. It accepts the following options:
  6189. @table @option
  6190. @item threshold0
  6191. @item threshold1
  6192. @item threshold2
  6193. @item threshold3
  6194. Limit the maximum change for each plane, default is 65535.
  6195. If 0, plane will remain unchanged.
  6196. @item coordinates
  6197. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6198. pixels are used.
  6199. Flags to local 3x3 coordinates maps like this:
  6200. 1 2 3
  6201. 4 5
  6202. 6 7 8
  6203. @end table
  6204. @section displace
  6205. Displace pixels as indicated by second and third input stream.
  6206. It takes three input streams and outputs one stream, the first input is the
  6207. source, and second and third input are displacement maps.
  6208. The second input specifies how much to displace pixels along the
  6209. x-axis, while the third input specifies how much to displace pixels
  6210. along the y-axis.
  6211. If one of displacement map streams terminates, last frame from that
  6212. displacement map will be used.
  6213. Note that once generated, displacements maps can be reused over and over again.
  6214. A description of the accepted options follows.
  6215. @table @option
  6216. @item edge
  6217. Set displace behavior for pixels that are out of range.
  6218. Available values are:
  6219. @table @samp
  6220. @item blank
  6221. Missing pixels are replaced by black pixels.
  6222. @item smear
  6223. Adjacent pixels will spread out to replace missing pixels.
  6224. @item wrap
  6225. Out of range pixels are wrapped so they point to pixels of other side.
  6226. @item mirror
  6227. Out of range pixels will be replaced with mirrored pixels.
  6228. @end table
  6229. Default is @samp{smear}.
  6230. @end table
  6231. @subsection Examples
  6232. @itemize
  6233. @item
  6234. Add ripple effect to rgb input of video size hd720:
  6235. @example
  6236. 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
  6237. @end example
  6238. @item
  6239. Add wave effect to rgb input of video size hd720:
  6240. @example
  6241. 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
  6242. @end example
  6243. @end itemize
  6244. @section drawbox
  6245. Draw a colored box on the input image.
  6246. It accepts the following parameters:
  6247. @table @option
  6248. @item x
  6249. @item y
  6250. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6251. @item width, w
  6252. @item height, h
  6253. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6254. the input width and height. It defaults to 0.
  6255. @item color, c
  6256. Specify the color of the box to write. For the general syntax of this option,
  6257. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6258. value @code{invert} is used, the box edge color is the same as the
  6259. video with inverted luma.
  6260. @item thickness, t
  6261. The expression which sets the thickness of the box edge.
  6262. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6263. See below for the list of accepted constants.
  6264. @item replace
  6265. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6266. will overwrite the video's color and alpha pixels.
  6267. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6268. @end table
  6269. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6270. following constants:
  6271. @table @option
  6272. @item dar
  6273. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6274. @item hsub
  6275. @item vsub
  6276. horizontal and vertical chroma subsample values. For example for the
  6277. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6278. @item in_h, ih
  6279. @item in_w, iw
  6280. The input width and height.
  6281. @item sar
  6282. The input sample aspect ratio.
  6283. @item x
  6284. @item y
  6285. The x and y offset coordinates where the box is drawn.
  6286. @item w
  6287. @item h
  6288. The width and height of the drawn box.
  6289. @item t
  6290. The thickness of the drawn box.
  6291. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6292. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6293. @end table
  6294. @subsection Examples
  6295. @itemize
  6296. @item
  6297. Draw a black box around the edge of the input image:
  6298. @example
  6299. drawbox
  6300. @end example
  6301. @item
  6302. Draw a box with color red and an opacity of 50%:
  6303. @example
  6304. drawbox=10:20:200:60:red@@0.5
  6305. @end example
  6306. The previous example can be specified as:
  6307. @example
  6308. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6309. @end example
  6310. @item
  6311. Fill the box with pink color:
  6312. @example
  6313. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6314. @end example
  6315. @item
  6316. Draw a 2-pixel red 2.40:1 mask:
  6317. @example
  6318. 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
  6319. @end example
  6320. @end itemize
  6321. @section drawgrid
  6322. Draw a grid on the input image.
  6323. It accepts the following parameters:
  6324. @table @option
  6325. @item x
  6326. @item y
  6327. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6328. @item width, w
  6329. @item height, h
  6330. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6331. input width and height, respectively, minus @code{thickness}, so image gets
  6332. framed. Default to 0.
  6333. @item color, c
  6334. Specify the color of the grid. For the general syntax of this option,
  6335. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6336. value @code{invert} is used, the grid color is the same as the
  6337. video with inverted luma.
  6338. @item thickness, t
  6339. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6340. See below for the list of accepted constants.
  6341. @item replace
  6342. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6343. will overwrite the video's color and alpha pixels.
  6344. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6345. @end table
  6346. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6347. following constants:
  6348. @table @option
  6349. @item dar
  6350. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6351. @item hsub
  6352. @item vsub
  6353. horizontal and vertical chroma subsample values. For example for the
  6354. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6355. @item in_h, ih
  6356. @item in_w, iw
  6357. The input grid cell width and height.
  6358. @item sar
  6359. The input sample aspect ratio.
  6360. @item x
  6361. @item y
  6362. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6363. @item w
  6364. @item h
  6365. The width and height of the drawn cell.
  6366. @item t
  6367. The thickness of the drawn cell.
  6368. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6369. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6370. @end table
  6371. @subsection Examples
  6372. @itemize
  6373. @item
  6374. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6375. @example
  6376. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6377. @end example
  6378. @item
  6379. Draw a white 3x3 grid with an opacity of 50%:
  6380. @example
  6381. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6382. @end example
  6383. @end itemize
  6384. @anchor{drawtext}
  6385. @section drawtext
  6386. Draw a text string or text from a specified file on top of a video, using the
  6387. libfreetype library.
  6388. To enable compilation of this filter, you need to configure FFmpeg with
  6389. @code{--enable-libfreetype}.
  6390. To enable default font fallback and the @var{font} option you need to
  6391. configure FFmpeg with @code{--enable-libfontconfig}.
  6392. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6393. @code{--enable-libfribidi}.
  6394. @subsection Syntax
  6395. It accepts the following parameters:
  6396. @table @option
  6397. @item box
  6398. Used to draw a box around text using the background color.
  6399. The value must be either 1 (enable) or 0 (disable).
  6400. The default value of @var{box} is 0.
  6401. @item boxborderw
  6402. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6403. The default value of @var{boxborderw} is 0.
  6404. @item boxcolor
  6405. The color to be used for drawing box around text. For the syntax of this
  6406. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6407. The default value of @var{boxcolor} is "white".
  6408. @item line_spacing
  6409. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6410. The default value of @var{line_spacing} is 0.
  6411. @item borderw
  6412. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6413. The default value of @var{borderw} is 0.
  6414. @item bordercolor
  6415. Set the color to be used for drawing border around text. For the syntax of this
  6416. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6417. The default value of @var{bordercolor} is "black".
  6418. @item expansion
  6419. Select how the @var{text} is expanded. Can be either @code{none},
  6420. @code{strftime} (deprecated) or
  6421. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6422. below for details.
  6423. @item basetime
  6424. Set a start time for the count. Value is in microseconds. Only applied
  6425. in the deprecated strftime expansion mode. To emulate in normal expansion
  6426. mode use the @code{pts} function, supplying the start time (in seconds)
  6427. as the second argument.
  6428. @item fix_bounds
  6429. If true, check and fix text coords to avoid clipping.
  6430. @item fontcolor
  6431. The color to be used for drawing fonts. For the syntax of this option, check
  6432. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6433. The default value of @var{fontcolor} is "black".
  6434. @item fontcolor_expr
  6435. String which is expanded the same way as @var{text} to obtain dynamic
  6436. @var{fontcolor} value. By default this option has empty value and is not
  6437. processed. When this option is set, it overrides @var{fontcolor} option.
  6438. @item font
  6439. The font family to be used for drawing text. By default Sans.
  6440. @item fontfile
  6441. The font file to be used for drawing text. The path must be included.
  6442. This parameter is mandatory if the fontconfig support is disabled.
  6443. @item alpha
  6444. Draw the text applying alpha blending. The value can
  6445. be a number between 0.0 and 1.0.
  6446. The expression accepts the same variables @var{x, y} as well.
  6447. The default value is 1.
  6448. Please see @var{fontcolor_expr}.
  6449. @item fontsize
  6450. The font size to be used for drawing text.
  6451. The default value of @var{fontsize} is 16.
  6452. @item text_shaping
  6453. If set to 1, attempt to shape the text (for example, reverse the order of
  6454. right-to-left text and join Arabic characters) before drawing it.
  6455. Otherwise, just draw the text exactly as given.
  6456. By default 1 (if supported).
  6457. @item ft_load_flags
  6458. The flags to be used for loading the fonts.
  6459. The flags map the corresponding flags supported by libfreetype, and are
  6460. a combination of the following values:
  6461. @table @var
  6462. @item default
  6463. @item no_scale
  6464. @item no_hinting
  6465. @item render
  6466. @item no_bitmap
  6467. @item vertical_layout
  6468. @item force_autohint
  6469. @item crop_bitmap
  6470. @item pedantic
  6471. @item ignore_global_advance_width
  6472. @item no_recurse
  6473. @item ignore_transform
  6474. @item monochrome
  6475. @item linear_design
  6476. @item no_autohint
  6477. @end table
  6478. Default value is "default".
  6479. For more information consult the documentation for the FT_LOAD_*
  6480. libfreetype flags.
  6481. @item shadowcolor
  6482. The color to be used for drawing a shadow behind the drawn text. For the
  6483. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6484. ffmpeg-utils manual,ffmpeg-utils}.
  6485. The default value of @var{shadowcolor} is "black".
  6486. @item shadowx
  6487. @item shadowy
  6488. The x and y offsets for the text shadow position with respect to the
  6489. position of the text. They can be either positive or negative
  6490. values. The default value for both is "0".
  6491. @item start_number
  6492. The starting frame number for the n/frame_num variable. The default value
  6493. is "0".
  6494. @item tabsize
  6495. The size in number of spaces to use for rendering the tab.
  6496. Default value is 4.
  6497. @item timecode
  6498. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6499. format. It can be used with or without text parameter. @var{timecode_rate}
  6500. option must be specified.
  6501. @item timecode_rate, rate, r
  6502. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6503. integer. Minimum value is "1".
  6504. Drop-frame timecode is supported for frame rates 30 & 60.
  6505. @item tc24hmax
  6506. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6507. Default is 0 (disabled).
  6508. @item text
  6509. The text string to be drawn. The text must be a sequence of UTF-8
  6510. encoded characters.
  6511. This parameter is mandatory if no file is specified with the parameter
  6512. @var{textfile}.
  6513. @item textfile
  6514. A text file containing text to be drawn. The text must be a sequence
  6515. of UTF-8 encoded characters.
  6516. This parameter is mandatory if no text string is specified with the
  6517. parameter @var{text}.
  6518. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6519. @item reload
  6520. If set to 1, the @var{textfile} will be reloaded before each frame.
  6521. Be sure to update it atomically, or it may be read partially, or even fail.
  6522. @item x
  6523. @item y
  6524. The expressions which specify the offsets where text will be drawn
  6525. within the video frame. They are relative to the top/left border of the
  6526. output image.
  6527. The default value of @var{x} and @var{y} is "0".
  6528. See below for the list of accepted constants and functions.
  6529. @end table
  6530. The parameters for @var{x} and @var{y} are expressions containing the
  6531. following constants and functions:
  6532. @table @option
  6533. @item dar
  6534. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6535. @item hsub
  6536. @item vsub
  6537. horizontal and vertical chroma subsample values. For example for the
  6538. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6539. @item line_h, lh
  6540. the height of each text line
  6541. @item main_h, h, H
  6542. the input height
  6543. @item main_w, w, W
  6544. the input width
  6545. @item max_glyph_a, ascent
  6546. the maximum distance from the baseline to the highest/upper grid
  6547. coordinate used to place a glyph outline point, for all the rendered
  6548. glyphs.
  6549. It is a positive value, due to the grid's orientation with the Y axis
  6550. upwards.
  6551. @item max_glyph_d, descent
  6552. the maximum distance from the baseline to the lowest grid coordinate
  6553. used to place a glyph outline point, for all the rendered glyphs.
  6554. This is a negative value, due to the grid's orientation, with the Y axis
  6555. upwards.
  6556. @item max_glyph_h
  6557. maximum glyph height, that is the maximum height for all the glyphs
  6558. contained in the rendered text, it is equivalent to @var{ascent} -
  6559. @var{descent}.
  6560. @item max_glyph_w
  6561. maximum glyph width, that is the maximum width for all the glyphs
  6562. contained in the rendered text
  6563. @item n
  6564. the number of input frame, starting from 0
  6565. @item rand(min, max)
  6566. return a random number included between @var{min} and @var{max}
  6567. @item sar
  6568. The input sample aspect ratio.
  6569. @item t
  6570. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6571. @item text_h, th
  6572. the height of the rendered text
  6573. @item text_w, tw
  6574. the width of the rendered text
  6575. @item x
  6576. @item y
  6577. the x and y offset coordinates where the text is drawn.
  6578. These parameters allow the @var{x} and @var{y} expressions to refer
  6579. each other, so you can for example specify @code{y=x/dar}.
  6580. @end table
  6581. @anchor{drawtext_expansion}
  6582. @subsection Text expansion
  6583. If @option{expansion} is set to @code{strftime},
  6584. the filter recognizes strftime() sequences in the provided text and
  6585. expands them accordingly. Check the documentation of strftime(). This
  6586. feature is deprecated.
  6587. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6588. If @option{expansion} is set to @code{normal} (which is the default),
  6589. the following expansion mechanism is used.
  6590. The backslash character @samp{\}, followed by any character, always expands to
  6591. the second character.
  6592. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6593. braces is a function name, possibly followed by arguments separated by ':'.
  6594. If the arguments contain special characters or delimiters (':' or '@}'),
  6595. they should be escaped.
  6596. Note that they probably must also be escaped as the value for the
  6597. @option{text} option in the filter argument string and as the filter
  6598. argument in the filtergraph description, and possibly also for the shell,
  6599. that makes up to four levels of escaping; using a text file avoids these
  6600. problems.
  6601. The following functions are available:
  6602. @table @command
  6603. @item expr, e
  6604. The expression evaluation result.
  6605. It must take one argument specifying the expression to be evaluated,
  6606. which accepts the same constants and functions as the @var{x} and
  6607. @var{y} values. Note that not all constants should be used, for
  6608. example the text size is not known when evaluating the expression, so
  6609. the constants @var{text_w} and @var{text_h} will have an undefined
  6610. value.
  6611. @item expr_int_format, eif
  6612. Evaluate the expression's value and output as formatted integer.
  6613. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6614. The second argument specifies the output format. Allowed values are @samp{x},
  6615. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6616. @code{printf} function.
  6617. The third parameter is optional and sets the number of positions taken by the output.
  6618. It can be used to add padding with zeros from the left.
  6619. @item gmtime
  6620. The time at which the filter is running, expressed in UTC.
  6621. It can accept an argument: a strftime() format string.
  6622. @item localtime
  6623. The time at which the filter is running, expressed in the local time zone.
  6624. It can accept an argument: a strftime() format string.
  6625. @item metadata
  6626. Frame metadata. Takes one or two arguments.
  6627. The first argument is mandatory and specifies the metadata key.
  6628. The second argument is optional and specifies a default value, used when the
  6629. metadata key is not found or empty.
  6630. @item n, frame_num
  6631. The frame number, starting from 0.
  6632. @item pict_type
  6633. A 1 character description of the current picture type.
  6634. @item pts
  6635. The timestamp of the current frame.
  6636. It can take up to three arguments.
  6637. The first argument is the format of the timestamp; it defaults to @code{flt}
  6638. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6639. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6640. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6641. @code{localtime} stands for the timestamp of the frame formatted as
  6642. local time zone time.
  6643. The second argument is an offset added to the timestamp.
  6644. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6645. supplied to present the hour part of the formatted timestamp in 24h format
  6646. (00-23).
  6647. If the format is set to @code{localtime} or @code{gmtime},
  6648. a third argument may be supplied: a strftime() format string.
  6649. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6650. @end table
  6651. @subsection Examples
  6652. @itemize
  6653. @item
  6654. Draw "Test Text" with font FreeSerif, using the default values for the
  6655. optional parameters.
  6656. @example
  6657. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6658. @end example
  6659. @item
  6660. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6661. and y=50 (counting from the top-left corner of the screen), text is
  6662. yellow with a red box around it. Both the text and the box have an
  6663. opacity of 20%.
  6664. @example
  6665. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6666. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6667. @end example
  6668. Note that the double quotes are not necessary if spaces are not used
  6669. within the parameter list.
  6670. @item
  6671. Show the text at the center of the video frame:
  6672. @example
  6673. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6674. @end example
  6675. @item
  6676. Show the text at a random position, switching to a new position every 30 seconds:
  6677. @example
  6678. 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)"
  6679. @end example
  6680. @item
  6681. Show a text line sliding from right to left in the last row of the video
  6682. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6683. with no newlines.
  6684. @example
  6685. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6686. @end example
  6687. @item
  6688. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6689. @example
  6690. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6691. @end example
  6692. @item
  6693. Draw a single green letter "g", at the center of the input video.
  6694. The glyph baseline is placed at half screen height.
  6695. @example
  6696. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6697. @end example
  6698. @item
  6699. Show text for 1 second every 3 seconds:
  6700. @example
  6701. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6702. @end example
  6703. @item
  6704. Use fontconfig to set the font. Note that the colons need to be escaped.
  6705. @example
  6706. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6707. @end example
  6708. @item
  6709. Print the date of a real-time encoding (see strftime(3)):
  6710. @example
  6711. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6712. @end example
  6713. @item
  6714. Show text fading in and out (appearing/disappearing):
  6715. @example
  6716. #!/bin/sh
  6717. DS=1.0 # display start
  6718. DE=10.0 # display end
  6719. FID=1.5 # fade in duration
  6720. FOD=5 # fade out duration
  6721. 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 @}"
  6722. @end example
  6723. @item
  6724. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6725. and the @option{fontsize} value are included in the @option{y} offset.
  6726. @example
  6727. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6728. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6729. @end example
  6730. @end itemize
  6731. For more information about libfreetype, check:
  6732. @url{http://www.freetype.org/}.
  6733. For more information about fontconfig, check:
  6734. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6735. For more information about libfribidi, check:
  6736. @url{http://fribidi.org/}.
  6737. @section edgedetect
  6738. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6739. The filter accepts the following options:
  6740. @table @option
  6741. @item low
  6742. @item high
  6743. Set low and high threshold values used by the Canny thresholding
  6744. algorithm.
  6745. The high threshold selects the "strong" edge pixels, which are then
  6746. connected through 8-connectivity with the "weak" edge pixels selected
  6747. by the low threshold.
  6748. @var{low} and @var{high} threshold values must be chosen in the range
  6749. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6750. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6751. is @code{50/255}.
  6752. @item mode
  6753. Define the drawing mode.
  6754. @table @samp
  6755. @item wires
  6756. Draw white/gray wires on black background.
  6757. @item colormix
  6758. Mix the colors to create a paint/cartoon effect.
  6759. @item canny
  6760. Apply Canny edge detector on all selected planes.
  6761. @end table
  6762. Default value is @var{wires}.
  6763. @item planes
  6764. Select planes for filtering. By default all available planes are filtered.
  6765. @end table
  6766. @subsection Examples
  6767. @itemize
  6768. @item
  6769. Standard edge detection with custom values for the hysteresis thresholding:
  6770. @example
  6771. edgedetect=low=0.1:high=0.4
  6772. @end example
  6773. @item
  6774. Painting effect without thresholding:
  6775. @example
  6776. edgedetect=mode=colormix:high=0
  6777. @end example
  6778. @end itemize
  6779. @section eq
  6780. Set brightness, contrast, saturation and approximate gamma adjustment.
  6781. The filter accepts the following options:
  6782. @table @option
  6783. @item contrast
  6784. Set the contrast expression. The value must be a float value in range
  6785. @code{-2.0} to @code{2.0}. The default value is "1".
  6786. @item brightness
  6787. Set the brightness expression. The value must be a float value in
  6788. range @code{-1.0} to @code{1.0}. The default value is "0".
  6789. @item saturation
  6790. Set the saturation expression. The value must be a float in
  6791. range @code{0.0} to @code{3.0}. The default value is "1".
  6792. @item gamma
  6793. Set the gamma expression. The value must be a float in range
  6794. @code{0.1} to @code{10.0}. The default value is "1".
  6795. @item gamma_r
  6796. Set the gamma expression for red. The value must be a float in
  6797. range @code{0.1} to @code{10.0}. The default value is "1".
  6798. @item gamma_g
  6799. Set the gamma expression for green. The value must be a float in range
  6800. @code{0.1} to @code{10.0}. The default value is "1".
  6801. @item gamma_b
  6802. Set the gamma expression for blue. The value must be a float in range
  6803. @code{0.1} to @code{10.0}. The default value is "1".
  6804. @item gamma_weight
  6805. Set the gamma weight expression. It can be used to reduce the effect
  6806. of a high gamma value on bright image areas, e.g. keep them from
  6807. getting overamplified and just plain white. The value must be a float
  6808. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6809. gamma correction all the way down while @code{1.0} leaves it at its
  6810. full strength. Default is "1".
  6811. @item eval
  6812. Set when the expressions for brightness, contrast, saturation and
  6813. gamma expressions are evaluated.
  6814. It accepts the following values:
  6815. @table @samp
  6816. @item init
  6817. only evaluate expressions once during the filter initialization or
  6818. when a command is processed
  6819. @item frame
  6820. evaluate expressions for each incoming frame
  6821. @end table
  6822. Default value is @samp{init}.
  6823. @end table
  6824. The expressions accept the following parameters:
  6825. @table @option
  6826. @item n
  6827. frame count of the input frame starting from 0
  6828. @item pos
  6829. byte position of the corresponding packet in the input file, NAN if
  6830. unspecified
  6831. @item r
  6832. frame rate of the input video, NAN if the input frame rate is unknown
  6833. @item t
  6834. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6835. @end table
  6836. @subsection Commands
  6837. The filter supports the following commands:
  6838. @table @option
  6839. @item contrast
  6840. Set the contrast expression.
  6841. @item brightness
  6842. Set the brightness expression.
  6843. @item saturation
  6844. Set the saturation expression.
  6845. @item gamma
  6846. Set the gamma expression.
  6847. @item gamma_r
  6848. Set the gamma_r expression.
  6849. @item gamma_g
  6850. Set gamma_g expression.
  6851. @item gamma_b
  6852. Set gamma_b expression.
  6853. @item gamma_weight
  6854. Set gamma_weight expression.
  6855. The command accepts the same syntax of the corresponding option.
  6856. If the specified expression is not valid, it is kept at its current
  6857. value.
  6858. @end table
  6859. @section erosion
  6860. Apply erosion effect to the video.
  6861. This filter replaces the pixel by the local(3x3) minimum.
  6862. It accepts the following options:
  6863. @table @option
  6864. @item threshold0
  6865. @item threshold1
  6866. @item threshold2
  6867. @item threshold3
  6868. Limit the maximum change for each plane, default is 65535.
  6869. If 0, plane will remain unchanged.
  6870. @item coordinates
  6871. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6872. pixels are used.
  6873. Flags to local 3x3 coordinates maps like this:
  6874. 1 2 3
  6875. 4 5
  6876. 6 7 8
  6877. @end table
  6878. @section extractplanes
  6879. Extract color channel components from input video stream into
  6880. separate grayscale video streams.
  6881. The filter accepts the following option:
  6882. @table @option
  6883. @item planes
  6884. Set plane(s) to extract.
  6885. Available values for planes are:
  6886. @table @samp
  6887. @item y
  6888. @item u
  6889. @item v
  6890. @item a
  6891. @item r
  6892. @item g
  6893. @item b
  6894. @end table
  6895. Choosing planes not available in the input will result in an error.
  6896. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6897. with @code{y}, @code{u}, @code{v} planes at same time.
  6898. @end table
  6899. @subsection Examples
  6900. @itemize
  6901. @item
  6902. Extract luma, u and v color channel component from input video frame
  6903. into 3 grayscale outputs:
  6904. @example
  6905. 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
  6906. @end example
  6907. @end itemize
  6908. @section elbg
  6909. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6910. For each input image, the filter will compute the optimal mapping from
  6911. the input to the output given the codebook length, that is the number
  6912. of distinct output colors.
  6913. This filter accepts the following options.
  6914. @table @option
  6915. @item codebook_length, l
  6916. Set codebook length. The value must be a positive integer, and
  6917. represents the number of distinct output colors. Default value is 256.
  6918. @item nb_steps, n
  6919. Set the maximum number of iterations to apply for computing the optimal
  6920. mapping. The higher the value the better the result and the higher the
  6921. computation time. Default value is 1.
  6922. @item seed, s
  6923. Set a random seed, must be an integer included between 0 and
  6924. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6925. will try to use a good random seed on a best effort basis.
  6926. @item pal8
  6927. Set pal8 output pixel format. This option does not work with codebook
  6928. length greater than 256.
  6929. @end table
  6930. @section entropy
  6931. Measure graylevel entropy in histogram of color channels of video frames.
  6932. It accepts the following parameters:
  6933. @table @option
  6934. @item mode
  6935. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6936. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6937. between neighbour histogram values.
  6938. @end table
  6939. @section fade
  6940. Apply a fade-in/out effect to the input video.
  6941. It accepts the following parameters:
  6942. @table @option
  6943. @item type, t
  6944. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6945. effect.
  6946. Default is @code{in}.
  6947. @item start_frame, s
  6948. Specify the number of the frame to start applying the fade
  6949. effect at. Default is 0.
  6950. @item nb_frames, n
  6951. The number of frames that the fade effect lasts. At the end of the
  6952. fade-in effect, the output video will have the same intensity as the input video.
  6953. At the end of the fade-out transition, the output video will be filled with the
  6954. selected @option{color}.
  6955. Default is 25.
  6956. @item alpha
  6957. If set to 1, fade only alpha channel, if one exists on the input.
  6958. Default value is 0.
  6959. @item start_time, st
  6960. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6961. effect. If both start_frame and start_time are specified, the fade will start at
  6962. whichever comes last. Default is 0.
  6963. @item duration, d
  6964. The number of seconds for which the fade effect has to last. At the end of the
  6965. fade-in effect the output video will have the same intensity as the input video,
  6966. at the end of the fade-out transition the output video will be filled with the
  6967. selected @option{color}.
  6968. If both duration and nb_frames are specified, duration is used. Default is 0
  6969. (nb_frames is used by default).
  6970. @item color, c
  6971. Specify the color of the fade. Default is "black".
  6972. @end table
  6973. @subsection Examples
  6974. @itemize
  6975. @item
  6976. Fade in the first 30 frames of video:
  6977. @example
  6978. fade=in:0:30
  6979. @end example
  6980. The command above is equivalent to:
  6981. @example
  6982. fade=t=in:s=0:n=30
  6983. @end example
  6984. @item
  6985. Fade out the last 45 frames of a 200-frame video:
  6986. @example
  6987. fade=out:155:45
  6988. fade=type=out:start_frame=155:nb_frames=45
  6989. @end example
  6990. @item
  6991. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6992. @example
  6993. fade=in:0:25, fade=out:975:25
  6994. @end example
  6995. @item
  6996. Make the first 5 frames yellow, then fade in from frame 5-24:
  6997. @example
  6998. fade=in:5:20:color=yellow
  6999. @end example
  7000. @item
  7001. Fade in alpha over first 25 frames of video:
  7002. @example
  7003. fade=in:0:25:alpha=1
  7004. @end example
  7005. @item
  7006. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7007. @example
  7008. fade=t=in:st=5.5:d=0.5
  7009. @end example
  7010. @end itemize
  7011. @section fftfilt
  7012. Apply arbitrary expressions to samples in frequency domain
  7013. @table @option
  7014. @item dc_Y
  7015. Adjust the dc value (gain) of the luma plane of the image. The filter
  7016. accepts an integer value in range @code{0} to @code{1000}. The default
  7017. value is set to @code{0}.
  7018. @item dc_U
  7019. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7020. filter accepts an integer value in range @code{0} to @code{1000}. The
  7021. default value is set to @code{0}.
  7022. @item dc_V
  7023. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7024. filter accepts an integer value in range @code{0} to @code{1000}. The
  7025. default value is set to @code{0}.
  7026. @item weight_Y
  7027. Set the frequency domain weight expression for the luma plane.
  7028. @item weight_U
  7029. Set the frequency domain weight expression for the 1st chroma plane.
  7030. @item weight_V
  7031. Set the frequency domain weight expression for the 2nd chroma plane.
  7032. @item eval
  7033. Set when the expressions are evaluated.
  7034. It accepts the following values:
  7035. @table @samp
  7036. @item init
  7037. Only evaluate expressions once during the filter initialization.
  7038. @item frame
  7039. Evaluate expressions for each incoming frame.
  7040. @end table
  7041. Default value is @samp{init}.
  7042. The filter accepts the following variables:
  7043. @item X
  7044. @item Y
  7045. The coordinates of the current sample.
  7046. @item W
  7047. @item H
  7048. The width and height of the image.
  7049. @item N
  7050. The number of input frame, starting from 0.
  7051. @end table
  7052. @subsection Examples
  7053. @itemize
  7054. @item
  7055. High-pass:
  7056. @example
  7057. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7058. @end example
  7059. @item
  7060. Low-pass:
  7061. @example
  7062. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7063. @end example
  7064. @item
  7065. Sharpen:
  7066. @example
  7067. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7068. @end example
  7069. @item
  7070. Blur:
  7071. @example
  7072. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7073. @end example
  7074. @end itemize
  7075. @section fftdnoiz
  7076. Denoise frames using 3D FFT (frequency domain filtering).
  7077. The filter accepts the following options:
  7078. @table @option
  7079. @item sigma
  7080. Set the noise sigma constant. This sets denoising strength.
  7081. Default value is 1. Allowed range is from 0 to 30.
  7082. Using very high sigma with low overlap may give blocking artifacts.
  7083. @item amount
  7084. Set amount of denoising. By default all detected noise is reduced.
  7085. Default value is 1. Allowed range is from 0 to 1.
  7086. @item block
  7087. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7088. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7089. block size in pixels is 2^4 which is 16.
  7090. @item overlap
  7091. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7092. @item prev
  7093. Set number of previous frames to use for denoising. By default is set to 0.
  7094. @item next
  7095. Set number of next frames to to use for denoising. By default is set to 0.
  7096. @item planes
  7097. Set planes which will be filtered, by default are all available filtered
  7098. except alpha.
  7099. @end table
  7100. @section field
  7101. Extract a single field from an interlaced image using stride
  7102. arithmetic to avoid wasting CPU time. The output frames are marked as
  7103. non-interlaced.
  7104. The filter accepts the following options:
  7105. @table @option
  7106. @item type
  7107. Specify whether to extract the top (if the value is @code{0} or
  7108. @code{top}) or the bottom field (if the value is @code{1} or
  7109. @code{bottom}).
  7110. @end table
  7111. @section fieldhint
  7112. Create new frames by copying the top and bottom fields from surrounding frames
  7113. supplied as numbers by the hint file.
  7114. @table @option
  7115. @item hint
  7116. Set file containing hints: absolute/relative frame numbers.
  7117. There must be one line for each frame in a clip. Each line must contain two
  7118. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7119. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7120. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7121. for @code{relative} mode. First number tells from which frame to pick up top
  7122. field and second number tells from which frame to pick up bottom field.
  7123. If optionally followed by @code{+} output frame will be marked as interlaced,
  7124. else if followed by @code{-} output frame will be marked as progressive, else
  7125. it will be marked same as input frame.
  7126. If line starts with @code{#} or @code{;} that line is skipped.
  7127. @item mode
  7128. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7129. @end table
  7130. Example of first several lines of @code{hint} file for @code{relative} mode:
  7131. @example
  7132. 0,0 - # first frame
  7133. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7134. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7135. 1,0 -
  7136. 0,0 -
  7137. 0,0 -
  7138. 1,0 -
  7139. 1,0 -
  7140. 1,0 -
  7141. 0,0 -
  7142. 0,0 -
  7143. 1,0 -
  7144. 1,0 -
  7145. 1,0 -
  7146. 0,0 -
  7147. @end example
  7148. @section fieldmatch
  7149. Field matching filter for inverse telecine. It is meant to reconstruct the
  7150. progressive frames from a telecined stream. The filter does not drop duplicated
  7151. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7152. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7153. The separation of the field matching and the decimation is notably motivated by
  7154. the possibility of inserting a de-interlacing filter fallback between the two.
  7155. If the source has mixed telecined and real interlaced content,
  7156. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7157. But these remaining combed frames will be marked as interlaced, and thus can be
  7158. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7159. In addition to the various configuration options, @code{fieldmatch} can take an
  7160. optional second stream, activated through the @option{ppsrc} option. If
  7161. enabled, the frames reconstruction will be based on the fields and frames from
  7162. this second stream. This allows the first input to be pre-processed in order to
  7163. help the various algorithms of the filter, while keeping the output lossless
  7164. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7165. or brightness/contrast adjustments can help.
  7166. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7167. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7168. which @code{fieldmatch} is based on. While the semantic and usage are very
  7169. close, some behaviour and options names can differ.
  7170. The @ref{decimate} filter currently only works for constant frame rate input.
  7171. If your input has mixed telecined (30fps) and progressive content with a lower
  7172. framerate like 24fps use the following filterchain to produce the necessary cfr
  7173. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7174. The filter accepts the following options:
  7175. @table @option
  7176. @item order
  7177. Specify the assumed field order of the input stream. Available values are:
  7178. @table @samp
  7179. @item auto
  7180. Auto detect parity (use FFmpeg's internal parity value).
  7181. @item bff
  7182. Assume bottom field first.
  7183. @item tff
  7184. Assume top field first.
  7185. @end table
  7186. Note that it is sometimes recommended not to trust the parity announced by the
  7187. stream.
  7188. Default value is @var{auto}.
  7189. @item mode
  7190. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7191. sense that it won't risk creating jerkiness due to duplicate frames when
  7192. possible, but if there are bad edits or blended fields it will end up
  7193. outputting combed frames when a good match might actually exist. On the other
  7194. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7195. but will almost always find a good frame if there is one. The other values are
  7196. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7197. jerkiness and creating duplicate frames versus finding good matches in sections
  7198. with bad edits, orphaned fields, blended fields, etc.
  7199. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7200. Available values are:
  7201. @table @samp
  7202. @item pc
  7203. 2-way matching (p/c)
  7204. @item pc_n
  7205. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7206. @item pc_u
  7207. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7208. @item pc_n_ub
  7209. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7210. still combed (p/c + n + u/b)
  7211. @item pcn
  7212. 3-way matching (p/c/n)
  7213. @item pcn_ub
  7214. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7215. detected as combed (p/c/n + u/b)
  7216. @end table
  7217. The parenthesis at the end indicate the matches that would be used for that
  7218. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7219. @var{top}).
  7220. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7221. the slowest.
  7222. Default value is @var{pc_n}.
  7223. @item ppsrc
  7224. Mark the main input stream as a pre-processed input, and enable the secondary
  7225. input stream as the clean source to pick the fields from. See the filter
  7226. introduction for more details. It is similar to the @option{clip2} feature from
  7227. VFM/TFM.
  7228. Default value is @code{0} (disabled).
  7229. @item field
  7230. Set the field to match from. It is recommended to set this to the same value as
  7231. @option{order} unless you experience matching failures with that setting. In
  7232. certain circumstances changing the field that is used to match from can have a
  7233. large impact on matching performance. Available values are:
  7234. @table @samp
  7235. @item auto
  7236. Automatic (same value as @option{order}).
  7237. @item bottom
  7238. Match from the bottom field.
  7239. @item top
  7240. Match from the top field.
  7241. @end table
  7242. Default value is @var{auto}.
  7243. @item mchroma
  7244. Set whether or not chroma is included during the match comparisons. In most
  7245. cases it is recommended to leave this enabled. You should set this to @code{0}
  7246. only if your clip has bad chroma problems such as heavy rainbowing or other
  7247. artifacts. Setting this to @code{0} could also be used to speed things up at
  7248. the cost of some accuracy.
  7249. Default value is @code{1}.
  7250. @item y0
  7251. @item y1
  7252. These define an exclusion band which excludes the lines between @option{y0} and
  7253. @option{y1} from being included in the field matching decision. An exclusion
  7254. band can be used to ignore subtitles, a logo, or other things that may
  7255. interfere with the matching. @option{y0} sets the starting scan line and
  7256. @option{y1} sets the ending line; all lines in between @option{y0} and
  7257. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7258. @option{y0} and @option{y1} to the same value will disable the feature.
  7259. @option{y0} and @option{y1} defaults to @code{0}.
  7260. @item scthresh
  7261. Set the scene change detection threshold as a percentage of maximum change on
  7262. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7263. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7264. @option{scthresh} is @code{[0.0, 100.0]}.
  7265. Default value is @code{12.0}.
  7266. @item combmatch
  7267. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7268. account the combed scores of matches when deciding what match to use as the
  7269. final match. Available values are:
  7270. @table @samp
  7271. @item none
  7272. No final matching based on combed scores.
  7273. @item sc
  7274. Combed scores are only used when a scene change is detected.
  7275. @item full
  7276. Use combed scores all the time.
  7277. @end table
  7278. Default is @var{sc}.
  7279. @item combdbg
  7280. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7281. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7282. Available values are:
  7283. @table @samp
  7284. @item none
  7285. No forced calculation.
  7286. @item pcn
  7287. Force p/c/n calculations.
  7288. @item pcnub
  7289. Force p/c/n/u/b calculations.
  7290. @end table
  7291. Default value is @var{none}.
  7292. @item cthresh
  7293. This is the area combing threshold used for combed frame detection. This
  7294. essentially controls how "strong" or "visible" combing must be to be detected.
  7295. Larger values mean combing must be more visible and smaller values mean combing
  7296. can be less visible or strong and still be detected. Valid settings are from
  7297. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7298. be detected as combed). This is basically a pixel difference value. A good
  7299. range is @code{[8, 12]}.
  7300. Default value is @code{9}.
  7301. @item chroma
  7302. Sets whether or not chroma is considered in the combed frame decision. Only
  7303. disable this if your source has chroma problems (rainbowing, etc.) that are
  7304. causing problems for the combed frame detection with chroma enabled. Actually,
  7305. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7306. where there is chroma only combing in the source.
  7307. Default value is @code{0}.
  7308. @item blockx
  7309. @item blocky
  7310. Respectively set the x-axis and y-axis size of the window used during combed
  7311. frame detection. This has to do with the size of the area in which
  7312. @option{combpel} pixels are required to be detected as combed for a frame to be
  7313. declared combed. See the @option{combpel} parameter description for more info.
  7314. Possible values are any number that is a power of 2 starting at 4 and going up
  7315. to 512.
  7316. Default value is @code{16}.
  7317. @item combpel
  7318. The number of combed pixels inside any of the @option{blocky} by
  7319. @option{blockx} size blocks on the frame for the frame to be detected as
  7320. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7321. setting controls "how much" combing there must be in any localized area (a
  7322. window defined by the @option{blockx} and @option{blocky} settings) on the
  7323. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7324. which point no frames will ever be detected as combed). This setting is known
  7325. as @option{MI} in TFM/VFM vocabulary.
  7326. Default value is @code{80}.
  7327. @end table
  7328. @anchor{p/c/n/u/b meaning}
  7329. @subsection p/c/n/u/b meaning
  7330. @subsubsection p/c/n
  7331. We assume the following telecined stream:
  7332. @example
  7333. Top fields: 1 2 2 3 4
  7334. Bottom fields: 1 2 3 4 4
  7335. @end example
  7336. The numbers correspond to the progressive frame the fields relate to. Here, the
  7337. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7338. When @code{fieldmatch} is configured to run a matching from bottom
  7339. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7340. @example
  7341. Input stream:
  7342. T 1 2 2 3 4
  7343. B 1 2 3 4 4 <-- matching reference
  7344. Matches: c c n n c
  7345. Output stream:
  7346. T 1 2 3 4 4
  7347. B 1 2 3 4 4
  7348. @end example
  7349. As a result of the field matching, we can see that some frames get duplicated.
  7350. To perform a complete inverse telecine, you need to rely on a decimation filter
  7351. after this operation. See for instance the @ref{decimate} filter.
  7352. The same operation now matching from top fields (@option{field}=@var{top})
  7353. looks like this:
  7354. @example
  7355. Input stream:
  7356. T 1 2 2 3 4 <-- matching reference
  7357. B 1 2 3 4 4
  7358. Matches: c c p p c
  7359. Output stream:
  7360. T 1 2 2 3 4
  7361. B 1 2 2 3 4
  7362. @end example
  7363. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7364. basically, they refer to the frame and field of the opposite parity:
  7365. @itemize
  7366. @item @var{p} matches the field of the opposite parity in the previous frame
  7367. @item @var{c} matches the field of the opposite parity in the current frame
  7368. @item @var{n} matches the field of the opposite parity in the next frame
  7369. @end itemize
  7370. @subsubsection u/b
  7371. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7372. from the opposite parity flag. In the following examples, we assume that we are
  7373. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7374. 'x' is placed above and below each matched fields.
  7375. With bottom matching (@option{field}=@var{bottom}):
  7376. @example
  7377. Match: c p n b u
  7378. x x x x x
  7379. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7380. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7381. x x x x x
  7382. Output frames:
  7383. 2 1 2 2 2
  7384. 2 2 2 1 3
  7385. @end example
  7386. With top matching (@option{field}=@var{top}):
  7387. @example
  7388. Match: c p n b u
  7389. x x x x x
  7390. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7391. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7392. x x x x x
  7393. Output frames:
  7394. 2 2 2 1 2
  7395. 2 1 3 2 2
  7396. @end example
  7397. @subsection Examples
  7398. Simple IVTC of a top field first telecined stream:
  7399. @example
  7400. fieldmatch=order=tff:combmatch=none, decimate
  7401. @end example
  7402. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7403. @example
  7404. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7405. @end example
  7406. @section fieldorder
  7407. Transform the field order of the input video.
  7408. It accepts the following parameters:
  7409. @table @option
  7410. @item order
  7411. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7412. for bottom field first.
  7413. @end table
  7414. The default value is @samp{tff}.
  7415. The transformation is done by shifting the picture content up or down
  7416. by one line, and filling the remaining line with appropriate picture content.
  7417. This method is consistent with most broadcast field order converters.
  7418. If the input video is not flagged as being interlaced, or it is already
  7419. flagged as being of the required output field order, then this filter does
  7420. not alter the incoming video.
  7421. It is very useful when converting to or from PAL DV material,
  7422. which is bottom field first.
  7423. For example:
  7424. @example
  7425. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7426. @end example
  7427. @section fifo, afifo
  7428. Buffer input images and send them when they are requested.
  7429. It is mainly useful when auto-inserted by the libavfilter
  7430. framework.
  7431. It does not take parameters.
  7432. @section fillborders
  7433. Fill borders of the input video, without changing video stream dimensions.
  7434. Sometimes video can have garbage at the four edges and you may not want to
  7435. crop video input to keep size multiple of some number.
  7436. This filter accepts the following options:
  7437. @table @option
  7438. @item left
  7439. Number of pixels to fill from left border.
  7440. @item right
  7441. Number of pixels to fill from right border.
  7442. @item top
  7443. Number of pixels to fill from top border.
  7444. @item bottom
  7445. Number of pixels to fill from bottom border.
  7446. @item mode
  7447. Set fill mode.
  7448. It accepts the following values:
  7449. @table @samp
  7450. @item smear
  7451. fill pixels using outermost pixels
  7452. @item mirror
  7453. fill pixels using mirroring
  7454. @item fixed
  7455. fill pixels with constant value
  7456. @end table
  7457. Default is @var{smear}.
  7458. @item color
  7459. Set color for pixels in fixed mode. Default is @var{black}.
  7460. @end table
  7461. @section find_rect
  7462. Find a rectangular object
  7463. It accepts the following options:
  7464. @table @option
  7465. @item object
  7466. Filepath of the object image, needs to be in gray8.
  7467. @item threshold
  7468. Detection threshold, default is 0.5.
  7469. @item mipmaps
  7470. Number of mipmaps, default is 3.
  7471. @item xmin, ymin, xmax, ymax
  7472. Specifies the rectangle in which to search.
  7473. @end table
  7474. @subsection Examples
  7475. @itemize
  7476. @item
  7477. Generate a representative palette of a given video using @command{ffmpeg}:
  7478. @example
  7479. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7480. @end example
  7481. @end itemize
  7482. @section cover_rect
  7483. Cover a rectangular object
  7484. It accepts the following options:
  7485. @table @option
  7486. @item cover
  7487. Filepath of the optional cover image, needs to be in yuv420.
  7488. @item mode
  7489. Set covering mode.
  7490. It accepts the following values:
  7491. @table @samp
  7492. @item cover
  7493. cover it by the supplied image
  7494. @item blur
  7495. cover it by interpolating the surrounding pixels
  7496. @end table
  7497. Default value is @var{blur}.
  7498. @end table
  7499. @subsection Examples
  7500. @itemize
  7501. @item
  7502. Generate a representative palette of a given video using @command{ffmpeg}:
  7503. @example
  7504. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7505. @end example
  7506. @end itemize
  7507. @section floodfill
  7508. Flood area with values of same pixel components with another values.
  7509. It accepts the following options:
  7510. @table @option
  7511. @item x
  7512. Set pixel x coordinate.
  7513. @item y
  7514. Set pixel y coordinate.
  7515. @item s0
  7516. Set source #0 component value.
  7517. @item s1
  7518. Set source #1 component value.
  7519. @item s2
  7520. Set source #2 component value.
  7521. @item s3
  7522. Set source #3 component value.
  7523. @item d0
  7524. Set destination #0 component value.
  7525. @item d1
  7526. Set destination #1 component value.
  7527. @item d2
  7528. Set destination #2 component value.
  7529. @item d3
  7530. Set destination #3 component value.
  7531. @end table
  7532. @anchor{format}
  7533. @section format
  7534. Convert the input video to one of the specified pixel formats.
  7535. Libavfilter will try to pick one that is suitable as input to
  7536. the next filter.
  7537. It accepts the following parameters:
  7538. @table @option
  7539. @item pix_fmts
  7540. A '|'-separated list of pixel format names, such as
  7541. "pix_fmts=yuv420p|monow|rgb24".
  7542. @end table
  7543. @subsection Examples
  7544. @itemize
  7545. @item
  7546. Convert the input video to the @var{yuv420p} format
  7547. @example
  7548. format=pix_fmts=yuv420p
  7549. @end example
  7550. Convert the input video to any of the formats in the list
  7551. @example
  7552. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7553. @end example
  7554. @end itemize
  7555. @anchor{fps}
  7556. @section fps
  7557. Convert the video to specified constant frame rate by duplicating or dropping
  7558. frames as necessary.
  7559. It accepts the following parameters:
  7560. @table @option
  7561. @item fps
  7562. The desired output frame rate. The default is @code{25}.
  7563. @item start_time
  7564. Assume the first PTS should be the given value, in seconds. This allows for
  7565. padding/trimming at the start of stream. By default, no assumption is made
  7566. about the first frame's expected PTS, so no padding or trimming is done.
  7567. For example, this could be set to 0 to pad the beginning with duplicates of
  7568. the first frame if a video stream starts after the audio stream or to trim any
  7569. frames with a negative PTS.
  7570. @item round
  7571. Timestamp (PTS) rounding method.
  7572. Possible values are:
  7573. @table @option
  7574. @item zero
  7575. round towards 0
  7576. @item inf
  7577. round away from 0
  7578. @item down
  7579. round towards -infinity
  7580. @item up
  7581. round towards +infinity
  7582. @item near
  7583. round to nearest
  7584. @end table
  7585. The default is @code{near}.
  7586. @item eof_action
  7587. Action performed when reading the last frame.
  7588. Possible values are:
  7589. @table @option
  7590. @item round
  7591. Use same timestamp rounding method as used for other frames.
  7592. @item pass
  7593. Pass through last frame if input duration has not been reached yet.
  7594. @end table
  7595. The default is @code{round}.
  7596. @end table
  7597. Alternatively, the options can be specified as a flat string:
  7598. @var{fps}[:@var{start_time}[:@var{round}]].
  7599. See also the @ref{setpts} filter.
  7600. @subsection Examples
  7601. @itemize
  7602. @item
  7603. A typical usage in order to set the fps to 25:
  7604. @example
  7605. fps=fps=25
  7606. @end example
  7607. @item
  7608. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7609. @example
  7610. fps=fps=film:round=near
  7611. @end example
  7612. @end itemize
  7613. @section framepack
  7614. Pack two different video streams into a stereoscopic video, setting proper
  7615. metadata on supported codecs. The two views should have the same size and
  7616. framerate and processing will stop when the shorter video ends. Please note
  7617. that you may conveniently adjust view properties with the @ref{scale} and
  7618. @ref{fps} filters.
  7619. It accepts the following parameters:
  7620. @table @option
  7621. @item format
  7622. The desired packing format. Supported values are:
  7623. @table @option
  7624. @item sbs
  7625. The views are next to each other (default).
  7626. @item tab
  7627. The views are on top of each other.
  7628. @item lines
  7629. The views are packed by line.
  7630. @item columns
  7631. The views are packed by column.
  7632. @item frameseq
  7633. The views are temporally interleaved.
  7634. @end table
  7635. @end table
  7636. Some examples:
  7637. @example
  7638. # Convert left and right views into a frame-sequential video
  7639. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7640. # Convert views into a side-by-side video with the same output resolution as the input
  7641. 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
  7642. @end example
  7643. @section framerate
  7644. Change the frame rate by interpolating new video output frames from the source
  7645. frames.
  7646. This filter is not designed to function correctly with interlaced media. If
  7647. you wish to change the frame rate of interlaced media then you are required
  7648. to deinterlace before this filter and re-interlace after this filter.
  7649. A description of the accepted options follows.
  7650. @table @option
  7651. @item fps
  7652. Specify the output frames per second. This option can also be specified
  7653. as a value alone. The default is @code{50}.
  7654. @item interp_start
  7655. Specify the start of a range where the output frame will be created as a
  7656. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7657. the default is @code{15}.
  7658. @item interp_end
  7659. Specify the end of a range where the output frame will be created as a
  7660. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7661. the default is @code{240}.
  7662. @item scene
  7663. Specify the level at which a scene change is detected as a value between
  7664. 0 and 100 to indicate a new scene; a low value reflects a low
  7665. probability for the current frame to introduce a new scene, while a higher
  7666. value means the current frame is more likely to be one.
  7667. The default is @code{8.2}.
  7668. @item flags
  7669. Specify flags influencing the filter process.
  7670. Available value for @var{flags} is:
  7671. @table @option
  7672. @item scene_change_detect, scd
  7673. Enable scene change detection using the value of the option @var{scene}.
  7674. This flag is enabled by default.
  7675. @end table
  7676. @end table
  7677. @section framestep
  7678. Select one frame every N-th frame.
  7679. This filter accepts the following option:
  7680. @table @option
  7681. @item step
  7682. Select frame after every @code{step} frames.
  7683. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7684. @end table
  7685. @anchor{frei0r}
  7686. @section frei0r
  7687. Apply a frei0r effect to the input video.
  7688. To enable the compilation of this filter, you need to install the frei0r
  7689. header and configure FFmpeg with @code{--enable-frei0r}.
  7690. It accepts the following parameters:
  7691. @table @option
  7692. @item filter_name
  7693. The name of the frei0r effect to load. If the environment variable
  7694. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7695. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7696. Otherwise, the standard frei0r paths are searched, in this order:
  7697. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7698. @file{/usr/lib/frei0r-1/}.
  7699. @item filter_params
  7700. A '|'-separated list of parameters to pass to the frei0r effect.
  7701. @end table
  7702. A frei0r effect parameter can be a boolean (its value is either
  7703. "y" or "n"), a double, a color (specified as
  7704. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7705. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7706. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7707. a position (specified as @var{X}/@var{Y}, where
  7708. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7709. The number and types of parameters depend on the loaded effect. If an
  7710. effect parameter is not specified, the default value is set.
  7711. @subsection Examples
  7712. @itemize
  7713. @item
  7714. Apply the distort0r effect, setting the first two double parameters:
  7715. @example
  7716. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7717. @end example
  7718. @item
  7719. Apply the colordistance effect, taking a color as the first parameter:
  7720. @example
  7721. frei0r=colordistance:0.2/0.3/0.4
  7722. frei0r=colordistance:violet
  7723. frei0r=colordistance:0x112233
  7724. @end example
  7725. @item
  7726. Apply the perspective effect, specifying the top left and top right image
  7727. positions:
  7728. @example
  7729. frei0r=perspective:0.2/0.2|0.8/0.2
  7730. @end example
  7731. @end itemize
  7732. For more information, see
  7733. @url{http://frei0r.dyne.org}
  7734. @section fspp
  7735. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7736. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7737. processing filter, one of them is performed once per block, not per pixel.
  7738. This allows for much higher speed.
  7739. The filter accepts the following options:
  7740. @table @option
  7741. @item quality
  7742. Set quality. This option defines the number of levels for averaging. It accepts
  7743. an integer in the range 4-5. Default value is @code{4}.
  7744. @item qp
  7745. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7746. If not set, the filter will use the QP from the video stream (if available).
  7747. @item strength
  7748. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7749. more details but also more artifacts, while higher values make the image smoother
  7750. but also blurrier. Default value is @code{0} − PSNR optimal.
  7751. @item use_bframe_qp
  7752. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7753. option may cause flicker since the B-Frames have often larger QP. Default is
  7754. @code{0} (not enabled).
  7755. @end table
  7756. @section gblur
  7757. Apply Gaussian blur filter.
  7758. The filter accepts the following options:
  7759. @table @option
  7760. @item sigma
  7761. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7762. @item steps
  7763. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7764. @item planes
  7765. Set which planes to filter. By default all planes are filtered.
  7766. @item sigmaV
  7767. Set vertical sigma, if negative it will be same as @code{sigma}.
  7768. Default is @code{-1}.
  7769. @end table
  7770. @section geq
  7771. Apply generic equation to each pixel.
  7772. The filter accepts the following options:
  7773. @table @option
  7774. @item lum_expr, lum
  7775. Set the luminance expression.
  7776. @item cb_expr, cb
  7777. Set the chrominance blue expression.
  7778. @item cr_expr, cr
  7779. Set the chrominance red expression.
  7780. @item alpha_expr, a
  7781. Set the alpha expression.
  7782. @item red_expr, r
  7783. Set the red expression.
  7784. @item green_expr, g
  7785. Set the green expression.
  7786. @item blue_expr, b
  7787. Set the blue expression.
  7788. @end table
  7789. The colorspace is selected according to the specified options. If one
  7790. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7791. options is specified, the filter will automatically select a YCbCr
  7792. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7793. @option{blue_expr} options is specified, it will select an RGB
  7794. colorspace.
  7795. If one of the chrominance expression is not defined, it falls back on the other
  7796. one. If no alpha expression is specified it will evaluate to opaque value.
  7797. If none of chrominance expressions are specified, they will evaluate
  7798. to the luminance expression.
  7799. The expressions can use the following variables and functions:
  7800. @table @option
  7801. @item N
  7802. The sequential number of the filtered frame, starting from @code{0}.
  7803. @item X
  7804. @item Y
  7805. The coordinates of the current sample.
  7806. @item W
  7807. @item H
  7808. The width and height of the image.
  7809. @item SW
  7810. @item SH
  7811. Width and height scale depending on the currently filtered plane. It is the
  7812. ratio between the corresponding luma plane number of pixels and the current
  7813. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7814. @code{0.5,0.5} for chroma planes.
  7815. @item T
  7816. Time of the current frame, expressed in seconds.
  7817. @item p(x, y)
  7818. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7819. plane.
  7820. @item lum(x, y)
  7821. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7822. plane.
  7823. @item cb(x, y)
  7824. Return the value of the pixel at location (@var{x},@var{y}) of the
  7825. blue-difference chroma plane. Return 0 if there is no such plane.
  7826. @item cr(x, y)
  7827. Return the value of the pixel at location (@var{x},@var{y}) of the
  7828. red-difference chroma plane. Return 0 if there is no such plane.
  7829. @item r(x, y)
  7830. @item g(x, y)
  7831. @item b(x, y)
  7832. Return the value of the pixel at location (@var{x},@var{y}) of the
  7833. red/green/blue component. Return 0 if there is no such component.
  7834. @item alpha(x, y)
  7835. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7836. plane. Return 0 if there is no such plane.
  7837. @end table
  7838. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7839. automatically clipped to the closer edge.
  7840. @subsection Examples
  7841. @itemize
  7842. @item
  7843. Flip the image horizontally:
  7844. @example
  7845. geq=p(W-X\,Y)
  7846. @end example
  7847. @item
  7848. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7849. wavelength of 100 pixels:
  7850. @example
  7851. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7852. @end example
  7853. @item
  7854. Generate a fancy enigmatic moving light:
  7855. @example
  7856. 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
  7857. @end example
  7858. @item
  7859. Generate a quick emboss effect:
  7860. @example
  7861. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7862. @end example
  7863. @item
  7864. Modify RGB components depending on pixel position:
  7865. @example
  7866. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7867. @end example
  7868. @item
  7869. Create a radial gradient that is the same size as the input (also see
  7870. the @ref{vignette} filter):
  7871. @example
  7872. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7873. @end example
  7874. @end itemize
  7875. @section gradfun
  7876. Fix the banding artifacts that are sometimes introduced into nearly flat
  7877. regions by truncation to 8-bit color depth.
  7878. Interpolate the gradients that should go where the bands are, and
  7879. dither them.
  7880. It is designed for playback only. Do not use it prior to
  7881. lossy compression, because compression tends to lose the dither and
  7882. bring back the bands.
  7883. It accepts the following parameters:
  7884. @table @option
  7885. @item strength
  7886. The maximum amount by which the filter will change any one pixel. This is also
  7887. the threshold for detecting nearly flat regions. Acceptable values range from
  7888. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7889. valid range.
  7890. @item radius
  7891. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7892. gradients, but also prevents the filter from modifying the pixels near detailed
  7893. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7894. values will be clipped to the valid range.
  7895. @end table
  7896. Alternatively, the options can be specified as a flat string:
  7897. @var{strength}[:@var{radius}]
  7898. @subsection Examples
  7899. @itemize
  7900. @item
  7901. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7902. @example
  7903. gradfun=3.5:8
  7904. @end example
  7905. @item
  7906. Specify radius, omitting the strength (which will fall-back to the default
  7907. value):
  7908. @example
  7909. gradfun=radius=8
  7910. @end example
  7911. @end itemize
  7912. @section graphmonitor, agraphmonitor
  7913. Show various filtergraph stats.
  7914. With this filter one can debug complete filtergraph.
  7915. Especially issues with links filling with queued frames.
  7916. The filter accepts the following options:
  7917. @table @option
  7918. @item size, s
  7919. Set video output size. Default is @var{hd720}.
  7920. @item opacity, o
  7921. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  7922. @item mode, m
  7923. Set output mode, can be @var{fulll} or @var{compact}.
  7924. In @var{compact} mode only filters with some queued frames have displayed stats.
  7925. @item flags, f
  7926. Set flags which enable which stats are shown in video.
  7927. Available values for flags are:
  7928. @table @samp
  7929. @item queue
  7930. Display number of queued frames in each link.
  7931. @item frame_count_in
  7932. Display number of frames taken from filter.
  7933. @item frame_count_out
  7934. Display number of frames given out from filter.
  7935. @item pts
  7936. Display current filtered frame pts.
  7937. @item time
  7938. Display current filtered frame time.
  7939. @item timebase
  7940. Display time base for filter link.
  7941. @item format
  7942. Display used format for filter link.
  7943. @item size
  7944. Display video size or number of audio channels in case of audio used by filter link.
  7945. @item rate
  7946. Display video frame rate or sample rate in case of audio used by filter link.
  7947. @end table
  7948. @item rate, r
  7949. Set upper limit for video rate of output stream, Default value is @var{25}.
  7950. This guarantee that output video frame rate will not be higher than this value.
  7951. @end table
  7952. @section greyedge
  7953. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  7954. and corrects the scene colors accordingly.
  7955. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  7956. The filter accepts the following options:
  7957. @table @option
  7958. @item difford
  7959. The order of differentiation to be applied on the scene. Must be chosen in the range
  7960. [0,2] and default value is 1.
  7961. @item minknorm
  7962. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  7963. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  7964. max value instead of calculating Minkowski distance.
  7965. @item sigma
  7966. The standard deviation of Gaussian blur to be applied on the scene. Must be
  7967. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  7968. can't be euqal to 0 if @var{difford} is greater than 0.
  7969. @end table
  7970. @subsection Examples
  7971. @itemize
  7972. @item
  7973. Grey Edge:
  7974. @example
  7975. greyedge=difford=1:minknorm=5:sigma=2
  7976. @end example
  7977. @item
  7978. Max Edge:
  7979. @example
  7980. greyedge=difford=1:minknorm=0:sigma=2
  7981. @end example
  7982. @end itemize
  7983. @anchor{haldclut}
  7984. @section haldclut
  7985. Apply a Hald CLUT to a video stream.
  7986. First input is the video stream to process, and second one is the Hald CLUT.
  7987. The Hald CLUT input can be a simple picture or a complete video stream.
  7988. The filter accepts the following options:
  7989. @table @option
  7990. @item shortest
  7991. Force termination when the shortest input terminates. Default is @code{0}.
  7992. @item repeatlast
  7993. Continue applying the last CLUT after the end of the stream. A value of
  7994. @code{0} disable the filter after the last frame of the CLUT is reached.
  7995. Default is @code{1}.
  7996. @end table
  7997. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7998. filters share the same internals).
  7999. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8000. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8001. @subsection Workflow examples
  8002. @subsubsection Hald CLUT video stream
  8003. Generate an identity Hald CLUT stream altered with various effects:
  8004. @example
  8005. 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
  8006. @end example
  8007. Note: make sure you use a lossless codec.
  8008. Then use it with @code{haldclut} to apply it on some random stream:
  8009. @example
  8010. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8011. @end example
  8012. The Hald CLUT will be applied to the 10 first seconds (duration of
  8013. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8014. to the remaining frames of the @code{mandelbrot} stream.
  8015. @subsubsection Hald CLUT with preview
  8016. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8017. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8018. biggest possible square starting at the top left of the picture. The remaining
  8019. padding pixels (bottom or right) will be ignored. This area can be used to add
  8020. a preview of the Hald CLUT.
  8021. Typically, the following generated Hald CLUT will be supported by the
  8022. @code{haldclut} filter:
  8023. @example
  8024. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8025. pad=iw+320 [padded_clut];
  8026. smptebars=s=320x256, split [a][b];
  8027. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8028. [main][b] overlay=W-320" -frames:v 1 clut.png
  8029. @end example
  8030. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8031. bars are displayed on the right-top, and below the same color bars processed by
  8032. the color changes.
  8033. Then, the effect of this Hald CLUT can be visualized with:
  8034. @example
  8035. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8036. @end example
  8037. @section hflip
  8038. Flip the input video horizontally.
  8039. For example, to horizontally flip the input video with @command{ffmpeg}:
  8040. @example
  8041. ffmpeg -i in.avi -vf "hflip" out.avi
  8042. @end example
  8043. @section histeq
  8044. This filter applies a global color histogram equalization on a
  8045. per-frame basis.
  8046. It can be used to correct video that has a compressed range of pixel
  8047. intensities. The filter redistributes the pixel intensities to
  8048. equalize their distribution across the intensity range. It may be
  8049. viewed as an "automatically adjusting contrast filter". This filter is
  8050. useful only for correcting degraded or poorly captured source
  8051. video.
  8052. The filter accepts the following options:
  8053. @table @option
  8054. @item strength
  8055. Determine the amount of equalization to be applied. As the strength
  8056. is reduced, the distribution of pixel intensities more-and-more
  8057. approaches that of the input frame. The value must be a float number
  8058. in the range [0,1] and defaults to 0.200.
  8059. @item intensity
  8060. Set the maximum intensity that can generated and scale the output
  8061. values appropriately. The strength should be set as desired and then
  8062. the intensity can be limited if needed to avoid washing-out. The value
  8063. must be a float number in the range [0,1] and defaults to 0.210.
  8064. @item antibanding
  8065. Set the antibanding level. If enabled the filter will randomly vary
  8066. the luminance of output pixels by a small amount to avoid banding of
  8067. the histogram. Possible values are @code{none}, @code{weak} or
  8068. @code{strong}. It defaults to @code{none}.
  8069. @end table
  8070. @section histogram
  8071. Compute and draw a color distribution histogram for the input video.
  8072. The computed histogram is a representation of the color component
  8073. distribution in an image.
  8074. Standard histogram displays the color components distribution in an image.
  8075. Displays color graph for each color component. Shows distribution of
  8076. the Y, U, V, A or R, G, B components, depending on input format, in the
  8077. current frame. Below each graph a color component scale meter is shown.
  8078. The filter accepts the following options:
  8079. @table @option
  8080. @item level_height
  8081. Set height of level. Default value is @code{200}.
  8082. Allowed range is [50, 2048].
  8083. @item scale_height
  8084. Set height of color scale. Default value is @code{12}.
  8085. Allowed range is [0, 40].
  8086. @item display_mode
  8087. Set display mode.
  8088. It accepts the following values:
  8089. @table @samp
  8090. @item stack
  8091. Per color component graphs are placed below each other.
  8092. @item parade
  8093. Per color component graphs are placed side by side.
  8094. @item overlay
  8095. Presents information identical to that in the @code{parade}, except
  8096. that the graphs representing color components are superimposed directly
  8097. over one another.
  8098. @end table
  8099. Default is @code{stack}.
  8100. @item levels_mode
  8101. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8102. Default is @code{linear}.
  8103. @item components
  8104. Set what color components to display.
  8105. Default is @code{7}.
  8106. @item fgopacity
  8107. Set foreground opacity. Default is @code{0.7}.
  8108. @item bgopacity
  8109. Set background opacity. Default is @code{0.5}.
  8110. @end table
  8111. @subsection Examples
  8112. @itemize
  8113. @item
  8114. Calculate and draw histogram:
  8115. @example
  8116. ffplay -i input -vf histogram
  8117. @end example
  8118. @end itemize
  8119. @anchor{hqdn3d}
  8120. @section hqdn3d
  8121. This is a high precision/quality 3d denoise filter. It aims to reduce
  8122. image noise, producing smooth images and making still images really
  8123. still. It should enhance compressibility.
  8124. It accepts the following optional parameters:
  8125. @table @option
  8126. @item luma_spatial
  8127. A non-negative floating point number which specifies spatial luma strength.
  8128. It defaults to 4.0.
  8129. @item chroma_spatial
  8130. A non-negative floating point number which specifies spatial chroma strength.
  8131. It defaults to 3.0*@var{luma_spatial}/4.0.
  8132. @item luma_tmp
  8133. A floating point number which specifies luma temporal strength. It defaults to
  8134. 6.0*@var{luma_spatial}/4.0.
  8135. @item chroma_tmp
  8136. A floating point number which specifies chroma temporal strength. It defaults to
  8137. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8138. @end table
  8139. @anchor{hwdownload}
  8140. @section hwdownload
  8141. Download hardware frames to system memory.
  8142. The input must be in hardware frames, and the output a non-hardware format.
  8143. Not all formats will be supported on the output - it may be necessary to insert
  8144. an additional @option{format} filter immediately following in the graph to get
  8145. the output in a supported format.
  8146. @section hwmap
  8147. Map hardware frames to system memory or to another device.
  8148. This filter has several different modes of operation; which one is used depends
  8149. on the input and output formats:
  8150. @itemize
  8151. @item
  8152. Hardware frame input, normal frame output
  8153. Map the input frames to system memory and pass them to the output. If the
  8154. original hardware frame is later required (for example, after overlaying
  8155. something else on part of it), the @option{hwmap} filter can be used again
  8156. in the next mode to retrieve it.
  8157. @item
  8158. Normal frame input, hardware frame output
  8159. If the input is actually a software-mapped hardware frame, then unmap it -
  8160. that is, return the original hardware frame.
  8161. Otherwise, a device must be provided. Create new hardware surfaces on that
  8162. device for the output, then map them back to the software format at the input
  8163. and give those frames to the preceding filter. This will then act like the
  8164. @option{hwupload} filter, but may be able to avoid an additional copy when
  8165. the input is already in a compatible format.
  8166. @item
  8167. Hardware frame input and output
  8168. A device must be supplied for the output, either directly or with the
  8169. @option{derive_device} option. The input and output devices must be of
  8170. different types and compatible - the exact meaning of this is
  8171. system-dependent, but typically it means that they must refer to the same
  8172. underlying hardware context (for example, refer to the same graphics card).
  8173. If the input frames were originally created on the output device, then unmap
  8174. to retrieve the original frames.
  8175. Otherwise, map the frames to the output device - create new hardware frames
  8176. on the output corresponding to the frames on the input.
  8177. @end itemize
  8178. The following additional parameters are accepted:
  8179. @table @option
  8180. @item mode
  8181. Set the frame mapping mode. Some combination of:
  8182. @table @var
  8183. @item read
  8184. The mapped frame should be readable.
  8185. @item write
  8186. The mapped frame should be writeable.
  8187. @item overwrite
  8188. The mapping will always overwrite the entire frame.
  8189. This may improve performance in some cases, as the original contents of the
  8190. frame need not be loaded.
  8191. @item direct
  8192. The mapping must not involve any copying.
  8193. Indirect mappings to copies of frames are created in some cases where either
  8194. direct mapping is not possible or it would have unexpected properties.
  8195. Setting this flag ensures that the mapping is direct and will fail if that is
  8196. not possible.
  8197. @end table
  8198. Defaults to @var{read+write} if not specified.
  8199. @item derive_device @var{type}
  8200. Rather than using the device supplied at initialisation, instead derive a new
  8201. device of type @var{type} from the device the input frames exist on.
  8202. @item reverse
  8203. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8204. and map them back to the source. This may be necessary in some cases where
  8205. a mapping in one direction is required but only the opposite direction is
  8206. supported by the devices being used.
  8207. This option is dangerous - it may break the preceding filter in undefined
  8208. ways if there are any additional constraints on that filter's output.
  8209. Do not use it without fully understanding the implications of its use.
  8210. @end table
  8211. @anchor{hwupload}
  8212. @section hwupload
  8213. Upload system memory frames to hardware surfaces.
  8214. The device to upload to must be supplied when the filter is initialised. If
  8215. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8216. option.
  8217. @anchor{hwupload_cuda}
  8218. @section hwupload_cuda
  8219. Upload system memory frames to a CUDA device.
  8220. It accepts the following optional parameters:
  8221. @table @option
  8222. @item device
  8223. The number of the CUDA device to use
  8224. @end table
  8225. @section hqx
  8226. Apply a high-quality magnification filter designed for pixel art. This filter
  8227. was originally created by Maxim Stepin.
  8228. It accepts the following option:
  8229. @table @option
  8230. @item n
  8231. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8232. @code{hq3x} and @code{4} for @code{hq4x}.
  8233. Default is @code{3}.
  8234. @end table
  8235. @section hstack
  8236. Stack input videos horizontally.
  8237. All streams must be of same pixel format and of same height.
  8238. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8239. to create same output.
  8240. The filter accept the following option:
  8241. @table @option
  8242. @item inputs
  8243. Set number of input streams. Default is 2.
  8244. @item shortest
  8245. If set to 1, force the output to terminate when the shortest input
  8246. terminates. Default value is 0.
  8247. @end table
  8248. @section hue
  8249. Modify the hue and/or the saturation of the input.
  8250. It accepts the following parameters:
  8251. @table @option
  8252. @item h
  8253. Specify the hue angle as a number of degrees. It accepts an expression,
  8254. and defaults to "0".
  8255. @item s
  8256. Specify the saturation in the [-10,10] range. It accepts an expression and
  8257. defaults to "1".
  8258. @item H
  8259. Specify the hue angle as a number of radians. It accepts an
  8260. expression, and defaults to "0".
  8261. @item b
  8262. Specify the brightness in the [-10,10] range. It accepts an expression and
  8263. defaults to "0".
  8264. @end table
  8265. @option{h} and @option{H} are mutually exclusive, and can't be
  8266. specified at the same time.
  8267. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8268. expressions containing the following constants:
  8269. @table @option
  8270. @item n
  8271. frame count of the input frame starting from 0
  8272. @item pts
  8273. presentation timestamp of the input frame expressed in time base units
  8274. @item r
  8275. frame rate of the input video, NAN if the input frame rate is unknown
  8276. @item t
  8277. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8278. @item tb
  8279. time base of the input video
  8280. @end table
  8281. @subsection Examples
  8282. @itemize
  8283. @item
  8284. Set the hue to 90 degrees and the saturation to 1.0:
  8285. @example
  8286. hue=h=90:s=1
  8287. @end example
  8288. @item
  8289. Same command but expressing the hue in radians:
  8290. @example
  8291. hue=H=PI/2:s=1
  8292. @end example
  8293. @item
  8294. Rotate hue and make the saturation swing between 0
  8295. and 2 over a period of 1 second:
  8296. @example
  8297. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8298. @end example
  8299. @item
  8300. Apply a 3 seconds saturation fade-in effect starting at 0:
  8301. @example
  8302. hue="s=min(t/3\,1)"
  8303. @end example
  8304. The general fade-in expression can be written as:
  8305. @example
  8306. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8307. @end example
  8308. @item
  8309. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8310. @example
  8311. hue="s=max(0\, min(1\, (8-t)/3))"
  8312. @end example
  8313. The general fade-out expression can be written as:
  8314. @example
  8315. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8316. @end example
  8317. @end itemize
  8318. @subsection Commands
  8319. This filter supports the following commands:
  8320. @table @option
  8321. @item b
  8322. @item s
  8323. @item h
  8324. @item H
  8325. Modify the hue and/or the saturation and/or brightness of the input video.
  8326. The command accepts the same syntax of the corresponding option.
  8327. If the specified expression is not valid, it is kept at its current
  8328. value.
  8329. @end table
  8330. @section hysteresis
  8331. Grow first stream into second stream by connecting components.
  8332. This makes it possible to build more robust edge masks.
  8333. This filter accepts the following options:
  8334. @table @option
  8335. @item planes
  8336. Set which planes will be processed as bitmap, unprocessed planes will be
  8337. copied from first stream.
  8338. By default value 0xf, all planes will be processed.
  8339. @item threshold
  8340. Set threshold which is used in filtering. If pixel component value is higher than
  8341. this value filter algorithm for connecting components is activated.
  8342. By default value is 0.
  8343. @end table
  8344. @section idet
  8345. Detect video interlacing type.
  8346. This filter tries to detect if the input frames are interlaced, progressive,
  8347. top or bottom field first. It will also try to detect fields that are
  8348. repeated between adjacent frames (a sign of telecine).
  8349. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8350. Multiple frame detection incorporates the classification history of previous frames.
  8351. The filter will log these metadata values:
  8352. @table @option
  8353. @item single.current_frame
  8354. Detected type of current frame using single-frame detection. One of:
  8355. ``tff'' (top field first), ``bff'' (bottom field first),
  8356. ``progressive'', or ``undetermined''
  8357. @item single.tff
  8358. Cumulative number of frames detected as top field first using single-frame detection.
  8359. @item multiple.tff
  8360. Cumulative number of frames detected as top field first using multiple-frame detection.
  8361. @item single.bff
  8362. Cumulative number of frames detected as bottom field first using single-frame detection.
  8363. @item multiple.current_frame
  8364. Detected type of current frame using multiple-frame detection. One of:
  8365. ``tff'' (top field first), ``bff'' (bottom field first),
  8366. ``progressive'', or ``undetermined''
  8367. @item multiple.bff
  8368. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8369. @item single.progressive
  8370. Cumulative number of frames detected as progressive using single-frame detection.
  8371. @item multiple.progressive
  8372. Cumulative number of frames detected as progressive using multiple-frame detection.
  8373. @item single.undetermined
  8374. Cumulative number of frames that could not be classified using single-frame detection.
  8375. @item multiple.undetermined
  8376. Cumulative number of frames that could not be classified using multiple-frame detection.
  8377. @item repeated.current_frame
  8378. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8379. @item repeated.neither
  8380. Cumulative number of frames with no repeated field.
  8381. @item repeated.top
  8382. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8383. @item repeated.bottom
  8384. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8385. @end table
  8386. The filter accepts the following options:
  8387. @table @option
  8388. @item intl_thres
  8389. Set interlacing threshold.
  8390. @item prog_thres
  8391. Set progressive threshold.
  8392. @item rep_thres
  8393. Threshold for repeated field detection.
  8394. @item half_life
  8395. Number of frames after which a given frame's contribution to the
  8396. statistics is halved (i.e., it contributes only 0.5 to its
  8397. classification). The default of 0 means that all frames seen are given
  8398. full weight of 1.0 forever.
  8399. @item analyze_interlaced_flag
  8400. When this is not 0 then idet will use the specified number of frames to determine
  8401. if the interlaced flag is accurate, it will not count undetermined frames.
  8402. If the flag is found to be accurate it will be used without any further
  8403. computations, if it is found to be inaccurate it will be cleared without any
  8404. further computations. This allows inserting the idet filter as a low computational
  8405. method to clean up the interlaced flag
  8406. @end table
  8407. @section il
  8408. Deinterleave or interleave fields.
  8409. This filter allows one to process interlaced images fields without
  8410. deinterlacing them. Deinterleaving splits the input frame into 2
  8411. fields (so called half pictures). Odd lines are moved to the top
  8412. half of the output image, even lines to the bottom half.
  8413. You can process (filter) them independently and then re-interleave them.
  8414. The filter accepts the following options:
  8415. @table @option
  8416. @item luma_mode, l
  8417. @item chroma_mode, c
  8418. @item alpha_mode, a
  8419. Available values for @var{luma_mode}, @var{chroma_mode} and
  8420. @var{alpha_mode} are:
  8421. @table @samp
  8422. @item none
  8423. Do nothing.
  8424. @item deinterleave, d
  8425. Deinterleave fields, placing one above the other.
  8426. @item interleave, i
  8427. Interleave fields. Reverse the effect of deinterleaving.
  8428. @end table
  8429. Default value is @code{none}.
  8430. @item luma_swap, ls
  8431. @item chroma_swap, cs
  8432. @item alpha_swap, as
  8433. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8434. @end table
  8435. @section inflate
  8436. Apply inflate effect to the video.
  8437. This filter replaces the pixel by the local(3x3) average by taking into account
  8438. only values higher than the pixel.
  8439. It accepts the following options:
  8440. @table @option
  8441. @item threshold0
  8442. @item threshold1
  8443. @item threshold2
  8444. @item threshold3
  8445. Limit the maximum change for each plane, default is 65535.
  8446. If 0, plane will remain unchanged.
  8447. @end table
  8448. @section interlace
  8449. Simple interlacing filter from progressive contents. This interleaves upper (or
  8450. lower) lines from odd frames with lower (or upper) lines from even frames,
  8451. halving the frame rate and preserving image height.
  8452. @example
  8453. Original Original New Frame
  8454. Frame 'j' Frame 'j+1' (tff)
  8455. ========== =========== ==================
  8456. Line 0 --------------------> Frame 'j' Line 0
  8457. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8458. Line 2 ---------------------> Frame 'j' Line 2
  8459. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8460. ... ... ...
  8461. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8462. @end example
  8463. It accepts the following optional parameters:
  8464. @table @option
  8465. @item scan
  8466. This determines whether the interlaced frame is taken from the even
  8467. (tff - default) or odd (bff) lines of the progressive frame.
  8468. @item lowpass
  8469. Vertical lowpass filter to avoid twitter interlacing and
  8470. reduce moire patterns.
  8471. @table @samp
  8472. @item 0, off
  8473. Disable vertical lowpass filter
  8474. @item 1, linear
  8475. Enable linear filter (default)
  8476. @item 2, complex
  8477. Enable complex filter. This will slightly less reduce twitter and moire
  8478. but better retain detail and subjective sharpness impression.
  8479. @end table
  8480. @end table
  8481. @section kerndeint
  8482. Deinterlace input video by applying Donald Graft's adaptive kernel
  8483. deinterling. Work on interlaced parts of a video to produce
  8484. progressive frames.
  8485. The description of the accepted parameters follows.
  8486. @table @option
  8487. @item thresh
  8488. Set the threshold which affects the filter's tolerance when
  8489. determining if a pixel line must be processed. It must be an integer
  8490. in the range [0,255] and defaults to 10. A value of 0 will result in
  8491. applying the process on every pixels.
  8492. @item map
  8493. Paint pixels exceeding the threshold value to white if set to 1.
  8494. Default is 0.
  8495. @item order
  8496. Set the fields order. Swap fields if set to 1, leave fields alone if
  8497. 0. Default is 0.
  8498. @item sharp
  8499. Enable additional sharpening if set to 1. Default is 0.
  8500. @item twoway
  8501. Enable twoway sharpening if set to 1. Default is 0.
  8502. @end table
  8503. @subsection Examples
  8504. @itemize
  8505. @item
  8506. Apply default values:
  8507. @example
  8508. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8509. @end example
  8510. @item
  8511. Enable additional sharpening:
  8512. @example
  8513. kerndeint=sharp=1
  8514. @end example
  8515. @item
  8516. Paint processed pixels in white:
  8517. @example
  8518. kerndeint=map=1
  8519. @end example
  8520. @end itemize
  8521. @section lenscorrection
  8522. Correct radial lens distortion
  8523. This filter can be used to correct for radial distortion as can result from the use
  8524. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8525. one can use tools available for example as part of opencv or simply trial-and-error.
  8526. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8527. and extract the k1 and k2 coefficients from the resulting matrix.
  8528. Note that effectively the same filter is available in the open-source tools Krita and
  8529. Digikam from the KDE project.
  8530. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8531. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8532. brightness distribution, so you may want to use both filters together in certain
  8533. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8534. be applied before or after lens correction.
  8535. @subsection Options
  8536. The filter accepts the following options:
  8537. @table @option
  8538. @item cx
  8539. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8540. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8541. width. Default is 0.5.
  8542. @item cy
  8543. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8544. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8545. height. Default is 0.5.
  8546. @item k1
  8547. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8548. no correction. Default is 0.
  8549. @item k2
  8550. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8551. 0 means no correction. Default is 0.
  8552. @end table
  8553. The formula that generates the correction is:
  8554. @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)
  8555. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8556. distances from the focal point in the source and target images, respectively.
  8557. @section lensfun
  8558. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8559. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8560. to apply the lens correction. The filter will load the lensfun database and
  8561. query it to find the corresponding camera and lens entries in the database. As
  8562. long as these entries can be found with the given options, the filter can
  8563. perform corrections on frames. Note that incomplete strings will result in the
  8564. filter choosing the best match with the given options, and the filter will
  8565. output the chosen camera and lens models (logged with level "info"). You must
  8566. provide the make, camera model, and lens model as they are required.
  8567. The filter accepts the following options:
  8568. @table @option
  8569. @item make
  8570. The make of the camera (for example, "Canon"). This option is required.
  8571. @item model
  8572. The model of the camera (for example, "Canon EOS 100D"). This option is
  8573. required.
  8574. @item lens_model
  8575. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8576. option is required.
  8577. @item mode
  8578. The type of correction to apply. The following values are valid options:
  8579. @table @samp
  8580. @item vignetting
  8581. Enables fixing lens vignetting.
  8582. @item geometry
  8583. Enables fixing lens geometry. This is the default.
  8584. @item subpixel
  8585. Enables fixing chromatic aberrations.
  8586. @item vig_geo
  8587. Enables fixing lens vignetting and lens geometry.
  8588. @item vig_subpixel
  8589. Enables fixing lens vignetting and chromatic aberrations.
  8590. @item distortion
  8591. Enables fixing both lens geometry and chromatic aberrations.
  8592. @item all
  8593. Enables all possible corrections.
  8594. @end table
  8595. @item focal_length
  8596. The focal length of the image/video (zoom; expected constant for video). For
  8597. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8598. range should be chosen when using that lens. Default 18.
  8599. @item aperture
  8600. The aperture of the image/video (expected constant for video). Note that
  8601. aperture is only used for vignetting correction. Default 3.5.
  8602. @item focus_distance
  8603. The focus distance of the image/video (expected constant for video). Note that
  8604. focus distance is only used for vignetting and only slightly affects the
  8605. vignetting correction process. If unknown, leave it at the default value (which
  8606. is 1000).
  8607. @item target_geometry
  8608. The target geometry of the output image/video. The following values are valid
  8609. options:
  8610. @table @samp
  8611. @item rectilinear (default)
  8612. @item fisheye
  8613. @item panoramic
  8614. @item equirectangular
  8615. @item fisheye_orthographic
  8616. @item fisheye_stereographic
  8617. @item fisheye_equisolid
  8618. @item fisheye_thoby
  8619. @end table
  8620. @item reverse
  8621. Apply the reverse of image correction (instead of correcting distortion, apply
  8622. it).
  8623. @item interpolation
  8624. The type of interpolation used when correcting distortion. The following values
  8625. are valid options:
  8626. @table @samp
  8627. @item nearest
  8628. @item linear (default)
  8629. @item lanczos
  8630. @end table
  8631. @end table
  8632. @subsection Examples
  8633. @itemize
  8634. @item
  8635. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  8636. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  8637. aperture of "8.0".
  8638. @example
  8639. 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
  8640. @end example
  8641. @item
  8642. Apply the same as before, but only for the first 5 seconds of video.
  8643. @example
  8644. 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
  8645. @end example
  8646. @end itemize
  8647. @section libvmaf
  8648. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8649. score between two input videos.
  8650. The obtained VMAF score is printed through the logging system.
  8651. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8652. After installing the library it can be enabled using:
  8653. @code{./configure --enable-libvmaf --enable-version3}.
  8654. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8655. The filter has following options:
  8656. @table @option
  8657. @item model_path
  8658. Set the model path which is to be used for SVM.
  8659. Default value: @code{"vmaf_v0.6.1.pkl"}
  8660. @item log_path
  8661. Set the file path to be used to store logs.
  8662. @item log_fmt
  8663. Set the format of the log file (xml or json).
  8664. @item enable_transform
  8665. Enables transform for computing vmaf.
  8666. @item phone_model
  8667. Invokes the phone model which will generate VMAF scores higher than in the
  8668. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8669. @item psnr
  8670. Enables computing psnr along with vmaf.
  8671. @item ssim
  8672. Enables computing ssim along with vmaf.
  8673. @item ms_ssim
  8674. Enables computing ms_ssim along with vmaf.
  8675. @item pool
  8676. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8677. @item n_threads
  8678. Set number of threads to be used when computing vmaf.
  8679. @item n_subsample
  8680. Set interval for frame subsampling used when computing vmaf.
  8681. @item enable_conf_interval
  8682. Enables confidence interval.
  8683. @end table
  8684. This filter also supports the @ref{framesync} options.
  8685. On the below examples the input file @file{main.mpg} being processed is
  8686. compared with the reference file @file{ref.mpg}.
  8687. @example
  8688. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8689. @end example
  8690. Example with options:
  8691. @example
  8692. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  8693. @end example
  8694. @section limiter
  8695. Limits the pixel components values to the specified range [min, max].
  8696. The filter accepts the following options:
  8697. @table @option
  8698. @item min
  8699. Lower bound. Defaults to the lowest allowed value for the input.
  8700. @item max
  8701. Upper bound. Defaults to the highest allowed value for the input.
  8702. @item planes
  8703. Specify which planes will be processed. Defaults to all available.
  8704. @end table
  8705. @section loop
  8706. Loop video frames.
  8707. The filter accepts the following options:
  8708. @table @option
  8709. @item loop
  8710. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8711. Default is 0.
  8712. @item size
  8713. Set maximal size in number of frames. Default is 0.
  8714. @item start
  8715. Set first frame of loop. Default is 0.
  8716. @end table
  8717. @subsection Examples
  8718. @itemize
  8719. @item
  8720. Loop single first frame infinitely:
  8721. @example
  8722. loop=loop=-1:size=1:start=0
  8723. @end example
  8724. @item
  8725. Loop single first frame 10 times:
  8726. @example
  8727. loop=loop=10:size=1:start=0
  8728. @end example
  8729. @item
  8730. Loop 10 first frames 5 times:
  8731. @example
  8732. loop=loop=5:size=10:start=0
  8733. @end example
  8734. @end itemize
  8735. @section lut1d
  8736. Apply a 1D LUT to an input video.
  8737. The filter accepts the following options:
  8738. @table @option
  8739. @item file
  8740. Set the 1D LUT file name.
  8741. Currently supported formats:
  8742. @table @samp
  8743. @item cube
  8744. Iridas
  8745. @end table
  8746. @item interp
  8747. Select interpolation mode.
  8748. Available values are:
  8749. @table @samp
  8750. @item nearest
  8751. Use values from the nearest defined point.
  8752. @item linear
  8753. Interpolate values using the linear interpolation.
  8754. @item cosine
  8755. Interpolate values using the cosine interpolation.
  8756. @item cubic
  8757. Interpolate values using the cubic interpolation.
  8758. @item spline
  8759. Interpolate values using the spline interpolation.
  8760. @end table
  8761. @end table
  8762. @anchor{lut3d}
  8763. @section lut3d
  8764. Apply a 3D LUT to an input video.
  8765. The filter accepts the following options:
  8766. @table @option
  8767. @item file
  8768. Set the 3D LUT file name.
  8769. Currently supported formats:
  8770. @table @samp
  8771. @item 3dl
  8772. AfterEffects
  8773. @item cube
  8774. Iridas
  8775. @item dat
  8776. DaVinci
  8777. @item m3d
  8778. Pandora
  8779. @end table
  8780. @item interp
  8781. Select interpolation mode.
  8782. Available values are:
  8783. @table @samp
  8784. @item nearest
  8785. Use values from the nearest defined point.
  8786. @item trilinear
  8787. Interpolate values using the 8 points defining a cube.
  8788. @item tetrahedral
  8789. Interpolate values using a tetrahedron.
  8790. @end table
  8791. @end table
  8792. This filter also supports the @ref{framesync} options.
  8793. @section lumakey
  8794. Turn certain luma values into transparency.
  8795. The filter accepts the following options:
  8796. @table @option
  8797. @item threshold
  8798. Set the luma which will be used as base for transparency.
  8799. Default value is @code{0}.
  8800. @item tolerance
  8801. Set the range of luma values to be keyed out.
  8802. Default value is @code{0}.
  8803. @item softness
  8804. Set the range of softness. Default value is @code{0}.
  8805. Use this to control gradual transition from zero to full transparency.
  8806. @end table
  8807. @section lut, lutrgb, lutyuv
  8808. Compute a look-up table for binding each pixel component input value
  8809. to an output value, and apply it to the input video.
  8810. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8811. to an RGB input video.
  8812. These filters accept the following parameters:
  8813. @table @option
  8814. @item c0
  8815. set first pixel component expression
  8816. @item c1
  8817. set second pixel component expression
  8818. @item c2
  8819. set third pixel component expression
  8820. @item c3
  8821. set fourth pixel component expression, corresponds to the alpha component
  8822. @item r
  8823. set red component expression
  8824. @item g
  8825. set green component expression
  8826. @item b
  8827. set blue component expression
  8828. @item a
  8829. alpha component expression
  8830. @item y
  8831. set Y/luminance component expression
  8832. @item u
  8833. set U/Cb component expression
  8834. @item v
  8835. set V/Cr component expression
  8836. @end table
  8837. Each of them specifies the expression to use for computing the lookup table for
  8838. the corresponding pixel component values.
  8839. The exact component associated to each of the @var{c*} options depends on the
  8840. format in input.
  8841. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8842. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8843. The expressions can contain the following constants and functions:
  8844. @table @option
  8845. @item w
  8846. @item h
  8847. The input width and height.
  8848. @item val
  8849. The input value for the pixel component.
  8850. @item clipval
  8851. The input value, clipped to the @var{minval}-@var{maxval} range.
  8852. @item maxval
  8853. The maximum value for the pixel component.
  8854. @item minval
  8855. The minimum value for the pixel component.
  8856. @item negval
  8857. The negated value for the pixel component value, clipped to the
  8858. @var{minval}-@var{maxval} range; it corresponds to the expression
  8859. "maxval-clipval+minval".
  8860. @item clip(val)
  8861. The computed value in @var{val}, clipped to the
  8862. @var{minval}-@var{maxval} range.
  8863. @item gammaval(gamma)
  8864. The computed gamma correction value of the pixel component value,
  8865. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8866. expression
  8867. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8868. @end table
  8869. All expressions default to "val".
  8870. @subsection Examples
  8871. @itemize
  8872. @item
  8873. Negate input video:
  8874. @example
  8875. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8876. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8877. @end example
  8878. The above is the same as:
  8879. @example
  8880. lutrgb="r=negval:g=negval:b=negval"
  8881. lutyuv="y=negval:u=negval:v=negval"
  8882. @end example
  8883. @item
  8884. Negate luminance:
  8885. @example
  8886. lutyuv=y=negval
  8887. @end example
  8888. @item
  8889. Remove chroma components, turning the video into a graytone image:
  8890. @example
  8891. lutyuv="u=128:v=128"
  8892. @end example
  8893. @item
  8894. Apply a luma burning effect:
  8895. @example
  8896. lutyuv="y=2*val"
  8897. @end example
  8898. @item
  8899. Remove green and blue components:
  8900. @example
  8901. lutrgb="g=0:b=0"
  8902. @end example
  8903. @item
  8904. Set a constant alpha channel value on input:
  8905. @example
  8906. format=rgba,lutrgb=a="maxval-minval/2"
  8907. @end example
  8908. @item
  8909. Correct luminance gamma by a factor of 0.5:
  8910. @example
  8911. lutyuv=y=gammaval(0.5)
  8912. @end example
  8913. @item
  8914. Discard least significant bits of luma:
  8915. @example
  8916. lutyuv=y='bitand(val, 128+64+32)'
  8917. @end example
  8918. @item
  8919. Technicolor like effect:
  8920. @example
  8921. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8922. @end example
  8923. @end itemize
  8924. @section lut2, tlut2
  8925. The @code{lut2} filter takes two input streams and outputs one
  8926. stream.
  8927. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8928. from one single stream.
  8929. This filter accepts the following parameters:
  8930. @table @option
  8931. @item c0
  8932. set first pixel component expression
  8933. @item c1
  8934. set second pixel component expression
  8935. @item c2
  8936. set third pixel component expression
  8937. @item c3
  8938. set fourth pixel component expression, corresponds to the alpha component
  8939. @end table
  8940. Each of them specifies the expression to use for computing the lookup table for
  8941. the corresponding pixel component values.
  8942. The exact component associated to each of the @var{c*} options depends on the
  8943. format in inputs.
  8944. The expressions can contain the following constants:
  8945. @table @option
  8946. @item w
  8947. @item h
  8948. The input width and height.
  8949. @item x
  8950. The first input value for the pixel component.
  8951. @item y
  8952. The second input value for the pixel component.
  8953. @item bdx
  8954. The first input video bit depth.
  8955. @item bdy
  8956. The second input video bit depth.
  8957. @end table
  8958. All expressions default to "x".
  8959. @subsection Examples
  8960. @itemize
  8961. @item
  8962. Highlight differences between two RGB video streams:
  8963. @example
  8964. 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)'
  8965. @end example
  8966. @item
  8967. Highlight differences between two YUV video streams:
  8968. @example
  8969. 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)'
  8970. @end example
  8971. @item
  8972. Show max difference between two video streams:
  8973. @example
  8974. 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)))'
  8975. @end example
  8976. @end itemize
  8977. @section maskedclamp
  8978. Clamp the first input stream with the second input and third input stream.
  8979. Returns the value of first stream to be between second input
  8980. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8981. This filter accepts the following options:
  8982. @table @option
  8983. @item undershoot
  8984. Default value is @code{0}.
  8985. @item overshoot
  8986. Default value is @code{0}.
  8987. @item planes
  8988. Set which planes will be processed as bitmap, unprocessed planes will be
  8989. copied from first stream.
  8990. By default value 0xf, all planes will be processed.
  8991. @end table
  8992. @section maskedmerge
  8993. Merge the first input stream with the second input stream using per pixel
  8994. weights in the third input stream.
  8995. A value of 0 in the third stream pixel component means that pixel component
  8996. from first stream is returned unchanged, while maximum value (eg. 255 for
  8997. 8-bit videos) means that pixel component from second stream is returned
  8998. unchanged. Intermediate values define the amount of merging between both
  8999. input stream's pixel components.
  9000. This filter accepts the following options:
  9001. @table @option
  9002. @item planes
  9003. Set which planes will be processed as bitmap, unprocessed planes will be
  9004. copied from first stream.
  9005. By default value 0xf, all planes will be processed.
  9006. @end table
  9007. @section mcdeint
  9008. Apply motion-compensation deinterlacing.
  9009. It needs one field per frame as input and must thus be used together
  9010. with yadif=1/3 or equivalent.
  9011. This filter accepts the following options:
  9012. @table @option
  9013. @item mode
  9014. Set the deinterlacing mode.
  9015. It accepts one of the following values:
  9016. @table @samp
  9017. @item fast
  9018. @item medium
  9019. @item slow
  9020. use iterative motion estimation
  9021. @item extra_slow
  9022. like @samp{slow}, but use multiple reference frames.
  9023. @end table
  9024. Default value is @samp{fast}.
  9025. @item parity
  9026. Set the picture field parity assumed for the input video. It must be
  9027. one of the following values:
  9028. @table @samp
  9029. @item 0, tff
  9030. assume top field first
  9031. @item 1, bff
  9032. assume bottom field first
  9033. @end table
  9034. Default value is @samp{bff}.
  9035. @item qp
  9036. Set per-block quantization parameter (QP) used by the internal
  9037. encoder.
  9038. Higher values should result in a smoother motion vector field but less
  9039. optimal individual vectors. Default value is 1.
  9040. @end table
  9041. @section mergeplanes
  9042. Merge color channel components from several video streams.
  9043. The filter accepts up to 4 input streams, and merge selected input
  9044. planes to the output video.
  9045. This filter accepts the following options:
  9046. @table @option
  9047. @item mapping
  9048. Set input to output plane mapping. Default is @code{0}.
  9049. The mappings is specified as a bitmap. It should be specified as a
  9050. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9051. mapping for the first plane of the output stream. 'A' sets the number of
  9052. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9053. corresponding input to use (from 0 to 3). The rest of the mappings is
  9054. similar, 'Bb' describes the mapping for the output stream second
  9055. plane, 'Cc' describes the mapping for the output stream third plane and
  9056. 'Dd' describes the mapping for the output stream fourth plane.
  9057. @item format
  9058. Set output pixel format. Default is @code{yuva444p}.
  9059. @end table
  9060. @subsection Examples
  9061. @itemize
  9062. @item
  9063. Merge three gray video streams of same width and height into single video stream:
  9064. @example
  9065. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9066. @end example
  9067. @item
  9068. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9069. @example
  9070. [a0][a1]mergeplanes=0x00010210:yuva444p
  9071. @end example
  9072. @item
  9073. Swap Y and A plane in yuva444p stream:
  9074. @example
  9075. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9076. @end example
  9077. @item
  9078. Swap U and V plane in yuv420p stream:
  9079. @example
  9080. format=yuv420p,mergeplanes=0x000201:yuv420p
  9081. @end example
  9082. @item
  9083. Cast a rgb24 clip to yuv444p:
  9084. @example
  9085. format=rgb24,mergeplanes=0x000102:yuv444p
  9086. @end example
  9087. @end itemize
  9088. @section mestimate
  9089. Estimate and export motion vectors using block matching algorithms.
  9090. Motion vectors are stored in frame side data to be used by other filters.
  9091. This filter accepts the following options:
  9092. @table @option
  9093. @item method
  9094. Specify the motion estimation method. Accepts one of the following values:
  9095. @table @samp
  9096. @item esa
  9097. Exhaustive search algorithm.
  9098. @item tss
  9099. Three step search algorithm.
  9100. @item tdls
  9101. Two dimensional logarithmic search algorithm.
  9102. @item ntss
  9103. New three step search algorithm.
  9104. @item fss
  9105. Four step search algorithm.
  9106. @item ds
  9107. Diamond search algorithm.
  9108. @item hexbs
  9109. Hexagon-based search algorithm.
  9110. @item epzs
  9111. Enhanced predictive zonal search algorithm.
  9112. @item umh
  9113. Uneven multi-hexagon search algorithm.
  9114. @end table
  9115. Default value is @samp{esa}.
  9116. @item mb_size
  9117. Macroblock size. Default @code{16}.
  9118. @item search_param
  9119. Search parameter. Default @code{7}.
  9120. @end table
  9121. @section midequalizer
  9122. Apply Midway Image Equalization effect using two video streams.
  9123. Midway Image Equalization adjusts a pair of images to have the same
  9124. histogram, while maintaining their dynamics as much as possible. It's
  9125. useful for e.g. matching exposures from a pair of stereo cameras.
  9126. This filter has two inputs and one output, which must be of same pixel format, but
  9127. may be of different sizes. The output of filter is first input adjusted with
  9128. midway histogram of both inputs.
  9129. This filter accepts the following option:
  9130. @table @option
  9131. @item planes
  9132. Set which planes to process. Default is @code{15}, which is all available planes.
  9133. @end table
  9134. @section minterpolate
  9135. Convert the video to specified frame rate using motion interpolation.
  9136. This filter accepts the following options:
  9137. @table @option
  9138. @item fps
  9139. 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}.
  9140. @item mi_mode
  9141. Motion interpolation mode. Following values are accepted:
  9142. @table @samp
  9143. @item dup
  9144. Duplicate previous or next frame for interpolating new ones.
  9145. @item blend
  9146. Blend source frames. Interpolated frame is mean of previous and next frames.
  9147. @item mci
  9148. Motion compensated interpolation. Following options are effective when this mode is selected:
  9149. @table @samp
  9150. @item mc_mode
  9151. Motion compensation mode. Following values are accepted:
  9152. @table @samp
  9153. @item obmc
  9154. Overlapped block motion compensation.
  9155. @item aobmc
  9156. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9157. @end table
  9158. Default mode is @samp{obmc}.
  9159. @item me_mode
  9160. Motion estimation mode. Following values are accepted:
  9161. @table @samp
  9162. @item bidir
  9163. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9164. @item bilat
  9165. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9166. @end table
  9167. Default mode is @samp{bilat}.
  9168. @item me
  9169. The algorithm to be used for motion estimation. Following values are accepted:
  9170. @table @samp
  9171. @item esa
  9172. Exhaustive search algorithm.
  9173. @item tss
  9174. Three step search algorithm.
  9175. @item tdls
  9176. Two dimensional logarithmic search algorithm.
  9177. @item ntss
  9178. New three step search algorithm.
  9179. @item fss
  9180. Four step search algorithm.
  9181. @item ds
  9182. Diamond search algorithm.
  9183. @item hexbs
  9184. Hexagon-based search algorithm.
  9185. @item epzs
  9186. Enhanced predictive zonal search algorithm.
  9187. @item umh
  9188. Uneven multi-hexagon search algorithm.
  9189. @end table
  9190. Default algorithm is @samp{epzs}.
  9191. @item mb_size
  9192. Macroblock size. Default @code{16}.
  9193. @item search_param
  9194. Motion estimation search parameter. Default @code{32}.
  9195. @item vsbmc
  9196. 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).
  9197. @end table
  9198. @end table
  9199. @item scd
  9200. 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:
  9201. @table @samp
  9202. @item none
  9203. Disable scene change detection.
  9204. @item fdiff
  9205. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9206. @end table
  9207. Default method is @samp{fdiff}.
  9208. @item scd_threshold
  9209. Scene change detection threshold. Default is @code{5.0}.
  9210. @end table
  9211. @section mix
  9212. Mix several video input streams into one video stream.
  9213. A description of the accepted options follows.
  9214. @table @option
  9215. @item nb_inputs
  9216. The number of inputs. If unspecified, it defaults to 2.
  9217. @item weights
  9218. Specify weight of each input video stream as sequence.
  9219. Each weight is separated by space. If number of weights
  9220. is smaller than number of @var{frames} last specified
  9221. weight will be used for all remaining unset weights.
  9222. @item scale
  9223. Specify scale, if it is set it will be multiplied with sum
  9224. of each weight multiplied with pixel values to give final destination
  9225. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9226. @item duration
  9227. Specify how end of stream is determined.
  9228. @table @samp
  9229. @item longest
  9230. The duration of the longest input. (default)
  9231. @item shortest
  9232. The duration of the shortest input.
  9233. @item first
  9234. The duration of the first input.
  9235. @end table
  9236. @end table
  9237. @section mpdecimate
  9238. Drop frames that do not differ greatly from the previous frame in
  9239. order to reduce frame rate.
  9240. The main use of this filter is for very-low-bitrate encoding
  9241. (e.g. streaming over dialup modem), but it could in theory be used for
  9242. fixing movies that were inverse-telecined incorrectly.
  9243. A description of the accepted options follows.
  9244. @table @option
  9245. @item max
  9246. Set the maximum number of consecutive frames which can be dropped (if
  9247. positive), or the minimum interval between dropped frames (if
  9248. negative). If the value is 0, the frame is dropped disregarding the
  9249. number of previous sequentially dropped frames.
  9250. Default value is 0.
  9251. @item hi
  9252. @item lo
  9253. @item frac
  9254. Set the dropping threshold values.
  9255. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9256. represent actual pixel value differences, so a threshold of 64
  9257. corresponds to 1 unit of difference for each pixel, or the same spread
  9258. out differently over the block.
  9259. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9260. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9261. meaning the whole image) differ by more than a threshold of @option{lo}.
  9262. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9263. 64*5, and default value for @option{frac} is 0.33.
  9264. @end table
  9265. @section negate
  9266. Negate (invert) the input video.
  9267. It accepts the following option:
  9268. @table @option
  9269. @item negate_alpha
  9270. With value 1, it negates the alpha component, if present. Default value is 0.
  9271. @end table
  9272. @anchor{nlmeans}
  9273. @section nlmeans
  9274. Denoise frames using Non-Local Means algorithm.
  9275. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9276. context similarity is defined by comparing their surrounding patches of size
  9277. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9278. around the pixel.
  9279. Note that the research area defines centers for patches, which means some
  9280. patches will be made of pixels outside that research area.
  9281. The filter accepts the following options.
  9282. @table @option
  9283. @item s
  9284. Set denoising strength.
  9285. @item p
  9286. Set patch size.
  9287. @item pc
  9288. Same as @option{p} but for chroma planes.
  9289. The default value is @var{0} and means automatic.
  9290. @item r
  9291. Set research size.
  9292. @item rc
  9293. Same as @option{r} but for chroma planes.
  9294. The default value is @var{0} and means automatic.
  9295. @end table
  9296. @section nnedi
  9297. Deinterlace video using neural network edge directed interpolation.
  9298. This filter accepts the following options:
  9299. @table @option
  9300. @item weights
  9301. Mandatory option, without binary file filter can not work.
  9302. Currently file can be found here:
  9303. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9304. @item deint
  9305. Set which frames to deinterlace, by default it is @code{all}.
  9306. Can be @code{all} or @code{interlaced}.
  9307. @item field
  9308. Set mode of operation.
  9309. Can be one of the following:
  9310. @table @samp
  9311. @item af
  9312. Use frame flags, both fields.
  9313. @item a
  9314. Use frame flags, single field.
  9315. @item t
  9316. Use top field only.
  9317. @item b
  9318. Use bottom field only.
  9319. @item tf
  9320. Use both fields, top first.
  9321. @item bf
  9322. Use both fields, bottom first.
  9323. @end table
  9324. @item planes
  9325. Set which planes to process, by default filter process all frames.
  9326. @item nsize
  9327. Set size of local neighborhood around each pixel, used by the predictor neural
  9328. network.
  9329. Can be one of the following:
  9330. @table @samp
  9331. @item s8x6
  9332. @item s16x6
  9333. @item s32x6
  9334. @item s48x6
  9335. @item s8x4
  9336. @item s16x4
  9337. @item s32x4
  9338. @end table
  9339. @item nns
  9340. Set the number of neurons in predictor neural network.
  9341. Can be one of the following:
  9342. @table @samp
  9343. @item n16
  9344. @item n32
  9345. @item n64
  9346. @item n128
  9347. @item n256
  9348. @end table
  9349. @item qual
  9350. Controls the number of different neural network predictions that are blended
  9351. together to compute the final output value. Can be @code{fast}, default or
  9352. @code{slow}.
  9353. @item etype
  9354. Set which set of weights to use in the predictor.
  9355. Can be one of the following:
  9356. @table @samp
  9357. @item a
  9358. weights trained to minimize absolute error
  9359. @item s
  9360. weights trained to minimize squared error
  9361. @end table
  9362. @item pscrn
  9363. Controls whether or not the prescreener neural network is used to decide
  9364. which pixels should be processed by the predictor neural network and which
  9365. can be handled by simple cubic interpolation.
  9366. The prescreener is trained to know whether cubic interpolation will be
  9367. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9368. The computational complexity of the prescreener nn is much less than that of
  9369. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9370. using the prescreener generally results in much faster processing.
  9371. The prescreener is pretty accurate, so the difference between using it and not
  9372. using it is almost always unnoticeable.
  9373. Can be one of the following:
  9374. @table @samp
  9375. @item none
  9376. @item original
  9377. @item new
  9378. @end table
  9379. Default is @code{new}.
  9380. @item fapprox
  9381. Set various debugging flags.
  9382. @end table
  9383. @section noformat
  9384. Force libavfilter not to use any of the specified pixel formats for the
  9385. input to the next filter.
  9386. It accepts the following parameters:
  9387. @table @option
  9388. @item pix_fmts
  9389. A '|'-separated list of pixel format names, such as
  9390. pix_fmts=yuv420p|monow|rgb24".
  9391. @end table
  9392. @subsection Examples
  9393. @itemize
  9394. @item
  9395. Force libavfilter to use a format different from @var{yuv420p} for the
  9396. input to the vflip filter:
  9397. @example
  9398. noformat=pix_fmts=yuv420p,vflip
  9399. @end example
  9400. @item
  9401. Convert the input video to any of the formats not contained in the list:
  9402. @example
  9403. noformat=yuv420p|yuv444p|yuv410p
  9404. @end example
  9405. @end itemize
  9406. @section noise
  9407. Add noise on video input frame.
  9408. The filter accepts the following options:
  9409. @table @option
  9410. @item all_seed
  9411. @item c0_seed
  9412. @item c1_seed
  9413. @item c2_seed
  9414. @item c3_seed
  9415. Set noise seed for specific pixel component or all pixel components in case
  9416. of @var{all_seed}. Default value is @code{123457}.
  9417. @item all_strength, alls
  9418. @item c0_strength, c0s
  9419. @item c1_strength, c1s
  9420. @item c2_strength, c2s
  9421. @item c3_strength, c3s
  9422. Set noise strength for specific pixel component or all pixel components in case
  9423. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9424. @item all_flags, allf
  9425. @item c0_flags, c0f
  9426. @item c1_flags, c1f
  9427. @item c2_flags, c2f
  9428. @item c3_flags, c3f
  9429. Set pixel component flags or set flags for all components if @var{all_flags}.
  9430. Available values for component flags are:
  9431. @table @samp
  9432. @item a
  9433. averaged temporal noise (smoother)
  9434. @item p
  9435. mix random noise with a (semi)regular pattern
  9436. @item t
  9437. temporal noise (noise pattern changes between frames)
  9438. @item u
  9439. uniform noise (gaussian otherwise)
  9440. @end table
  9441. @end table
  9442. @subsection Examples
  9443. Add temporal and uniform noise to input video:
  9444. @example
  9445. noise=alls=20:allf=t+u
  9446. @end example
  9447. @section normalize
  9448. Normalize RGB video (aka histogram stretching, contrast stretching).
  9449. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9450. For each channel of each frame, the filter computes the input range and maps
  9451. it linearly to the user-specified output range. The output range defaults
  9452. to the full dynamic range from pure black to pure white.
  9453. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9454. changes in brightness) caused when small dark or bright objects enter or leave
  9455. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9456. video camera, and, like a video camera, it may cause a period of over- or
  9457. under-exposure of the video.
  9458. The R,G,B channels can be normalized independently, which may cause some
  9459. color shifting, or linked together as a single channel, which prevents
  9460. color shifting. Linked normalization preserves hue. Independent normalization
  9461. does not, so it can be used to remove some color casts. Independent and linked
  9462. normalization can be combined in any ratio.
  9463. The normalize filter accepts the following options:
  9464. @table @option
  9465. @item blackpt
  9466. @item whitept
  9467. Colors which define the output range. The minimum input value is mapped to
  9468. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9469. The defaults are black and white respectively. Specifying white for
  9470. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9471. normalized video. Shades of grey can be used to reduce the dynamic range
  9472. (contrast). Specifying saturated colors here can create some interesting
  9473. effects.
  9474. @item smoothing
  9475. The number of previous frames to use for temporal smoothing. The input range
  9476. of each channel is smoothed using a rolling average over the current frame
  9477. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9478. smoothing).
  9479. @item independence
  9480. Controls the ratio of independent (color shifting) channel normalization to
  9481. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9482. independent. Defaults to 1.0 (fully independent).
  9483. @item strength
  9484. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9485. expensive no-op. Defaults to 1.0 (full strength).
  9486. @end table
  9487. @subsection Examples
  9488. Stretch video contrast to use the full dynamic range, with no temporal
  9489. smoothing; may flicker depending on the source content:
  9490. @example
  9491. normalize=blackpt=black:whitept=white:smoothing=0
  9492. @end example
  9493. As above, but with 50 frames of temporal smoothing; flicker should be
  9494. reduced, depending on the source content:
  9495. @example
  9496. normalize=blackpt=black:whitept=white:smoothing=50
  9497. @end example
  9498. As above, but with hue-preserving linked channel normalization:
  9499. @example
  9500. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9501. @end example
  9502. As above, but with half strength:
  9503. @example
  9504. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9505. @end example
  9506. Map the darkest input color to red, the brightest input color to cyan:
  9507. @example
  9508. normalize=blackpt=red:whitept=cyan
  9509. @end example
  9510. @section null
  9511. Pass the video source unchanged to the output.
  9512. @section ocr
  9513. Optical Character Recognition
  9514. This filter uses Tesseract for optical character recognition. To enable
  9515. compilation of this filter, you need to configure FFmpeg with
  9516. @code{--enable-libtesseract}.
  9517. It accepts the following options:
  9518. @table @option
  9519. @item datapath
  9520. Set datapath to tesseract data. Default is to use whatever was
  9521. set at installation.
  9522. @item language
  9523. Set language, default is "eng".
  9524. @item whitelist
  9525. Set character whitelist.
  9526. @item blacklist
  9527. Set character blacklist.
  9528. @end table
  9529. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9530. @section ocv
  9531. Apply a video transform using libopencv.
  9532. To enable this filter, install the libopencv library and headers and
  9533. configure FFmpeg with @code{--enable-libopencv}.
  9534. It accepts the following parameters:
  9535. @table @option
  9536. @item filter_name
  9537. The name of the libopencv filter to apply.
  9538. @item filter_params
  9539. The parameters to pass to the libopencv filter. If not specified, the default
  9540. values are assumed.
  9541. @end table
  9542. Refer to the official libopencv documentation for more precise
  9543. information:
  9544. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9545. Several libopencv filters are supported; see the following subsections.
  9546. @anchor{dilate}
  9547. @subsection dilate
  9548. Dilate an image by using a specific structuring element.
  9549. It corresponds to the libopencv function @code{cvDilate}.
  9550. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9551. @var{struct_el} represents a structuring element, and has the syntax:
  9552. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9553. @var{cols} and @var{rows} represent the number of columns and rows of
  9554. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9555. point, and @var{shape} the shape for the structuring element. @var{shape}
  9556. must be "rect", "cross", "ellipse", or "custom".
  9557. If the value for @var{shape} is "custom", it must be followed by a
  9558. string of the form "=@var{filename}". The file with name
  9559. @var{filename} is assumed to represent a binary image, with each
  9560. printable character corresponding to a bright pixel. When a custom
  9561. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9562. or columns and rows of the read file are assumed instead.
  9563. The default value for @var{struct_el} is "3x3+0x0/rect".
  9564. @var{nb_iterations} specifies the number of times the transform is
  9565. applied to the image, and defaults to 1.
  9566. Some examples:
  9567. @example
  9568. # Use the default values
  9569. ocv=dilate
  9570. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9571. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9572. # Read the shape from the file diamond.shape, iterating two times.
  9573. # The file diamond.shape may contain a pattern of characters like this
  9574. # *
  9575. # ***
  9576. # *****
  9577. # ***
  9578. # *
  9579. # The specified columns and rows are ignored
  9580. # but the anchor point coordinates are not
  9581. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9582. @end example
  9583. @subsection erode
  9584. Erode an image by using a specific structuring element.
  9585. It corresponds to the libopencv function @code{cvErode}.
  9586. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9587. with the same syntax and semantics as the @ref{dilate} filter.
  9588. @subsection smooth
  9589. Smooth the input video.
  9590. The filter takes the following parameters:
  9591. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9592. @var{type} is the type of smooth filter to apply, and must be one of
  9593. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9594. or "bilateral". The default value is "gaussian".
  9595. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9596. depend on the smooth type. @var{param1} and
  9597. @var{param2} accept integer positive values or 0. @var{param3} and
  9598. @var{param4} accept floating point values.
  9599. The default value for @var{param1} is 3. The default value for the
  9600. other parameters is 0.
  9601. These parameters correspond to the parameters assigned to the
  9602. libopencv function @code{cvSmooth}.
  9603. @section oscilloscope
  9604. 2D Video Oscilloscope.
  9605. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9606. It accepts the following parameters:
  9607. @table @option
  9608. @item x
  9609. Set scope center x position.
  9610. @item y
  9611. Set scope center y position.
  9612. @item s
  9613. Set scope size, relative to frame diagonal.
  9614. @item t
  9615. Set scope tilt/rotation.
  9616. @item o
  9617. Set trace opacity.
  9618. @item tx
  9619. Set trace center x position.
  9620. @item ty
  9621. Set trace center y position.
  9622. @item tw
  9623. Set trace width, relative to width of frame.
  9624. @item th
  9625. Set trace height, relative to height of frame.
  9626. @item c
  9627. Set which components to trace. By default it traces first three components.
  9628. @item g
  9629. Draw trace grid. By default is enabled.
  9630. @item st
  9631. Draw some statistics. By default is enabled.
  9632. @item sc
  9633. Draw scope. By default is enabled.
  9634. @end table
  9635. @subsection Examples
  9636. @itemize
  9637. @item
  9638. Inspect full first row of video frame.
  9639. @example
  9640. oscilloscope=x=0.5:y=0:s=1
  9641. @end example
  9642. @item
  9643. Inspect full last row of video frame.
  9644. @example
  9645. oscilloscope=x=0.5:y=1:s=1
  9646. @end example
  9647. @item
  9648. Inspect full 5th line of video frame of height 1080.
  9649. @example
  9650. oscilloscope=x=0.5:y=5/1080:s=1
  9651. @end example
  9652. @item
  9653. Inspect full last column of video frame.
  9654. @example
  9655. oscilloscope=x=1:y=0.5:s=1:t=1
  9656. @end example
  9657. @end itemize
  9658. @anchor{overlay}
  9659. @section overlay
  9660. Overlay one video on top of another.
  9661. It takes two inputs and has one output. The first input is the "main"
  9662. video on which the second input is overlaid.
  9663. It accepts the following parameters:
  9664. A description of the accepted options follows.
  9665. @table @option
  9666. @item x
  9667. @item y
  9668. Set the expression for the x and y coordinates of the overlaid video
  9669. on the main video. Default value is "0" for both expressions. In case
  9670. the expression is invalid, it is set to a huge value (meaning that the
  9671. overlay will not be displayed within the output visible area).
  9672. @item eof_action
  9673. See @ref{framesync}.
  9674. @item eval
  9675. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9676. It accepts the following values:
  9677. @table @samp
  9678. @item init
  9679. only evaluate expressions once during the filter initialization or
  9680. when a command is processed
  9681. @item frame
  9682. evaluate expressions for each incoming frame
  9683. @end table
  9684. Default value is @samp{frame}.
  9685. @item shortest
  9686. See @ref{framesync}.
  9687. @item format
  9688. Set the format for the output video.
  9689. It accepts the following values:
  9690. @table @samp
  9691. @item yuv420
  9692. force YUV420 output
  9693. @item yuv422
  9694. force YUV422 output
  9695. @item yuv444
  9696. force YUV444 output
  9697. @item rgb
  9698. force packed RGB output
  9699. @item gbrp
  9700. force planar RGB output
  9701. @item auto
  9702. automatically pick format
  9703. @end table
  9704. Default value is @samp{yuv420}.
  9705. @item repeatlast
  9706. See @ref{framesync}.
  9707. @item alpha
  9708. Set format of alpha of the overlaid video, it can be @var{straight} or
  9709. @var{premultiplied}. Default is @var{straight}.
  9710. @end table
  9711. The @option{x}, and @option{y} expressions can contain the following
  9712. parameters.
  9713. @table @option
  9714. @item main_w, W
  9715. @item main_h, H
  9716. The main input width and height.
  9717. @item overlay_w, w
  9718. @item overlay_h, h
  9719. The overlay input width and height.
  9720. @item x
  9721. @item y
  9722. The computed values for @var{x} and @var{y}. They are evaluated for
  9723. each new frame.
  9724. @item hsub
  9725. @item vsub
  9726. horizontal and vertical chroma subsample values of the output
  9727. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9728. @var{vsub} is 1.
  9729. @item n
  9730. the number of input frame, starting from 0
  9731. @item pos
  9732. the position in the file of the input frame, NAN if unknown
  9733. @item t
  9734. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9735. @end table
  9736. This filter also supports the @ref{framesync} options.
  9737. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9738. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9739. when @option{eval} is set to @samp{init}.
  9740. Be aware that frames are taken from each input video in timestamp
  9741. order, hence, if their initial timestamps differ, it is a good idea
  9742. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9743. have them begin in the same zero timestamp, as the example for
  9744. the @var{movie} filter does.
  9745. You can chain together more overlays but you should test the
  9746. efficiency of such approach.
  9747. @subsection Commands
  9748. This filter supports the following commands:
  9749. @table @option
  9750. @item x
  9751. @item y
  9752. Modify the x and y of the overlay input.
  9753. The command accepts the same syntax of the corresponding option.
  9754. If the specified expression is not valid, it is kept at its current
  9755. value.
  9756. @end table
  9757. @subsection Examples
  9758. @itemize
  9759. @item
  9760. Draw the overlay at 10 pixels from the bottom right corner of the main
  9761. video:
  9762. @example
  9763. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9764. @end example
  9765. Using named options the example above becomes:
  9766. @example
  9767. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9768. @end example
  9769. @item
  9770. Insert a transparent PNG logo in the bottom left corner of the input,
  9771. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9772. @example
  9773. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9774. @end example
  9775. @item
  9776. Insert 2 different transparent PNG logos (second logo on bottom
  9777. right corner) using the @command{ffmpeg} tool:
  9778. @example
  9779. 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
  9780. @end example
  9781. @item
  9782. Add a transparent color layer on top of the main video; @code{WxH}
  9783. must specify the size of the main input to the overlay filter:
  9784. @example
  9785. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9786. @end example
  9787. @item
  9788. Play an original video and a filtered version (here with the deshake
  9789. filter) side by side using the @command{ffplay} tool:
  9790. @example
  9791. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9792. @end example
  9793. The above command is the same as:
  9794. @example
  9795. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9796. @end example
  9797. @item
  9798. Make a sliding overlay appearing from the left to the right top part of the
  9799. screen starting since time 2:
  9800. @example
  9801. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9802. @end example
  9803. @item
  9804. Compose output by putting two input videos side to side:
  9805. @example
  9806. ffmpeg -i left.avi -i right.avi -filter_complex "
  9807. nullsrc=size=200x100 [background];
  9808. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9809. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9810. [background][left] overlay=shortest=1 [background+left];
  9811. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9812. "
  9813. @end example
  9814. @item
  9815. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9816. @example
  9817. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9818. -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]'
  9819. masked.avi
  9820. @end example
  9821. @item
  9822. Chain several overlays in cascade:
  9823. @example
  9824. nullsrc=s=200x200 [bg];
  9825. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9826. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9827. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9828. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9829. [in3] null, [mid2] overlay=100:100 [out0]
  9830. @end example
  9831. @end itemize
  9832. @section owdenoise
  9833. Apply Overcomplete Wavelet denoiser.
  9834. The filter accepts the following options:
  9835. @table @option
  9836. @item depth
  9837. Set depth.
  9838. Larger depth values will denoise lower frequency components more, but
  9839. slow down filtering.
  9840. Must be an int in the range 8-16, default is @code{8}.
  9841. @item luma_strength, ls
  9842. Set luma strength.
  9843. Must be a double value in the range 0-1000, default is @code{1.0}.
  9844. @item chroma_strength, cs
  9845. Set chroma strength.
  9846. Must be a double value in the range 0-1000, default is @code{1.0}.
  9847. @end table
  9848. @anchor{pad}
  9849. @section pad
  9850. Add paddings to the input image, and place the original input at the
  9851. provided @var{x}, @var{y} coordinates.
  9852. It accepts the following parameters:
  9853. @table @option
  9854. @item width, w
  9855. @item height, h
  9856. Specify an expression for the size of the output image with the
  9857. paddings added. If the value for @var{width} or @var{height} is 0, the
  9858. corresponding input size is used for the output.
  9859. The @var{width} expression can reference the value set by the
  9860. @var{height} expression, and vice versa.
  9861. The default value of @var{width} and @var{height} is 0.
  9862. @item x
  9863. @item y
  9864. Specify the offsets to place the input image at within the padded area,
  9865. with respect to the top/left border of the output image.
  9866. The @var{x} expression can reference the value set by the @var{y}
  9867. expression, and vice versa.
  9868. The default value of @var{x} and @var{y} is 0.
  9869. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9870. so the input image is centered on the padded area.
  9871. @item color
  9872. Specify the color of the padded area. For the syntax of this option,
  9873. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9874. manual,ffmpeg-utils}.
  9875. The default value of @var{color} is "black".
  9876. @item eval
  9877. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9878. It accepts the following values:
  9879. @table @samp
  9880. @item init
  9881. Only evaluate expressions once during the filter initialization or when
  9882. a command is processed.
  9883. @item frame
  9884. Evaluate expressions for each incoming frame.
  9885. @end table
  9886. Default value is @samp{init}.
  9887. @item aspect
  9888. Pad to aspect instead to a resolution.
  9889. @end table
  9890. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9891. options are expressions containing the following constants:
  9892. @table @option
  9893. @item in_w
  9894. @item in_h
  9895. The input video width and height.
  9896. @item iw
  9897. @item ih
  9898. These are the same as @var{in_w} and @var{in_h}.
  9899. @item out_w
  9900. @item out_h
  9901. The output width and height (the size of the padded area), as
  9902. specified by the @var{width} and @var{height} expressions.
  9903. @item ow
  9904. @item oh
  9905. These are the same as @var{out_w} and @var{out_h}.
  9906. @item x
  9907. @item y
  9908. The x and y offsets as specified by the @var{x} and @var{y}
  9909. expressions, or NAN if not yet specified.
  9910. @item a
  9911. same as @var{iw} / @var{ih}
  9912. @item sar
  9913. input sample aspect ratio
  9914. @item dar
  9915. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9916. @item hsub
  9917. @item vsub
  9918. The horizontal and vertical chroma subsample values. For example for the
  9919. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9920. @end table
  9921. @subsection Examples
  9922. @itemize
  9923. @item
  9924. Add paddings with the color "violet" to the input video. The output video
  9925. size is 640x480, and the top-left corner of the input video is placed at
  9926. column 0, row 40
  9927. @example
  9928. pad=640:480:0:40:violet
  9929. @end example
  9930. The example above is equivalent to the following command:
  9931. @example
  9932. pad=width=640:height=480:x=0:y=40:color=violet
  9933. @end example
  9934. @item
  9935. Pad the input to get an output with dimensions increased by 3/2,
  9936. and put the input video at the center of the padded area:
  9937. @example
  9938. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9939. @end example
  9940. @item
  9941. Pad the input to get a squared output with size equal to the maximum
  9942. value between the input width and height, and put the input video at
  9943. the center of the padded area:
  9944. @example
  9945. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9946. @end example
  9947. @item
  9948. Pad the input to get a final w/h ratio of 16:9:
  9949. @example
  9950. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9951. @end example
  9952. @item
  9953. In case of anamorphic video, in order to set the output display aspect
  9954. correctly, it is necessary to use @var{sar} in the expression,
  9955. according to the relation:
  9956. @example
  9957. (ih * X / ih) * sar = output_dar
  9958. X = output_dar / sar
  9959. @end example
  9960. Thus the previous example needs to be modified to:
  9961. @example
  9962. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9963. @end example
  9964. @item
  9965. Double the output size and put the input video in the bottom-right
  9966. corner of the output padded area:
  9967. @example
  9968. pad="2*iw:2*ih:ow-iw:oh-ih"
  9969. @end example
  9970. @end itemize
  9971. @anchor{palettegen}
  9972. @section palettegen
  9973. Generate one palette for a whole video stream.
  9974. It accepts the following options:
  9975. @table @option
  9976. @item max_colors
  9977. Set the maximum number of colors to quantize in the palette.
  9978. Note: the palette will still contain 256 colors; the unused palette entries
  9979. will be black.
  9980. @item reserve_transparent
  9981. Create a palette of 255 colors maximum and reserve the last one for
  9982. transparency. Reserving the transparency color is useful for GIF optimization.
  9983. If not set, the maximum of colors in the palette will be 256. You probably want
  9984. to disable this option for a standalone image.
  9985. Set by default.
  9986. @item transparency_color
  9987. Set the color that will be used as background for transparency.
  9988. @item stats_mode
  9989. Set statistics mode.
  9990. It accepts the following values:
  9991. @table @samp
  9992. @item full
  9993. Compute full frame histograms.
  9994. @item diff
  9995. Compute histograms only for the part that differs from previous frame. This
  9996. might be relevant to give more importance to the moving part of your input if
  9997. the background is static.
  9998. @item single
  9999. Compute new histogram for each frame.
  10000. @end table
  10001. Default value is @var{full}.
  10002. @end table
  10003. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10004. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10005. color quantization of the palette. This information is also visible at
  10006. @var{info} logging level.
  10007. @subsection Examples
  10008. @itemize
  10009. @item
  10010. Generate a representative palette of a given video using @command{ffmpeg}:
  10011. @example
  10012. ffmpeg -i input.mkv -vf palettegen palette.png
  10013. @end example
  10014. @end itemize
  10015. @section paletteuse
  10016. Use a palette to downsample an input video stream.
  10017. The filter takes two inputs: one video stream and a palette. The palette must
  10018. be a 256 pixels image.
  10019. It accepts the following options:
  10020. @table @option
  10021. @item dither
  10022. Select dithering mode. Available algorithms are:
  10023. @table @samp
  10024. @item bayer
  10025. Ordered 8x8 bayer dithering (deterministic)
  10026. @item heckbert
  10027. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10028. Note: this dithering is sometimes considered "wrong" and is included as a
  10029. reference.
  10030. @item floyd_steinberg
  10031. Floyd and Steingberg dithering (error diffusion)
  10032. @item sierra2
  10033. Frankie Sierra dithering v2 (error diffusion)
  10034. @item sierra2_4a
  10035. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10036. @end table
  10037. Default is @var{sierra2_4a}.
  10038. @item bayer_scale
  10039. When @var{bayer} dithering is selected, this option defines the scale of the
  10040. pattern (how much the crosshatch pattern is visible). A low value means more
  10041. visible pattern for less banding, and higher value means less visible pattern
  10042. at the cost of more banding.
  10043. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10044. @item diff_mode
  10045. If set, define the zone to process
  10046. @table @samp
  10047. @item rectangle
  10048. Only the changing rectangle will be reprocessed. This is similar to GIF
  10049. cropping/offsetting compression mechanism. This option can be useful for speed
  10050. if only a part of the image is changing, and has use cases such as limiting the
  10051. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10052. moving scene (it leads to more deterministic output if the scene doesn't change
  10053. much, and as a result less moving noise and better GIF compression).
  10054. @end table
  10055. Default is @var{none}.
  10056. @item new
  10057. Take new palette for each output frame.
  10058. @item alpha_threshold
  10059. Sets the alpha threshold for transparency. Alpha values above this threshold
  10060. will be treated as completely opaque, and values below this threshold will be
  10061. treated as completely transparent.
  10062. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10063. @end table
  10064. @subsection Examples
  10065. @itemize
  10066. @item
  10067. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10068. using @command{ffmpeg}:
  10069. @example
  10070. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10071. @end example
  10072. @end itemize
  10073. @section perspective
  10074. Correct perspective of video not recorded perpendicular to the screen.
  10075. A description of the accepted parameters follows.
  10076. @table @option
  10077. @item x0
  10078. @item y0
  10079. @item x1
  10080. @item y1
  10081. @item x2
  10082. @item y2
  10083. @item x3
  10084. @item y3
  10085. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10086. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10087. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10088. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10089. then the corners of the source will be sent to the specified coordinates.
  10090. The expressions can use the following variables:
  10091. @table @option
  10092. @item W
  10093. @item H
  10094. the width and height of video frame.
  10095. @item in
  10096. Input frame count.
  10097. @item on
  10098. Output frame count.
  10099. @end table
  10100. @item interpolation
  10101. Set interpolation for perspective correction.
  10102. It accepts the following values:
  10103. @table @samp
  10104. @item linear
  10105. @item cubic
  10106. @end table
  10107. Default value is @samp{linear}.
  10108. @item sense
  10109. Set interpretation of coordinate options.
  10110. It accepts the following values:
  10111. @table @samp
  10112. @item 0, source
  10113. Send point in the source specified by the given coordinates to
  10114. the corners of the destination.
  10115. @item 1, destination
  10116. Send the corners of the source to the point in the destination specified
  10117. by the given coordinates.
  10118. Default value is @samp{source}.
  10119. @end table
  10120. @item eval
  10121. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10122. It accepts the following values:
  10123. @table @samp
  10124. @item init
  10125. only evaluate expressions once during the filter initialization or
  10126. when a command is processed
  10127. @item frame
  10128. evaluate expressions for each incoming frame
  10129. @end table
  10130. Default value is @samp{init}.
  10131. @end table
  10132. @section phase
  10133. Delay interlaced video by one field time so that the field order changes.
  10134. The intended use is to fix PAL movies that have been captured with the
  10135. opposite field order to the film-to-video transfer.
  10136. A description of the accepted parameters follows.
  10137. @table @option
  10138. @item mode
  10139. Set phase mode.
  10140. It accepts the following values:
  10141. @table @samp
  10142. @item t
  10143. Capture field order top-first, transfer bottom-first.
  10144. Filter will delay the bottom field.
  10145. @item b
  10146. Capture field order bottom-first, transfer top-first.
  10147. Filter will delay the top field.
  10148. @item p
  10149. Capture and transfer with the same field order. This mode only exists
  10150. for the documentation of the other options to refer to, but if you
  10151. actually select it, the filter will faithfully do nothing.
  10152. @item a
  10153. Capture field order determined automatically by field flags, transfer
  10154. opposite.
  10155. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10156. basis using field flags. If no field information is available,
  10157. then this works just like @samp{u}.
  10158. @item u
  10159. Capture unknown or varying, transfer opposite.
  10160. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10161. analyzing the images and selecting the alternative that produces best
  10162. match between the fields.
  10163. @item T
  10164. Capture top-first, transfer unknown or varying.
  10165. Filter selects among @samp{t} and @samp{p} using image analysis.
  10166. @item B
  10167. Capture bottom-first, transfer unknown or varying.
  10168. Filter selects among @samp{b} and @samp{p} using image analysis.
  10169. @item A
  10170. Capture determined by field flags, transfer unknown or varying.
  10171. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10172. image analysis. If no field information is available, then this works just
  10173. like @samp{U}. This is the default mode.
  10174. @item U
  10175. Both capture and transfer unknown or varying.
  10176. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10177. @end table
  10178. @end table
  10179. @section pixdesctest
  10180. Pixel format descriptor test filter, mainly useful for internal
  10181. testing. The output video should be equal to the input video.
  10182. For example:
  10183. @example
  10184. format=monow, pixdesctest
  10185. @end example
  10186. can be used to test the monowhite pixel format descriptor definition.
  10187. @section pixscope
  10188. Display sample values of color channels. Mainly useful for checking color
  10189. and levels. Minimum supported resolution is 640x480.
  10190. The filters accept the following options:
  10191. @table @option
  10192. @item x
  10193. Set scope X position, relative offset on X axis.
  10194. @item y
  10195. Set scope Y position, relative offset on Y axis.
  10196. @item w
  10197. Set scope width.
  10198. @item h
  10199. Set scope height.
  10200. @item o
  10201. Set window opacity. This window also holds statistics about pixel area.
  10202. @item wx
  10203. Set window X position, relative offset on X axis.
  10204. @item wy
  10205. Set window Y position, relative offset on Y axis.
  10206. @end table
  10207. @section pp
  10208. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10209. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10210. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10211. Each subfilter and some options have a short and a long name that can be used
  10212. interchangeably, i.e. dr/dering are the same.
  10213. The filters accept the following options:
  10214. @table @option
  10215. @item subfilters
  10216. Set postprocessing subfilters string.
  10217. @end table
  10218. All subfilters share common options to determine their scope:
  10219. @table @option
  10220. @item a/autoq
  10221. Honor the quality commands for this subfilter.
  10222. @item c/chrom
  10223. Do chrominance filtering, too (default).
  10224. @item y/nochrom
  10225. Do luminance filtering only (no chrominance).
  10226. @item n/noluma
  10227. Do chrominance filtering only (no luminance).
  10228. @end table
  10229. These options can be appended after the subfilter name, separated by a '|'.
  10230. Available subfilters are:
  10231. @table @option
  10232. @item hb/hdeblock[|difference[|flatness]]
  10233. Horizontal deblocking filter
  10234. @table @option
  10235. @item difference
  10236. Difference factor where higher values mean more deblocking (default: @code{32}).
  10237. @item flatness
  10238. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10239. @end table
  10240. @item vb/vdeblock[|difference[|flatness]]
  10241. Vertical deblocking filter
  10242. @table @option
  10243. @item difference
  10244. Difference factor where higher values mean more deblocking (default: @code{32}).
  10245. @item flatness
  10246. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10247. @end table
  10248. @item ha/hadeblock[|difference[|flatness]]
  10249. Accurate horizontal deblocking filter
  10250. @table @option
  10251. @item difference
  10252. Difference factor where higher values mean more deblocking (default: @code{32}).
  10253. @item flatness
  10254. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10255. @end table
  10256. @item va/vadeblock[|difference[|flatness]]
  10257. Accurate vertical deblocking filter
  10258. @table @option
  10259. @item difference
  10260. Difference factor where higher values mean more deblocking (default: @code{32}).
  10261. @item flatness
  10262. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10263. @end table
  10264. @end table
  10265. The horizontal and vertical deblocking filters share the difference and
  10266. flatness values so you cannot set different horizontal and vertical
  10267. thresholds.
  10268. @table @option
  10269. @item h1/x1hdeblock
  10270. Experimental horizontal deblocking filter
  10271. @item v1/x1vdeblock
  10272. Experimental vertical deblocking filter
  10273. @item dr/dering
  10274. Deringing filter
  10275. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10276. @table @option
  10277. @item threshold1
  10278. larger -> stronger filtering
  10279. @item threshold2
  10280. larger -> stronger filtering
  10281. @item threshold3
  10282. larger -> stronger filtering
  10283. @end table
  10284. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10285. @table @option
  10286. @item f/fullyrange
  10287. Stretch luminance to @code{0-255}.
  10288. @end table
  10289. @item lb/linblenddeint
  10290. Linear blend deinterlacing filter that deinterlaces the given block by
  10291. filtering all lines with a @code{(1 2 1)} filter.
  10292. @item li/linipoldeint
  10293. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10294. linearly interpolating every second line.
  10295. @item ci/cubicipoldeint
  10296. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10297. cubically interpolating every second line.
  10298. @item md/mediandeint
  10299. Median deinterlacing filter that deinterlaces the given block by applying a
  10300. median filter to every second line.
  10301. @item fd/ffmpegdeint
  10302. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10303. second line with a @code{(-1 4 2 4 -1)} filter.
  10304. @item l5/lowpass5
  10305. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10306. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10307. @item fq/forceQuant[|quantizer]
  10308. Overrides the quantizer table from the input with the constant quantizer you
  10309. specify.
  10310. @table @option
  10311. @item quantizer
  10312. Quantizer to use
  10313. @end table
  10314. @item de/default
  10315. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10316. @item fa/fast
  10317. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10318. @item ac
  10319. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10320. @end table
  10321. @subsection Examples
  10322. @itemize
  10323. @item
  10324. Apply horizontal and vertical deblocking, deringing and automatic
  10325. brightness/contrast:
  10326. @example
  10327. pp=hb/vb/dr/al
  10328. @end example
  10329. @item
  10330. Apply default filters without brightness/contrast correction:
  10331. @example
  10332. pp=de/-al
  10333. @end example
  10334. @item
  10335. Apply default filters and temporal denoiser:
  10336. @example
  10337. pp=default/tmpnoise|1|2|3
  10338. @end example
  10339. @item
  10340. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10341. automatically depending on available CPU time:
  10342. @example
  10343. pp=hb|y/vb|a
  10344. @end example
  10345. @end itemize
  10346. @section pp7
  10347. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10348. similar to spp = 6 with 7 point DCT, where only the center sample is
  10349. used after IDCT.
  10350. The filter accepts the following options:
  10351. @table @option
  10352. @item qp
  10353. Force a constant quantization parameter. It accepts an integer in range
  10354. 0 to 63. If not set, the filter will use the QP from the video stream
  10355. (if available).
  10356. @item mode
  10357. Set thresholding mode. Available modes are:
  10358. @table @samp
  10359. @item hard
  10360. Set hard thresholding.
  10361. @item soft
  10362. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10363. @item medium
  10364. Set medium thresholding (good results, default).
  10365. @end table
  10366. @end table
  10367. @section premultiply
  10368. Apply alpha premultiply effect to input video stream using first plane
  10369. of second stream as alpha.
  10370. Both streams must have same dimensions and same pixel format.
  10371. The filter accepts the following option:
  10372. @table @option
  10373. @item planes
  10374. Set which planes will be processed, unprocessed planes will be copied.
  10375. By default value 0xf, all planes will be processed.
  10376. @item inplace
  10377. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10378. @end table
  10379. @section prewitt
  10380. Apply prewitt operator to input video stream.
  10381. The filter accepts the following option:
  10382. @table @option
  10383. @item planes
  10384. Set which planes will be processed, unprocessed planes will be copied.
  10385. By default value 0xf, all planes will be processed.
  10386. @item scale
  10387. Set value which will be multiplied with filtered result.
  10388. @item delta
  10389. Set value which will be added to filtered result.
  10390. @end table
  10391. @anchor{program_opencl}
  10392. @section program_opencl
  10393. Filter video using an OpenCL program.
  10394. @table @option
  10395. @item source
  10396. OpenCL program source file.
  10397. @item kernel
  10398. Kernel name in program.
  10399. @item inputs
  10400. Number of inputs to the filter. Defaults to 1.
  10401. @item size, s
  10402. Size of output frames. Defaults to the same as the first input.
  10403. @end table
  10404. The program source file must contain a kernel function with the given name,
  10405. which will be run once for each plane of the output. Each run on a plane
  10406. gets enqueued as a separate 2D global NDRange with one work-item for each
  10407. pixel to be generated. The global ID offset for each work-item is therefore
  10408. the coordinates of a pixel in the destination image.
  10409. The kernel function needs to take the following arguments:
  10410. @itemize
  10411. @item
  10412. Destination image, @var{__write_only image2d_t}.
  10413. This image will become the output; the kernel should write all of it.
  10414. @item
  10415. Frame index, @var{unsigned int}.
  10416. This is a counter starting from zero and increasing by one for each frame.
  10417. @item
  10418. Source images, @var{__read_only image2d_t}.
  10419. These are the most recent images on each input. The kernel may read from
  10420. them to generate the output, but they can't be written to.
  10421. @end itemize
  10422. Example programs:
  10423. @itemize
  10424. @item
  10425. Copy the input to the output (output must be the same size as the input).
  10426. @verbatim
  10427. __kernel void copy(__write_only image2d_t destination,
  10428. unsigned int index,
  10429. __read_only image2d_t source)
  10430. {
  10431. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10432. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10433. float4 value = read_imagef(source, sampler, location);
  10434. write_imagef(destination, location, value);
  10435. }
  10436. @end verbatim
  10437. @item
  10438. Apply a simple transformation, rotating the input by an amount increasing
  10439. with the index counter. Pixel values are linearly interpolated by the
  10440. sampler, and the output need not have the same dimensions as the input.
  10441. @verbatim
  10442. __kernel void rotate_image(__write_only image2d_t dst,
  10443. unsigned int index,
  10444. __read_only image2d_t src)
  10445. {
  10446. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10447. CLK_FILTER_LINEAR);
  10448. float angle = (float)index / 100.0f;
  10449. float2 dst_dim = convert_float2(get_image_dim(dst));
  10450. float2 src_dim = convert_float2(get_image_dim(src));
  10451. float2 dst_cen = dst_dim / 2.0f;
  10452. float2 src_cen = src_dim / 2.0f;
  10453. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10454. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10455. float2 src_pos = {
  10456. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10457. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10458. };
  10459. src_pos = src_pos * src_dim / dst_dim;
  10460. float2 src_loc = src_pos + src_cen;
  10461. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10462. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10463. write_imagef(dst, dst_loc, 0.5f);
  10464. else
  10465. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10466. }
  10467. @end verbatim
  10468. @item
  10469. Blend two inputs together, with the amount of each input used varying
  10470. with the index counter.
  10471. @verbatim
  10472. __kernel void blend_images(__write_only image2d_t dst,
  10473. unsigned int index,
  10474. __read_only image2d_t src1,
  10475. __read_only image2d_t src2)
  10476. {
  10477. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10478. CLK_FILTER_LINEAR);
  10479. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10480. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10481. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10482. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10483. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10484. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10485. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10486. }
  10487. @end verbatim
  10488. @end itemize
  10489. @section pseudocolor
  10490. Alter frame colors in video with pseudocolors.
  10491. This filter accept the following options:
  10492. @table @option
  10493. @item c0
  10494. set pixel first component expression
  10495. @item c1
  10496. set pixel second component expression
  10497. @item c2
  10498. set pixel third component expression
  10499. @item c3
  10500. set pixel fourth component expression, corresponds to the alpha component
  10501. @item i
  10502. set component to use as base for altering colors
  10503. @end table
  10504. Each of them specifies the expression to use for computing the lookup table for
  10505. the corresponding pixel component values.
  10506. The expressions can contain the following constants and functions:
  10507. @table @option
  10508. @item w
  10509. @item h
  10510. The input width and height.
  10511. @item val
  10512. The input value for the pixel component.
  10513. @item ymin, umin, vmin, amin
  10514. The minimum allowed component value.
  10515. @item ymax, umax, vmax, amax
  10516. The maximum allowed component value.
  10517. @end table
  10518. All expressions default to "val".
  10519. @subsection Examples
  10520. @itemize
  10521. @item
  10522. Change too high luma values to gradient:
  10523. @example
  10524. 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'"
  10525. @end example
  10526. @end itemize
  10527. @section psnr
  10528. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10529. Ratio) between two input videos.
  10530. This filter takes in input two input videos, the first input is
  10531. considered the "main" source and is passed unchanged to the
  10532. output. The second input is used as a "reference" video for computing
  10533. the PSNR.
  10534. Both video inputs must have the same resolution and pixel format for
  10535. this filter to work correctly. Also it assumes that both inputs
  10536. have the same number of frames, which are compared one by one.
  10537. The obtained average PSNR is printed through the logging system.
  10538. The filter stores the accumulated MSE (mean squared error) of each
  10539. frame, and at the end of the processing it is averaged across all frames
  10540. equally, and the following formula is applied to obtain the PSNR:
  10541. @example
  10542. PSNR = 10*log10(MAX^2/MSE)
  10543. @end example
  10544. Where MAX is the average of the maximum values of each component of the
  10545. image.
  10546. The description of the accepted parameters follows.
  10547. @table @option
  10548. @item stats_file, f
  10549. If specified the filter will use the named file to save the PSNR of
  10550. each individual frame. When filename equals "-" the data is sent to
  10551. standard output.
  10552. @item stats_version
  10553. Specifies which version of the stats file format to use. Details of
  10554. each format are written below.
  10555. Default value is 1.
  10556. @item stats_add_max
  10557. Determines whether the max value is output to the stats log.
  10558. Default value is 0.
  10559. Requires stats_version >= 2. If this is set and stats_version < 2,
  10560. the filter will return an error.
  10561. @end table
  10562. This filter also supports the @ref{framesync} options.
  10563. The file printed if @var{stats_file} is selected, contains a sequence of
  10564. key/value pairs of the form @var{key}:@var{value} for each compared
  10565. couple of frames.
  10566. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10567. the list of per-frame-pair stats, with key value pairs following the frame
  10568. format with the following parameters:
  10569. @table @option
  10570. @item psnr_log_version
  10571. The version of the log file format. Will match @var{stats_version}.
  10572. @item fields
  10573. A comma separated list of the per-frame-pair parameters included in
  10574. the log.
  10575. @end table
  10576. A description of each shown per-frame-pair parameter follows:
  10577. @table @option
  10578. @item n
  10579. sequential number of the input frame, starting from 1
  10580. @item mse_avg
  10581. Mean Square Error pixel-by-pixel average difference of the compared
  10582. frames, averaged over all the image components.
  10583. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10584. Mean Square Error pixel-by-pixel average difference of the compared
  10585. frames for the component specified by the suffix.
  10586. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10587. Peak Signal to Noise ratio of the compared frames for the component
  10588. specified by the suffix.
  10589. @item max_avg, max_y, max_u, max_v
  10590. Maximum allowed value for each channel, and average over all
  10591. channels.
  10592. @end table
  10593. For example:
  10594. @example
  10595. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10596. [main][ref] psnr="stats_file=stats.log" [out]
  10597. @end example
  10598. On this example the input file being processed is compared with the
  10599. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10600. is stored in @file{stats.log}.
  10601. @anchor{pullup}
  10602. @section pullup
  10603. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10604. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10605. content.
  10606. The pullup filter is designed to take advantage of future context in making
  10607. its decisions. This filter is stateless in the sense that it does not lock
  10608. onto a pattern to follow, but it instead looks forward to the following
  10609. fields in order to identify matches and rebuild progressive frames.
  10610. To produce content with an even framerate, insert the fps filter after
  10611. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10612. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10613. The filter accepts the following options:
  10614. @table @option
  10615. @item jl
  10616. @item jr
  10617. @item jt
  10618. @item jb
  10619. These options set the amount of "junk" to ignore at the left, right, top, and
  10620. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10621. while top and bottom are in units of 2 lines.
  10622. The default is 8 pixels on each side.
  10623. @item sb
  10624. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10625. filter generating an occasional mismatched frame, but it may also cause an
  10626. excessive number of frames to be dropped during high motion sequences.
  10627. Conversely, setting it to -1 will make filter match fields more easily.
  10628. This may help processing of video where there is slight blurring between
  10629. the fields, but may also cause there to be interlaced frames in the output.
  10630. Default value is @code{0}.
  10631. @item mp
  10632. Set the metric plane to use. It accepts the following values:
  10633. @table @samp
  10634. @item l
  10635. Use luma plane.
  10636. @item u
  10637. Use chroma blue plane.
  10638. @item v
  10639. Use chroma red plane.
  10640. @end table
  10641. This option may be set to use chroma plane instead of the default luma plane
  10642. for doing filter's computations. This may improve accuracy on very clean
  10643. source material, but more likely will decrease accuracy, especially if there
  10644. is chroma noise (rainbow effect) or any grayscale video.
  10645. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10646. load and make pullup usable in realtime on slow machines.
  10647. @end table
  10648. For best results (without duplicated frames in the output file) it is
  10649. necessary to change the output frame rate. For example, to inverse
  10650. telecine NTSC input:
  10651. @example
  10652. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10653. @end example
  10654. @section qp
  10655. Change video quantization parameters (QP).
  10656. The filter accepts the following option:
  10657. @table @option
  10658. @item qp
  10659. Set expression for quantization parameter.
  10660. @end table
  10661. The expression is evaluated through the eval API and can contain, among others,
  10662. the following constants:
  10663. @table @var
  10664. @item known
  10665. 1 if index is not 129, 0 otherwise.
  10666. @item qp
  10667. Sequential index starting from -129 to 128.
  10668. @end table
  10669. @subsection Examples
  10670. @itemize
  10671. @item
  10672. Some equation like:
  10673. @example
  10674. qp=2+2*sin(PI*qp)
  10675. @end example
  10676. @end itemize
  10677. @section random
  10678. Flush video frames from internal cache of frames into a random order.
  10679. No frame is discarded.
  10680. Inspired by @ref{frei0r} nervous filter.
  10681. @table @option
  10682. @item frames
  10683. Set size in number of frames of internal cache, in range from @code{2} to
  10684. @code{512}. Default is @code{30}.
  10685. @item seed
  10686. Set seed for random number generator, must be an integer included between
  10687. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10688. less than @code{0}, the filter will try to use a good random seed on a
  10689. best effort basis.
  10690. @end table
  10691. @section readeia608
  10692. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10693. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10694. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10695. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10696. @table @option
  10697. @item lavfi.readeia608.X.cc
  10698. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10699. @item lavfi.readeia608.X.line
  10700. The number of the line on which the EIA-608 data was identified and read.
  10701. @end table
  10702. This filter accepts the following options:
  10703. @table @option
  10704. @item scan_min
  10705. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10706. @item scan_max
  10707. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10708. @item mac
  10709. Set minimal acceptable amplitude change for sync codes detection.
  10710. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10711. @item spw
  10712. Set the ratio of width reserved for sync code detection.
  10713. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10714. @item mhd
  10715. Set the max peaks height difference for sync code detection.
  10716. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10717. @item mpd
  10718. Set max peaks period difference for sync code detection.
  10719. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10720. @item msd
  10721. Set the first two max start code bits differences.
  10722. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10723. @item bhd
  10724. Set the minimum ratio of bits height compared to 3rd start code bit.
  10725. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10726. @item th_w
  10727. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10728. @item th_b
  10729. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10730. @item chp
  10731. Enable checking the parity bit. In the event of a parity error, the filter will output
  10732. @code{0x00} for that character. Default is false.
  10733. @end table
  10734. @subsection Examples
  10735. @itemize
  10736. @item
  10737. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10738. @example
  10739. 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
  10740. @end example
  10741. @end itemize
  10742. @section readvitc
  10743. Read vertical interval timecode (VITC) information from the top lines of a
  10744. video frame.
  10745. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10746. timecode value, if a valid timecode has been detected. Further metadata key
  10747. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10748. timecode data has been found or not.
  10749. This filter accepts the following options:
  10750. @table @option
  10751. @item scan_max
  10752. Set the maximum number of lines to scan for VITC data. If the value is set to
  10753. @code{-1} the full video frame is scanned. Default is @code{45}.
  10754. @item thr_b
  10755. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10756. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10757. @item thr_w
  10758. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10759. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10760. @end table
  10761. @subsection Examples
  10762. @itemize
  10763. @item
  10764. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10765. draw @code{--:--:--:--} as a placeholder:
  10766. @example
  10767. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10768. @end example
  10769. @end itemize
  10770. @section remap
  10771. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10772. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10773. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10774. value for pixel will be used for destination pixel.
  10775. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10776. will have Xmap/Ymap video stream dimensions.
  10777. Xmap and Ymap input video streams are 16bit depth, single channel.
  10778. @section removegrain
  10779. The removegrain filter is a spatial denoiser for progressive video.
  10780. @table @option
  10781. @item m0
  10782. Set mode for the first plane.
  10783. @item m1
  10784. Set mode for the second plane.
  10785. @item m2
  10786. Set mode for the third plane.
  10787. @item m3
  10788. Set mode for the fourth plane.
  10789. @end table
  10790. Range of mode is from 0 to 24. Description of each mode follows:
  10791. @table @var
  10792. @item 0
  10793. Leave input plane unchanged. Default.
  10794. @item 1
  10795. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10796. @item 2
  10797. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10798. @item 3
  10799. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10800. @item 4
  10801. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10802. This is equivalent to a median filter.
  10803. @item 5
  10804. Line-sensitive clipping giving the minimal change.
  10805. @item 6
  10806. Line-sensitive clipping, intermediate.
  10807. @item 7
  10808. Line-sensitive clipping, intermediate.
  10809. @item 8
  10810. Line-sensitive clipping, intermediate.
  10811. @item 9
  10812. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10813. @item 10
  10814. Replaces the target pixel with the closest neighbour.
  10815. @item 11
  10816. [1 2 1] horizontal and vertical kernel blur.
  10817. @item 12
  10818. Same as mode 11.
  10819. @item 13
  10820. Bob mode, interpolates top field from the line where the neighbours
  10821. pixels are the closest.
  10822. @item 14
  10823. Bob mode, interpolates bottom field from the line where the neighbours
  10824. pixels are the closest.
  10825. @item 15
  10826. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10827. interpolation formula.
  10828. @item 16
  10829. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10830. interpolation formula.
  10831. @item 17
  10832. Clips the pixel with the minimum and maximum of respectively the maximum and
  10833. minimum of each pair of opposite neighbour pixels.
  10834. @item 18
  10835. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10836. the current pixel is minimal.
  10837. @item 19
  10838. Replaces the pixel with the average of its 8 neighbours.
  10839. @item 20
  10840. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10841. @item 21
  10842. Clips pixels using the averages of opposite neighbour.
  10843. @item 22
  10844. Same as mode 21 but simpler and faster.
  10845. @item 23
  10846. Small edge and halo removal, but reputed useless.
  10847. @item 24
  10848. Similar as 23.
  10849. @end table
  10850. @section removelogo
  10851. Suppress a TV station logo, using an image file to determine which
  10852. pixels comprise the logo. It works by filling in the pixels that
  10853. comprise the logo with neighboring pixels.
  10854. The filter accepts the following options:
  10855. @table @option
  10856. @item filename, f
  10857. Set the filter bitmap file, which can be any image format supported by
  10858. libavformat. The width and height of the image file must match those of the
  10859. video stream being processed.
  10860. @end table
  10861. Pixels in the provided bitmap image with a value of zero are not
  10862. considered part of the logo, non-zero pixels are considered part of
  10863. the logo. If you use white (255) for the logo and black (0) for the
  10864. rest, you will be safe. For making the filter bitmap, it is
  10865. recommended to take a screen capture of a black frame with the logo
  10866. visible, and then using a threshold filter followed by the erode
  10867. filter once or twice.
  10868. If needed, little splotches can be fixed manually. Remember that if
  10869. logo pixels are not covered, the filter quality will be much
  10870. reduced. Marking too many pixels as part of the logo does not hurt as
  10871. much, but it will increase the amount of blurring needed to cover over
  10872. the image and will destroy more information than necessary, and extra
  10873. pixels will slow things down on a large logo.
  10874. @section repeatfields
  10875. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10876. fields based on its value.
  10877. @section reverse
  10878. Reverse a video clip.
  10879. Warning: This filter requires memory to buffer the entire clip, so trimming
  10880. is suggested.
  10881. @subsection Examples
  10882. @itemize
  10883. @item
  10884. Take the first 5 seconds of a clip, and reverse it.
  10885. @example
  10886. trim=end=5,reverse
  10887. @end example
  10888. @end itemize
  10889. @section roberts
  10890. Apply roberts cross operator to input video stream.
  10891. The filter accepts the following option:
  10892. @table @option
  10893. @item planes
  10894. Set which planes will be processed, unprocessed planes will be copied.
  10895. By default value 0xf, all planes will be processed.
  10896. @item scale
  10897. Set value which will be multiplied with filtered result.
  10898. @item delta
  10899. Set value which will be added to filtered result.
  10900. @end table
  10901. @section rotate
  10902. Rotate video by an arbitrary angle expressed in radians.
  10903. The filter accepts the following options:
  10904. A description of the optional parameters follows.
  10905. @table @option
  10906. @item angle, a
  10907. Set an expression for the angle by which to rotate the input video
  10908. clockwise, expressed as a number of radians. A negative value will
  10909. result in a counter-clockwise rotation. By default it is set to "0".
  10910. This expression is evaluated for each frame.
  10911. @item out_w, ow
  10912. Set the output width expression, default value is "iw".
  10913. This expression is evaluated just once during configuration.
  10914. @item out_h, oh
  10915. Set the output height expression, default value is "ih".
  10916. This expression is evaluated just once during configuration.
  10917. @item bilinear
  10918. Enable bilinear interpolation if set to 1, a value of 0 disables
  10919. it. Default value is 1.
  10920. @item fillcolor, c
  10921. Set the color used to fill the output area not covered by the rotated
  10922. image. For the general syntax of this option, check the
  10923. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10924. If the special value "none" is selected then no
  10925. background is printed (useful for example if the background is never shown).
  10926. Default value is "black".
  10927. @end table
  10928. The expressions for the angle and the output size can contain the
  10929. following constants and functions:
  10930. @table @option
  10931. @item n
  10932. sequential number of the input frame, starting from 0. It is always NAN
  10933. before the first frame is filtered.
  10934. @item t
  10935. time in seconds of the input frame, it is set to 0 when the filter is
  10936. configured. It is always NAN before the first frame is filtered.
  10937. @item hsub
  10938. @item vsub
  10939. horizontal and vertical chroma subsample values. For example for the
  10940. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10941. @item in_w, iw
  10942. @item in_h, ih
  10943. the input video width and height
  10944. @item out_w, ow
  10945. @item out_h, oh
  10946. the output width and height, that is the size of the padded area as
  10947. specified by the @var{width} and @var{height} expressions
  10948. @item rotw(a)
  10949. @item roth(a)
  10950. the minimal width/height required for completely containing the input
  10951. video rotated by @var{a} radians.
  10952. These are only available when computing the @option{out_w} and
  10953. @option{out_h} expressions.
  10954. @end table
  10955. @subsection Examples
  10956. @itemize
  10957. @item
  10958. Rotate the input by PI/6 radians clockwise:
  10959. @example
  10960. rotate=PI/6
  10961. @end example
  10962. @item
  10963. Rotate the input by PI/6 radians counter-clockwise:
  10964. @example
  10965. rotate=-PI/6
  10966. @end example
  10967. @item
  10968. Rotate the input by 45 degrees clockwise:
  10969. @example
  10970. rotate=45*PI/180
  10971. @end example
  10972. @item
  10973. Apply a constant rotation with period T, starting from an angle of PI/3:
  10974. @example
  10975. rotate=PI/3+2*PI*t/T
  10976. @end example
  10977. @item
  10978. Make the input video rotation oscillating with a period of T
  10979. seconds and an amplitude of A radians:
  10980. @example
  10981. rotate=A*sin(2*PI/T*t)
  10982. @end example
  10983. @item
  10984. Rotate the video, output size is chosen so that the whole rotating
  10985. input video is always completely contained in the output:
  10986. @example
  10987. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10988. @end example
  10989. @item
  10990. Rotate the video, reduce the output size so that no background is ever
  10991. shown:
  10992. @example
  10993. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10994. @end example
  10995. @end itemize
  10996. @subsection Commands
  10997. The filter supports the following commands:
  10998. @table @option
  10999. @item a, angle
  11000. Set the angle expression.
  11001. The command accepts the same syntax of the corresponding option.
  11002. If the specified expression is not valid, it is kept at its current
  11003. value.
  11004. @end table
  11005. @section sab
  11006. Apply Shape Adaptive Blur.
  11007. The filter accepts the following options:
  11008. @table @option
  11009. @item luma_radius, lr
  11010. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11011. value is 1.0. A greater value will result in a more blurred image, and
  11012. in slower processing.
  11013. @item luma_pre_filter_radius, lpfr
  11014. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11015. value is 1.0.
  11016. @item luma_strength, ls
  11017. Set luma maximum difference between pixels to still be considered, must
  11018. be a value in the 0.1-100.0 range, default value is 1.0.
  11019. @item chroma_radius, cr
  11020. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11021. greater value will result in a more blurred image, and in slower
  11022. processing.
  11023. @item chroma_pre_filter_radius, cpfr
  11024. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11025. @item chroma_strength, cs
  11026. Set chroma maximum difference between pixels to still be considered,
  11027. must be a value in the -0.9-100.0 range.
  11028. @end table
  11029. Each chroma option value, if not explicitly specified, is set to the
  11030. corresponding luma option value.
  11031. @anchor{scale}
  11032. @section scale
  11033. Scale (resize) the input video, using the libswscale library.
  11034. The scale filter forces the output display aspect ratio to be the same
  11035. of the input, by changing the output sample aspect ratio.
  11036. If the input image format is different from the format requested by
  11037. the next filter, the scale filter will convert the input to the
  11038. requested format.
  11039. @subsection Options
  11040. The filter accepts the following options, or any of the options
  11041. supported by the libswscale scaler.
  11042. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11043. the complete list of scaler options.
  11044. @table @option
  11045. @item width, w
  11046. @item height, h
  11047. Set the output video dimension expression. Default value is the input
  11048. dimension.
  11049. If the @var{width} or @var{w} value is 0, the input width is used for
  11050. the output. If the @var{height} or @var{h} value is 0, the input height
  11051. is used for the output.
  11052. If one and only one of the values is -n with n >= 1, the scale filter
  11053. will use a value that maintains the aspect ratio of the input image,
  11054. calculated from the other specified dimension. After that it will,
  11055. however, make sure that the calculated dimension is divisible by n and
  11056. adjust the value if necessary.
  11057. If both values are -n with n >= 1, the behavior will be identical to
  11058. both values being set to 0 as previously detailed.
  11059. See below for the list of accepted constants for use in the dimension
  11060. expression.
  11061. @item eval
  11062. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11063. @table @samp
  11064. @item init
  11065. Only evaluate expressions once during the filter initialization or when a command is processed.
  11066. @item frame
  11067. Evaluate expressions for each incoming frame.
  11068. @end table
  11069. Default value is @samp{init}.
  11070. @item interl
  11071. Set the interlacing mode. It accepts the following values:
  11072. @table @samp
  11073. @item 1
  11074. Force interlaced aware scaling.
  11075. @item 0
  11076. Do not apply interlaced scaling.
  11077. @item -1
  11078. Select interlaced aware scaling depending on whether the source frames
  11079. are flagged as interlaced or not.
  11080. @end table
  11081. Default value is @samp{0}.
  11082. @item flags
  11083. Set libswscale scaling flags. See
  11084. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11085. complete list of values. If not explicitly specified the filter applies
  11086. the default flags.
  11087. @item param0, param1
  11088. Set libswscale input parameters for scaling algorithms that need them. See
  11089. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11090. complete documentation. If not explicitly specified the filter applies
  11091. empty parameters.
  11092. @item size, s
  11093. Set the video size. For the syntax of this option, check the
  11094. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11095. @item in_color_matrix
  11096. @item out_color_matrix
  11097. Set in/output YCbCr color space type.
  11098. This allows the autodetected value to be overridden as well as allows forcing
  11099. a specific value used for the output and encoder.
  11100. If not specified, the color space type depends on the pixel format.
  11101. Possible values:
  11102. @table @samp
  11103. @item auto
  11104. Choose automatically.
  11105. @item bt709
  11106. Format conforming to International Telecommunication Union (ITU)
  11107. Recommendation BT.709.
  11108. @item fcc
  11109. Set color space conforming to the United States Federal Communications
  11110. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11111. @item bt601
  11112. Set color space conforming to:
  11113. @itemize
  11114. @item
  11115. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11116. @item
  11117. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11118. @item
  11119. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11120. @end itemize
  11121. @item smpte240m
  11122. Set color space conforming to SMPTE ST 240:1999.
  11123. @end table
  11124. @item in_range
  11125. @item out_range
  11126. Set in/output YCbCr sample range.
  11127. This allows the autodetected value to be overridden as well as allows forcing
  11128. a specific value used for the output and encoder. If not specified, the
  11129. range depends on the pixel format. Possible values:
  11130. @table @samp
  11131. @item auto/unknown
  11132. Choose automatically.
  11133. @item jpeg/full/pc
  11134. Set full range (0-255 in case of 8-bit luma).
  11135. @item mpeg/limited/tv
  11136. Set "MPEG" range (16-235 in case of 8-bit luma).
  11137. @end table
  11138. @item force_original_aspect_ratio
  11139. Enable decreasing or increasing output video width or height if necessary to
  11140. keep the original aspect ratio. Possible values:
  11141. @table @samp
  11142. @item disable
  11143. Scale the video as specified and disable this feature.
  11144. @item decrease
  11145. The output video dimensions will automatically be decreased if needed.
  11146. @item increase
  11147. The output video dimensions will automatically be increased if needed.
  11148. @end table
  11149. One useful instance of this option is that when you know a specific device's
  11150. maximum allowed resolution, you can use this to limit the output video to
  11151. that, while retaining the aspect ratio. For example, device A allows
  11152. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11153. decrease) and specifying 1280x720 to the command line makes the output
  11154. 1280x533.
  11155. Please note that this is a different thing than specifying -1 for @option{w}
  11156. or @option{h}, you still need to specify the output resolution for this option
  11157. to work.
  11158. @end table
  11159. The values of the @option{w} and @option{h} options are expressions
  11160. containing the following constants:
  11161. @table @var
  11162. @item in_w
  11163. @item in_h
  11164. The input width and height
  11165. @item iw
  11166. @item ih
  11167. These are the same as @var{in_w} and @var{in_h}.
  11168. @item out_w
  11169. @item out_h
  11170. The output (scaled) width and height
  11171. @item ow
  11172. @item oh
  11173. These are the same as @var{out_w} and @var{out_h}
  11174. @item a
  11175. The same as @var{iw} / @var{ih}
  11176. @item sar
  11177. input sample aspect ratio
  11178. @item dar
  11179. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11180. @item hsub
  11181. @item vsub
  11182. horizontal and vertical input chroma subsample values. For example for the
  11183. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11184. @item ohsub
  11185. @item ovsub
  11186. horizontal and vertical output chroma subsample values. For example for the
  11187. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11188. @end table
  11189. @subsection Examples
  11190. @itemize
  11191. @item
  11192. Scale the input video to a size of 200x100
  11193. @example
  11194. scale=w=200:h=100
  11195. @end example
  11196. This is equivalent to:
  11197. @example
  11198. scale=200:100
  11199. @end example
  11200. or:
  11201. @example
  11202. scale=200x100
  11203. @end example
  11204. @item
  11205. Specify a size abbreviation for the output size:
  11206. @example
  11207. scale=qcif
  11208. @end example
  11209. which can also be written as:
  11210. @example
  11211. scale=size=qcif
  11212. @end example
  11213. @item
  11214. Scale the input to 2x:
  11215. @example
  11216. scale=w=2*iw:h=2*ih
  11217. @end example
  11218. @item
  11219. The above is the same as:
  11220. @example
  11221. scale=2*in_w:2*in_h
  11222. @end example
  11223. @item
  11224. Scale the input to 2x with forced interlaced scaling:
  11225. @example
  11226. scale=2*iw:2*ih:interl=1
  11227. @end example
  11228. @item
  11229. Scale the input to half size:
  11230. @example
  11231. scale=w=iw/2:h=ih/2
  11232. @end example
  11233. @item
  11234. Increase the width, and set the height to the same size:
  11235. @example
  11236. scale=3/2*iw:ow
  11237. @end example
  11238. @item
  11239. Seek Greek harmony:
  11240. @example
  11241. scale=iw:1/PHI*iw
  11242. scale=ih*PHI:ih
  11243. @end example
  11244. @item
  11245. Increase the height, and set the width to 3/2 of the height:
  11246. @example
  11247. scale=w=3/2*oh:h=3/5*ih
  11248. @end example
  11249. @item
  11250. Increase the size, making the size a multiple of the chroma
  11251. subsample values:
  11252. @example
  11253. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11254. @end example
  11255. @item
  11256. Increase the width to a maximum of 500 pixels,
  11257. keeping the same aspect ratio as the input:
  11258. @example
  11259. scale=w='min(500\, iw*3/2):h=-1'
  11260. @end example
  11261. @item
  11262. Make pixels square by combining scale and setsar:
  11263. @example
  11264. scale='trunc(ih*dar):ih',setsar=1/1
  11265. @end example
  11266. @item
  11267. Make pixels square by combining scale and setsar,
  11268. making sure the resulting resolution is even (required by some codecs):
  11269. @example
  11270. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11271. @end example
  11272. @end itemize
  11273. @subsection Commands
  11274. This filter supports the following commands:
  11275. @table @option
  11276. @item width, w
  11277. @item height, h
  11278. Set the output video dimension expression.
  11279. The command accepts the same syntax of the corresponding option.
  11280. If the specified expression is not valid, it is kept at its current
  11281. value.
  11282. @end table
  11283. @section scale_npp
  11284. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11285. format conversion on CUDA video frames. Setting the output width and height
  11286. works in the same way as for the @var{scale} filter.
  11287. The following additional options are accepted:
  11288. @table @option
  11289. @item format
  11290. The pixel format of the output CUDA frames. If set to the string "same" (the
  11291. default), the input format will be kept. Note that automatic format negotiation
  11292. and conversion is not yet supported for hardware frames
  11293. @item interp_algo
  11294. The interpolation algorithm used for resizing. One of the following:
  11295. @table @option
  11296. @item nn
  11297. Nearest neighbour.
  11298. @item linear
  11299. @item cubic
  11300. @item cubic2p_bspline
  11301. 2-parameter cubic (B=1, C=0)
  11302. @item cubic2p_catmullrom
  11303. 2-parameter cubic (B=0, C=1/2)
  11304. @item cubic2p_b05c03
  11305. 2-parameter cubic (B=1/2, C=3/10)
  11306. @item super
  11307. Supersampling
  11308. @item lanczos
  11309. @end table
  11310. @end table
  11311. @section scale2ref
  11312. Scale (resize) the input video, based on a reference video.
  11313. See the scale filter for available options, scale2ref supports the same but
  11314. uses the reference video instead of the main input as basis. scale2ref also
  11315. supports the following additional constants for the @option{w} and
  11316. @option{h} options:
  11317. @table @var
  11318. @item main_w
  11319. @item main_h
  11320. The main input video's width and height
  11321. @item main_a
  11322. The same as @var{main_w} / @var{main_h}
  11323. @item main_sar
  11324. The main input video's sample aspect ratio
  11325. @item main_dar, mdar
  11326. The main input video's display aspect ratio. Calculated from
  11327. @code{(main_w / main_h) * main_sar}.
  11328. @item main_hsub
  11329. @item main_vsub
  11330. The main input video's horizontal and vertical chroma subsample values.
  11331. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11332. is 1.
  11333. @end table
  11334. @subsection Examples
  11335. @itemize
  11336. @item
  11337. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11338. @example
  11339. 'scale2ref[b][a];[a][b]overlay'
  11340. @end example
  11341. @end itemize
  11342. @anchor{selectivecolor}
  11343. @section selectivecolor
  11344. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11345. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11346. by the "purity" of the color (that is, how saturated it already is).
  11347. This filter is similar to the Adobe Photoshop Selective Color tool.
  11348. The filter accepts the following options:
  11349. @table @option
  11350. @item correction_method
  11351. Select color correction method.
  11352. Available values are:
  11353. @table @samp
  11354. @item absolute
  11355. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11356. component value).
  11357. @item relative
  11358. Specified adjustments are relative to the original component value.
  11359. @end table
  11360. Default is @code{absolute}.
  11361. @item reds
  11362. Adjustments for red pixels (pixels where the red component is the maximum)
  11363. @item yellows
  11364. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11365. @item greens
  11366. Adjustments for green pixels (pixels where the green component is the maximum)
  11367. @item cyans
  11368. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11369. @item blues
  11370. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11371. @item magentas
  11372. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11373. @item whites
  11374. Adjustments for white pixels (pixels where all components are greater than 128)
  11375. @item neutrals
  11376. Adjustments for all pixels except pure black and pure white
  11377. @item blacks
  11378. Adjustments for black pixels (pixels where all components are lesser than 128)
  11379. @item psfile
  11380. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11381. @end table
  11382. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11383. 4 space separated floating point adjustment values in the [-1,1] range,
  11384. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11385. pixels of its range.
  11386. @subsection Examples
  11387. @itemize
  11388. @item
  11389. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11390. increase magenta by 27% in blue areas:
  11391. @example
  11392. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11393. @end example
  11394. @item
  11395. Use a Photoshop selective color preset:
  11396. @example
  11397. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11398. @end example
  11399. @end itemize
  11400. @anchor{separatefields}
  11401. @section separatefields
  11402. The @code{separatefields} takes a frame-based video input and splits
  11403. each frame into its components fields, producing a new half height clip
  11404. with twice the frame rate and twice the frame count.
  11405. This filter use field-dominance information in frame to decide which
  11406. of each pair of fields to place first in the output.
  11407. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11408. @section setdar, setsar
  11409. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11410. output video.
  11411. This is done by changing the specified Sample (aka Pixel) Aspect
  11412. Ratio, according to the following equation:
  11413. @example
  11414. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11415. @end example
  11416. Keep in mind that the @code{setdar} filter does not modify the pixel
  11417. dimensions of the video frame. Also, the display aspect ratio set by
  11418. this filter may be changed by later filters in the filterchain,
  11419. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11420. applied.
  11421. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11422. the filter output video.
  11423. Note that as a consequence of the application of this filter, the
  11424. output display aspect ratio will change according to the equation
  11425. above.
  11426. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11427. filter may be changed by later filters in the filterchain, e.g. if
  11428. another "setsar" or a "setdar" filter is applied.
  11429. It accepts the following parameters:
  11430. @table @option
  11431. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11432. Set the aspect ratio used by the filter.
  11433. The parameter can be a floating point number string, an expression, or
  11434. a string of the form @var{num}:@var{den}, where @var{num} and
  11435. @var{den} are the numerator and denominator of the aspect ratio. If
  11436. the parameter is not specified, it is assumed the value "0".
  11437. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11438. should be escaped.
  11439. @item max
  11440. Set the maximum integer value to use for expressing numerator and
  11441. denominator when reducing the expressed aspect ratio to a rational.
  11442. Default value is @code{100}.
  11443. @end table
  11444. The parameter @var{sar} is an expression containing
  11445. the following constants:
  11446. @table @option
  11447. @item E, PI, PHI
  11448. These are approximated values for the mathematical constants e
  11449. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11450. @item w, h
  11451. The input width and height.
  11452. @item a
  11453. These are the same as @var{w} / @var{h}.
  11454. @item sar
  11455. The input sample aspect ratio.
  11456. @item dar
  11457. The input display aspect ratio. It is the same as
  11458. (@var{w} / @var{h}) * @var{sar}.
  11459. @item hsub, vsub
  11460. Horizontal and vertical chroma subsample values. For example, for the
  11461. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11462. @end table
  11463. @subsection Examples
  11464. @itemize
  11465. @item
  11466. To change the display aspect ratio to 16:9, specify one of the following:
  11467. @example
  11468. setdar=dar=1.77777
  11469. setdar=dar=16/9
  11470. @end example
  11471. @item
  11472. To change the sample aspect ratio to 10:11, specify:
  11473. @example
  11474. setsar=sar=10/11
  11475. @end example
  11476. @item
  11477. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11478. 1000 in the aspect ratio reduction, use the command:
  11479. @example
  11480. setdar=ratio=16/9:max=1000
  11481. @end example
  11482. @end itemize
  11483. @anchor{setfield}
  11484. @section setfield
  11485. Force field for the output video frame.
  11486. The @code{setfield} filter marks the interlace type field for the
  11487. output frames. It does not change the input frame, but only sets the
  11488. corresponding property, which affects how the frame is treated by
  11489. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11490. The filter accepts the following options:
  11491. @table @option
  11492. @item mode
  11493. Available values are:
  11494. @table @samp
  11495. @item auto
  11496. Keep the same field property.
  11497. @item bff
  11498. Mark the frame as bottom-field-first.
  11499. @item tff
  11500. Mark the frame as top-field-first.
  11501. @item prog
  11502. Mark the frame as progressive.
  11503. @end table
  11504. @end table
  11505. @anchor{setparams}
  11506. @section setparams
  11507. Force frame parameter for the output video frame.
  11508. The @code{setparams} filter marks interlace and color range for the
  11509. output frames. It does not change the input frame, but only sets the
  11510. corresponding property, which affects how the frame is treated by
  11511. filters/encoders.
  11512. @table @option
  11513. @item field_mode
  11514. Available values are:
  11515. @table @samp
  11516. @item auto
  11517. Keep the same field property (default).
  11518. @item bff
  11519. Mark the frame as bottom-field-first.
  11520. @item tff
  11521. Mark the frame as top-field-first.
  11522. @item prog
  11523. Mark the frame as progressive.
  11524. @end table
  11525. @item range
  11526. Available values are:
  11527. @table @samp
  11528. @item auto
  11529. Keep the same color range property (default).
  11530. @item unspecified, unknown
  11531. Mark the frame as unspecified color range.
  11532. @item limited, tv, mpeg
  11533. Mark the frame as limited range.
  11534. @item full, pc, jpeg
  11535. Mark the frame as full range.
  11536. @end table
  11537. @item color_primaries
  11538. Set the color primaries.
  11539. Available values are:
  11540. @table @samp
  11541. @item auto
  11542. Keep the same color primaries property (default).
  11543. @item bt709
  11544. @item unknown
  11545. @item bt470m
  11546. @item bt470bg
  11547. @item smpte170m
  11548. @item smpte240m
  11549. @item film
  11550. @item bt2020
  11551. @item smpte428
  11552. @item smpte431
  11553. @item smpte432
  11554. @item jedec-p22
  11555. @end table
  11556. @item color_trc
  11557. Set the color transfert.
  11558. Available values are:
  11559. @table @samp
  11560. @item auto
  11561. Keep the same color trc property (default).
  11562. @item bt709
  11563. @item unknown
  11564. @item bt470m
  11565. @item bt470bg
  11566. @item smpte170m
  11567. @item smpte240m
  11568. @item linear
  11569. @item log100
  11570. @item log316
  11571. @item iec61966-2-4
  11572. @item bt1361e
  11573. @item iec61966-2-1
  11574. @item bt2020-10
  11575. @item bt2020-12
  11576. @item smpte2084
  11577. @item smpte428
  11578. @item arib-std-b67
  11579. @end table
  11580. @item colorspace
  11581. Set the colorspace.
  11582. Available values are:
  11583. @table @samp
  11584. @item auto
  11585. Keep the same colorspace property (default).
  11586. @item gbr
  11587. @item bt709
  11588. @item unknown
  11589. @item fcc
  11590. @item bt470bg
  11591. @item smpte170m
  11592. @item smpte240m
  11593. @item ycgco
  11594. @item bt2020nc
  11595. @item bt2020c
  11596. @item smpte2085
  11597. @item chroma-derived-nc
  11598. @item chroma-derived-c
  11599. @item ictcp
  11600. @end table
  11601. @end table
  11602. @section showinfo
  11603. Show a line containing various information for each input video frame.
  11604. The input video is not modified.
  11605. The shown line contains a sequence of key/value pairs of the form
  11606. @var{key}:@var{value}.
  11607. The following values are shown in the output:
  11608. @table @option
  11609. @item n
  11610. The (sequential) number of the input frame, starting from 0.
  11611. @item pts
  11612. The Presentation TimeStamp of the input frame, expressed as a number of
  11613. time base units. The time base unit depends on the filter input pad.
  11614. @item pts_time
  11615. The Presentation TimeStamp of the input frame, expressed as a number of
  11616. seconds.
  11617. @item pos
  11618. The position of the frame in the input stream, or -1 if this information is
  11619. unavailable and/or meaningless (for example in case of synthetic video).
  11620. @item fmt
  11621. The pixel format name.
  11622. @item sar
  11623. The sample aspect ratio of the input frame, expressed in the form
  11624. @var{num}/@var{den}.
  11625. @item s
  11626. The size of the input frame. For the syntax of this option, check the
  11627. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11628. @item i
  11629. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  11630. for bottom field first).
  11631. @item iskey
  11632. This is 1 if the frame is a key frame, 0 otherwise.
  11633. @item type
  11634. The picture type of the input frame ("I" for an I-frame, "P" for a
  11635. P-frame, "B" for a B-frame, or "?" for an unknown type).
  11636. Also refer to the documentation of the @code{AVPictureType} enum and of
  11637. the @code{av_get_picture_type_char} function defined in
  11638. @file{libavutil/avutil.h}.
  11639. @item checksum
  11640. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  11641. @item plane_checksum
  11642. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  11643. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  11644. @end table
  11645. @section showpalette
  11646. Displays the 256 colors palette of each frame. This filter is only relevant for
  11647. @var{pal8} pixel format frames.
  11648. It accepts the following option:
  11649. @table @option
  11650. @item s
  11651. Set the size of the box used to represent one palette color entry. Default is
  11652. @code{30} (for a @code{30x30} pixel box).
  11653. @end table
  11654. @section shuffleframes
  11655. Reorder and/or duplicate and/or drop video frames.
  11656. It accepts the following parameters:
  11657. @table @option
  11658. @item mapping
  11659. Set the destination indexes of input frames.
  11660. This is space or '|' separated list of indexes that maps input frames to output
  11661. frames. Number of indexes also sets maximal value that each index may have.
  11662. '-1' index have special meaning and that is to drop frame.
  11663. @end table
  11664. The first frame has the index 0. The default is to keep the input unchanged.
  11665. @subsection Examples
  11666. @itemize
  11667. @item
  11668. Swap second and third frame of every three frames of the input:
  11669. @example
  11670. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  11671. @end example
  11672. @item
  11673. Swap 10th and 1st frame of every ten frames of the input:
  11674. @example
  11675. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  11676. @end example
  11677. @end itemize
  11678. @section shuffleplanes
  11679. Reorder and/or duplicate video planes.
  11680. It accepts the following parameters:
  11681. @table @option
  11682. @item map0
  11683. The index of the input plane to be used as the first output plane.
  11684. @item map1
  11685. The index of the input plane to be used as the second output plane.
  11686. @item map2
  11687. The index of the input plane to be used as the third output plane.
  11688. @item map3
  11689. The index of the input plane to be used as the fourth output plane.
  11690. @end table
  11691. The first plane has the index 0. The default is to keep the input unchanged.
  11692. @subsection Examples
  11693. @itemize
  11694. @item
  11695. Swap the second and third planes of the input:
  11696. @example
  11697. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  11698. @end example
  11699. @end itemize
  11700. @anchor{signalstats}
  11701. @section signalstats
  11702. Evaluate various visual metrics that assist in determining issues associated
  11703. with the digitization of analog video media.
  11704. By default the filter will log these metadata values:
  11705. @table @option
  11706. @item YMIN
  11707. Display the minimal Y value contained within the input frame. Expressed in
  11708. range of [0-255].
  11709. @item YLOW
  11710. Display the Y value at the 10% percentile within the input frame. Expressed in
  11711. range of [0-255].
  11712. @item YAVG
  11713. Display the average Y value within the input frame. Expressed in range of
  11714. [0-255].
  11715. @item YHIGH
  11716. Display the Y value at the 90% percentile within the input frame. Expressed in
  11717. range of [0-255].
  11718. @item YMAX
  11719. Display the maximum Y value contained within the input frame. Expressed in
  11720. range of [0-255].
  11721. @item UMIN
  11722. Display the minimal U value contained within the input frame. Expressed in
  11723. range of [0-255].
  11724. @item ULOW
  11725. Display the U value at the 10% percentile within the input frame. Expressed in
  11726. range of [0-255].
  11727. @item UAVG
  11728. Display the average U value within the input frame. Expressed in range of
  11729. [0-255].
  11730. @item UHIGH
  11731. Display the U value at the 90% percentile within the input frame. Expressed in
  11732. range of [0-255].
  11733. @item UMAX
  11734. Display the maximum U value contained within the input frame. Expressed in
  11735. range of [0-255].
  11736. @item VMIN
  11737. Display the minimal V value contained within the input frame. Expressed in
  11738. range of [0-255].
  11739. @item VLOW
  11740. Display the V value at the 10% percentile within the input frame. Expressed in
  11741. range of [0-255].
  11742. @item VAVG
  11743. Display the average V value within the input frame. Expressed in range of
  11744. [0-255].
  11745. @item VHIGH
  11746. Display the V value at the 90% percentile within the input frame. Expressed in
  11747. range of [0-255].
  11748. @item VMAX
  11749. Display the maximum V value contained within the input frame. Expressed in
  11750. range of [0-255].
  11751. @item SATMIN
  11752. Display the minimal saturation value contained within the input frame.
  11753. Expressed in range of [0-~181.02].
  11754. @item SATLOW
  11755. Display the saturation value at the 10% percentile within the input frame.
  11756. Expressed in range of [0-~181.02].
  11757. @item SATAVG
  11758. Display the average saturation value within the input frame. Expressed in range
  11759. of [0-~181.02].
  11760. @item SATHIGH
  11761. Display the saturation value at the 90% percentile within the input frame.
  11762. Expressed in range of [0-~181.02].
  11763. @item SATMAX
  11764. Display the maximum saturation value contained within the input frame.
  11765. Expressed in range of [0-~181.02].
  11766. @item HUEMED
  11767. Display the median value for hue within the input frame. Expressed in range of
  11768. [0-360].
  11769. @item HUEAVG
  11770. Display the average value for hue within the input frame. Expressed in range of
  11771. [0-360].
  11772. @item YDIF
  11773. Display the average of sample value difference between all values of the Y
  11774. plane in the current frame and corresponding values of the previous input frame.
  11775. Expressed in range of [0-255].
  11776. @item UDIF
  11777. Display the average of sample value difference between all values of the U
  11778. plane in the current frame and corresponding values of the previous input frame.
  11779. Expressed in range of [0-255].
  11780. @item VDIF
  11781. Display the average of sample value difference between all values of the V
  11782. plane in the current frame and corresponding values of the previous input frame.
  11783. Expressed in range of [0-255].
  11784. @item YBITDEPTH
  11785. Display bit depth of Y plane in current frame.
  11786. Expressed in range of [0-16].
  11787. @item UBITDEPTH
  11788. Display bit depth of U plane in current frame.
  11789. Expressed in range of [0-16].
  11790. @item VBITDEPTH
  11791. Display bit depth of V plane in current frame.
  11792. Expressed in range of [0-16].
  11793. @end table
  11794. The filter accepts the following options:
  11795. @table @option
  11796. @item stat
  11797. @item out
  11798. @option{stat} specify an additional form of image analysis.
  11799. @option{out} output video with the specified type of pixel highlighted.
  11800. Both options accept the following values:
  11801. @table @samp
  11802. @item tout
  11803. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  11804. unlike the neighboring pixels of the same field. Examples of temporal outliers
  11805. include the results of video dropouts, head clogs, or tape tracking issues.
  11806. @item vrep
  11807. Identify @var{vertical line repetition}. Vertical line repetition includes
  11808. similar rows of pixels within a frame. In born-digital video vertical line
  11809. repetition is common, but this pattern is uncommon in video digitized from an
  11810. analog source. When it occurs in video that results from the digitization of an
  11811. analog source it can indicate concealment from a dropout compensator.
  11812. @item brng
  11813. Identify pixels that fall outside of legal broadcast range.
  11814. @end table
  11815. @item color, c
  11816. Set the highlight color for the @option{out} option. The default color is
  11817. yellow.
  11818. @end table
  11819. @subsection Examples
  11820. @itemize
  11821. @item
  11822. Output data of various video metrics:
  11823. @example
  11824. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11825. @end example
  11826. @item
  11827. Output specific data about the minimum and maximum values of the Y plane per frame:
  11828. @example
  11829. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11830. @end example
  11831. @item
  11832. Playback video while highlighting pixels that are outside of broadcast range in red.
  11833. @example
  11834. ffplay example.mov -vf signalstats="out=brng:color=red"
  11835. @end example
  11836. @item
  11837. Playback video with signalstats metadata drawn over the frame.
  11838. @example
  11839. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11840. @end example
  11841. The contents of signalstat_drawtext.txt used in the command are:
  11842. @example
  11843. time %@{pts:hms@}
  11844. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11845. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11846. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11847. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11848. @end example
  11849. @end itemize
  11850. @anchor{signature}
  11851. @section signature
  11852. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11853. input. In this case the matching between the inputs can be calculated additionally.
  11854. The filter always passes through the first input. The signature of each stream can
  11855. be written into a file.
  11856. It accepts the following options:
  11857. @table @option
  11858. @item detectmode
  11859. Enable or disable the matching process.
  11860. Available values are:
  11861. @table @samp
  11862. @item off
  11863. Disable the calculation of a matching (default).
  11864. @item full
  11865. Calculate the matching for the whole video and output whether the whole video
  11866. matches or only parts.
  11867. @item fast
  11868. Calculate only until a matching is found or the video ends. Should be faster in
  11869. some cases.
  11870. @end table
  11871. @item nb_inputs
  11872. Set the number of inputs. The option value must be a non negative integer.
  11873. Default value is 1.
  11874. @item filename
  11875. Set the path to which the output is written. If there is more than one input,
  11876. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11877. integer), that will be replaced with the input number. If no filename is
  11878. specified, no output will be written. This is the default.
  11879. @item format
  11880. Choose the output format.
  11881. Available values are:
  11882. @table @samp
  11883. @item binary
  11884. Use the specified binary representation (default).
  11885. @item xml
  11886. Use the specified xml representation.
  11887. @end table
  11888. @item th_d
  11889. Set threshold to detect one word as similar. The option value must be an integer
  11890. greater than zero. The default value is 9000.
  11891. @item th_dc
  11892. Set threshold to detect all words as similar. The option value must be an integer
  11893. greater than zero. The default value is 60000.
  11894. @item th_xh
  11895. Set threshold to detect frames as similar. The option value must be an integer
  11896. greater than zero. The default value is 116.
  11897. @item th_di
  11898. Set the minimum length of a sequence in frames to recognize it as matching
  11899. sequence. The option value must be a non negative integer value.
  11900. The default value is 0.
  11901. @item th_it
  11902. Set the minimum relation, that matching frames to all frames must have.
  11903. The option value must be a double value between 0 and 1. The default value is 0.5.
  11904. @end table
  11905. @subsection Examples
  11906. @itemize
  11907. @item
  11908. To calculate the signature of an input video and store it in signature.bin:
  11909. @example
  11910. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11911. @end example
  11912. @item
  11913. To detect whether two videos match and store the signatures in XML format in
  11914. signature0.xml and signature1.xml:
  11915. @example
  11916. 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 -
  11917. @end example
  11918. @end itemize
  11919. @anchor{smartblur}
  11920. @section smartblur
  11921. Blur the input video without impacting the outlines.
  11922. It accepts the following options:
  11923. @table @option
  11924. @item luma_radius, lr
  11925. Set the luma radius. The option value must be a float number in
  11926. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11927. used to blur the image (slower if larger). Default value is 1.0.
  11928. @item luma_strength, ls
  11929. Set the luma strength. The option value must be a float number
  11930. in the range [-1.0,1.0] that configures the blurring. A value included
  11931. in [0.0,1.0] will blur the image whereas a value included in
  11932. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11933. @item luma_threshold, lt
  11934. Set the luma threshold used as a coefficient to determine
  11935. whether a pixel should be blurred or not. The option value must be an
  11936. integer in the range [-30,30]. A value of 0 will filter all the image,
  11937. a value included in [0,30] will filter flat areas and a value included
  11938. in [-30,0] will filter edges. Default value is 0.
  11939. @item chroma_radius, cr
  11940. Set the chroma radius. The option value must be a float number in
  11941. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11942. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11943. @item chroma_strength, cs
  11944. Set the chroma strength. The option value must be a float number
  11945. in the range [-1.0,1.0] that configures the blurring. A value included
  11946. in [0.0,1.0] will blur the image whereas a value included in
  11947. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11948. @item chroma_threshold, ct
  11949. Set the chroma threshold used as a coefficient to determine
  11950. whether a pixel should be blurred or not. The option value must be an
  11951. integer in the range [-30,30]. A value of 0 will filter all the image,
  11952. a value included in [0,30] will filter flat areas and a value included
  11953. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11954. @end table
  11955. If a chroma option is not explicitly set, the corresponding luma value
  11956. is set.
  11957. @section ssim
  11958. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11959. This filter takes in input two input videos, the first input is
  11960. considered the "main" source and is passed unchanged to the
  11961. output. The second input is used as a "reference" video for computing
  11962. the SSIM.
  11963. Both video inputs must have the same resolution and pixel format for
  11964. this filter to work correctly. Also it assumes that both inputs
  11965. have the same number of frames, which are compared one by one.
  11966. The filter stores the calculated SSIM of each frame.
  11967. The description of the accepted parameters follows.
  11968. @table @option
  11969. @item stats_file, f
  11970. If specified the filter will use the named file to save the SSIM of
  11971. each individual frame. When filename equals "-" the data is sent to
  11972. standard output.
  11973. @end table
  11974. The file printed if @var{stats_file} is selected, contains a sequence of
  11975. key/value pairs of the form @var{key}:@var{value} for each compared
  11976. couple of frames.
  11977. A description of each shown parameter follows:
  11978. @table @option
  11979. @item n
  11980. sequential number of the input frame, starting from 1
  11981. @item Y, U, V, R, G, B
  11982. SSIM of the compared frames for the component specified by the suffix.
  11983. @item All
  11984. SSIM of the compared frames for the whole frame.
  11985. @item dB
  11986. Same as above but in dB representation.
  11987. @end table
  11988. This filter also supports the @ref{framesync} options.
  11989. For example:
  11990. @example
  11991. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11992. [main][ref] ssim="stats_file=stats.log" [out]
  11993. @end example
  11994. On this example the input file being processed is compared with the
  11995. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11996. is stored in @file{stats.log}.
  11997. Another example with both psnr and ssim at same time:
  11998. @example
  11999. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12000. @end example
  12001. @section stereo3d
  12002. Convert between different stereoscopic image formats.
  12003. The filters accept the following options:
  12004. @table @option
  12005. @item in
  12006. Set stereoscopic image format of input.
  12007. Available values for input image formats are:
  12008. @table @samp
  12009. @item sbsl
  12010. side by side parallel (left eye left, right eye right)
  12011. @item sbsr
  12012. side by side crosseye (right eye left, left eye right)
  12013. @item sbs2l
  12014. side by side parallel with half width resolution
  12015. (left eye left, right eye right)
  12016. @item sbs2r
  12017. side by side crosseye with half width resolution
  12018. (right eye left, left eye right)
  12019. @item abl
  12020. above-below (left eye above, right eye below)
  12021. @item abr
  12022. above-below (right eye above, left eye below)
  12023. @item ab2l
  12024. above-below with half height resolution
  12025. (left eye above, right eye below)
  12026. @item ab2r
  12027. above-below with half height resolution
  12028. (right eye above, left eye below)
  12029. @item al
  12030. alternating frames (left eye first, right eye second)
  12031. @item ar
  12032. alternating frames (right eye first, left eye second)
  12033. @item irl
  12034. interleaved rows (left eye has top row, right eye starts on next row)
  12035. @item irr
  12036. interleaved rows (right eye has top row, left eye starts on next row)
  12037. @item icl
  12038. interleaved columns, left eye first
  12039. @item icr
  12040. interleaved columns, right eye first
  12041. Default value is @samp{sbsl}.
  12042. @end table
  12043. @item out
  12044. Set stereoscopic image format of output.
  12045. @table @samp
  12046. @item sbsl
  12047. side by side parallel (left eye left, right eye right)
  12048. @item sbsr
  12049. side by side crosseye (right eye left, left eye right)
  12050. @item sbs2l
  12051. side by side parallel with half width resolution
  12052. (left eye left, right eye right)
  12053. @item sbs2r
  12054. side by side crosseye with half width resolution
  12055. (right eye left, left eye right)
  12056. @item abl
  12057. above-below (left eye above, right eye below)
  12058. @item abr
  12059. above-below (right eye above, left eye below)
  12060. @item ab2l
  12061. above-below with half height resolution
  12062. (left eye above, right eye below)
  12063. @item ab2r
  12064. above-below with half height resolution
  12065. (right eye above, left eye below)
  12066. @item al
  12067. alternating frames (left eye first, right eye second)
  12068. @item ar
  12069. alternating frames (right eye first, left eye second)
  12070. @item irl
  12071. interleaved rows (left eye has top row, right eye starts on next row)
  12072. @item irr
  12073. interleaved rows (right eye has top row, left eye starts on next row)
  12074. @item arbg
  12075. anaglyph red/blue gray
  12076. (red filter on left eye, blue filter on right eye)
  12077. @item argg
  12078. anaglyph red/green gray
  12079. (red filter on left eye, green filter on right eye)
  12080. @item arcg
  12081. anaglyph red/cyan gray
  12082. (red filter on left eye, cyan filter on right eye)
  12083. @item arch
  12084. anaglyph red/cyan half colored
  12085. (red filter on left eye, cyan filter on right eye)
  12086. @item arcc
  12087. anaglyph red/cyan color
  12088. (red filter on left eye, cyan filter on right eye)
  12089. @item arcd
  12090. anaglyph red/cyan color optimized with the least squares projection of dubois
  12091. (red filter on left eye, cyan filter on right eye)
  12092. @item agmg
  12093. anaglyph green/magenta gray
  12094. (green filter on left eye, magenta filter on right eye)
  12095. @item agmh
  12096. anaglyph green/magenta half colored
  12097. (green filter on left eye, magenta filter on right eye)
  12098. @item agmc
  12099. anaglyph green/magenta colored
  12100. (green filter on left eye, magenta filter on right eye)
  12101. @item agmd
  12102. anaglyph green/magenta color optimized with the least squares projection of dubois
  12103. (green filter on left eye, magenta filter on right eye)
  12104. @item aybg
  12105. anaglyph yellow/blue gray
  12106. (yellow filter on left eye, blue filter on right eye)
  12107. @item aybh
  12108. anaglyph yellow/blue half colored
  12109. (yellow filter on left eye, blue filter on right eye)
  12110. @item aybc
  12111. anaglyph yellow/blue colored
  12112. (yellow filter on left eye, blue filter on right eye)
  12113. @item aybd
  12114. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12115. (yellow filter on left eye, blue filter on right eye)
  12116. @item ml
  12117. mono output (left eye only)
  12118. @item mr
  12119. mono output (right eye only)
  12120. @item chl
  12121. checkerboard, left eye first
  12122. @item chr
  12123. checkerboard, right eye first
  12124. @item icl
  12125. interleaved columns, left eye first
  12126. @item icr
  12127. interleaved columns, right eye first
  12128. @item hdmi
  12129. HDMI frame pack
  12130. @end table
  12131. Default value is @samp{arcd}.
  12132. @end table
  12133. @subsection Examples
  12134. @itemize
  12135. @item
  12136. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12137. @example
  12138. stereo3d=sbsl:aybd
  12139. @end example
  12140. @item
  12141. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12142. @example
  12143. stereo3d=abl:sbsr
  12144. @end example
  12145. @end itemize
  12146. @section streamselect, astreamselect
  12147. Select video or audio streams.
  12148. The filter accepts the following options:
  12149. @table @option
  12150. @item inputs
  12151. Set number of inputs. Default is 2.
  12152. @item map
  12153. Set input indexes to remap to outputs.
  12154. @end table
  12155. @subsection Commands
  12156. The @code{streamselect} and @code{astreamselect} filter supports the following
  12157. commands:
  12158. @table @option
  12159. @item map
  12160. Set input indexes to remap to outputs.
  12161. @end table
  12162. @subsection Examples
  12163. @itemize
  12164. @item
  12165. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12166. @example
  12167. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12168. @end example
  12169. @item
  12170. Same as above, but for audio:
  12171. @example
  12172. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12173. @end example
  12174. @end itemize
  12175. @section sobel
  12176. Apply sobel operator to input video stream.
  12177. The filter accepts the following option:
  12178. @table @option
  12179. @item planes
  12180. Set which planes will be processed, unprocessed planes will be copied.
  12181. By default value 0xf, all planes will be processed.
  12182. @item scale
  12183. Set value which will be multiplied with filtered result.
  12184. @item delta
  12185. Set value which will be added to filtered result.
  12186. @end table
  12187. @anchor{spp}
  12188. @section spp
  12189. Apply a simple postprocessing filter that compresses and decompresses the image
  12190. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12191. and average the results.
  12192. The filter accepts the following options:
  12193. @table @option
  12194. @item quality
  12195. Set quality. This option defines the number of levels for averaging. It accepts
  12196. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12197. effect. A value of @code{6} means the higher quality. For each increment of
  12198. that value the speed drops by a factor of approximately 2. Default value is
  12199. @code{3}.
  12200. @item qp
  12201. Force a constant quantization parameter. If not set, the filter will use the QP
  12202. from the video stream (if available).
  12203. @item mode
  12204. Set thresholding mode. Available modes are:
  12205. @table @samp
  12206. @item hard
  12207. Set hard thresholding (default).
  12208. @item soft
  12209. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12210. @end table
  12211. @item use_bframe_qp
  12212. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12213. option may cause flicker since the B-Frames have often larger QP. Default is
  12214. @code{0} (not enabled).
  12215. @end table
  12216. @section sr
  12217. Scale the input by applying one of the super-resolution methods based on
  12218. convolutional neural networks. Supported models:
  12219. @itemize
  12220. @item
  12221. Super-Resolution Convolutional Neural Network model (SRCNN).
  12222. See @url{https://arxiv.org/abs/1501.00092}.
  12223. @item
  12224. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12225. See @url{https://arxiv.org/abs/1609.05158}.
  12226. @end itemize
  12227. Training scripts as well as scripts for model generation are provided in
  12228. the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12229. The filter accepts the following options:
  12230. @table @option
  12231. @item dnn_backend
  12232. Specify which DNN backend to use for model loading and execution. This option accepts
  12233. the following values:
  12234. @table @samp
  12235. @item native
  12236. Native implementation of DNN loading and execution.
  12237. @item tensorflow
  12238. TensorFlow backend. To enable this backend you
  12239. need to install the TensorFlow for C library (see
  12240. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12241. @code{--enable-libtensorflow}
  12242. @end table
  12243. Default value is @samp{native}.
  12244. @item model
  12245. Set path to model file specifying network architecture and its parameters.
  12246. Note that different backends use different file formats. TensorFlow backend
  12247. can load files for both formats, while native backend can load files for only
  12248. its format.
  12249. @item scale_factor
  12250. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12251. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12252. input upscaled using bicubic upscaling with proper scale factor.
  12253. @end table
  12254. @anchor{subtitles}
  12255. @section subtitles
  12256. Draw subtitles on top of input video using the libass library.
  12257. To enable compilation of this filter you need to configure FFmpeg with
  12258. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12259. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12260. Alpha) subtitles format.
  12261. The filter accepts the following options:
  12262. @table @option
  12263. @item filename, f
  12264. Set the filename of the subtitle file to read. It must be specified.
  12265. @item original_size
  12266. Specify the size of the original video, the video for which the ASS file
  12267. was composed. For the syntax of this option, check the
  12268. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12269. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12270. correctly scale the fonts if the aspect ratio has been changed.
  12271. @item fontsdir
  12272. Set a directory path containing fonts that can be used by the filter.
  12273. These fonts will be used in addition to whatever the font provider uses.
  12274. @item alpha
  12275. Process alpha channel, by default alpha channel is untouched.
  12276. @item charenc
  12277. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12278. useful if not UTF-8.
  12279. @item stream_index, si
  12280. Set subtitles stream index. @code{subtitles} filter only.
  12281. @item force_style
  12282. Override default style or script info parameters of the subtitles. It accepts a
  12283. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12284. @end table
  12285. If the first key is not specified, it is assumed that the first value
  12286. specifies the @option{filename}.
  12287. For example, to render the file @file{sub.srt} on top of the input
  12288. video, use the command:
  12289. @example
  12290. subtitles=sub.srt
  12291. @end example
  12292. which is equivalent to:
  12293. @example
  12294. subtitles=filename=sub.srt
  12295. @end example
  12296. To render the default subtitles stream from file @file{video.mkv}, use:
  12297. @example
  12298. subtitles=video.mkv
  12299. @end example
  12300. To render the second subtitles stream from that file, use:
  12301. @example
  12302. subtitles=video.mkv:si=1
  12303. @end example
  12304. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12305. @code{DejaVu Serif}, use:
  12306. @example
  12307. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12308. @end example
  12309. @section super2xsai
  12310. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12311. Interpolate) pixel art scaling algorithm.
  12312. Useful for enlarging pixel art images without reducing sharpness.
  12313. @section swaprect
  12314. Swap two rectangular objects in video.
  12315. This filter accepts the following options:
  12316. @table @option
  12317. @item w
  12318. Set object width.
  12319. @item h
  12320. Set object height.
  12321. @item x1
  12322. Set 1st rect x coordinate.
  12323. @item y1
  12324. Set 1st rect y coordinate.
  12325. @item x2
  12326. Set 2nd rect x coordinate.
  12327. @item y2
  12328. Set 2nd rect y coordinate.
  12329. All expressions are evaluated once for each frame.
  12330. @end table
  12331. The all options are expressions containing the following constants:
  12332. @table @option
  12333. @item w
  12334. @item h
  12335. The input width and height.
  12336. @item a
  12337. same as @var{w} / @var{h}
  12338. @item sar
  12339. input sample aspect ratio
  12340. @item dar
  12341. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12342. @item n
  12343. The number of the input frame, starting from 0.
  12344. @item t
  12345. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12346. @item pos
  12347. the position in the file of the input frame, NAN if unknown
  12348. @end table
  12349. @section swapuv
  12350. Swap U & V plane.
  12351. @section telecine
  12352. Apply telecine process to the video.
  12353. This filter accepts the following options:
  12354. @table @option
  12355. @item first_field
  12356. @table @samp
  12357. @item top, t
  12358. top field first
  12359. @item bottom, b
  12360. bottom field first
  12361. The default value is @code{top}.
  12362. @end table
  12363. @item pattern
  12364. A string of numbers representing the pulldown pattern you wish to apply.
  12365. The default value is @code{23}.
  12366. @end table
  12367. @example
  12368. Some typical patterns:
  12369. NTSC output (30i):
  12370. 27.5p: 32222
  12371. 24p: 23 (classic)
  12372. 24p: 2332 (preferred)
  12373. 20p: 33
  12374. 18p: 334
  12375. 16p: 3444
  12376. PAL output (25i):
  12377. 27.5p: 12222
  12378. 24p: 222222222223 ("Euro pulldown")
  12379. 16.67p: 33
  12380. 16p: 33333334
  12381. @end example
  12382. @section threshold
  12383. Apply threshold effect to video stream.
  12384. This filter needs four video streams to perform thresholding.
  12385. First stream is stream we are filtering.
  12386. Second stream is holding threshold values, third stream is holding min values,
  12387. and last, fourth stream is holding max values.
  12388. The filter accepts the following option:
  12389. @table @option
  12390. @item planes
  12391. Set which planes will be processed, unprocessed planes will be copied.
  12392. By default value 0xf, all planes will be processed.
  12393. @end table
  12394. For example if first stream pixel's component value is less then threshold value
  12395. of pixel component from 2nd threshold stream, third stream value will picked,
  12396. otherwise fourth stream pixel component value will be picked.
  12397. Using color source filter one can perform various types of thresholding:
  12398. @subsection Examples
  12399. @itemize
  12400. @item
  12401. Binary threshold, using gray color as threshold:
  12402. @example
  12403. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12404. @end example
  12405. @item
  12406. Inverted binary threshold, using gray color as threshold:
  12407. @example
  12408. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12409. @end example
  12410. @item
  12411. Truncate binary threshold, using gray color as threshold:
  12412. @example
  12413. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12414. @end example
  12415. @item
  12416. Threshold to zero, using gray color as threshold:
  12417. @example
  12418. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12419. @end example
  12420. @item
  12421. Inverted threshold to zero, using gray color as threshold:
  12422. @example
  12423. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12424. @end example
  12425. @end itemize
  12426. @section thumbnail
  12427. Select the most representative frame in a given sequence of consecutive frames.
  12428. The filter accepts the following options:
  12429. @table @option
  12430. @item n
  12431. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12432. will pick one of them, and then handle the next batch of @var{n} frames until
  12433. the end. Default is @code{100}.
  12434. @end table
  12435. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12436. value will result in a higher memory usage, so a high value is not recommended.
  12437. @subsection Examples
  12438. @itemize
  12439. @item
  12440. Extract one picture each 50 frames:
  12441. @example
  12442. thumbnail=50
  12443. @end example
  12444. @item
  12445. Complete example of a thumbnail creation with @command{ffmpeg}:
  12446. @example
  12447. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12448. @end example
  12449. @end itemize
  12450. @section tile
  12451. Tile several successive frames together.
  12452. The filter accepts the following options:
  12453. @table @option
  12454. @item layout
  12455. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12456. this option, check the
  12457. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12458. @item nb_frames
  12459. Set the maximum number of frames to render in the given area. It must be less
  12460. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12461. the area will be used.
  12462. @item margin
  12463. Set the outer border margin in pixels.
  12464. @item padding
  12465. Set the inner border thickness (i.e. the number of pixels between frames). For
  12466. more advanced padding options (such as having different values for the edges),
  12467. refer to the pad video filter.
  12468. @item color
  12469. Specify the color of the unused area. For the syntax of this option, check the
  12470. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12471. The default value of @var{color} is "black".
  12472. @item overlap
  12473. Set the number of frames to overlap when tiling several successive frames together.
  12474. The value must be between @code{0} and @var{nb_frames - 1}.
  12475. @item init_padding
  12476. Set the number of frames to initially be empty before displaying first output frame.
  12477. This controls how soon will one get first output frame.
  12478. The value must be between @code{0} and @var{nb_frames - 1}.
  12479. @end table
  12480. @subsection Examples
  12481. @itemize
  12482. @item
  12483. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12484. @example
  12485. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12486. @end example
  12487. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12488. duplicating each output frame to accommodate the originally detected frame
  12489. rate.
  12490. @item
  12491. Display @code{5} pictures in an area of @code{3x2} frames,
  12492. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12493. mixed flat and named options:
  12494. @example
  12495. tile=3x2:nb_frames=5:padding=7:margin=2
  12496. @end example
  12497. @end itemize
  12498. @section tinterlace
  12499. Perform various types of temporal field interlacing.
  12500. Frames are counted starting from 1, so the first input frame is
  12501. considered odd.
  12502. The filter accepts the following options:
  12503. @table @option
  12504. @item mode
  12505. Specify the mode of the interlacing. This option can also be specified
  12506. as a value alone. See below for a list of values for this option.
  12507. Available values are:
  12508. @table @samp
  12509. @item merge, 0
  12510. Move odd frames into the upper field, even into the lower field,
  12511. generating a double height frame at half frame rate.
  12512. @example
  12513. ------> time
  12514. Input:
  12515. Frame 1 Frame 2 Frame 3 Frame 4
  12516. 11111 22222 33333 44444
  12517. 11111 22222 33333 44444
  12518. 11111 22222 33333 44444
  12519. 11111 22222 33333 44444
  12520. Output:
  12521. 11111 33333
  12522. 22222 44444
  12523. 11111 33333
  12524. 22222 44444
  12525. 11111 33333
  12526. 22222 44444
  12527. 11111 33333
  12528. 22222 44444
  12529. @end example
  12530. @item drop_even, 1
  12531. Only output odd frames, even frames are dropped, generating a frame with
  12532. unchanged height at half frame rate.
  12533. @example
  12534. ------> time
  12535. Input:
  12536. Frame 1 Frame 2 Frame 3 Frame 4
  12537. 11111 22222 33333 44444
  12538. 11111 22222 33333 44444
  12539. 11111 22222 33333 44444
  12540. 11111 22222 33333 44444
  12541. Output:
  12542. 11111 33333
  12543. 11111 33333
  12544. 11111 33333
  12545. 11111 33333
  12546. @end example
  12547. @item drop_odd, 2
  12548. Only output even frames, odd frames are dropped, generating a frame with
  12549. unchanged height at half frame rate.
  12550. @example
  12551. ------> time
  12552. Input:
  12553. Frame 1 Frame 2 Frame 3 Frame 4
  12554. 11111 22222 33333 44444
  12555. 11111 22222 33333 44444
  12556. 11111 22222 33333 44444
  12557. 11111 22222 33333 44444
  12558. Output:
  12559. 22222 44444
  12560. 22222 44444
  12561. 22222 44444
  12562. 22222 44444
  12563. @end example
  12564. @item pad, 3
  12565. Expand each frame to full height, but pad alternate lines with black,
  12566. generating a frame with double height at the same input frame rate.
  12567. @example
  12568. ------> time
  12569. Input:
  12570. Frame 1 Frame 2 Frame 3 Frame 4
  12571. 11111 22222 33333 44444
  12572. 11111 22222 33333 44444
  12573. 11111 22222 33333 44444
  12574. 11111 22222 33333 44444
  12575. Output:
  12576. 11111 ..... 33333 .....
  12577. ..... 22222 ..... 44444
  12578. 11111 ..... 33333 .....
  12579. ..... 22222 ..... 44444
  12580. 11111 ..... 33333 .....
  12581. ..... 22222 ..... 44444
  12582. 11111 ..... 33333 .....
  12583. ..... 22222 ..... 44444
  12584. @end example
  12585. @item interleave_top, 4
  12586. Interleave the upper field from odd frames with the lower field from
  12587. even frames, generating a frame with unchanged height at half frame rate.
  12588. @example
  12589. ------> time
  12590. Input:
  12591. Frame 1 Frame 2 Frame 3 Frame 4
  12592. 11111<- 22222 33333<- 44444
  12593. 11111 22222<- 33333 44444<-
  12594. 11111<- 22222 33333<- 44444
  12595. 11111 22222<- 33333 44444<-
  12596. Output:
  12597. 11111 33333
  12598. 22222 44444
  12599. 11111 33333
  12600. 22222 44444
  12601. @end example
  12602. @item interleave_bottom, 5
  12603. Interleave the lower field from odd frames with the upper field from
  12604. even frames, generating a frame with unchanged height at half frame rate.
  12605. @example
  12606. ------> time
  12607. Input:
  12608. Frame 1 Frame 2 Frame 3 Frame 4
  12609. 11111 22222<- 33333 44444<-
  12610. 11111<- 22222 33333<- 44444
  12611. 11111 22222<- 33333 44444<-
  12612. 11111<- 22222 33333<- 44444
  12613. Output:
  12614. 22222 44444
  12615. 11111 33333
  12616. 22222 44444
  12617. 11111 33333
  12618. @end example
  12619. @item interlacex2, 6
  12620. Double frame rate with unchanged height. Frames are inserted each
  12621. containing the second temporal field from the previous input frame and
  12622. the first temporal field from the next input frame. This mode relies on
  12623. the top_field_first flag. Useful for interlaced video displays with no
  12624. field synchronisation.
  12625. @example
  12626. ------> time
  12627. Input:
  12628. Frame 1 Frame 2 Frame 3 Frame 4
  12629. 11111 22222 33333 44444
  12630. 11111 22222 33333 44444
  12631. 11111 22222 33333 44444
  12632. 11111 22222 33333 44444
  12633. Output:
  12634. 11111 22222 22222 33333 33333 44444 44444
  12635. 11111 11111 22222 22222 33333 33333 44444
  12636. 11111 22222 22222 33333 33333 44444 44444
  12637. 11111 11111 22222 22222 33333 33333 44444
  12638. @end example
  12639. @item mergex2, 7
  12640. Move odd frames into the upper field, even into the lower field,
  12641. generating a double height frame at same frame rate.
  12642. @example
  12643. ------> time
  12644. Input:
  12645. Frame 1 Frame 2 Frame 3 Frame 4
  12646. 11111 22222 33333 44444
  12647. 11111 22222 33333 44444
  12648. 11111 22222 33333 44444
  12649. 11111 22222 33333 44444
  12650. Output:
  12651. 11111 33333 33333 55555
  12652. 22222 22222 44444 44444
  12653. 11111 33333 33333 55555
  12654. 22222 22222 44444 44444
  12655. 11111 33333 33333 55555
  12656. 22222 22222 44444 44444
  12657. 11111 33333 33333 55555
  12658. 22222 22222 44444 44444
  12659. @end example
  12660. @end table
  12661. Numeric values are deprecated but are accepted for backward
  12662. compatibility reasons.
  12663. Default mode is @code{merge}.
  12664. @item flags
  12665. Specify flags influencing the filter process.
  12666. Available value for @var{flags} is:
  12667. @table @option
  12668. @item low_pass_filter, vlfp
  12669. Enable linear vertical low-pass filtering in the filter.
  12670. Vertical low-pass filtering is required when creating an interlaced
  12671. destination from a progressive source which contains high-frequency
  12672. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  12673. patterning.
  12674. @item complex_filter, cvlfp
  12675. Enable complex vertical low-pass filtering.
  12676. This will slightly less reduce interlace 'twitter' and Moire
  12677. patterning but better retain detail and subjective sharpness impression.
  12678. @end table
  12679. Vertical low-pass filtering can only be enabled for @option{mode}
  12680. @var{interleave_top} and @var{interleave_bottom}.
  12681. @end table
  12682. @section tmix
  12683. Mix successive video frames.
  12684. A description of the accepted options follows.
  12685. @table @option
  12686. @item frames
  12687. The number of successive frames to mix. If unspecified, it defaults to 3.
  12688. @item weights
  12689. Specify weight of each input video frame.
  12690. Each weight is separated by space. If number of weights is smaller than
  12691. number of @var{frames} last specified weight will be used for all remaining
  12692. unset weights.
  12693. @item scale
  12694. Specify scale, if it is set it will be multiplied with sum
  12695. of each weight multiplied with pixel values to give final destination
  12696. pixel value. By default @var{scale} is auto scaled to sum of weights.
  12697. @end table
  12698. @subsection Examples
  12699. @itemize
  12700. @item
  12701. Average 7 successive frames:
  12702. @example
  12703. tmix=frames=7:weights="1 1 1 1 1 1 1"
  12704. @end example
  12705. @item
  12706. Apply simple temporal convolution:
  12707. @example
  12708. tmix=frames=3:weights="-1 3 -1"
  12709. @end example
  12710. @item
  12711. Similar as above but only showing temporal differences:
  12712. @example
  12713. tmix=frames=3:weights="-1 2 -1":scale=1
  12714. @end example
  12715. @end itemize
  12716. @anchor{tonemap}
  12717. @section tonemap
  12718. Tone map colors from different dynamic ranges.
  12719. This filter expects data in single precision floating point, as it needs to
  12720. operate on (and can output) out-of-range values. Another filter, such as
  12721. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  12722. The tonemapping algorithms implemented only work on linear light, so input
  12723. data should be linearized beforehand (and possibly correctly tagged).
  12724. @example
  12725. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  12726. @end example
  12727. @subsection Options
  12728. The filter accepts the following options.
  12729. @table @option
  12730. @item tonemap
  12731. Set the tone map algorithm to use.
  12732. Possible values are:
  12733. @table @var
  12734. @item none
  12735. Do not apply any tone map, only desaturate overbright pixels.
  12736. @item clip
  12737. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  12738. in-range values, while distorting out-of-range values.
  12739. @item linear
  12740. Stretch the entire reference gamut to a linear multiple of the display.
  12741. @item gamma
  12742. Fit a logarithmic transfer between the tone curves.
  12743. @item reinhard
  12744. Preserve overall image brightness with a simple curve, using nonlinear
  12745. contrast, which results in flattening details and degrading color accuracy.
  12746. @item hable
  12747. Preserve both dark and bright details better than @var{reinhard}, at the cost
  12748. of slightly darkening everything. Use it when detail preservation is more
  12749. important than color and brightness accuracy.
  12750. @item mobius
  12751. Smoothly map out-of-range values, while retaining contrast and colors for
  12752. in-range material as much as possible. Use it when color accuracy is more
  12753. important than detail preservation.
  12754. @end table
  12755. Default is none.
  12756. @item param
  12757. Tune the tone mapping algorithm.
  12758. This affects the following algorithms:
  12759. @table @var
  12760. @item none
  12761. Ignored.
  12762. @item linear
  12763. Specifies the scale factor to use while stretching.
  12764. Default to 1.0.
  12765. @item gamma
  12766. Specifies the exponent of the function.
  12767. Default to 1.8.
  12768. @item clip
  12769. Specify an extra linear coefficient to multiply into the signal before clipping.
  12770. Default to 1.0.
  12771. @item reinhard
  12772. Specify the local contrast coefficient at the display peak.
  12773. Default to 0.5, which means that in-gamut values will be about half as bright
  12774. as when clipping.
  12775. @item hable
  12776. Ignored.
  12777. @item mobius
  12778. Specify the transition point from linear to mobius transform. Every value
  12779. below this point is guaranteed to be mapped 1:1. The higher the value, the
  12780. more accurate the result will be, at the cost of losing bright details.
  12781. Default to 0.3, which due to the steep initial slope still preserves in-range
  12782. colors fairly accurately.
  12783. @end table
  12784. @item desat
  12785. Apply desaturation for highlights that exceed this level of brightness. The
  12786. higher the parameter, the more color information will be preserved. This
  12787. setting helps prevent unnaturally blown-out colors for super-highlights, by
  12788. (smoothly) turning into white instead. This makes images feel more natural,
  12789. at the cost of reducing information about out-of-range colors.
  12790. The default of 2.0 is somewhat conservative and will mostly just apply to
  12791. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  12792. This option works only if the input frame has a supported color tag.
  12793. @item peak
  12794. Override signal/nominal/reference peak with this value. Useful when the
  12795. embedded peak information in display metadata is not reliable or when tone
  12796. mapping from a lower range to a higher range.
  12797. @end table
  12798. @section tpad
  12799. Temporarily pad video frames.
  12800. The filter accepts the following options:
  12801. @table @option
  12802. @item start
  12803. Specify number of delay frames before input video stream.
  12804. @item stop
  12805. Specify number of padding frames after input video stream.
  12806. Set to -1 to pad indefinitely.
  12807. @item start_mode
  12808. Set kind of frames added to beginning of stream.
  12809. Can be either @var{add} or @var{clone}.
  12810. With @var{add} frames of solid-color are added.
  12811. With @var{clone} frames are clones of first frame.
  12812. @item stop_mode
  12813. Set kind of frames added to end of stream.
  12814. Can be either @var{add} or @var{clone}.
  12815. With @var{add} frames of solid-color are added.
  12816. With @var{clone} frames are clones of last frame.
  12817. @item start_duration, stop_duration
  12818. Specify the duration of the start/stop delay. See
  12819. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12820. for the accepted syntax.
  12821. These options override @var{start} and @var{stop}.
  12822. @item color
  12823. Specify the color of the padded area. For the syntax of this option,
  12824. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12825. manual,ffmpeg-utils}.
  12826. The default value of @var{color} is "black".
  12827. @end table
  12828. @anchor{transpose}
  12829. @section transpose
  12830. Transpose rows with columns in the input video and optionally flip it.
  12831. It accepts the following parameters:
  12832. @table @option
  12833. @item dir
  12834. Specify the transposition direction.
  12835. Can assume the following values:
  12836. @table @samp
  12837. @item 0, 4, cclock_flip
  12838. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  12839. @example
  12840. L.R L.l
  12841. . . -> . .
  12842. l.r R.r
  12843. @end example
  12844. @item 1, 5, clock
  12845. Rotate by 90 degrees clockwise, that is:
  12846. @example
  12847. L.R l.L
  12848. . . -> . .
  12849. l.r r.R
  12850. @end example
  12851. @item 2, 6, cclock
  12852. Rotate by 90 degrees counterclockwise, that is:
  12853. @example
  12854. L.R R.r
  12855. . . -> . .
  12856. l.r L.l
  12857. @end example
  12858. @item 3, 7, clock_flip
  12859. Rotate by 90 degrees clockwise and vertically flip, that is:
  12860. @example
  12861. L.R r.R
  12862. . . -> . .
  12863. l.r l.L
  12864. @end example
  12865. @end table
  12866. For values between 4-7, the transposition is only done if the input
  12867. video geometry is portrait and not landscape. These values are
  12868. deprecated, the @code{passthrough} option should be used instead.
  12869. Numerical values are deprecated, and should be dropped in favor of
  12870. symbolic constants.
  12871. @item passthrough
  12872. Do not apply the transposition if the input geometry matches the one
  12873. specified by the specified value. It accepts the following values:
  12874. @table @samp
  12875. @item none
  12876. Always apply transposition.
  12877. @item portrait
  12878. Preserve portrait geometry (when @var{height} >= @var{width}).
  12879. @item landscape
  12880. Preserve landscape geometry (when @var{width} >= @var{height}).
  12881. @end table
  12882. Default value is @code{none}.
  12883. @end table
  12884. For example to rotate by 90 degrees clockwise and preserve portrait
  12885. layout:
  12886. @example
  12887. transpose=dir=1:passthrough=portrait
  12888. @end example
  12889. The command above can also be specified as:
  12890. @example
  12891. transpose=1:portrait
  12892. @end example
  12893. @section transpose_npp
  12894. Transpose rows with columns in the input video and optionally flip it.
  12895. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  12896. It accepts the following parameters:
  12897. @table @option
  12898. @item dir
  12899. Specify the transposition direction.
  12900. Can assume the following values:
  12901. @table @samp
  12902. @item cclock_flip
  12903. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  12904. @item clock
  12905. Rotate by 90 degrees clockwise.
  12906. @item cclock
  12907. Rotate by 90 degrees counterclockwise.
  12908. @item clock_flip
  12909. Rotate by 90 degrees clockwise and vertically flip.
  12910. @end table
  12911. @item passthrough
  12912. Do not apply the transposition if the input geometry matches the one
  12913. specified by the specified value. It accepts the following values:
  12914. @table @samp
  12915. @item none
  12916. Always apply transposition. (default)
  12917. @item portrait
  12918. Preserve portrait geometry (when @var{height} >= @var{width}).
  12919. @item landscape
  12920. Preserve landscape geometry (when @var{width} >= @var{height}).
  12921. @end table
  12922. @end table
  12923. @section trim
  12924. Trim the input so that the output contains one continuous subpart of the input.
  12925. It accepts the following parameters:
  12926. @table @option
  12927. @item start
  12928. Specify the time of the start of the kept section, i.e. the frame with the
  12929. timestamp @var{start} will be the first frame in the output.
  12930. @item end
  12931. Specify the time of the first frame that will be dropped, i.e. the frame
  12932. immediately preceding the one with the timestamp @var{end} will be the last
  12933. frame in the output.
  12934. @item start_pts
  12935. This is the same as @var{start}, except this option sets the start timestamp
  12936. in timebase units instead of seconds.
  12937. @item end_pts
  12938. This is the same as @var{end}, except this option sets the end timestamp
  12939. in timebase units instead of seconds.
  12940. @item duration
  12941. The maximum duration of the output in seconds.
  12942. @item start_frame
  12943. The number of the first frame that should be passed to the output.
  12944. @item end_frame
  12945. The number of the first frame that should be dropped.
  12946. @end table
  12947. @option{start}, @option{end}, and @option{duration} are expressed as time
  12948. duration specifications; see
  12949. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12950. for the accepted syntax.
  12951. Note that the first two sets of the start/end options and the @option{duration}
  12952. option look at the frame timestamp, while the _frame variants simply count the
  12953. frames that pass through the filter. Also note that this filter does not modify
  12954. the timestamps. If you wish for the output timestamps to start at zero, insert a
  12955. setpts filter after the trim filter.
  12956. If multiple start or end options are set, this filter tries to be greedy and
  12957. keep all the frames that match at least one of the specified constraints. To keep
  12958. only the part that matches all the constraints at once, chain multiple trim
  12959. filters.
  12960. The defaults are such that all the input is kept. So it is possible to set e.g.
  12961. just the end values to keep everything before the specified time.
  12962. Examples:
  12963. @itemize
  12964. @item
  12965. Drop everything except the second minute of input:
  12966. @example
  12967. ffmpeg -i INPUT -vf trim=60:120
  12968. @end example
  12969. @item
  12970. Keep only the first second:
  12971. @example
  12972. ffmpeg -i INPUT -vf trim=duration=1
  12973. @end example
  12974. @end itemize
  12975. @section unpremultiply
  12976. Apply alpha unpremultiply effect to input video stream using first plane
  12977. of second stream as alpha.
  12978. Both streams must have same dimensions and same pixel format.
  12979. The filter accepts the following option:
  12980. @table @option
  12981. @item planes
  12982. Set which planes will be processed, unprocessed planes will be copied.
  12983. By default value 0xf, all planes will be processed.
  12984. If the format has 1 or 2 components, then luma is bit 0.
  12985. If the format has 3 or 4 components:
  12986. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  12987. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  12988. If present, the alpha channel is always the last bit.
  12989. @item inplace
  12990. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12991. @end table
  12992. @anchor{unsharp}
  12993. @section unsharp
  12994. Sharpen or blur the input video.
  12995. It accepts the following parameters:
  12996. @table @option
  12997. @item luma_msize_x, lx
  12998. Set the luma matrix horizontal size. It must be an odd integer between
  12999. 3 and 23. The default value is 5.
  13000. @item luma_msize_y, ly
  13001. Set the luma matrix vertical size. It must be an odd integer between 3
  13002. and 23. The default value is 5.
  13003. @item luma_amount, la
  13004. Set the luma effect strength. It must be a floating point number, reasonable
  13005. values lay between -1.5 and 1.5.
  13006. Negative values will blur the input video, while positive values will
  13007. sharpen it, a value of zero will disable the effect.
  13008. Default value is 1.0.
  13009. @item chroma_msize_x, cx
  13010. Set the chroma matrix horizontal size. It must be an odd integer
  13011. between 3 and 23. The default value is 5.
  13012. @item chroma_msize_y, cy
  13013. Set the chroma matrix vertical size. It must be an odd integer
  13014. between 3 and 23. The default value is 5.
  13015. @item chroma_amount, ca
  13016. Set the chroma effect strength. It must be a floating point number, reasonable
  13017. values lay between -1.5 and 1.5.
  13018. Negative values will blur the input video, while positive values will
  13019. sharpen it, a value of zero will disable the effect.
  13020. Default value is 0.0.
  13021. @end table
  13022. All parameters are optional and default to the equivalent of the
  13023. string '5:5:1.0:5:5:0.0'.
  13024. @subsection Examples
  13025. @itemize
  13026. @item
  13027. Apply strong luma sharpen effect:
  13028. @example
  13029. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13030. @end example
  13031. @item
  13032. Apply a strong blur of both luma and chroma parameters:
  13033. @example
  13034. unsharp=7:7:-2:7:7:-2
  13035. @end example
  13036. @end itemize
  13037. @section uspp
  13038. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13039. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13040. shifts and average the results.
  13041. The way this differs from the behavior of spp is that uspp actually encodes &
  13042. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13043. DCT similar to MJPEG.
  13044. The filter accepts the following options:
  13045. @table @option
  13046. @item quality
  13047. Set quality. This option defines the number of levels for averaging. It accepts
  13048. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13049. effect. A value of @code{8} means the higher quality. For each increment of
  13050. that value the speed drops by a factor of approximately 2. Default value is
  13051. @code{3}.
  13052. @item qp
  13053. Force a constant quantization parameter. If not set, the filter will use the QP
  13054. from the video stream (if available).
  13055. @end table
  13056. @section vaguedenoiser
  13057. Apply a wavelet based denoiser.
  13058. It transforms each frame from the video input into the wavelet domain,
  13059. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13060. the obtained coefficients. It does an inverse wavelet transform after.
  13061. Due to wavelet properties, it should give a nice smoothed result, and
  13062. reduced noise, without blurring picture features.
  13063. This filter accepts the following options:
  13064. @table @option
  13065. @item threshold
  13066. The filtering strength. The higher, the more filtered the video will be.
  13067. Hard thresholding can use a higher threshold than soft thresholding
  13068. before the video looks overfiltered. Default value is 2.
  13069. @item method
  13070. The filtering method the filter will use.
  13071. It accepts the following values:
  13072. @table @samp
  13073. @item hard
  13074. All values under the threshold will be zeroed.
  13075. @item soft
  13076. All values under the threshold will be zeroed. All values above will be
  13077. reduced by the threshold.
  13078. @item garrote
  13079. Scales or nullifies coefficients - intermediary between (more) soft and
  13080. (less) hard thresholding.
  13081. @end table
  13082. Default is garrote.
  13083. @item nsteps
  13084. Number of times, the wavelet will decompose the picture. Picture can't
  13085. be decomposed beyond a particular point (typically, 8 for a 640x480
  13086. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13087. @item percent
  13088. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13089. @item planes
  13090. A list of the planes to process. By default all planes are processed.
  13091. @end table
  13092. @section vectorscope
  13093. Display 2 color component values in the two dimensional graph (which is called
  13094. a vectorscope).
  13095. This filter accepts the following options:
  13096. @table @option
  13097. @item mode, m
  13098. Set vectorscope mode.
  13099. It accepts the following values:
  13100. @table @samp
  13101. @item gray
  13102. Gray values are displayed on graph, higher brightness means more pixels have
  13103. same component color value on location in graph. This is the default mode.
  13104. @item color
  13105. Gray values are displayed on graph. Surrounding pixels values which are not
  13106. present in video frame are drawn in gradient of 2 color components which are
  13107. set by option @code{x} and @code{y}. The 3rd color component is static.
  13108. @item color2
  13109. Actual color components values present in video frame are displayed on graph.
  13110. @item color3
  13111. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13112. on graph increases value of another color component, which is luminance by
  13113. default values of @code{x} and @code{y}.
  13114. @item color4
  13115. Actual colors present in video frame are displayed on graph. If two different
  13116. colors map to same position on graph then color with higher value of component
  13117. not present in graph is picked.
  13118. @item color5
  13119. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13120. component picked from radial gradient.
  13121. @end table
  13122. @item x
  13123. Set which color component will be represented on X-axis. Default is @code{1}.
  13124. @item y
  13125. Set which color component will be represented on Y-axis. Default is @code{2}.
  13126. @item intensity, i
  13127. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13128. of color component which represents frequency of (X, Y) location in graph.
  13129. @item envelope, e
  13130. @table @samp
  13131. @item none
  13132. No envelope, this is default.
  13133. @item instant
  13134. Instant envelope, even darkest single pixel will be clearly highlighted.
  13135. @item peak
  13136. Hold maximum and minimum values presented in graph over time. This way you
  13137. can still spot out of range values without constantly looking at vectorscope.
  13138. @item peak+instant
  13139. Peak and instant envelope combined together.
  13140. @end table
  13141. @item graticule, g
  13142. Set what kind of graticule to draw.
  13143. @table @samp
  13144. @item none
  13145. @item green
  13146. @item color
  13147. @end table
  13148. @item opacity, o
  13149. Set graticule opacity.
  13150. @item flags, f
  13151. Set graticule flags.
  13152. @table @samp
  13153. @item white
  13154. Draw graticule for white point.
  13155. @item black
  13156. Draw graticule for black point.
  13157. @item name
  13158. Draw color points short names.
  13159. @end table
  13160. @item bgopacity, b
  13161. Set background opacity.
  13162. @item lthreshold, l
  13163. Set low threshold for color component not represented on X or Y axis.
  13164. Values lower than this value will be ignored. Default is 0.
  13165. Note this value is multiplied with actual max possible value one pixel component
  13166. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13167. is 0.1 * 255 = 25.
  13168. @item hthreshold, h
  13169. Set high threshold for color component not represented on X or Y axis.
  13170. Values higher than this value will be ignored. Default is 1.
  13171. Note this value is multiplied with actual max possible value one pixel component
  13172. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13173. is 0.9 * 255 = 230.
  13174. @item colorspace, c
  13175. Set what kind of colorspace to use when drawing graticule.
  13176. @table @samp
  13177. @item auto
  13178. @item 601
  13179. @item 709
  13180. @end table
  13181. Default is auto.
  13182. @end table
  13183. @anchor{vidstabdetect}
  13184. @section vidstabdetect
  13185. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13186. @ref{vidstabtransform} for pass 2.
  13187. This filter generates a file with relative translation and rotation
  13188. transform information about subsequent frames, which is then used by
  13189. the @ref{vidstabtransform} filter.
  13190. To enable compilation of this filter you need to configure FFmpeg with
  13191. @code{--enable-libvidstab}.
  13192. This filter accepts the following options:
  13193. @table @option
  13194. @item result
  13195. Set the path to the file used to write the transforms information.
  13196. Default value is @file{transforms.trf}.
  13197. @item shakiness
  13198. Set how shaky the video is and how quick the camera is. It accepts an
  13199. integer in the range 1-10, a value of 1 means little shakiness, a
  13200. value of 10 means strong shakiness. Default value is 5.
  13201. @item accuracy
  13202. Set the accuracy of the detection process. It must be a value in the
  13203. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13204. accuracy. Default value is 15.
  13205. @item stepsize
  13206. Set stepsize of the search process. The region around minimum is
  13207. scanned with 1 pixel resolution. Default value is 6.
  13208. @item mincontrast
  13209. Set minimum contrast. Below this value a local measurement field is
  13210. discarded. Must be a floating point value in the range 0-1. Default
  13211. value is 0.3.
  13212. @item tripod
  13213. Set reference frame number for tripod mode.
  13214. If enabled, the motion of the frames is compared to a reference frame
  13215. in the filtered stream, identified by the specified number. The idea
  13216. is to compensate all movements in a more-or-less static scene and keep
  13217. the camera view absolutely still.
  13218. If set to 0, it is disabled. The frames are counted starting from 1.
  13219. @item show
  13220. Show fields and transforms in the resulting frames. It accepts an
  13221. integer in the range 0-2. Default value is 0, which disables any
  13222. visualization.
  13223. @end table
  13224. @subsection Examples
  13225. @itemize
  13226. @item
  13227. Use default values:
  13228. @example
  13229. vidstabdetect
  13230. @end example
  13231. @item
  13232. Analyze strongly shaky movie and put the results in file
  13233. @file{mytransforms.trf}:
  13234. @example
  13235. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13236. @end example
  13237. @item
  13238. Visualize the result of internal transformations in the resulting
  13239. video:
  13240. @example
  13241. vidstabdetect=show=1
  13242. @end example
  13243. @item
  13244. Analyze a video with medium shakiness using @command{ffmpeg}:
  13245. @example
  13246. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13247. @end example
  13248. @end itemize
  13249. @anchor{vidstabtransform}
  13250. @section vidstabtransform
  13251. Video stabilization/deshaking: pass 2 of 2,
  13252. see @ref{vidstabdetect} for pass 1.
  13253. Read a file with transform information for each frame and
  13254. apply/compensate them. Together with the @ref{vidstabdetect}
  13255. filter this can be used to deshake videos. See also
  13256. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13257. the @ref{unsharp} filter, see below.
  13258. To enable compilation of this filter you need to configure FFmpeg with
  13259. @code{--enable-libvidstab}.
  13260. @subsection Options
  13261. @table @option
  13262. @item input
  13263. Set path to the file used to read the transforms. Default value is
  13264. @file{transforms.trf}.
  13265. @item smoothing
  13266. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13267. camera movements. Default value is 10.
  13268. For example a number of 10 means that 21 frames are used (10 in the
  13269. past and 10 in the future) to smoothen the motion in the video. A
  13270. larger value leads to a smoother video, but limits the acceleration of
  13271. the camera (pan/tilt movements). 0 is a special case where a static
  13272. camera is simulated.
  13273. @item optalgo
  13274. Set the camera path optimization algorithm.
  13275. Accepted values are:
  13276. @table @samp
  13277. @item gauss
  13278. gaussian kernel low-pass filter on camera motion (default)
  13279. @item avg
  13280. averaging on transformations
  13281. @end table
  13282. @item maxshift
  13283. Set maximal number of pixels to translate frames. Default value is -1,
  13284. meaning no limit.
  13285. @item maxangle
  13286. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13287. value is -1, meaning no limit.
  13288. @item crop
  13289. Specify how to deal with borders that may be visible due to movement
  13290. compensation.
  13291. Available values are:
  13292. @table @samp
  13293. @item keep
  13294. keep image information from previous frame (default)
  13295. @item black
  13296. fill the border black
  13297. @end table
  13298. @item invert
  13299. Invert transforms if set to 1. Default value is 0.
  13300. @item relative
  13301. Consider transforms as relative to previous frame if set to 1,
  13302. absolute if set to 0. Default value is 0.
  13303. @item zoom
  13304. Set percentage to zoom. A positive value will result in a zoom-in
  13305. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13306. zoom).
  13307. @item optzoom
  13308. Set optimal zooming to avoid borders.
  13309. Accepted values are:
  13310. @table @samp
  13311. @item 0
  13312. disabled
  13313. @item 1
  13314. optimal static zoom value is determined (only very strong movements
  13315. will lead to visible borders) (default)
  13316. @item 2
  13317. optimal adaptive zoom value is determined (no borders will be
  13318. visible), see @option{zoomspeed}
  13319. @end table
  13320. Note that the value given at zoom is added to the one calculated here.
  13321. @item zoomspeed
  13322. Set percent to zoom maximally each frame (enabled when
  13323. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13324. 0.25.
  13325. @item interpol
  13326. Specify type of interpolation.
  13327. Available values are:
  13328. @table @samp
  13329. @item no
  13330. no interpolation
  13331. @item linear
  13332. linear only horizontal
  13333. @item bilinear
  13334. linear in both directions (default)
  13335. @item bicubic
  13336. cubic in both directions (slow)
  13337. @end table
  13338. @item tripod
  13339. Enable virtual tripod mode if set to 1, which is equivalent to
  13340. @code{relative=0:smoothing=0}. Default value is 0.
  13341. Use also @code{tripod} option of @ref{vidstabdetect}.
  13342. @item debug
  13343. Increase log verbosity if set to 1. Also the detected global motions
  13344. are written to the temporary file @file{global_motions.trf}. Default
  13345. value is 0.
  13346. @end table
  13347. @subsection Examples
  13348. @itemize
  13349. @item
  13350. Use @command{ffmpeg} for a typical stabilization with default values:
  13351. @example
  13352. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13353. @end example
  13354. Note the use of the @ref{unsharp} filter which is always recommended.
  13355. @item
  13356. Zoom in a bit more and load transform data from a given file:
  13357. @example
  13358. vidstabtransform=zoom=5:input="mytransforms.trf"
  13359. @end example
  13360. @item
  13361. Smoothen the video even more:
  13362. @example
  13363. vidstabtransform=smoothing=30
  13364. @end example
  13365. @end itemize
  13366. @section vflip
  13367. Flip the input video vertically.
  13368. For example, to vertically flip a video with @command{ffmpeg}:
  13369. @example
  13370. ffmpeg -i in.avi -vf "vflip" out.avi
  13371. @end example
  13372. @section vfrdet
  13373. Detect variable frame rate video.
  13374. This filter tries to detect if the input is variable or constant frame rate.
  13375. At end it will output number of frames detected as having variable delta pts,
  13376. and ones with constant delta pts.
  13377. If there was frames with variable delta, than it will also show min and max delta
  13378. encountered.
  13379. @section vibrance
  13380. Boost or alter saturation.
  13381. The filter accepts the following options:
  13382. @table @option
  13383. @item intensity
  13384. Set strength of boost if positive value or strength of alter if negative value.
  13385. Default is 0. Allowed range is from -2 to 2.
  13386. @item rbal
  13387. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  13388. @item gbal
  13389. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  13390. @item bbal
  13391. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  13392. @item rlum
  13393. Set the red luma coefficient.
  13394. @item glum
  13395. Set the green luma coefficient.
  13396. @item blum
  13397. Set the blue luma coefficient.
  13398. @end table
  13399. @anchor{vignette}
  13400. @section vignette
  13401. Make or reverse a natural vignetting effect.
  13402. The filter accepts the following options:
  13403. @table @option
  13404. @item angle, a
  13405. Set lens angle expression as a number of radians.
  13406. The value is clipped in the @code{[0,PI/2]} range.
  13407. Default value: @code{"PI/5"}
  13408. @item x0
  13409. @item y0
  13410. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13411. by default.
  13412. @item mode
  13413. Set forward/backward mode.
  13414. Available modes are:
  13415. @table @samp
  13416. @item forward
  13417. The larger the distance from the central point, the darker the image becomes.
  13418. @item backward
  13419. The larger the distance from the central point, the brighter the image becomes.
  13420. This can be used to reverse a vignette effect, though there is no automatic
  13421. detection to extract the lens @option{angle} and other settings (yet). It can
  13422. also be used to create a burning effect.
  13423. @end table
  13424. Default value is @samp{forward}.
  13425. @item eval
  13426. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13427. It accepts the following values:
  13428. @table @samp
  13429. @item init
  13430. Evaluate expressions only once during the filter initialization.
  13431. @item frame
  13432. Evaluate expressions for each incoming frame. This is way slower than the
  13433. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13434. allows advanced dynamic expressions.
  13435. @end table
  13436. Default value is @samp{init}.
  13437. @item dither
  13438. Set dithering to reduce the circular banding effects. Default is @code{1}
  13439. (enabled).
  13440. @item aspect
  13441. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13442. Setting this value to the SAR of the input will make a rectangular vignetting
  13443. following the dimensions of the video.
  13444. Default is @code{1/1}.
  13445. @end table
  13446. @subsection Expressions
  13447. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13448. following parameters.
  13449. @table @option
  13450. @item w
  13451. @item h
  13452. input width and height
  13453. @item n
  13454. the number of input frame, starting from 0
  13455. @item pts
  13456. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13457. @var{TB} units, NAN if undefined
  13458. @item r
  13459. frame rate of the input video, NAN if the input frame rate is unknown
  13460. @item t
  13461. the PTS (Presentation TimeStamp) of the filtered video frame,
  13462. expressed in seconds, NAN if undefined
  13463. @item tb
  13464. time base of the input video
  13465. @end table
  13466. @subsection Examples
  13467. @itemize
  13468. @item
  13469. Apply simple strong vignetting effect:
  13470. @example
  13471. vignette=PI/4
  13472. @end example
  13473. @item
  13474. Make a flickering vignetting:
  13475. @example
  13476. vignette='PI/4+random(1)*PI/50':eval=frame
  13477. @end example
  13478. @end itemize
  13479. @section vmafmotion
  13480. Obtain the average vmaf motion score of a video.
  13481. It is one of the component filters of VMAF.
  13482. The obtained average motion score is printed through the logging system.
  13483. In the below example the input file @file{ref.mpg} is being processed and score
  13484. is computed.
  13485. @example
  13486. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13487. @end example
  13488. @section vstack
  13489. Stack input videos vertically.
  13490. All streams must be of same pixel format and of same width.
  13491. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13492. to create same output.
  13493. The filter accept the following option:
  13494. @table @option
  13495. @item inputs
  13496. Set number of input streams. Default is 2.
  13497. @item shortest
  13498. If set to 1, force the output to terminate when the shortest input
  13499. terminates. Default value is 0.
  13500. @end table
  13501. @section w3fdif
  13502. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13503. Deinterlacing Filter").
  13504. Based on the process described by Martin Weston for BBC R&D, and
  13505. implemented based on the de-interlace algorithm written by Jim
  13506. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13507. uses filter coefficients calculated by BBC R&D.
  13508. There are two sets of filter coefficients, so called "simple":
  13509. and "complex". Which set of filter coefficients is used can
  13510. be set by passing an optional parameter:
  13511. @table @option
  13512. @item filter
  13513. Set the interlacing filter coefficients. Accepts one of the following values:
  13514. @table @samp
  13515. @item simple
  13516. Simple filter coefficient set.
  13517. @item complex
  13518. More-complex filter coefficient set.
  13519. @end table
  13520. Default value is @samp{complex}.
  13521. @item deint
  13522. Specify which frames to deinterlace. Accept one of the following values:
  13523. @table @samp
  13524. @item all
  13525. Deinterlace all frames,
  13526. @item interlaced
  13527. Only deinterlace frames marked as interlaced.
  13528. @end table
  13529. Default value is @samp{all}.
  13530. @end table
  13531. @section waveform
  13532. Video waveform monitor.
  13533. The waveform monitor plots color component intensity. By default luminance
  13534. only. Each column of the waveform corresponds to a column of pixels in the
  13535. source video.
  13536. It accepts the following options:
  13537. @table @option
  13538. @item mode, m
  13539. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13540. In row mode, the graph on the left side represents color component value 0 and
  13541. the right side represents value = 255. In column mode, the top side represents
  13542. color component value = 0 and bottom side represents value = 255.
  13543. @item intensity, i
  13544. Set intensity. Smaller values are useful to find out how many values of the same
  13545. luminance are distributed across input rows/columns.
  13546. Default value is @code{0.04}. Allowed range is [0, 1].
  13547. @item mirror, r
  13548. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13549. In mirrored mode, higher values will be represented on the left
  13550. side for @code{row} mode and at the top for @code{column} mode. Default is
  13551. @code{1} (mirrored).
  13552. @item display, d
  13553. Set display mode.
  13554. It accepts the following values:
  13555. @table @samp
  13556. @item overlay
  13557. Presents information identical to that in the @code{parade}, except
  13558. that the graphs representing color components are superimposed directly
  13559. over one another.
  13560. This display mode makes it easier to spot relative differences or similarities
  13561. in overlapping areas of the color components that are supposed to be identical,
  13562. such as neutral whites, grays, or blacks.
  13563. @item stack
  13564. Display separate graph for the color components side by side in
  13565. @code{row} mode or one below the other in @code{column} mode.
  13566. @item parade
  13567. Display separate graph for the color components side by side in
  13568. @code{column} mode or one below the other in @code{row} mode.
  13569. Using this display mode makes it easy to spot color casts in the highlights
  13570. and shadows of an image, by comparing the contours of the top and the bottom
  13571. graphs of each waveform. Since whites, grays, and blacks are characterized
  13572. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  13573. should display three waveforms of roughly equal width/height. If not, the
  13574. correction is easy to perform by making level adjustments the three waveforms.
  13575. @end table
  13576. Default is @code{stack}.
  13577. @item components, c
  13578. Set which color components to display. Default is 1, which means only luminance
  13579. or red color component if input is in RGB colorspace. If is set for example to
  13580. 7 it will display all 3 (if) available color components.
  13581. @item envelope, e
  13582. @table @samp
  13583. @item none
  13584. No envelope, this is default.
  13585. @item instant
  13586. Instant envelope, minimum and maximum values presented in graph will be easily
  13587. visible even with small @code{step} value.
  13588. @item peak
  13589. Hold minimum and maximum values presented in graph across time. This way you
  13590. can still spot out of range values without constantly looking at waveforms.
  13591. @item peak+instant
  13592. Peak and instant envelope combined together.
  13593. @end table
  13594. @item filter, f
  13595. @table @samp
  13596. @item lowpass
  13597. No filtering, this is default.
  13598. @item flat
  13599. Luma and chroma combined together.
  13600. @item aflat
  13601. Similar as above, but shows difference between blue and red chroma.
  13602. @item xflat
  13603. Similar as above, but use different colors.
  13604. @item chroma
  13605. Displays only chroma.
  13606. @item color
  13607. Displays actual color value on waveform.
  13608. @item acolor
  13609. Similar as above, but with luma showing frequency of chroma values.
  13610. @end table
  13611. @item graticule, g
  13612. Set which graticule to display.
  13613. @table @samp
  13614. @item none
  13615. Do not display graticule.
  13616. @item green
  13617. Display green graticule showing legal broadcast ranges.
  13618. @item orange
  13619. Display orange graticule showing legal broadcast ranges.
  13620. @end table
  13621. @item opacity, o
  13622. Set graticule opacity.
  13623. @item flags, fl
  13624. Set graticule flags.
  13625. @table @samp
  13626. @item numbers
  13627. Draw numbers above lines. By default enabled.
  13628. @item dots
  13629. Draw dots instead of lines.
  13630. @end table
  13631. @item scale, s
  13632. Set scale used for displaying graticule.
  13633. @table @samp
  13634. @item digital
  13635. @item millivolts
  13636. @item ire
  13637. @end table
  13638. Default is digital.
  13639. @item bgopacity, b
  13640. Set background opacity.
  13641. @end table
  13642. @section weave, doubleweave
  13643. The @code{weave} takes a field-based video input and join
  13644. each two sequential fields into single frame, producing a new double
  13645. height clip with half the frame rate and half the frame count.
  13646. The @code{doubleweave} works same as @code{weave} but without
  13647. halving frame rate and frame count.
  13648. It accepts the following option:
  13649. @table @option
  13650. @item first_field
  13651. Set first field. Available values are:
  13652. @table @samp
  13653. @item top, t
  13654. Set the frame as top-field-first.
  13655. @item bottom, b
  13656. Set the frame as bottom-field-first.
  13657. @end table
  13658. @end table
  13659. @subsection Examples
  13660. @itemize
  13661. @item
  13662. Interlace video using @ref{select} and @ref{separatefields} filter:
  13663. @example
  13664. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  13665. @end example
  13666. @end itemize
  13667. @section xbr
  13668. Apply the xBR high-quality magnification filter which is designed for pixel
  13669. art. It follows a set of edge-detection rules, see
  13670. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  13671. It accepts the following option:
  13672. @table @option
  13673. @item n
  13674. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  13675. @code{3xBR} and @code{4} for @code{4xBR}.
  13676. Default is @code{3}.
  13677. @end table
  13678. @section xstack
  13679. Stack video inputs into custom layout.
  13680. All streams must be of same pixel format.
  13681. The filter accept the following option:
  13682. @table @option
  13683. @item inputs
  13684. Set number of input streams. Default is 2.
  13685. @item layout
  13686. Specify layout of inputs.
  13687. This option requires the desired layout configuration to be explicitly set by the user.
  13688. This sets position of each video input in output. Each input
  13689. is separated by '|'.
  13690. The first number represents the column, and the second number represents the row.
  13691. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  13692. where X is video input from which to take width or height.
  13693. Multiple values can be used when separated by '+'. In such
  13694. case values are summed together.
  13695. @item shortest
  13696. If set to 1, force the output to terminate when the shortest input
  13697. terminates. Default value is 0.
  13698. @end table
  13699. @subsection Examples
  13700. @itemize
  13701. @item
  13702. Display 4 inputs into 2x2 grid,
  13703. note that if inputs are of different sizes unused gaps might appear,
  13704. as not all of output video is used.
  13705. @example
  13706. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  13707. @end example
  13708. @item
  13709. Display 4 inputs into 1x4 grid,
  13710. note that if inputs are of different sizes unused gaps might appear,
  13711. as not all of output video is used.
  13712. @example
  13713. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  13714. @end example
  13715. @item
  13716. Display 9 inputs into 3x3 grid,
  13717. note that if inputs are of different sizes unused gaps might appear,
  13718. as not all of output video is used.
  13719. @example
  13720. 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
  13721. @end example
  13722. @end itemize
  13723. @anchor{yadif}
  13724. @section yadif
  13725. Deinterlace the input video ("yadif" means "yet another deinterlacing
  13726. filter").
  13727. It accepts the following parameters:
  13728. @table @option
  13729. @item mode
  13730. The interlacing mode to adopt. It accepts one of the following values:
  13731. @table @option
  13732. @item 0, send_frame
  13733. Output one frame for each frame.
  13734. @item 1, send_field
  13735. Output one frame for each field.
  13736. @item 2, send_frame_nospatial
  13737. Like @code{send_frame}, but it skips the spatial interlacing check.
  13738. @item 3, send_field_nospatial
  13739. Like @code{send_field}, but it skips the spatial interlacing check.
  13740. @end table
  13741. The default value is @code{send_frame}.
  13742. @item parity
  13743. The picture field parity assumed for the input interlaced video. It accepts one
  13744. of the following values:
  13745. @table @option
  13746. @item 0, tff
  13747. Assume the top field is first.
  13748. @item 1, bff
  13749. Assume the bottom field is first.
  13750. @item -1, auto
  13751. Enable automatic detection of field parity.
  13752. @end table
  13753. The default value is @code{auto}.
  13754. If the interlacing is unknown or the decoder does not export this information,
  13755. top field first will be assumed.
  13756. @item deint
  13757. Specify which frames to deinterlace. Accept one of the following
  13758. values:
  13759. @table @option
  13760. @item 0, all
  13761. Deinterlace all frames.
  13762. @item 1, interlaced
  13763. Only deinterlace frames marked as interlaced.
  13764. @end table
  13765. The default value is @code{all}.
  13766. @end table
  13767. @section yadif_cuda
  13768. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  13769. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  13770. and/or nvenc.
  13771. It accepts the following parameters:
  13772. @table @option
  13773. @item mode
  13774. The interlacing mode to adopt. It accepts one of the following values:
  13775. @table @option
  13776. @item 0, send_frame
  13777. Output one frame for each frame.
  13778. @item 1, send_field
  13779. Output one frame for each field.
  13780. @item 2, send_frame_nospatial
  13781. Like @code{send_frame}, but it skips the spatial interlacing check.
  13782. @item 3, send_field_nospatial
  13783. Like @code{send_field}, but it skips the spatial interlacing check.
  13784. @end table
  13785. The default value is @code{send_frame}.
  13786. @item parity
  13787. The picture field parity assumed for the input interlaced video. It accepts one
  13788. of the following values:
  13789. @table @option
  13790. @item 0, tff
  13791. Assume the top field is first.
  13792. @item 1, bff
  13793. Assume the bottom field is first.
  13794. @item -1, auto
  13795. Enable automatic detection of field parity.
  13796. @end table
  13797. The default value is @code{auto}.
  13798. If the interlacing is unknown or the decoder does not export this information,
  13799. top field first will be assumed.
  13800. @item deint
  13801. Specify which frames to deinterlace. Accept one of the following
  13802. values:
  13803. @table @option
  13804. @item 0, all
  13805. Deinterlace all frames.
  13806. @item 1, interlaced
  13807. Only deinterlace frames marked as interlaced.
  13808. @end table
  13809. The default value is @code{all}.
  13810. @end table
  13811. @section zoompan
  13812. Apply Zoom & Pan effect.
  13813. This filter accepts the following options:
  13814. @table @option
  13815. @item zoom, z
  13816. Set the zoom expression. Default is 1.
  13817. @item x
  13818. @item y
  13819. Set the x and y expression. Default is 0.
  13820. @item d
  13821. Set the duration expression in number of frames.
  13822. This sets for how many number of frames effect will last for
  13823. single input image.
  13824. @item s
  13825. Set the output image size, default is 'hd720'.
  13826. @item fps
  13827. Set the output frame rate, default is '25'.
  13828. @end table
  13829. Each expression can contain the following constants:
  13830. @table @option
  13831. @item in_w, iw
  13832. Input width.
  13833. @item in_h, ih
  13834. Input height.
  13835. @item out_w, ow
  13836. Output width.
  13837. @item out_h, oh
  13838. Output height.
  13839. @item in
  13840. Input frame count.
  13841. @item on
  13842. Output frame count.
  13843. @item x
  13844. @item y
  13845. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  13846. for current input frame.
  13847. @item px
  13848. @item py
  13849. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  13850. not yet such frame (first input frame).
  13851. @item zoom
  13852. Last calculated zoom from 'z' expression for current input frame.
  13853. @item pzoom
  13854. Last calculated zoom of last output frame of previous input frame.
  13855. @item duration
  13856. Number of output frames for current input frame. Calculated from 'd' expression
  13857. for each input frame.
  13858. @item pduration
  13859. number of output frames created for previous input frame
  13860. @item a
  13861. Rational number: input width / input height
  13862. @item sar
  13863. sample aspect ratio
  13864. @item dar
  13865. display aspect ratio
  13866. @end table
  13867. @subsection Examples
  13868. @itemize
  13869. @item
  13870. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  13871. @example
  13872. 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
  13873. @end example
  13874. @item
  13875. Zoom-in up to 1.5 and pan always at center of picture:
  13876. @example
  13877. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13878. @end example
  13879. @item
  13880. Same as above but without pausing:
  13881. @example
  13882. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13883. @end example
  13884. @end itemize
  13885. @anchor{zscale}
  13886. @section zscale
  13887. Scale (resize) the input video, using the z.lib library:
  13888. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  13889. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  13890. The zscale filter forces the output display aspect ratio to be the same
  13891. as the input, by changing the output sample aspect ratio.
  13892. If the input image format is different from the format requested by
  13893. the next filter, the zscale filter will convert the input to the
  13894. requested format.
  13895. @subsection Options
  13896. The filter accepts the following options.
  13897. @table @option
  13898. @item width, w
  13899. @item height, h
  13900. Set the output video dimension expression. Default value is the input
  13901. dimension.
  13902. If the @var{width} or @var{w} value is 0, the input width is used for
  13903. the output. If the @var{height} or @var{h} value is 0, the input height
  13904. is used for the output.
  13905. If one and only one of the values is -n with n >= 1, the zscale filter
  13906. will use a value that maintains the aspect ratio of the input image,
  13907. calculated from the other specified dimension. After that it will,
  13908. however, make sure that the calculated dimension is divisible by n and
  13909. adjust the value if necessary.
  13910. If both values are -n with n >= 1, the behavior will be identical to
  13911. both values being set to 0 as previously detailed.
  13912. See below for the list of accepted constants for use in the dimension
  13913. expression.
  13914. @item size, s
  13915. Set the video size. For the syntax of this option, check the
  13916. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13917. @item dither, d
  13918. Set the dither type.
  13919. Possible values are:
  13920. @table @var
  13921. @item none
  13922. @item ordered
  13923. @item random
  13924. @item error_diffusion
  13925. @end table
  13926. Default is none.
  13927. @item filter, f
  13928. Set the resize filter type.
  13929. Possible values are:
  13930. @table @var
  13931. @item point
  13932. @item bilinear
  13933. @item bicubic
  13934. @item spline16
  13935. @item spline36
  13936. @item lanczos
  13937. @end table
  13938. Default is bilinear.
  13939. @item range, r
  13940. Set the color range.
  13941. Possible values are:
  13942. @table @var
  13943. @item input
  13944. @item limited
  13945. @item full
  13946. @end table
  13947. Default is same as input.
  13948. @item primaries, p
  13949. Set the color primaries.
  13950. Possible values are:
  13951. @table @var
  13952. @item input
  13953. @item 709
  13954. @item unspecified
  13955. @item 170m
  13956. @item 240m
  13957. @item 2020
  13958. @end table
  13959. Default is same as input.
  13960. @item transfer, t
  13961. Set the transfer characteristics.
  13962. Possible values are:
  13963. @table @var
  13964. @item input
  13965. @item 709
  13966. @item unspecified
  13967. @item 601
  13968. @item linear
  13969. @item 2020_10
  13970. @item 2020_12
  13971. @item smpte2084
  13972. @item iec61966-2-1
  13973. @item arib-std-b67
  13974. @end table
  13975. Default is same as input.
  13976. @item matrix, m
  13977. Set the colorspace matrix.
  13978. Possible value are:
  13979. @table @var
  13980. @item input
  13981. @item 709
  13982. @item unspecified
  13983. @item 470bg
  13984. @item 170m
  13985. @item 2020_ncl
  13986. @item 2020_cl
  13987. @end table
  13988. Default is same as input.
  13989. @item rangein, rin
  13990. Set the input color range.
  13991. Possible values are:
  13992. @table @var
  13993. @item input
  13994. @item limited
  13995. @item full
  13996. @end table
  13997. Default is same as input.
  13998. @item primariesin, pin
  13999. Set the input color primaries.
  14000. Possible values are:
  14001. @table @var
  14002. @item input
  14003. @item 709
  14004. @item unspecified
  14005. @item 170m
  14006. @item 240m
  14007. @item 2020
  14008. @end table
  14009. Default is same as input.
  14010. @item transferin, tin
  14011. Set the input transfer characteristics.
  14012. Possible values are:
  14013. @table @var
  14014. @item input
  14015. @item 709
  14016. @item unspecified
  14017. @item 601
  14018. @item linear
  14019. @item 2020_10
  14020. @item 2020_12
  14021. @end table
  14022. Default is same as input.
  14023. @item matrixin, min
  14024. Set the input colorspace matrix.
  14025. Possible value are:
  14026. @table @var
  14027. @item input
  14028. @item 709
  14029. @item unspecified
  14030. @item 470bg
  14031. @item 170m
  14032. @item 2020_ncl
  14033. @item 2020_cl
  14034. @end table
  14035. @item chromal, c
  14036. Set the output chroma location.
  14037. Possible values are:
  14038. @table @var
  14039. @item input
  14040. @item left
  14041. @item center
  14042. @item topleft
  14043. @item top
  14044. @item bottomleft
  14045. @item bottom
  14046. @end table
  14047. @item chromalin, cin
  14048. Set the input chroma location.
  14049. Possible values are:
  14050. @table @var
  14051. @item input
  14052. @item left
  14053. @item center
  14054. @item topleft
  14055. @item top
  14056. @item bottomleft
  14057. @item bottom
  14058. @end table
  14059. @item npl
  14060. Set the nominal peak luminance.
  14061. @end table
  14062. The values of the @option{w} and @option{h} options are expressions
  14063. containing the following constants:
  14064. @table @var
  14065. @item in_w
  14066. @item in_h
  14067. The input width and height
  14068. @item iw
  14069. @item ih
  14070. These are the same as @var{in_w} and @var{in_h}.
  14071. @item out_w
  14072. @item out_h
  14073. The output (scaled) width and height
  14074. @item ow
  14075. @item oh
  14076. These are the same as @var{out_w} and @var{out_h}
  14077. @item a
  14078. The same as @var{iw} / @var{ih}
  14079. @item sar
  14080. input sample aspect ratio
  14081. @item dar
  14082. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14083. @item hsub
  14084. @item vsub
  14085. horizontal and vertical input chroma subsample values. For example for the
  14086. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14087. @item ohsub
  14088. @item ovsub
  14089. horizontal and vertical output chroma subsample values. For example for the
  14090. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14091. @end table
  14092. @table @option
  14093. @end table
  14094. @c man end VIDEO FILTERS
  14095. @chapter OpenCL Video Filters
  14096. @c man begin OPENCL VIDEO FILTERS
  14097. Below is a description of the currently available OpenCL video filters.
  14098. To enable compilation of these filters you need to configure FFmpeg with
  14099. @code{--enable-opencl}.
  14100. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14101. @table @option
  14102. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14103. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14104. given device parameters.
  14105. @item -filter_hw_device @var{name}
  14106. Pass the hardware device called @var{name} to all filters in any filter graph.
  14107. @end table
  14108. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14109. @itemize
  14110. @item
  14111. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14112. @example
  14113. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14114. @end example
  14115. @end itemize
  14116. 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.
  14117. @section avgblur_opencl
  14118. Apply average blur filter.
  14119. The filter accepts the following options:
  14120. @table @option
  14121. @item sizeX
  14122. Set horizontal radius size.
  14123. Range is @code{[1, 1024]} and default value is @code{1}.
  14124. @item planes
  14125. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14126. @item sizeY
  14127. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14128. @end table
  14129. @subsection Example
  14130. @itemize
  14131. @item
  14132. 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.
  14133. @example
  14134. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14135. @end example
  14136. @end itemize
  14137. @section boxblur_opencl
  14138. Apply a boxblur algorithm to the input video.
  14139. It accepts the following parameters:
  14140. @table @option
  14141. @item luma_radius, lr
  14142. @item luma_power, lp
  14143. @item chroma_radius, cr
  14144. @item chroma_power, cp
  14145. @item alpha_radius, ar
  14146. @item alpha_power, ap
  14147. @end table
  14148. A description of the accepted options follows.
  14149. @table @option
  14150. @item luma_radius, lr
  14151. @item chroma_radius, cr
  14152. @item alpha_radius, ar
  14153. Set an expression for the box radius in pixels used for blurring the
  14154. corresponding input plane.
  14155. The radius value must be a non-negative number, and must not be
  14156. greater than the value of the expression @code{min(w,h)/2} for the
  14157. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14158. planes.
  14159. Default value for @option{luma_radius} is "2". If not specified,
  14160. @option{chroma_radius} and @option{alpha_radius} default to the
  14161. corresponding value set for @option{luma_radius}.
  14162. The expressions can contain the following constants:
  14163. @table @option
  14164. @item w
  14165. @item h
  14166. The input width and height in pixels.
  14167. @item cw
  14168. @item ch
  14169. The input chroma image width and height in pixels.
  14170. @item hsub
  14171. @item vsub
  14172. The horizontal and vertical chroma subsample values. For example, for the
  14173. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14174. @end table
  14175. @item luma_power, lp
  14176. @item chroma_power, cp
  14177. @item alpha_power, ap
  14178. Specify how many times the boxblur filter is applied to the
  14179. corresponding plane.
  14180. Default value for @option{luma_power} is 2. If not specified,
  14181. @option{chroma_power} and @option{alpha_power} default to the
  14182. corresponding value set for @option{luma_power}.
  14183. A value of 0 will disable the effect.
  14184. @end table
  14185. @subsection Examples
  14186. 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.
  14187. @itemize
  14188. @item
  14189. Apply a boxblur filter with the luma, chroma, and alpha radius
  14190. 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.
  14191. @example
  14192. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14193. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14194. @end example
  14195. @item
  14196. 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.
  14197. For the luma plane, a 2x2 box radius will be run once.
  14198. For the chroma plane, a 4x4 box radius will be run 5 times.
  14199. For the alpha plane, a 3x3 box radius will be run 7 times.
  14200. @example
  14201. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14202. @end example
  14203. @end itemize
  14204. @section convolution_opencl
  14205. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14206. The filter accepts the following options:
  14207. @table @option
  14208. @item 0m
  14209. @item 1m
  14210. @item 2m
  14211. @item 3m
  14212. Set matrix for each plane.
  14213. Matrix is sequence of 9, 25 or 49 signed numbers.
  14214. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14215. @item 0rdiv
  14216. @item 1rdiv
  14217. @item 2rdiv
  14218. @item 3rdiv
  14219. Set multiplier for calculated value for each plane.
  14220. If unset or 0, it will be sum of all matrix elements.
  14221. The option value must be an float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14222. @item 0bias
  14223. @item 1bias
  14224. @item 2bias
  14225. @item 3bias
  14226. Set bias for each plane. This value is added to the result of the multiplication.
  14227. Useful for making the overall image brighter or darker.
  14228. The option value must be an float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  14229. @end table
  14230. @subsection Examples
  14231. @itemize
  14232. @item
  14233. Apply sharpen:
  14234. @example
  14235. -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
  14236. @end example
  14237. @item
  14238. Apply blur:
  14239. @example
  14240. -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
  14241. @end example
  14242. @item
  14243. Apply edge enhance:
  14244. @example
  14245. -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
  14246. @end example
  14247. @item
  14248. Apply edge detect:
  14249. @example
  14250. -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
  14251. @end example
  14252. @item
  14253. Apply laplacian edge detector which includes diagonals:
  14254. @example
  14255. -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
  14256. @end example
  14257. @item
  14258. Apply emboss:
  14259. @example
  14260. -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
  14261. @end example
  14262. @end itemize
  14263. @section dilation_opencl
  14264. Apply dilation effect to the video.
  14265. This filter replaces the pixel by the local(3x3) maximum.
  14266. It accepts the following options:
  14267. @table @option
  14268. @item threshold0
  14269. @item threshold1
  14270. @item threshold2
  14271. @item threshold3
  14272. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14273. If @code{0}, plane will remain unchanged.
  14274. @item coordinates
  14275. Flag which specifies the pixel to refer to.
  14276. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14277. Flags to local 3x3 coordinates region centered on @code{x}:
  14278. 1 2 3
  14279. 4 x 5
  14280. 6 7 8
  14281. @end table
  14282. @subsection Example
  14283. @itemize
  14284. @item
  14285. 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.
  14286. @example
  14287. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14288. @end example
  14289. @end itemize
  14290. @section erosion_opencl
  14291. Apply erosion effect to the video.
  14292. This filter replaces the pixel by the local(3x3) minimum.
  14293. It accepts the following options:
  14294. @table @option
  14295. @item threshold0
  14296. @item threshold1
  14297. @item threshold2
  14298. @item threshold3
  14299. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14300. If @code{0}, plane will remain unchanged.
  14301. @item coordinates
  14302. Flag which specifies the pixel to refer to.
  14303. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14304. Flags to local 3x3 coordinates region centered on @code{x}:
  14305. 1 2 3
  14306. 4 x 5
  14307. 6 7 8
  14308. @end table
  14309. @subsection Example
  14310. @itemize
  14311. @item
  14312. 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.
  14313. @example
  14314. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14315. @end example
  14316. @end itemize
  14317. @section overlay_opencl
  14318. Overlay one video on top of another.
  14319. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  14320. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  14321. The filter accepts the following options:
  14322. @table @option
  14323. @item x
  14324. Set the x coordinate of the overlaid video on the main video.
  14325. Default value is @code{0}.
  14326. @item y
  14327. Set the x coordinate of the overlaid video on the main video.
  14328. Default value is @code{0}.
  14329. @end table
  14330. @subsection Examples
  14331. @itemize
  14332. @item
  14333. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  14334. @example
  14335. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14336. @end example
  14337. @item
  14338. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  14339. @example
  14340. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14341. @end example
  14342. @end itemize
  14343. @section prewitt_opencl
  14344. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  14345. The filter accepts the following option:
  14346. @table @option
  14347. @item planes
  14348. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14349. @item scale
  14350. Set value which will be multiplied with filtered result.
  14351. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14352. @item delta
  14353. Set value which will be added to filtered result.
  14354. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14355. @end table
  14356. @subsection Example
  14357. @itemize
  14358. @item
  14359. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  14360. @example
  14361. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14362. @end example
  14363. @end itemize
  14364. @section roberts_opencl
  14365. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  14366. The filter accepts the following option:
  14367. @table @option
  14368. @item planes
  14369. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14370. @item scale
  14371. Set value which will be multiplied with filtered result.
  14372. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14373. @item delta
  14374. Set value which will be added to filtered result.
  14375. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14376. @end table
  14377. @subsection Example
  14378. @itemize
  14379. @item
  14380. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  14381. @example
  14382. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14383. @end example
  14384. @end itemize
  14385. @section sobel_opencl
  14386. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  14387. The filter accepts the following option:
  14388. @table @option
  14389. @item planes
  14390. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14391. @item scale
  14392. Set value which will be multiplied with filtered result.
  14393. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14394. @item delta
  14395. Set value which will be added to filtered result.
  14396. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14397. @end table
  14398. @subsection Example
  14399. @itemize
  14400. @item
  14401. Apply sobel operator with scale set to 2 and delta set to 10
  14402. @example
  14403. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14404. @end example
  14405. @end itemize
  14406. @section tonemap_opencl
  14407. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  14408. It accepts the following parameters:
  14409. @table @option
  14410. @item tonemap
  14411. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  14412. @item param
  14413. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  14414. @item desat
  14415. Apply desaturation for highlights that exceed this level of brightness. The
  14416. higher the parameter, the more color information will be preserved. This
  14417. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14418. (smoothly) turning into white instead. This makes images feel more natural,
  14419. at the cost of reducing information about out-of-range colors.
  14420. The default value is 0.5, and the algorithm here is a little different from
  14421. the cpu version tonemap currently. A setting of 0.0 disables this option.
  14422. @item threshold
  14423. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  14424. is used to detect whether the scene has changed or not. If the distance beween
  14425. the current frame average brightness and the current running average exceeds
  14426. a threshold value, we would re-calculate scene average and peak brightness.
  14427. The default value is 0.2.
  14428. @item format
  14429. Specify the output pixel format.
  14430. Currently supported formats are:
  14431. @table @var
  14432. @item p010
  14433. @item nv12
  14434. @end table
  14435. @item range, r
  14436. Set the output color range.
  14437. Possible values are:
  14438. @table @var
  14439. @item tv/mpeg
  14440. @item pc/jpeg
  14441. @end table
  14442. Default is same as input.
  14443. @item primaries, p
  14444. Set the output color primaries.
  14445. Possible values are:
  14446. @table @var
  14447. @item bt709
  14448. @item bt2020
  14449. @end table
  14450. Default is same as input.
  14451. @item transfer, t
  14452. Set the output transfer characteristics.
  14453. Possible values are:
  14454. @table @var
  14455. @item bt709
  14456. @item bt2020
  14457. @end table
  14458. Default is bt709.
  14459. @item matrix, m
  14460. Set the output colorspace matrix.
  14461. Possible value are:
  14462. @table @var
  14463. @item bt709
  14464. @item bt2020
  14465. @end table
  14466. Default is same as input.
  14467. @end table
  14468. @subsection Example
  14469. @itemize
  14470. @item
  14471. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  14472. @example
  14473. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  14474. @end example
  14475. @end itemize
  14476. @section unsharp_opencl
  14477. Sharpen or blur the input video.
  14478. It accepts the following parameters:
  14479. @table @option
  14480. @item luma_msize_x, lx
  14481. Set the luma matrix horizontal size.
  14482. Range is @code{[1, 23]} and default value is @code{5}.
  14483. @item luma_msize_y, ly
  14484. Set the luma matrix vertical size.
  14485. Range is @code{[1, 23]} and default value is @code{5}.
  14486. @item luma_amount, la
  14487. Set the luma effect strength.
  14488. Range is @code{[-10, 10]} and default value is @code{1.0}.
  14489. Negative values will blur the input video, while positive values will
  14490. sharpen it, a value of zero will disable the effect.
  14491. @item chroma_msize_x, cx
  14492. Set the chroma matrix horizontal size.
  14493. Range is @code{[1, 23]} and default value is @code{5}.
  14494. @item chroma_msize_y, cy
  14495. Set the chroma matrix vertical size.
  14496. Range is @code{[1, 23]} and default value is @code{5}.
  14497. @item chroma_amount, ca
  14498. Set the chroma effect strength.
  14499. Range is @code{[-10, 10]} and default value is @code{0.0}.
  14500. Negative values will blur the input video, while positive values will
  14501. sharpen it, a value of zero will disable the effect.
  14502. @end table
  14503. All parameters are optional and default to the equivalent of the
  14504. string '5:5:1.0:5:5:0.0'.
  14505. @subsection Examples
  14506. @itemize
  14507. @item
  14508. Apply strong luma sharpen effect:
  14509. @example
  14510. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  14511. @end example
  14512. @item
  14513. Apply a strong blur of both luma and chroma parameters:
  14514. @example
  14515. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  14516. @end example
  14517. @end itemize
  14518. @c man end OPENCL VIDEO FILTERS
  14519. @chapter Video Sources
  14520. @c man begin VIDEO SOURCES
  14521. Below is a description of the currently available video sources.
  14522. @section buffer
  14523. Buffer video frames, and make them available to the filter chain.
  14524. This source is mainly intended for a programmatic use, in particular
  14525. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  14526. It accepts the following parameters:
  14527. @table @option
  14528. @item video_size
  14529. Specify the size (width and height) of the buffered video frames. For the
  14530. syntax of this option, check the
  14531. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14532. @item width
  14533. The input video width.
  14534. @item height
  14535. The input video height.
  14536. @item pix_fmt
  14537. A string representing the pixel format of the buffered video frames.
  14538. It may be a number corresponding to a pixel format, or a pixel format
  14539. name.
  14540. @item time_base
  14541. Specify the timebase assumed by the timestamps of the buffered frames.
  14542. @item frame_rate
  14543. Specify the frame rate expected for the video stream.
  14544. @item pixel_aspect, sar
  14545. The sample (pixel) aspect ratio of the input video.
  14546. @item sws_param
  14547. Specify the optional parameters to be used for the scale filter which
  14548. is automatically inserted when an input change is detected in the
  14549. input size or format.
  14550. @item hw_frames_ctx
  14551. When using a hardware pixel format, this should be a reference to an
  14552. AVHWFramesContext describing input frames.
  14553. @end table
  14554. For example:
  14555. @example
  14556. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  14557. @end example
  14558. will instruct the source to accept video frames with size 320x240 and
  14559. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  14560. square pixels (1:1 sample aspect ratio).
  14561. Since the pixel format with name "yuv410p" corresponds to the number 6
  14562. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  14563. this example corresponds to:
  14564. @example
  14565. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  14566. @end example
  14567. Alternatively, the options can be specified as a flat string, but this
  14568. syntax is deprecated:
  14569. @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}]
  14570. @section cellauto
  14571. Create a pattern generated by an elementary cellular automaton.
  14572. The initial state of the cellular automaton can be defined through the
  14573. @option{filename} and @option{pattern} options. If such options are
  14574. not specified an initial state is created randomly.
  14575. At each new frame a new row in the video is filled with the result of
  14576. the cellular automaton next generation. The behavior when the whole
  14577. frame is filled is defined by the @option{scroll} option.
  14578. This source accepts the following options:
  14579. @table @option
  14580. @item filename, f
  14581. Read the initial cellular automaton state, i.e. the starting row, from
  14582. the specified file.
  14583. In the file, each non-whitespace character is considered an alive
  14584. cell, a newline will terminate the row, and further characters in the
  14585. file will be ignored.
  14586. @item pattern, p
  14587. Read the initial cellular automaton state, i.e. the starting row, from
  14588. the specified string.
  14589. Each non-whitespace character in the string is considered an alive
  14590. cell, a newline will terminate the row, and further characters in the
  14591. string will be ignored.
  14592. @item rate, r
  14593. Set the video rate, that is the number of frames generated per second.
  14594. Default is 25.
  14595. @item random_fill_ratio, ratio
  14596. Set the random fill ratio for the initial cellular automaton row. It
  14597. is a floating point number value ranging from 0 to 1, defaults to
  14598. 1/PHI.
  14599. This option is ignored when a file or a pattern is specified.
  14600. @item random_seed, seed
  14601. Set the seed for filling randomly the initial row, must be an integer
  14602. included between 0 and UINT32_MAX. If not specified, or if explicitly
  14603. set to -1, the filter will try to use a good random seed on a best
  14604. effort basis.
  14605. @item rule
  14606. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  14607. Default value is 110.
  14608. @item size, s
  14609. Set the size of the output video. For the syntax of this option, check the
  14610. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14611. If @option{filename} or @option{pattern} is specified, the size is set
  14612. by default to the width of the specified initial state row, and the
  14613. height is set to @var{width} * PHI.
  14614. If @option{size} is set, it must contain the width of the specified
  14615. pattern string, and the specified pattern will be centered in the
  14616. larger row.
  14617. If a filename or a pattern string is not specified, the size value
  14618. defaults to "320x518" (used for a randomly generated initial state).
  14619. @item scroll
  14620. If set to 1, scroll the output upward when all the rows in the output
  14621. have been already filled. If set to 0, the new generated row will be
  14622. written over the top row just after the bottom row is filled.
  14623. Defaults to 1.
  14624. @item start_full, full
  14625. If set to 1, completely fill the output with generated rows before
  14626. outputting the first frame.
  14627. This is the default behavior, for disabling set the value to 0.
  14628. @item stitch
  14629. If set to 1, stitch the left and right row edges together.
  14630. This is the default behavior, for disabling set the value to 0.
  14631. @end table
  14632. @subsection Examples
  14633. @itemize
  14634. @item
  14635. Read the initial state from @file{pattern}, and specify an output of
  14636. size 200x400.
  14637. @example
  14638. cellauto=f=pattern:s=200x400
  14639. @end example
  14640. @item
  14641. Generate a random initial row with a width of 200 cells, with a fill
  14642. ratio of 2/3:
  14643. @example
  14644. cellauto=ratio=2/3:s=200x200
  14645. @end example
  14646. @item
  14647. Create a pattern generated by rule 18 starting by a single alive cell
  14648. centered on an initial row with width 100:
  14649. @example
  14650. cellauto=p=@@:s=100x400:full=0:rule=18
  14651. @end example
  14652. @item
  14653. Specify a more elaborated initial pattern:
  14654. @example
  14655. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  14656. @end example
  14657. @end itemize
  14658. @anchor{coreimagesrc}
  14659. @section coreimagesrc
  14660. Video source generated on GPU using Apple's CoreImage API on OSX.
  14661. This video source is a specialized version of the @ref{coreimage} video filter.
  14662. Use a core image generator at the beginning of the applied filterchain to
  14663. generate the content.
  14664. The coreimagesrc video source accepts the following options:
  14665. @table @option
  14666. @item list_generators
  14667. List all available generators along with all their respective options as well as
  14668. possible minimum and maximum values along with the default values.
  14669. @example
  14670. list_generators=true
  14671. @end example
  14672. @item size, s
  14673. Specify the size of the sourced video. For the syntax of this option, check the
  14674. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14675. The default value is @code{320x240}.
  14676. @item rate, r
  14677. Specify the frame rate of the sourced video, as the number of frames
  14678. generated per second. It has to be a string in the format
  14679. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14680. number or a valid video frame rate abbreviation. The default value is
  14681. "25".
  14682. @item sar
  14683. Set the sample aspect ratio of the sourced video.
  14684. @item duration, d
  14685. Set the duration of the sourced video. See
  14686. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14687. for the accepted syntax.
  14688. If not specified, or the expressed duration is negative, the video is
  14689. supposed to be generated forever.
  14690. @end table
  14691. Additionally, all options of the @ref{coreimage} video filter are accepted.
  14692. A complete filterchain can be used for further processing of the
  14693. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  14694. and examples for details.
  14695. @subsection Examples
  14696. @itemize
  14697. @item
  14698. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  14699. given as complete and escaped command-line for Apple's standard bash shell:
  14700. @example
  14701. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  14702. @end example
  14703. This example is equivalent to the QRCode example of @ref{coreimage} without the
  14704. need for a nullsrc video source.
  14705. @end itemize
  14706. @section mandelbrot
  14707. Generate a Mandelbrot set fractal, and progressively zoom towards the
  14708. point specified with @var{start_x} and @var{start_y}.
  14709. This source accepts the following options:
  14710. @table @option
  14711. @item end_pts
  14712. Set the terminal pts value. Default value is 400.
  14713. @item end_scale
  14714. Set the terminal scale value.
  14715. Must be a floating point value. Default value is 0.3.
  14716. @item inner
  14717. Set the inner coloring mode, that is the algorithm used to draw the
  14718. Mandelbrot fractal internal region.
  14719. It shall assume one of the following values:
  14720. @table @option
  14721. @item black
  14722. Set black mode.
  14723. @item convergence
  14724. Show time until convergence.
  14725. @item mincol
  14726. Set color based on point closest to the origin of the iterations.
  14727. @item period
  14728. Set period mode.
  14729. @end table
  14730. Default value is @var{mincol}.
  14731. @item bailout
  14732. Set the bailout value. Default value is 10.0.
  14733. @item maxiter
  14734. Set the maximum of iterations performed by the rendering
  14735. algorithm. Default value is 7189.
  14736. @item outer
  14737. Set outer coloring mode.
  14738. It shall assume one of following values:
  14739. @table @option
  14740. @item iteration_count
  14741. Set iteration cound mode.
  14742. @item normalized_iteration_count
  14743. set normalized iteration count mode.
  14744. @end table
  14745. Default value is @var{normalized_iteration_count}.
  14746. @item rate, r
  14747. Set frame rate, expressed as number of frames per second. Default
  14748. value is "25".
  14749. @item size, s
  14750. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  14751. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  14752. @item start_scale
  14753. Set the initial scale value. Default value is 3.0.
  14754. @item start_x
  14755. Set the initial x position. Must be a floating point value between
  14756. -100 and 100. Default value is -0.743643887037158704752191506114774.
  14757. @item start_y
  14758. Set the initial y position. Must be a floating point value between
  14759. -100 and 100. Default value is -0.131825904205311970493132056385139.
  14760. @end table
  14761. @section mptestsrc
  14762. Generate various test patterns, as generated by the MPlayer test filter.
  14763. The size of the generated video is fixed, and is 256x256.
  14764. This source is useful in particular for testing encoding features.
  14765. This source accepts the following options:
  14766. @table @option
  14767. @item rate, r
  14768. Specify the frame rate of the sourced video, as the number of frames
  14769. generated per second. It has to be a string in the format
  14770. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14771. number or a valid video frame rate abbreviation. The default value is
  14772. "25".
  14773. @item duration, d
  14774. Set the duration of the sourced video. See
  14775. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14776. for the accepted syntax.
  14777. If not specified, or the expressed duration is negative, the video is
  14778. supposed to be generated forever.
  14779. @item test, t
  14780. Set the number or the name of the test to perform. Supported tests are:
  14781. @table @option
  14782. @item dc_luma
  14783. @item dc_chroma
  14784. @item freq_luma
  14785. @item freq_chroma
  14786. @item amp_luma
  14787. @item amp_chroma
  14788. @item cbp
  14789. @item mv
  14790. @item ring1
  14791. @item ring2
  14792. @item all
  14793. @end table
  14794. Default value is "all", which will cycle through the list of all tests.
  14795. @end table
  14796. Some examples:
  14797. @example
  14798. mptestsrc=t=dc_luma
  14799. @end example
  14800. will generate a "dc_luma" test pattern.
  14801. @section frei0r_src
  14802. Provide a frei0r source.
  14803. To enable compilation of this filter you need to install the frei0r
  14804. header and configure FFmpeg with @code{--enable-frei0r}.
  14805. This source accepts the following parameters:
  14806. @table @option
  14807. @item size
  14808. The size of the video to generate. For the syntax of this option, check the
  14809. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14810. @item framerate
  14811. The framerate of the generated video. It may be a string of the form
  14812. @var{num}/@var{den} or a frame rate abbreviation.
  14813. @item filter_name
  14814. The name to the frei0r source to load. For more information regarding frei0r and
  14815. how to set the parameters, read the @ref{frei0r} section in the video filters
  14816. documentation.
  14817. @item filter_params
  14818. A '|'-separated list of parameters to pass to the frei0r source.
  14819. @end table
  14820. For example, to generate a frei0r partik0l source with size 200x200
  14821. and frame rate 10 which is overlaid on the overlay filter main input:
  14822. @example
  14823. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  14824. @end example
  14825. @section life
  14826. Generate a life pattern.
  14827. This source is based on a generalization of John Conway's life game.
  14828. The sourced input represents a life grid, each pixel represents a cell
  14829. which can be in one of two possible states, alive or dead. Every cell
  14830. interacts with its eight neighbours, which are the cells that are
  14831. horizontally, vertically, or diagonally adjacent.
  14832. At each interaction the grid evolves according to the adopted rule,
  14833. which specifies the number of neighbor alive cells which will make a
  14834. cell stay alive or born. The @option{rule} option allows one to specify
  14835. the rule to adopt.
  14836. This source accepts the following options:
  14837. @table @option
  14838. @item filename, f
  14839. Set the file from which to read the initial grid state. In the file,
  14840. each non-whitespace character is considered an alive cell, and newline
  14841. is used to delimit the end of each row.
  14842. If this option is not specified, the initial grid is generated
  14843. randomly.
  14844. @item rate, r
  14845. Set the video rate, that is the number of frames generated per second.
  14846. Default is 25.
  14847. @item random_fill_ratio, ratio
  14848. Set the random fill ratio for the initial random grid. It is a
  14849. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  14850. It is ignored when a file is specified.
  14851. @item random_seed, seed
  14852. Set the seed for filling the initial random grid, must be an integer
  14853. included between 0 and UINT32_MAX. If not specified, or if explicitly
  14854. set to -1, the filter will try to use a good random seed on a best
  14855. effort basis.
  14856. @item rule
  14857. Set the life rule.
  14858. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  14859. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  14860. @var{NS} specifies the number of alive neighbor cells which make a
  14861. live cell stay alive, and @var{NB} the number of alive neighbor cells
  14862. which make a dead cell to become alive (i.e. to "born").
  14863. "s" and "b" can be used in place of "S" and "B", respectively.
  14864. Alternatively a rule can be specified by an 18-bits integer. The 9
  14865. high order bits are used to encode the next cell state if it is alive
  14866. for each number of neighbor alive cells, the low order bits specify
  14867. the rule for "borning" new cells. Higher order bits encode for an
  14868. higher number of neighbor cells.
  14869. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  14870. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  14871. Default value is "S23/B3", which is the original Conway's game of life
  14872. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  14873. cells, and will born a new cell if there are three alive cells around
  14874. a dead cell.
  14875. @item size, s
  14876. Set the size of the output video. For the syntax of this option, check the
  14877. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14878. If @option{filename} is specified, the size is set by default to the
  14879. same size of the input file. If @option{size} is set, it must contain
  14880. the size specified in the input file, and the initial grid defined in
  14881. that file is centered in the larger resulting area.
  14882. If a filename is not specified, the size value defaults to "320x240"
  14883. (used for a randomly generated initial grid).
  14884. @item stitch
  14885. If set to 1, stitch the left and right grid edges together, and the
  14886. top and bottom edges also. Defaults to 1.
  14887. @item mold
  14888. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  14889. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  14890. value from 0 to 255.
  14891. @item life_color
  14892. Set the color of living (or new born) cells.
  14893. @item death_color
  14894. Set the color of dead cells. If @option{mold} is set, this is the first color
  14895. used to represent a dead cell.
  14896. @item mold_color
  14897. Set mold color, for definitely dead and moldy cells.
  14898. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  14899. ffmpeg-utils manual,ffmpeg-utils}.
  14900. @end table
  14901. @subsection Examples
  14902. @itemize
  14903. @item
  14904. Read a grid from @file{pattern}, and center it on a grid of size
  14905. 300x300 pixels:
  14906. @example
  14907. life=f=pattern:s=300x300
  14908. @end example
  14909. @item
  14910. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  14911. @example
  14912. life=ratio=2/3:s=200x200
  14913. @end example
  14914. @item
  14915. Specify a custom rule for evolving a randomly generated grid:
  14916. @example
  14917. life=rule=S14/B34
  14918. @end example
  14919. @item
  14920. Full example with slow death effect (mold) using @command{ffplay}:
  14921. @example
  14922. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  14923. @end example
  14924. @end itemize
  14925. @anchor{allrgb}
  14926. @anchor{allyuv}
  14927. @anchor{color}
  14928. @anchor{haldclutsrc}
  14929. @anchor{nullsrc}
  14930. @anchor{pal75bars}
  14931. @anchor{pal100bars}
  14932. @anchor{rgbtestsrc}
  14933. @anchor{smptebars}
  14934. @anchor{smptehdbars}
  14935. @anchor{testsrc}
  14936. @anchor{testsrc2}
  14937. @anchor{yuvtestsrc}
  14938. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  14939. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  14940. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  14941. The @code{color} source provides an uniformly colored input.
  14942. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  14943. @ref{haldclut} filter.
  14944. The @code{nullsrc} source returns unprocessed video frames. It is
  14945. mainly useful to be employed in analysis / debugging tools, or as the
  14946. source for filters which ignore the input data.
  14947. The @code{pal75bars} source generates a color bars pattern, based on
  14948. EBU PAL recommendations with 75% color levels.
  14949. The @code{pal100bars} source generates a color bars pattern, based on
  14950. EBU PAL recommendations with 100% color levels.
  14951. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  14952. detecting RGB vs BGR issues. You should see a red, green and blue
  14953. stripe from top to bottom.
  14954. The @code{smptebars} source generates a color bars pattern, based on
  14955. the SMPTE Engineering Guideline EG 1-1990.
  14956. The @code{smptehdbars} source generates a color bars pattern, based on
  14957. the SMPTE RP 219-2002.
  14958. The @code{testsrc} source generates a test video pattern, showing a
  14959. color pattern, a scrolling gradient and a timestamp. This is mainly
  14960. intended for testing purposes.
  14961. The @code{testsrc2} source is similar to testsrc, but supports more
  14962. pixel formats instead of just @code{rgb24}. This allows using it as an
  14963. input for other tests without requiring a format conversion.
  14964. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  14965. see a y, cb and cr stripe from top to bottom.
  14966. The sources accept the following parameters:
  14967. @table @option
  14968. @item level
  14969. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  14970. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  14971. pixels to be used as identity matrix for 3D lookup tables. Each component is
  14972. coded on a @code{1/(N*N)} scale.
  14973. @item color, c
  14974. Specify the color of the source, only available in the @code{color}
  14975. source. For the syntax of this option, check the
  14976. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14977. @item size, s
  14978. Specify the size of the sourced video. For the syntax of this option, check the
  14979. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14980. The default value is @code{320x240}.
  14981. This option is not available with the @code{allrgb}, @code{allyuv}, and
  14982. @code{haldclutsrc} filters.
  14983. @item rate, r
  14984. Specify the frame rate of the sourced video, as the number of frames
  14985. generated per second. It has to be a string in the format
  14986. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14987. number or a valid video frame rate abbreviation. The default value is
  14988. "25".
  14989. @item duration, d
  14990. Set the duration of the sourced video. See
  14991. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14992. for the accepted syntax.
  14993. If not specified, or the expressed duration is negative, the video is
  14994. supposed to be generated forever.
  14995. @item sar
  14996. Set the sample aspect ratio of the sourced video.
  14997. @item alpha
  14998. Specify the alpha (opacity) of the background, only available in the
  14999. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15000. 255 (fully opaque, the default).
  15001. @item decimals, n
  15002. Set the number of decimals to show in the timestamp, only available in the
  15003. @code{testsrc} source.
  15004. The displayed timestamp value will correspond to the original
  15005. timestamp value multiplied by the power of 10 of the specified
  15006. value. Default value is 0.
  15007. @end table
  15008. @subsection Examples
  15009. @itemize
  15010. @item
  15011. Generate a video with a duration of 5.3 seconds, with size
  15012. 176x144 and a frame rate of 10 frames per second:
  15013. @example
  15014. testsrc=duration=5.3:size=qcif:rate=10
  15015. @end example
  15016. @item
  15017. The following graph description will generate a red source
  15018. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15019. frames per second:
  15020. @example
  15021. color=c=red@@0.2:s=qcif:r=10
  15022. @end example
  15023. @item
  15024. If the input content is to be ignored, @code{nullsrc} can be used. The
  15025. following command generates noise in the luminance plane by employing
  15026. the @code{geq} filter:
  15027. @example
  15028. nullsrc=s=256x256, geq=random(1)*255:128:128
  15029. @end example
  15030. @end itemize
  15031. @subsection Commands
  15032. The @code{color} source supports the following commands:
  15033. @table @option
  15034. @item c, color
  15035. Set the color of the created image. Accepts the same syntax of the
  15036. corresponding @option{color} option.
  15037. @end table
  15038. @section openclsrc
  15039. Generate video using an OpenCL program.
  15040. @table @option
  15041. @item source
  15042. OpenCL program source file.
  15043. @item kernel
  15044. Kernel name in program.
  15045. @item size, s
  15046. Size of frames to generate. This must be set.
  15047. @item format
  15048. Pixel format to use for the generated frames. This must be set.
  15049. @item rate, r
  15050. Number of frames generated every second. Default value is '25'.
  15051. @end table
  15052. For details of how the program loading works, see the @ref{program_opencl}
  15053. filter.
  15054. Example programs:
  15055. @itemize
  15056. @item
  15057. Generate a colour ramp by setting pixel values from the position of the pixel
  15058. in the output image. (Note that this will work with all pixel formats, but
  15059. the generated output will not be the same.)
  15060. @verbatim
  15061. __kernel void ramp(__write_only image2d_t dst,
  15062. unsigned int index)
  15063. {
  15064. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15065. float4 val;
  15066. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15067. write_imagef(dst, loc, val);
  15068. }
  15069. @end verbatim
  15070. @item
  15071. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15072. @verbatim
  15073. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15074. unsigned int index)
  15075. {
  15076. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15077. float4 value = 0.0f;
  15078. int x = loc.x + index;
  15079. int y = loc.y + index;
  15080. while (x > 0 || y > 0) {
  15081. if (x % 3 == 1 && y % 3 == 1) {
  15082. value = 1.0f;
  15083. break;
  15084. }
  15085. x /= 3;
  15086. y /= 3;
  15087. }
  15088. write_imagef(dst, loc, value);
  15089. }
  15090. @end verbatim
  15091. @end itemize
  15092. @c man end VIDEO SOURCES
  15093. @chapter Video Sinks
  15094. @c man begin VIDEO SINKS
  15095. Below is a description of the currently available video sinks.
  15096. @section buffersink
  15097. Buffer video frames, and make them available to the end of the filter
  15098. graph.
  15099. This sink is mainly intended for programmatic use, in particular
  15100. through the interface defined in @file{libavfilter/buffersink.h}
  15101. or the options system.
  15102. It accepts a pointer to an AVBufferSinkContext structure, which
  15103. defines the incoming buffers' formats, to be passed as the opaque
  15104. parameter to @code{avfilter_init_filter} for initialization.
  15105. @section nullsink
  15106. Null video sink: do absolutely nothing with the input video. It is
  15107. mainly useful as a template and for use in analysis / debugging
  15108. tools.
  15109. @c man end VIDEO SINKS
  15110. @chapter Multimedia Filters
  15111. @c man begin MULTIMEDIA FILTERS
  15112. Below is a description of the currently available multimedia filters.
  15113. @section abitscope
  15114. Convert input audio to a video output, displaying the audio bit scope.
  15115. The filter accepts the following options:
  15116. @table @option
  15117. @item rate, r
  15118. Set frame rate, expressed as number of frames per second. Default
  15119. value is "25".
  15120. @item size, s
  15121. Specify the video size for the output. For the syntax of this option, check the
  15122. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15123. Default value is @code{1024x256}.
  15124. @item colors
  15125. Specify list of colors separated by space or by '|' which will be used to
  15126. draw channels. Unrecognized or missing colors will be replaced
  15127. by white color.
  15128. @end table
  15129. @section ahistogram
  15130. Convert input audio to a video output, displaying the volume histogram.
  15131. The filter accepts the following options:
  15132. @table @option
  15133. @item dmode
  15134. Specify how histogram is calculated.
  15135. It accepts the following values:
  15136. @table @samp
  15137. @item single
  15138. Use single histogram for all channels.
  15139. @item separate
  15140. Use separate histogram for each channel.
  15141. @end table
  15142. Default is @code{single}.
  15143. @item rate, r
  15144. Set frame rate, expressed as number of frames per second. Default
  15145. value is "25".
  15146. @item size, s
  15147. Specify the video size for the output. For the syntax of this option, check the
  15148. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15149. Default value is @code{hd720}.
  15150. @item scale
  15151. Set display scale.
  15152. It accepts the following values:
  15153. @table @samp
  15154. @item log
  15155. logarithmic
  15156. @item sqrt
  15157. square root
  15158. @item cbrt
  15159. cubic root
  15160. @item lin
  15161. linear
  15162. @item rlog
  15163. reverse logarithmic
  15164. @end table
  15165. Default is @code{log}.
  15166. @item ascale
  15167. Set amplitude scale.
  15168. It accepts the following values:
  15169. @table @samp
  15170. @item log
  15171. logarithmic
  15172. @item lin
  15173. linear
  15174. @end table
  15175. Default is @code{log}.
  15176. @item acount
  15177. Set how much frames to accumulate in histogram.
  15178. Defauls is 1. Setting this to -1 accumulates all frames.
  15179. @item rheight
  15180. Set histogram ratio of window height.
  15181. @item slide
  15182. Set sonogram sliding.
  15183. It accepts the following values:
  15184. @table @samp
  15185. @item replace
  15186. replace old rows with new ones.
  15187. @item scroll
  15188. scroll from top to bottom.
  15189. @end table
  15190. Default is @code{replace}.
  15191. @end table
  15192. @section aphasemeter
  15193. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  15194. representing mean phase of current audio frame. A video output can also be produced and is
  15195. enabled by default. The audio is passed through as first output.
  15196. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  15197. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  15198. and @code{1} means channels are in phase.
  15199. The filter accepts the following options, all related to its video output:
  15200. @table @option
  15201. @item rate, r
  15202. Set the output frame rate. Default value is @code{25}.
  15203. @item size, s
  15204. Set the video size for the output. For the syntax of this option, check the
  15205. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15206. Default value is @code{800x400}.
  15207. @item rc
  15208. @item gc
  15209. @item bc
  15210. Specify the red, green, blue contrast. Default values are @code{2},
  15211. @code{7} and @code{1}.
  15212. Allowed range is @code{[0, 255]}.
  15213. @item mpc
  15214. Set color which will be used for drawing median phase. If color is
  15215. @code{none} which is default, no median phase value will be drawn.
  15216. @item video
  15217. Enable video output. Default is enabled.
  15218. @end table
  15219. @section avectorscope
  15220. Convert input audio to a video output, representing the audio vector
  15221. scope.
  15222. The filter is used to measure the difference between channels of stereo
  15223. audio stream. A monoaural signal, consisting of identical left and right
  15224. signal, results in straight vertical line. Any stereo separation is visible
  15225. as a deviation from this line, creating a Lissajous figure.
  15226. If the straight (or deviation from it) but horizontal line appears this
  15227. indicates that the left and right channels are out of phase.
  15228. The filter accepts the following options:
  15229. @table @option
  15230. @item mode, m
  15231. Set the vectorscope mode.
  15232. Available values are:
  15233. @table @samp
  15234. @item lissajous
  15235. Lissajous rotated by 45 degrees.
  15236. @item lissajous_xy
  15237. Same as above but not rotated.
  15238. @item polar
  15239. Shape resembling half of circle.
  15240. @end table
  15241. Default value is @samp{lissajous}.
  15242. @item size, s
  15243. Set the video size for the output. For the syntax of this option, check the
  15244. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15245. Default value is @code{400x400}.
  15246. @item rate, r
  15247. Set the output frame rate. Default value is @code{25}.
  15248. @item rc
  15249. @item gc
  15250. @item bc
  15251. @item ac
  15252. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  15253. @code{160}, @code{80} and @code{255}.
  15254. Allowed range is @code{[0, 255]}.
  15255. @item rf
  15256. @item gf
  15257. @item bf
  15258. @item af
  15259. Specify the red, green, blue and alpha fade. Default values are @code{15},
  15260. @code{10}, @code{5} and @code{5}.
  15261. Allowed range is @code{[0, 255]}.
  15262. @item zoom
  15263. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  15264. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  15265. @item draw
  15266. Set the vectorscope drawing mode.
  15267. Available values are:
  15268. @table @samp
  15269. @item dot
  15270. Draw dot for each sample.
  15271. @item line
  15272. Draw line between previous and current sample.
  15273. @end table
  15274. Default value is @samp{dot}.
  15275. @item scale
  15276. Specify amplitude scale of audio samples.
  15277. Available values are:
  15278. @table @samp
  15279. @item lin
  15280. Linear.
  15281. @item sqrt
  15282. Square root.
  15283. @item cbrt
  15284. Cubic root.
  15285. @item log
  15286. Logarithmic.
  15287. @end table
  15288. @item swap
  15289. Swap left channel axis with right channel axis.
  15290. @item mirror
  15291. Mirror axis.
  15292. @table @samp
  15293. @item none
  15294. No mirror.
  15295. @item x
  15296. Mirror only x axis.
  15297. @item y
  15298. Mirror only y axis.
  15299. @item xy
  15300. Mirror both axis.
  15301. @end table
  15302. @end table
  15303. @subsection Examples
  15304. @itemize
  15305. @item
  15306. Complete example using @command{ffplay}:
  15307. @example
  15308. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15309. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  15310. @end example
  15311. @end itemize
  15312. @section bench, abench
  15313. Benchmark part of a filtergraph.
  15314. The filter accepts the following options:
  15315. @table @option
  15316. @item action
  15317. Start or stop a timer.
  15318. Available values are:
  15319. @table @samp
  15320. @item start
  15321. Get the current time, set it as frame metadata (using the key
  15322. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  15323. @item stop
  15324. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  15325. the input frame metadata to get the time difference. Time difference, average,
  15326. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  15327. @code{min}) are then printed. The timestamps are expressed in seconds.
  15328. @end table
  15329. @end table
  15330. @subsection Examples
  15331. @itemize
  15332. @item
  15333. Benchmark @ref{selectivecolor} filter:
  15334. @example
  15335. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  15336. @end example
  15337. @end itemize
  15338. @section concat
  15339. Concatenate audio and video streams, joining them together one after the
  15340. other.
  15341. The filter works on segments of synchronized video and audio streams. All
  15342. segments must have the same number of streams of each type, and that will
  15343. also be the number of streams at output.
  15344. The filter accepts the following options:
  15345. @table @option
  15346. @item n
  15347. Set the number of segments. Default is 2.
  15348. @item v
  15349. Set the number of output video streams, that is also the number of video
  15350. streams in each segment. Default is 1.
  15351. @item a
  15352. Set the number of output audio streams, that is also the number of audio
  15353. streams in each segment. Default is 0.
  15354. @item unsafe
  15355. Activate unsafe mode: do not fail if segments have a different format.
  15356. @end table
  15357. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  15358. @var{a} audio outputs.
  15359. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  15360. segment, in the same order as the outputs, then the inputs for the second
  15361. segment, etc.
  15362. Related streams do not always have exactly the same duration, for various
  15363. reasons including codec frame size or sloppy authoring. For that reason,
  15364. related synchronized streams (e.g. a video and its audio track) should be
  15365. concatenated at once. The concat filter will use the duration of the longest
  15366. stream in each segment (except the last one), and if necessary pad shorter
  15367. audio streams with silence.
  15368. For this filter to work correctly, all segments must start at timestamp 0.
  15369. All corresponding streams must have the same parameters in all segments; the
  15370. filtering system will automatically select a common pixel format for video
  15371. streams, and a common sample format, sample rate and channel layout for
  15372. audio streams, but other settings, such as resolution, must be converted
  15373. explicitly by the user.
  15374. Different frame rates are acceptable but will result in variable frame rate
  15375. at output; be sure to configure the output file to handle it.
  15376. @subsection Examples
  15377. @itemize
  15378. @item
  15379. Concatenate an opening, an episode and an ending, all in bilingual version
  15380. (video in stream 0, audio in streams 1 and 2):
  15381. @example
  15382. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  15383. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  15384. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  15385. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  15386. @end example
  15387. @item
  15388. Concatenate two parts, handling audio and video separately, using the
  15389. (a)movie sources, and adjusting the resolution:
  15390. @example
  15391. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  15392. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  15393. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  15394. @end example
  15395. Note that a desync will happen at the stitch if the audio and video streams
  15396. do not have exactly the same duration in the first file.
  15397. @end itemize
  15398. @subsection Commands
  15399. This filter supports the following commands:
  15400. @table @option
  15401. @item next
  15402. Close the current segment and step to the next one
  15403. @end table
  15404. @section drawgraph, adrawgraph
  15405. Draw a graph using input video or audio metadata.
  15406. It accepts the following parameters:
  15407. @table @option
  15408. @item m1
  15409. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  15410. @item fg1
  15411. Set 1st foreground color expression.
  15412. @item m2
  15413. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  15414. @item fg2
  15415. Set 2nd foreground color expression.
  15416. @item m3
  15417. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  15418. @item fg3
  15419. Set 3rd foreground color expression.
  15420. @item m4
  15421. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  15422. @item fg4
  15423. Set 4th foreground color expression.
  15424. @item min
  15425. Set minimal value of metadata value.
  15426. @item max
  15427. Set maximal value of metadata value.
  15428. @item bg
  15429. Set graph background color. Default is white.
  15430. @item mode
  15431. Set graph mode.
  15432. Available values for mode is:
  15433. @table @samp
  15434. @item bar
  15435. @item dot
  15436. @item line
  15437. @end table
  15438. Default is @code{line}.
  15439. @item slide
  15440. Set slide mode.
  15441. Available values for slide is:
  15442. @table @samp
  15443. @item frame
  15444. Draw new frame when right border is reached.
  15445. @item replace
  15446. Replace old columns with new ones.
  15447. @item scroll
  15448. Scroll from right to left.
  15449. @item rscroll
  15450. Scroll from left to right.
  15451. @item picture
  15452. Draw single picture.
  15453. @end table
  15454. Default is @code{frame}.
  15455. @item size
  15456. Set size of graph video. For the syntax of this option, check the
  15457. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15458. The default value is @code{900x256}.
  15459. The foreground color expressions can use the following variables:
  15460. @table @option
  15461. @item MIN
  15462. Minimal value of metadata value.
  15463. @item MAX
  15464. Maximal value of metadata value.
  15465. @item VAL
  15466. Current metadata key value.
  15467. @end table
  15468. The color is defined as 0xAABBGGRR.
  15469. @end table
  15470. Example using metadata from @ref{signalstats} filter:
  15471. @example
  15472. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  15473. @end example
  15474. Example using metadata from @ref{ebur128} filter:
  15475. @example
  15476. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  15477. @end example
  15478. @anchor{ebur128}
  15479. @section ebur128
  15480. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  15481. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  15482. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  15483. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  15484. The filter also has a video output (see the @var{video} option) with a real
  15485. time graph to observe the loudness evolution. The graphic contains the logged
  15486. message mentioned above, so it is not printed anymore when this option is set,
  15487. unless the verbose logging is set. The main graphing area contains the
  15488. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  15489. the momentary loudness (400 milliseconds), but can optionally be configured
  15490. to instead display short-term loudness (see @var{gauge}).
  15491. The green area marks a +/- 1LU target range around the target loudness
  15492. (-23LUFS by default, unless modified through @var{target}).
  15493. More information about the Loudness Recommendation EBU R128 on
  15494. @url{http://tech.ebu.ch/loudness}.
  15495. The filter accepts the following options:
  15496. @table @option
  15497. @item video
  15498. Activate the video output. The audio stream is passed unchanged whether this
  15499. option is set or no. The video stream will be the first output stream if
  15500. activated. Default is @code{0}.
  15501. @item size
  15502. Set the video size. This option is for video only. For the syntax of this
  15503. option, check the
  15504. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15505. Default and minimum resolution is @code{640x480}.
  15506. @item meter
  15507. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  15508. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  15509. other integer value between this range is allowed.
  15510. @item metadata
  15511. Set metadata injection. If set to @code{1}, the audio input will be segmented
  15512. into 100ms output frames, each of them containing various loudness information
  15513. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  15514. Default is @code{0}.
  15515. @item framelog
  15516. Force the frame logging level.
  15517. Available values are:
  15518. @table @samp
  15519. @item info
  15520. information logging level
  15521. @item verbose
  15522. verbose logging level
  15523. @end table
  15524. By default, the logging level is set to @var{info}. If the @option{video} or
  15525. the @option{metadata} options are set, it switches to @var{verbose}.
  15526. @item peak
  15527. Set peak mode(s).
  15528. Available modes can be cumulated (the option is a @code{flag} type). Possible
  15529. values are:
  15530. @table @samp
  15531. @item none
  15532. Disable any peak mode (default).
  15533. @item sample
  15534. Enable sample-peak mode.
  15535. Simple peak mode looking for the higher sample value. It logs a message
  15536. for sample-peak (identified by @code{SPK}).
  15537. @item true
  15538. Enable true-peak mode.
  15539. If enabled, the peak lookup is done on an over-sampled version of the input
  15540. stream for better peak accuracy. It logs a message for true-peak.
  15541. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  15542. This mode requires a build with @code{libswresample}.
  15543. @end table
  15544. @item dualmono
  15545. Treat mono input files as "dual mono". If a mono file is intended for playback
  15546. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  15547. If set to @code{true}, this option will compensate for this effect.
  15548. Multi-channel input files are not affected by this option.
  15549. @item panlaw
  15550. Set a specific pan law to be used for the measurement of dual mono files.
  15551. This parameter is optional, and has a default value of -3.01dB.
  15552. @item target
  15553. Set a specific target level (in LUFS) used as relative zero in the visualization.
  15554. This parameter is optional and has a default value of -23LUFS as specified
  15555. by EBU R128. However, material published online may prefer a level of -16LUFS
  15556. (e.g. for use with podcasts or video platforms).
  15557. @item gauge
  15558. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  15559. @code{shortterm}. By default the momentary value will be used, but in certain
  15560. scenarios it may be more useful to observe the short term value instead (e.g.
  15561. live mixing).
  15562. @item scale
  15563. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  15564. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  15565. video output, not the summary or continuous log output.
  15566. @end table
  15567. @subsection Examples
  15568. @itemize
  15569. @item
  15570. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  15571. @example
  15572. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  15573. @end example
  15574. @item
  15575. Run an analysis with @command{ffmpeg}:
  15576. @example
  15577. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  15578. @end example
  15579. @end itemize
  15580. @section interleave, ainterleave
  15581. Temporally interleave frames from several inputs.
  15582. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  15583. These filters read frames from several inputs and send the oldest
  15584. queued frame to the output.
  15585. Input streams must have well defined, monotonically increasing frame
  15586. timestamp values.
  15587. In order to submit one frame to output, these filters need to enqueue
  15588. at least one frame for each input, so they cannot work in case one
  15589. input is not yet terminated and will not receive incoming frames.
  15590. For example consider the case when one input is a @code{select} filter
  15591. which always drops input frames. The @code{interleave} filter will keep
  15592. reading from that input, but it will never be able to send new frames
  15593. to output until the input sends an end-of-stream signal.
  15594. Also, depending on inputs synchronization, the filters will drop
  15595. frames in case one input receives more frames than the other ones, and
  15596. the queue is already filled.
  15597. These filters accept the following options:
  15598. @table @option
  15599. @item nb_inputs, n
  15600. Set the number of different inputs, it is 2 by default.
  15601. @end table
  15602. @subsection Examples
  15603. @itemize
  15604. @item
  15605. Interleave frames belonging to different streams using @command{ffmpeg}:
  15606. @example
  15607. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  15608. @end example
  15609. @item
  15610. Add flickering blur effect:
  15611. @example
  15612. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  15613. @end example
  15614. @end itemize
  15615. @section metadata, ametadata
  15616. Manipulate frame metadata.
  15617. This filter accepts the following options:
  15618. @table @option
  15619. @item mode
  15620. Set mode of operation of the filter.
  15621. Can be one of the following:
  15622. @table @samp
  15623. @item select
  15624. If both @code{value} and @code{key} is set, select frames
  15625. which have such metadata. If only @code{key} is set, select
  15626. every frame that has such key in metadata.
  15627. @item add
  15628. Add new metadata @code{key} and @code{value}. If key is already available
  15629. do nothing.
  15630. @item modify
  15631. Modify value of already present key.
  15632. @item delete
  15633. If @code{value} is set, delete only keys that have such value.
  15634. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  15635. the frame.
  15636. @item print
  15637. Print key and its value if metadata was found. If @code{key} is not set print all
  15638. metadata values available in frame.
  15639. @end table
  15640. @item key
  15641. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  15642. @item value
  15643. Set metadata value which will be used. This option is mandatory for
  15644. @code{modify} and @code{add} mode.
  15645. @item function
  15646. Which function to use when comparing metadata value and @code{value}.
  15647. Can be one of following:
  15648. @table @samp
  15649. @item same_str
  15650. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  15651. @item starts_with
  15652. Values are interpreted as strings, returns true if metadata value starts with
  15653. the @code{value} option string.
  15654. @item less
  15655. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  15656. @item equal
  15657. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  15658. @item greater
  15659. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  15660. @item expr
  15661. Values are interpreted as floats, returns true if expression from option @code{expr}
  15662. evaluates to true.
  15663. @end table
  15664. @item expr
  15665. Set expression which is used when @code{function} is set to @code{expr}.
  15666. The expression is evaluated through the eval API and can contain the following
  15667. constants:
  15668. @table @option
  15669. @item VALUE1
  15670. Float representation of @code{value} from metadata key.
  15671. @item VALUE2
  15672. Float representation of @code{value} as supplied by user in @code{value} option.
  15673. @end table
  15674. @item file
  15675. If specified in @code{print} mode, output is written to the named file. Instead of
  15676. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  15677. for standard output. If @code{file} option is not set, output is written to the log
  15678. with AV_LOG_INFO loglevel.
  15679. @end table
  15680. @subsection Examples
  15681. @itemize
  15682. @item
  15683. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  15684. between 0 and 1.
  15685. @example
  15686. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  15687. @end example
  15688. @item
  15689. Print silencedetect output to file @file{metadata.txt}.
  15690. @example
  15691. silencedetect,ametadata=mode=print:file=metadata.txt
  15692. @end example
  15693. @item
  15694. Direct all metadata to a pipe with file descriptor 4.
  15695. @example
  15696. metadata=mode=print:file='pipe\:4'
  15697. @end example
  15698. @end itemize
  15699. @section perms, aperms
  15700. Set read/write permissions for the output frames.
  15701. These filters are mainly aimed at developers to test direct path in the
  15702. following filter in the filtergraph.
  15703. The filters accept the following options:
  15704. @table @option
  15705. @item mode
  15706. Select the permissions mode.
  15707. It accepts the following values:
  15708. @table @samp
  15709. @item none
  15710. Do nothing. This is the default.
  15711. @item ro
  15712. Set all the output frames read-only.
  15713. @item rw
  15714. Set all the output frames directly writable.
  15715. @item toggle
  15716. Make the frame read-only if writable, and writable if read-only.
  15717. @item random
  15718. Set each output frame read-only or writable randomly.
  15719. @end table
  15720. @item seed
  15721. Set the seed for the @var{random} mode, must be an integer included between
  15722. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  15723. @code{-1}, the filter will try to use a good random seed on a best effort
  15724. basis.
  15725. @end table
  15726. Note: in case of auto-inserted filter between the permission filter and the
  15727. following one, the permission might not be received as expected in that
  15728. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  15729. perms/aperms filter can avoid this problem.
  15730. @section realtime, arealtime
  15731. Slow down filtering to match real time approximately.
  15732. These filters will pause the filtering for a variable amount of time to
  15733. match the output rate with the input timestamps.
  15734. They are similar to the @option{re} option to @code{ffmpeg}.
  15735. They accept the following options:
  15736. @table @option
  15737. @item limit
  15738. Time limit for the pauses. Any pause longer than that will be considered
  15739. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  15740. @end table
  15741. @anchor{select}
  15742. @section select, aselect
  15743. Select frames to pass in output.
  15744. This filter accepts the following options:
  15745. @table @option
  15746. @item expr, e
  15747. Set expression, which is evaluated for each input frame.
  15748. If the expression is evaluated to zero, the frame is discarded.
  15749. If the evaluation result is negative or NaN, the frame is sent to the
  15750. first output; otherwise it is sent to the output with index
  15751. @code{ceil(val)-1}, assuming that the input index starts from 0.
  15752. For example a value of @code{1.2} corresponds to the output with index
  15753. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  15754. @item outputs, n
  15755. Set the number of outputs. The output to which to send the selected
  15756. frame is based on the result of the evaluation. Default value is 1.
  15757. @end table
  15758. The expression can contain the following constants:
  15759. @table @option
  15760. @item n
  15761. The (sequential) number of the filtered frame, starting from 0.
  15762. @item selected_n
  15763. The (sequential) number of the selected frame, starting from 0.
  15764. @item prev_selected_n
  15765. The sequential number of the last selected frame. It's NAN if undefined.
  15766. @item TB
  15767. The timebase of the input timestamps.
  15768. @item pts
  15769. The PTS (Presentation TimeStamp) of the filtered video frame,
  15770. expressed in @var{TB} units. It's NAN if undefined.
  15771. @item t
  15772. The PTS of the filtered video frame,
  15773. expressed in seconds. It's NAN if undefined.
  15774. @item prev_pts
  15775. The PTS of the previously filtered video frame. It's NAN if undefined.
  15776. @item prev_selected_pts
  15777. The PTS of the last previously filtered video frame. It's NAN if undefined.
  15778. @item prev_selected_t
  15779. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  15780. @item start_pts
  15781. The PTS of the first video frame in the video. It's NAN if undefined.
  15782. @item start_t
  15783. The time of the first video frame in the video. It's NAN if undefined.
  15784. @item pict_type @emph{(video only)}
  15785. The type of the filtered frame. It can assume one of the following
  15786. values:
  15787. @table @option
  15788. @item I
  15789. @item P
  15790. @item B
  15791. @item S
  15792. @item SI
  15793. @item SP
  15794. @item BI
  15795. @end table
  15796. @item interlace_type @emph{(video only)}
  15797. The frame interlace type. It can assume one of the following values:
  15798. @table @option
  15799. @item PROGRESSIVE
  15800. The frame is progressive (not interlaced).
  15801. @item TOPFIRST
  15802. The frame is top-field-first.
  15803. @item BOTTOMFIRST
  15804. The frame is bottom-field-first.
  15805. @end table
  15806. @item consumed_sample_n @emph{(audio only)}
  15807. the number of selected samples before the current frame
  15808. @item samples_n @emph{(audio only)}
  15809. the number of samples in the current frame
  15810. @item sample_rate @emph{(audio only)}
  15811. the input sample rate
  15812. @item key
  15813. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  15814. @item pos
  15815. the position in the file of the filtered frame, -1 if the information
  15816. is not available (e.g. for synthetic video)
  15817. @item scene @emph{(video only)}
  15818. value between 0 and 1 to indicate a new scene; a low value reflects a low
  15819. probability for the current frame to introduce a new scene, while a higher
  15820. value means the current frame is more likely to be one (see the example below)
  15821. @item concatdec_select
  15822. The concat demuxer can select only part of a concat input file by setting an
  15823. inpoint and an outpoint, but the output packets may not be entirely contained
  15824. in the selected interval. By using this variable, it is possible to skip frames
  15825. generated by the concat demuxer which are not exactly contained in the selected
  15826. interval.
  15827. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  15828. and the @var{lavf.concat.duration} packet metadata values which are also
  15829. present in the decoded frames.
  15830. The @var{concatdec_select} variable is -1 if the frame pts is at least
  15831. start_time and either the duration metadata is missing or the frame pts is less
  15832. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  15833. missing.
  15834. That basically means that an input frame is selected if its pts is within the
  15835. interval set by the concat demuxer.
  15836. @end table
  15837. The default value of the select expression is "1".
  15838. @subsection Examples
  15839. @itemize
  15840. @item
  15841. Select all frames in input:
  15842. @example
  15843. select
  15844. @end example
  15845. The example above is the same as:
  15846. @example
  15847. select=1
  15848. @end example
  15849. @item
  15850. Skip all frames:
  15851. @example
  15852. select=0
  15853. @end example
  15854. @item
  15855. Select only I-frames:
  15856. @example
  15857. select='eq(pict_type\,I)'
  15858. @end example
  15859. @item
  15860. Select one frame every 100:
  15861. @example
  15862. select='not(mod(n\,100))'
  15863. @end example
  15864. @item
  15865. Select only frames contained in the 10-20 time interval:
  15866. @example
  15867. select=between(t\,10\,20)
  15868. @end example
  15869. @item
  15870. Select only I-frames contained in the 10-20 time interval:
  15871. @example
  15872. select=between(t\,10\,20)*eq(pict_type\,I)
  15873. @end example
  15874. @item
  15875. Select frames with a minimum distance of 10 seconds:
  15876. @example
  15877. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  15878. @end example
  15879. @item
  15880. Use aselect to select only audio frames with samples number > 100:
  15881. @example
  15882. aselect='gt(samples_n\,100)'
  15883. @end example
  15884. @item
  15885. Create a mosaic of the first scenes:
  15886. @example
  15887. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  15888. @end example
  15889. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  15890. choice.
  15891. @item
  15892. Send even and odd frames to separate outputs, and compose them:
  15893. @example
  15894. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  15895. @end example
  15896. @item
  15897. Select useful frames from an ffconcat file which is using inpoints and
  15898. outpoints but where the source files are not intra frame only.
  15899. @example
  15900. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  15901. @end example
  15902. @end itemize
  15903. @section sendcmd, asendcmd
  15904. Send commands to filters in the filtergraph.
  15905. These filters read commands to be sent to other filters in the
  15906. filtergraph.
  15907. @code{sendcmd} must be inserted between two video filters,
  15908. @code{asendcmd} must be inserted between two audio filters, but apart
  15909. from that they act the same way.
  15910. The specification of commands can be provided in the filter arguments
  15911. with the @var{commands} option, or in a file specified by the
  15912. @var{filename} option.
  15913. These filters accept the following options:
  15914. @table @option
  15915. @item commands, c
  15916. Set the commands to be read and sent to the other filters.
  15917. @item filename, f
  15918. Set the filename of the commands to be read and sent to the other
  15919. filters.
  15920. @end table
  15921. @subsection Commands syntax
  15922. A commands description consists of a sequence of interval
  15923. specifications, comprising a list of commands to be executed when a
  15924. particular event related to that interval occurs. The occurring event
  15925. is typically the current frame time entering or leaving a given time
  15926. interval.
  15927. An interval is specified by the following syntax:
  15928. @example
  15929. @var{START}[-@var{END}] @var{COMMANDS};
  15930. @end example
  15931. The time interval is specified by the @var{START} and @var{END} times.
  15932. @var{END} is optional and defaults to the maximum time.
  15933. The current frame time is considered within the specified interval if
  15934. it is included in the interval [@var{START}, @var{END}), that is when
  15935. the time is greater or equal to @var{START} and is lesser than
  15936. @var{END}.
  15937. @var{COMMANDS} consists of a sequence of one or more command
  15938. specifications, separated by ",", relating to that interval. The
  15939. syntax of a command specification is given by:
  15940. @example
  15941. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  15942. @end example
  15943. @var{FLAGS} is optional and specifies the type of events relating to
  15944. the time interval which enable sending the specified command, and must
  15945. be a non-null sequence of identifier flags separated by "+" or "|" and
  15946. enclosed between "[" and "]".
  15947. The following flags are recognized:
  15948. @table @option
  15949. @item enter
  15950. The command is sent when the current frame timestamp enters the
  15951. specified interval. In other words, the command is sent when the
  15952. previous frame timestamp was not in the given interval, and the
  15953. current is.
  15954. @item leave
  15955. The command is sent when the current frame timestamp leaves the
  15956. specified interval. In other words, the command is sent when the
  15957. previous frame timestamp was in the given interval, and the
  15958. current is not.
  15959. @end table
  15960. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  15961. assumed.
  15962. @var{TARGET} specifies the target of the command, usually the name of
  15963. the filter class or a specific filter instance name.
  15964. @var{COMMAND} specifies the name of the command for the target filter.
  15965. @var{ARG} is optional and specifies the optional list of argument for
  15966. the given @var{COMMAND}.
  15967. Between one interval specification and another, whitespaces, or
  15968. sequences of characters starting with @code{#} until the end of line,
  15969. are ignored and can be used to annotate comments.
  15970. A simplified BNF description of the commands specification syntax
  15971. follows:
  15972. @example
  15973. @var{COMMAND_FLAG} ::= "enter" | "leave"
  15974. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  15975. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  15976. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  15977. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  15978. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  15979. @end example
  15980. @subsection Examples
  15981. @itemize
  15982. @item
  15983. Specify audio tempo change at second 4:
  15984. @example
  15985. asendcmd=c='4.0 atempo tempo 1.5',atempo
  15986. @end example
  15987. @item
  15988. Target a specific filter instance:
  15989. @example
  15990. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  15991. @end example
  15992. @item
  15993. Specify a list of drawtext and hue commands in a file.
  15994. @example
  15995. # show text in the interval 5-10
  15996. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  15997. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  15998. # desaturate the image in the interval 15-20
  15999. 15.0-20.0 [enter] hue s 0,
  16000. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16001. [leave] hue s 1,
  16002. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16003. # apply an exponential saturation fade-out effect, starting from time 25
  16004. 25 [enter] hue s exp(25-t)
  16005. @end example
  16006. A filtergraph allowing to read and process the above command list
  16007. stored in a file @file{test.cmd}, can be specified with:
  16008. @example
  16009. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16010. @end example
  16011. @end itemize
  16012. @anchor{setpts}
  16013. @section setpts, asetpts
  16014. Change the PTS (presentation timestamp) of the input frames.
  16015. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16016. This filter accepts the following options:
  16017. @table @option
  16018. @item expr
  16019. The expression which is evaluated for each frame to construct its timestamp.
  16020. @end table
  16021. The expression is evaluated through the eval API and can contain the following
  16022. constants:
  16023. @table @option
  16024. @item FRAME_RATE, FR
  16025. frame rate, only defined for constant frame-rate video
  16026. @item PTS
  16027. The presentation timestamp in input
  16028. @item N
  16029. The count of the input frame for video or the number of consumed samples,
  16030. not including the current frame for audio, starting from 0.
  16031. @item NB_CONSUMED_SAMPLES
  16032. The number of consumed samples, not including the current frame (only
  16033. audio)
  16034. @item NB_SAMPLES, S
  16035. The number of samples in the current frame (only audio)
  16036. @item SAMPLE_RATE, SR
  16037. The audio sample rate.
  16038. @item STARTPTS
  16039. The PTS of the first frame.
  16040. @item STARTT
  16041. the time in seconds of the first frame
  16042. @item INTERLACED
  16043. State whether the current frame is interlaced.
  16044. @item T
  16045. the time in seconds of the current frame
  16046. @item POS
  16047. original position in the file of the frame, or undefined if undefined
  16048. for the current frame
  16049. @item PREV_INPTS
  16050. The previous input PTS.
  16051. @item PREV_INT
  16052. previous input time in seconds
  16053. @item PREV_OUTPTS
  16054. The previous output PTS.
  16055. @item PREV_OUTT
  16056. previous output time in seconds
  16057. @item RTCTIME
  16058. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16059. instead.
  16060. @item RTCSTART
  16061. The wallclock (RTC) time at the start of the movie in microseconds.
  16062. @item TB
  16063. The timebase of the input timestamps.
  16064. @end table
  16065. @subsection Examples
  16066. @itemize
  16067. @item
  16068. Start counting PTS from zero
  16069. @example
  16070. setpts=PTS-STARTPTS
  16071. @end example
  16072. @item
  16073. Apply fast motion effect:
  16074. @example
  16075. setpts=0.5*PTS
  16076. @end example
  16077. @item
  16078. Apply slow motion effect:
  16079. @example
  16080. setpts=2.0*PTS
  16081. @end example
  16082. @item
  16083. Set fixed rate of 25 frames per second:
  16084. @example
  16085. setpts=N/(25*TB)
  16086. @end example
  16087. @item
  16088. Set fixed rate 25 fps with some jitter:
  16089. @example
  16090. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16091. @end example
  16092. @item
  16093. Apply an offset of 10 seconds to the input PTS:
  16094. @example
  16095. setpts=PTS+10/TB
  16096. @end example
  16097. @item
  16098. Generate timestamps from a "live source" and rebase onto the current timebase:
  16099. @example
  16100. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16101. @end example
  16102. @item
  16103. Generate timestamps by counting samples:
  16104. @example
  16105. asetpts=N/SR/TB
  16106. @end example
  16107. @end itemize
  16108. @section setrange
  16109. Force color range for the output video frame.
  16110. The @code{setrange} filter marks the color range property for the
  16111. output frames. It does not change the input frame, but only sets the
  16112. corresponding property, which affects how the frame is treated by
  16113. following filters.
  16114. The filter accepts the following options:
  16115. @table @option
  16116. @item range
  16117. Available values are:
  16118. @table @samp
  16119. @item auto
  16120. Keep the same color range property.
  16121. @item unspecified, unknown
  16122. Set the color range as unspecified.
  16123. @item limited, tv, mpeg
  16124. Set the color range as limited.
  16125. @item full, pc, jpeg
  16126. Set the color range as full.
  16127. @end table
  16128. @end table
  16129. @section settb, asettb
  16130. Set the timebase to use for the output frames timestamps.
  16131. It is mainly useful for testing timebase configuration.
  16132. It accepts the following parameters:
  16133. @table @option
  16134. @item expr, tb
  16135. The expression which is evaluated into the output timebase.
  16136. @end table
  16137. The value for @option{tb} is an arithmetic expression representing a
  16138. rational. The expression can contain the constants "AVTB" (the default
  16139. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16140. audio only). Default value is "intb".
  16141. @subsection Examples
  16142. @itemize
  16143. @item
  16144. Set the timebase to 1/25:
  16145. @example
  16146. settb=expr=1/25
  16147. @end example
  16148. @item
  16149. Set the timebase to 1/10:
  16150. @example
  16151. settb=expr=0.1
  16152. @end example
  16153. @item
  16154. Set the timebase to 1001/1000:
  16155. @example
  16156. settb=1+0.001
  16157. @end example
  16158. @item
  16159. Set the timebase to 2*intb:
  16160. @example
  16161. settb=2*intb
  16162. @end example
  16163. @item
  16164. Set the default timebase value:
  16165. @example
  16166. settb=AVTB
  16167. @end example
  16168. @end itemize
  16169. @section showcqt
  16170. Convert input audio to a video output representing frequency spectrum
  16171. logarithmically using Brown-Puckette constant Q transform algorithm with
  16172. direct frequency domain coefficient calculation (but the transform itself
  16173. is not really constant Q, instead the Q factor is actually variable/clamped),
  16174. with musical tone scale, from E0 to D#10.
  16175. The filter accepts the following options:
  16176. @table @option
  16177. @item size, s
  16178. Specify the video size for the output. It must be even. For the syntax of this option,
  16179. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16180. Default value is @code{1920x1080}.
  16181. @item fps, rate, r
  16182. Set the output frame rate. Default value is @code{25}.
  16183. @item bar_h
  16184. Set the bargraph height. It must be even. Default value is @code{-1} which
  16185. computes the bargraph height automatically.
  16186. @item axis_h
  16187. Set the axis height. It must be even. Default value is @code{-1} which computes
  16188. the axis height automatically.
  16189. @item sono_h
  16190. Set the sonogram height. It must be even. Default value is @code{-1} which
  16191. computes the sonogram height automatically.
  16192. @item fullhd
  16193. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  16194. instead. Default value is @code{1}.
  16195. @item sono_v, volume
  16196. Specify the sonogram volume expression. It can contain variables:
  16197. @table @option
  16198. @item bar_v
  16199. the @var{bar_v} evaluated expression
  16200. @item frequency, freq, f
  16201. the frequency where it is evaluated
  16202. @item timeclamp, tc
  16203. the value of @var{timeclamp} option
  16204. @end table
  16205. and functions:
  16206. @table @option
  16207. @item a_weighting(f)
  16208. A-weighting of equal loudness
  16209. @item b_weighting(f)
  16210. B-weighting of equal loudness
  16211. @item c_weighting(f)
  16212. C-weighting of equal loudness.
  16213. @end table
  16214. Default value is @code{16}.
  16215. @item bar_v, volume2
  16216. Specify the bargraph volume expression. It can contain variables:
  16217. @table @option
  16218. @item sono_v
  16219. the @var{sono_v} evaluated expression
  16220. @item frequency, freq, f
  16221. the frequency where it is evaluated
  16222. @item timeclamp, tc
  16223. the value of @var{timeclamp} option
  16224. @end table
  16225. and functions:
  16226. @table @option
  16227. @item a_weighting(f)
  16228. A-weighting of equal loudness
  16229. @item b_weighting(f)
  16230. B-weighting of equal loudness
  16231. @item c_weighting(f)
  16232. C-weighting of equal loudness.
  16233. @end table
  16234. Default value is @code{sono_v}.
  16235. @item sono_g, gamma
  16236. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  16237. higher gamma makes the spectrum having more range. Default value is @code{3}.
  16238. Acceptable range is @code{[1, 7]}.
  16239. @item bar_g, gamma2
  16240. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  16241. @code{[1, 7]}.
  16242. @item bar_t
  16243. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  16244. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  16245. @item timeclamp, tc
  16246. Specify the transform timeclamp. At low frequency, there is trade-off between
  16247. accuracy in time domain and frequency domain. If timeclamp is lower,
  16248. event in time domain is represented more accurately (such as fast bass drum),
  16249. otherwise event in frequency domain is represented more accurately
  16250. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  16251. @item attack
  16252. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  16253. limits future samples by applying asymmetric windowing in time domain, useful
  16254. when low latency is required. Accepted range is @code{[0, 1]}.
  16255. @item basefreq
  16256. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  16257. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  16258. @item endfreq
  16259. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  16260. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  16261. @item coeffclamp
  16262. This option is deprecated and ignored.
  16263. @item tlength
  16264. Specify the transform length in time domain. Use this option to control accuracy
  16265. trade-off between time domain and frequency domain at every frequency sample.
  16266. It can contain variables:
  16267. @table @option
  16268. @item frequency, freq, f
  16269. the frequency where it is evaluated
  16270. @item timeclamp, tc
  16271. the value of @var{timeclamp} option.
  16272. @end table
  16273. Default value is @code{384*tc/(384+tc*f)}.
  16274. @item count
  16275. Specify the transform count for every video frame. Default value is @code{6}.
  16276. Acceptable range is @code{[1, 30]}.
  16277. @item fcount
  16278. Specify the transform count for every single pixel. Default value is @code{0},
  16279. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  16280. @item fontfile
  16281. Specify font file for use with freetype to draw the axis. If not specified,
  16282. use embedded font. Note that drawing with font file or embedded font is not
  16283. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  16284. option instead.
  16285. @item font
  16286. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  16287. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  16288. @item fontcolor
  16289. Specify font color expression. This is arithmetic expression that should return
  16290. integer value 0xRRGGBB. It can contain variables:
  16291. @table @option
  16292. @item frequency, freq, f
  16293. the frequency where it is evaluated
  16294. @item timeclamp, tc
  16295. the value of @var{timeclamp} option
  16296. @end table
  16297. and functions:
  16298. @table @option
  16299. @item midi(f)
  16300. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  16301. @item r(x), g(x), b(x)
  16302. red, green, and blue value of intensity x.
  16303. @end table
  16304. Default value is @code{st(0, (midi(f)-59.5)/12);
  16305. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  16306. r(1-ld(1)) + b(ld(1))}.
  16307. @item axisfile
  16308. Specify image file to draw the axis. This option override @var{fontfile} and
  16309. @var{fontcolor} option.
  16310. @item axis, text
  16311. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  16312. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  16313. Default value is @code{1}.
  16314. @item csp
  16315. Set colorspace. The accepted values are:
  16316. @table @samp
  16317. @item unspecified
  16318. Unspecified (default)
  16319. @item bt709
  16320. BT.709
  16321. @item fcc
  16322. FCC
  16323. @item bt470bg
  16324. BT.470BG or BT.601-6 625
  16325. @item smpte170m
  16326. SMPTE-170M or BT.601-6 525
  16327. @item smpte240m
  16328. SMPTE-240M
  16329. @item bt2020ncl
  16330. BT.2020 with non-constant luminance
  16331. @end table
  16332. @item cscheme
  16333. Set spectrogram color scheme. This is list of floating point values with format
  16334. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  16335. The default is @code{1|0.5|0|0|0.5|1}.
  16336. @end table
  16337. @subsection Examples
  16338. @itemize
  16339. @item
  16340. Playing audio while showing the spectrum:
  16341. @example
  16342. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  16343. @end example
  16344. @item
  16345. Same as above, but with frame rate 30 fps:
  16346. @example
  16347. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  16348. @end example
  16349. @item
  16350. Playing at 1280x720:
  16351. @example
  16352. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  16353. @end example
  16354. @item
  16355. Disable sonogram display:
  16356. @example
  16357. sono_h=0
  16358. @end example
  16359. @item
  16360. A1 and its harmonics: A1, A2, (near)E3, A3:
  16361. @example
  16362. 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),
  16363. asplit[a][out1]; [a] showcqt [out0]'
  16364. @end example
  16365. @item
  16366. Same as above, but with more accuracy in frequency domain:
  16367. @example
  16368. 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),
  16369. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  16370. @end example
  16371. @item
  16372. Custom volume:
  16373. @example
  16374. bar_v=10:sono_v=bar_v*a_weighting(f)
  16375. @end example
  16376. @item
  16377. Custom gamma, now spectrum is linear to the amplitude.
  16378. @example
  16379. bar_g=2:sono_g=2
  16380. @end example
  16381. @item
  16382. Custom tlength equation:
  16383. @example
  16384. 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)))'
  16385. @end example
  16386. @item
  16387. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  16388. @example
  16389. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  16390. @end example
  16391. @item
  16392. Custom font using fontconfig:
  16393. @example
  16394. font='Courier New,Monospace,mono|bold'
  16395. @end example
  16396. @item
  16397. Custom frequency range with custom axis using image file:
  16398. @example
  16399. axisfile=myaxis.png:basefreq=40:endfreq=10000
  16400. @end example
  16401. @end itemize
  16402. @section showfreqs
  16403. Convert input audio to video output representing the audio power spectrum.
  16404. Audio amplitude is on Y-axis while frequency is on X-axis.
  16405. The filter accepts the following options:
  16406. @table @option
  16407. @item size, s
  16408. Specify size of video. For the syntax of this option, check the
  16409. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16410. Default is @code{1024x512}.
  16411. @item mode
  16412. Set display mode.
  16413. This set how each frequency bin will be represented.
  16414. It accepts the following values:
  16415. @table @samp
  16416. @item line
  16417. @item bar
  16418. @item dot
  16419. @end table
  16420. Default is @code{bar}.
  16421. @item ascale
  16422. Set amplitude scale.
  16423. It accepts the following values:
  16424. @table @samp
  16425. @item lin
  16426. Linear scale.
  16427. @item sqrt
  16428. Square root scale.
  16429. @item cbrt
  16430. Cubic root scale.
  16431. @item log
  16432. Logarithmic scale.
  16433. @end table
  16434. Default is @code{log}.
  16435. @item fscale
  16436. Set frequency scale.
  16437. It accepts the following values:
  16438. @table @samp
  16439. @item lin
  16440. Linear scale.
  16441. @item log
  16442. Logarithmic scale.
  16443. @item rlog
  16444. Reverse logarithmic scale.
  16445. @end table
  16446. Default is @code{lin}.
  16447. @item win_size
  16448. Set window size.
  16449. It accepts the following values:
  16450. @table @samp
  16451. @item w16
  16452. @item w32
  16453. @item w64
  16454. @item w128
  16455. @item w256
  16456. @item w512
  16457. @item w1024
  16458. @item w2048
  16459. @item w4096
  16460. @item w8192
  16461. @item w16384
  16462. @item w32768
  16463. @item w65536
  16464. @end table
  16465. Default is @code{w2048}
  16466. @item win_func
  16467. Set windowing function.
  16468. It accepts the following values:
  16469. @table @samp
  16470. @item rect
  16471. @item bartlett
  16472. @item hanning
  16473. @item hamming
  16474. @item blackman
  16475. @item welch
  16476. @item flattop
  16477. @item bharris
  16478. @item bnuttall
  16479. @item bhann
  16480. @item sine
  16481. @item nuttall
  16482. @item lanczos
  16483. @item gauss
  16484. @item tukey
  16485. @item dolph
  16486. @item cauchy
  16487. @item parzen
  16488. @item poisson
  16489. @item bohman
  16490. @end table
  16491. Default is @code{hanning}.
  16492. @item overlap
  16493. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16494. which means optimal overlap for selected window function will be picked.
  16495. @item averaging
  16496. Set time averaging. Setting this to 0 will display current maximal peaks.
  16497. Default is @code{1}, which means time averaging is disabled.
  16498. @item colors
  16499. Specify list of colors separated by space or by '|' which will be used to
  16500. draw channel frequencies. Unrecognized or missing colors will be replaced
  16501. by white color.
  16502. @item cmode
  16503. Set channel display mode.
  16504. It accepts the following values:
  16505. @table @samp
  16506. @item combined
  16507. @item separate
  16508. @end table
  16509. Default is @code{combined}.
  16510. @item minamp
  16511. Set minimum amplitude used in @code{log} amplitude scaler.
  16512. @end table
  16513. @anchor{showspectrum}
  16514. @section showspectrum
  16515. Convert input audio to a video output, representing the audio frequency
  16516. spectrum.
  16517. The filter accepts the following options:
  16518. @table @option
  16519. @item size, s
  16520. Specify the video size for the output. For the syntax of this option, check the
  16521. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16522. Default value is @code{640x512}.
  16523. @item slide
  16524. Specify how the spectrum should slide along the window.
  16525. It accepts the following values:
  16526. @table @samp
  16527. @item replace
  16528. the samples start again on the left when they reach the right
  16529. @item scroll
  16530. the samples scroll from right to left
  16531. @item fullframe
  16532. frames are only produced when the samples reach the right
  16533. @item rscroll
  16534. the samples scroll from left to right
  16535. @end table
  16536. Default value is @code{replace}.
  16537. @item mode
  16538. Specify display mode.
  16539. It accepts the following values:
  16540. @table @samp
  16541. @item combined
  16542. all channels are displayed in the same row
  16543. @item separate
  16544. all channels are displayed in separate rows
  16545. @end table
  16546. Default value is @samp{combined}.
  16547. @item color
  16548. Specify display color mode.
  16549. It accepts the following values:
  16550. @table @samp
  16551. @item channel
  16552. each channel is displayed in a separate color
  16553. @item intensity
  16554. each channel is displayed using the same color scheme
  16555. @item rainbow
  16556. each channel is displayed using the rainbow color scheme
  16557. @item moreland
  16558. each channel is displayed using the moreland color scheme
  16559. @item nebulae
  16560. each channel is displayed using the nebulae color scheme
  16561. @item fire
  16562. each channel is displayed using the fire color scheme
  16563. @item fiery
  16564. each channel is displayed using the fiery color scheme
  16565. @item fruit
  16566. each channel is displayed using the fruit color scheme
  16567. @item cool
  16568. each channel is displayed using the cool color scheme
  16569. @item magma
  16570. each channel is displayed using the magma color scheme
  16571. @item green
  16572. each channel is displayed using the green color scheme
  16573. @item viridis
  16574. each channel is displayed using the viridis color scheme
  16575. @item plasma
  16576. each channel is displayed using the plasma color scheme
  16577. @item cividis
  16578. each channel is displayed using the cividis color scheme
  16579. @item terrain
  16580. each channel is displayed using the terrain color scheme
  16581. @end table
  16582. Default value is @samp{channel}.
  16583. @item scale
  16584. Specify scale used for calculating intensity color values.
  16585. It accepts the following values:
  16586. @table @samp
  16587. @item lin
  16588. linear
  16589. @item sqrt
  16590. square root, default
  16591. @item cbrt
  16592. cubic root
  16593. @item log
  16594. logarithmic
  16595. @item 4thrt
  16596. 4th root
  16597. @item 5thrt
  16598. 5th root
  16599. @end table
  16600. Default value is @samp{sqrt}.
  16601. @item saturation
  16602. Set saturation modifier for displayed colors. Negative values provide
  16603. alternative color scheme. @code{0} is no saturation at all.
  16604. Saturation must be in [-10.0, 10.0] range.
  16605. Default value is @code{1}.
  16606. @item win_func
  16607. Set window function.
  16608. It accepts the following values:
  16609. @table @samp
  16610. @item rect
  16611. @item bartlett
  16612. @item hann
  16613. @item hanning
  16614. @item hamming
  16615. @item blackman
  16616. @item welch
  16617. @item flattop
  16618. @item bharris
  16619. @item bnuttall
  16620. @item bhann
  16621. @item sine
  16622. @item nuttall
  16623. @item lanczos
  16624. @item gauss
  16625. @item tukey
  16626. @item dolph
  16627. @item cauchy
  16628. @item parzen
  16629. @item poisson
  16630. @item bohman
  16631. @end table
  16632. Default value is @code{hann}.
  16633. @item orientation
  16634. Set orientation of time vs frequency axis. Can be @code{vertical} or
  16635. @code{horizontal}. Default is @code{vertical}.
  16636. @item overlap
  16637. Set ratio of overlap window. Default value is @code{0}.
  16638. When value is @code{1} overlap is set to recommended size for specific
  16639. window function currently used.
  16640. @item gain
  16641. Set scale gain for calculating intensity color values.
  16642. Default value is @code{1}.
  16643. @item data
  16644. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  16645. @item rotation
  16646. Set color rotation, must be in [-1.0, 1.0] range.
  16647. Default value is @code{0}.
  16648. @item start
  16649. Set start frequency from which to display spectrogram. Default is @code{0}.
  16650. @item stop
  16651. Set stop frequency to which to display spectrogram. Default is @code{0}.
  16652. @item fps
  16653. Set upper frame rate limit. Default is @code{auto}, unlimited.
  16654. @item legend
  16655. Draw time and frequency axes and legends. Default is disabled.
  16656. @end table
  16657. The usage is very similar to the showwaves filter; see the examples in that
  16658. section.
  16659. @subsection Examples
  16660. @itemize
  16661. @item
  16662. Large window with logarithmic color scaling:
  16663. @example
  16664. showspectrum=s=1280x480:scale=log
  16665. @end example
  16666. @item
  16667. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  16668. @example
  16669. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16670. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  16671. @end example
  16672. @end itemize
  16673. @section showspectrumpic
  16674. Convert input audio to a single video frame, representing the audio frequency
  16675. spectrum.
  16676. The filter accepts the following options:
  16677. @table @option
  16678. @item size, s
  16679. Specify the video size for the output. For the syntax of this option, check the
  16680. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16681. Default value is @code{4096x2048}.
  16682. @item mode
  16683. Specify display mode.
  16684. It accepts the following values:
  16685. @table @samp
  16686. @item combined
  16687. all channels are displayed in the same row
  16688. @item separate
  16689. all channels are displayed in separate rows
  16690. @end table
  16691. Default value is @samp{combined}.
  16692. @item color
  16693. Specify display color mode.
  16694. It accepts the following values:
  16695. @table @samp
  16696. @item channel
  16697. each channel is displayed in a separate color
  16698. @item intensity
  16699. each channel is displayed using the same color scheme
  16700. @item rainbow
  16701. each channel is displayed using the rainbow color scheme
  16702. @item moreland
  16703. each channel is displayed using the moreland color scheme
  16704. @item nebulae
  16705. each channel is displayed using the nebulae color scheme
  16706. @item fire
  16707. each channel is displayed using the fire color scheme
  16708. @item fiery
  16709. each channel is displayed using the fiery color scheme
  16710. @item fruit
  16711. each channel is displayed using the fruit color scheme
  16712. @item cool
  16713. each channel is displayed using the cool color scheme
  16714. @item magma
  16715. each channel is displayed using the magma color scheme
  16716. @item green
  16717. each channel is displayed using the green color scheme
  16718. @item viridis
  16719. each channel is displayed using the viridis color scheme
  16720. @item plasma
  16721. each channel is displayed using the plasma color scheme
  16722. @item cividis
  16723. each channel is displayed using the cividis color scheme
  16724. @item terrain
  16725. each channel is displayed using the terrain color scheme
  16726. @end table
  16727. Default value is @samp{intensity}.
  16728. @item scale
  16729. Specify scale used for calculating intensity color values.
  16730. It accepts the following values:
  16731. @table @samp
  16732. @item lin
  16733. linear
  16734. @item sqrt
  16735. square root, default
  16736. @item cbrt
  16737. cubic root
  16738. @item log
  16739. logarithmic
  16740. @item 4thrt
  16741. 4th root
  16742. @item 5thrt
  16743. 5th root
  16744. @end table
  16745. Default value is @samp{log}.
  16746. @item saturation
  16747. Set saturation modifier for displayed colors. Negative values provide
  16748. alternative color scheme. @code{0} is no saturation at all.
  16749. Saturation must be in [-10.0, 10.0] range.
  16750. Default value is @code{1}.
  16751. @item win_func
  16752. Set window function.
  16753. It accepts the following values:
  16754. @table @samp
  16755. @item rect
  16756. @item bartlett
  16757. @item hann
  16758. @item hanning
  16759. @item hamming
  16760. @item blackman
  16761. @item welch
  16762. @item flattop
  16763. @item bharris
  16764. @item bnuttall
  16765. @item bhann
  16766. @item sine
  16767. @item nuttall
  16768. @item lanczos
  16769. @item gauss
  16770. @item tukey
  16771. @item dolph
  16772. @item cauchy
  16773. @item parzen
  16774. @item poisson
  16775. @item bohman
  16776. @end table
  16777. Default value is @code{hann}.
  16778. @item orientation
  16779. Set orientation of time vs frequency axis. Can be @code{vertical} or
  16780. @code{horizontal}. Default is @code{vertical}.
  16781. @item gain
  16782. Set scale gain for calculating intensity color values.
  16783. Default value is @code{1}.
  16784. @item legend
  16785. Draw time and frequency axes and legends. Default is enabled.
  16786. @item rotation
  16787. Set color rotation, must be in [-1.0, 1.0] range.
  16788. Default value is @code{0}.
  16789. @item start
  16790. Set start frequency from which to display spectrogram. Default is @code{0}.
  16791. @item stop
  16792. Set stop frequency to which to display spectrogram. Default is @code{0}.
  16793. @end table
  16794. @subsection Examples
  16795. @itemize
  16796. @item
  16797. Extract an audio spectrogram of a whole audio track
  16798. in a 1024x1024 picture using @command{ffmpeg}:
  16799. @example
  16800. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  16801. @end example
  16802. @end itemize
  16803. @section showvolume
  16804. Convert input audio volume to a video output.
  16805. The filter accepts the following options:
  16806. @table @option
  16807. @item rate, r
  16808. Set video rate.
  16809. @item b
  16810. Set border width, allowed range is [0, 5]. Default is 1.
  16811. @item w
  16812. Set channel width, allowed range is [80, 8192]. Default is 400.
  16813. @item h
  16814. Set channel height, allowed range is [1, 900]. Default is 20.
  16815. @item f
  16816. Set fade, allowed range is [0, 1]. Default is 0.95.
  16817. @item c
  16818. Set volume color expression.
  16819. The expression can use the following variables:
  16820. @table @option
  16821. @item VOLUME
  16822. Current max volume of channel in dB.
  16823. @item PEAK
  16824. Current peak.
  16825. @item CHANNEL
  16826. Current channel number, starting from 0.
  16827. @end table
  16828. @item t
  16829. If set, displays channel names. Default is enabled.
  16830. @item v
  16831. If set, displays volume values. Default is enabled.
  16832. @item o
  16833. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  16834. default is @code{h}.
  16835. @item s
  16836. Set step size, allowed range is [0, 5]. Default is 0, which means
  16837. step is disabled.
  16838. @item p
  16839. Set background opacity, allowed range is [0, 1]. Default is 0.
  16840. @item m
  16841. Set metering mode, can be peak: @code{p} or rms: @code{r},
  16842. default is @code{p}.
  16843. @item ds
  16844. Set display scale, can be linear: @code{lin} or log: @code{log},
  16845. default is @code{lin}.
  16846. @item dm
  16847. In second.
  16848. If set to > 0., display a line for the max level
  16849. in the previous seconds.
  16850. default is disabled: @code{0.}
  16851. @item dmc
  16852. The color of the max line. Use when @code{dm} option is set to > 0.
  16853. default is: @code{orange}
  16854. @end table
  16855. @section showwaves
  16856. Convert input audio to a video output, representing the samples waves.
  16857. The filter accepts the following options:
  16858. @table @option
  16859. @item size, s
  16860. Specify the video size for the output. For the syntax of this option, check the
  16861. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16862. Default value is @code{600x240}.
  16863. @item mode
  16864. Set display mode.
  16865. Available values are:
  16866. @table @samp
  16867. @item point
  16868. Draw a point for each sample.
  16869. @item line
  16870. Draw a vertical line for each sample.
  16871. @item p2p
  16872. Draw a point for each sample and a line between them.
  16873. @item cline
  16874. Draw a centered vertical line for each sample.
  16875. @end table
  16876. Default value is @code{point}.
  16877. @item n
  16878. Set the number of samples which are printed on the same column. A
  16879. larger value will decrease the frame rate. Must be a positive
  16880. integer. This option can be set only if the value for @var{rate}
  16881. is not explicitly specified.
  16882. @item rate, r
  16883. Set the (approximate) output frame rate. This is done by setting the
  16884. option @var{n}. Default value is "25".
  16885. @item split_channels
  16886. Set if channels should be drawn separately or overlap. Default value is 0.
  16887. @item colors
  16888. Set colors separated by '|' which are going to be used for drawing of each channel.
  16889. @item scale
  16890. Set amplitude scale.
  16891. Available values are:
  16892. @table @samp
  16893. @item lin
  16894. Linear.
  16895. @item log
  16896. Logarithmic.
  16897. @item sqrt
  16898. Square root.
  16899. @item cbrt
  16900. Cubic root.
  16901. @end table
  16902. Default is linear.
  16903. @item draw
  16904. Set the draw mode. This is mostly useful to set for high @var{n}.
  16905. Available values are:
  16906. @table @samp
  16907. @item scale
  16908. Scale pixel values for each drawn sample.
  16909. @item full
  16910. Draw every sample directly.
  16911. @end table
  16912. Default value is @code{scale}.
  16913. @end table
  16914. @subsection Examples
  16915. @itemize
  16916. @item
  16917. Output the input file audio and the corresponding video representation
  16918. at the same time:
  16919. @example
  16920. amovie=a.mp3,asplit[out0],showwaves[out1]
  16921. @end example
  16922. @item
  16923. Create a synthetic signal and show it with showwaves, forcing a
  16924. frame rate of 30 frames per second:
  16925. @example
  16926. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  16927. @end example
  16928. @end itemize
  16929. @section showwavespic
  16930. Convert input audio to a single video frame, representing the samples waves.
  16931. The filter accepts the following options:
  16932. @table @option
  16933. @item size, s
  16934. Specify the video size for the output. For the syntax of this option, check the
  16935. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16936. Default value is @code{600x240}.
  16937. @item split_channels
  16938. Set if channels should be drawn separately or overlap. Default value is 0.
  16939. @item colors
  16940. Set colors separated by '|' which are going to be used for drawing of each channel.
  16941. @item scale
  16942. Set amplitude scale.
  16943. Available values are:
  16944. @table @samp
  16945. @item lin
  16946. Linear.
  16947. @item log
  16948. Logarithmic.
  16949. @item sqrt
  16950. Square root.
  16951. @item cbrt
  16952. Cubic root.
  16953. @end table
  16954. Default is linear.
  16955. @end table
  16956. @subsection Examples
  16957. @itemize
  16958. @item
  16959. Extract a channel split representation of the wave form of a whole audio track
  16960. in a 1024x800 picture using @command{ffmpeg}:
  16961. @example
  16962. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  16963. @end example
  16964. @end itemize
  16965. @section sidedata, asidedata
  16966. Delete frame side data, or select frames based on it.
  16967. This filter accepts the following options:
  16968. @table @option
  16969. @item mode
  16970. Set mode of operation of the filter.
  16971. Can be one of the following:
  16972. @table @samp
  16973. @item select
  16974. Select every frame with side data of @code{type}.
  16975. @item delete
  16976. Delete side data of @code{type}. If @code{type} is not set, delete all side
  16977. data in the frame.
  16978. @end table
  16979. @item type
  16980. Set side data type used with all modes. Must be set for @code{select} mode. For
  16981. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  16982. in @file{libavutil/frame.h}. For example, to choose
  16983. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  16984. @end table
  16985. @section spectrumsynth
  16986. Sythesize audio from 2 input video spectrums, first input stream represents
  16987. magnitude across time and second represents phase across time.
  16988. The filter will transform from frequency domain as displayed in videos back
  16989. to time domain as presented in audio output.
  16990. This filter is primarily created for reversing processed @ref{showspectrum}
  16991. filter outputs, but can synthesize sound from other spectrograms too.
  16992. But in such case results are going to be poor if the phase data is not
  16993. available, because in such cases phase data need to be recreated, usually
  16994. its just recreated from random noise.
  16995. For best results use gray only output (@code{channel} color mode in
  16996. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  16997. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  16998. @code{data} option. Inputs videos should generally use @code{fullframe}
  16999. slide mode as that saves resources needed for decoding video.
  17000. The filter accepts the following options:
  17001. @table @option
  17002. @item sample_rate
  17003. Specify sample rate of output audio, the sample rate of audio from which
  17004. spectrum was generated may differ.
  17005. @item channels
  17006. Set number of channels represented in input video spectrums.
  17007. @item scale
  17008. Set scale which was used when generating magnitude input spectrum.
  17009. Can be @code{lin} or @code{log}. Default is @code{log}.
  17010. @item slide
  17011. Set slide which was used when generating inputs spectrums.
  17012. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17013. Default is @code{fullframe}.
  17014. @item win_func
  17015. Set window function used for resynthesis.
  17016. @item overlap
  17017. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17018. which means optimal overlap for selected window function will be picked.
  17019. @item orientation
  17020. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17021. Default is @code{vertical}.
  17022. @end table
  17023. @subsection Examples
  17024. @itemize
  17025. @item
  17026. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17027. then resynthesize videos back to audio with spectrumsynth:
  17028. @example
  17029. 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
  17030. 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
  17031. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17032. @end example
  17033. @end itemize
  17034. @section split, asplit
  17035. Split input into several identical outputs.
  17036. @code{asplit} works with audio input, @code{split} with video.
  17037. The filter accepts a single parameter which specifies the number of outputs. If
  17038. unspecified, it defaults to 2.
  17039. @subsection Examples
  17040. @itemize
  17041. @item
  17042. Create two separate outputs from the same input:
  17043. @example
  17044. [in] split [out0][out1]
  17045. @end example
  17046. @item
  17047. To create 3 or more outputs, you need to specify the number of
  17048. outputs, like in:
  17049. @example
  17050. [in] asplit=3 [out0][out1][out2]
  17051. @end example
  17052. @item
  17053. Create two separate outputs from the same input, one cropped and
  17054. one padded:
  17055. @example
  17056. [in] split [splitout1][splitout2];
  17057. [splitout1] crop=100:100:0:0 [cropout];
  17058. [splitout2] pad=200:200:100:100 [padout];
  17059. @end example
  17060. @item
  17061. Create 5 copies of the input audio with @command{ffmpeg}:
  17062. @example
  17063. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17064. @end example
  17065. @end itemize
  17066. @section zmq, azmq
  17067. Receive commands sent through a libzmq client, and forward them to
  17068. filters in the filtergraph.
  17069. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17070. must be inserted between two video filters, @code{azmq} between two
  17071. audio filters. Both are capable to send messages to any filter type.
  17072. To enable these filters you need to install the libzmq library and
  17073. headers and configure FFmpeg with @code{--enable-libzmq}.
  17074. For more information about libzmq see:
  17075. @url{http://www.zeromq.org/}
  17076. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17077. receives messages sent through a network interface defined by the
  17078. @option{bind_address} (or the abbreviation "@option{b}") option.
  17079. Default value of this option is @file{tcp://localhost:5555}. You may
  17080. want to alter this value to your needs, but do not forget to escape any
  17081. ':' signs (see @ref{filtergraph escaping}).
  17082. The received message must be in the form:
  17083. @example
  17084. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17085. @end example
  17086. @var{TARGET} specifies the target of the command, usually the name of
  17087. the filter class or a specific filter instance name. The default
  17088. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17089. but you can override this by using the @samp{filter_name@@id} syntax
  17090. (see @ref{Filtergraph syntax}).
  17091. @var{COMMAND} specifies the name of the command for the target filter.
  17092. @var{ARG} is optional and specifies the optional argument list for the
  17093. given @var{COMMAND}.
  17094. Upon reception, the message is processed and the corresponding command
  17095. is injected into the filtergraph. Depending on the result, the filter
  17096. will send a reply to the client, adopting the format:
  17097. @example
  17098. @var{ERROR_CODE} @var{ERROR_REASON}
  17099. @var{MESSAGE}
  17100. @end example
  17101. @var{MESSAGE} is optional.
  17102. @subsection Examples
  17103. Look at @file{tools/zmqsend} for an example of a zmq client which can
  17104. be used to send commands processed by these filters.
  17105. Consider the following filtergraph generated by @command{ffplay}.
  17106. In this example the last overlay filter has an instance name. All other
  17107. filters will have default instance names.
  17108. @example
  17109. ffplay -dumpgraph 1 -f lavfi "
  17110. color=s=100x100:c=red [l];
  17111. color=s=100x100:c=blue [r];
  17112. nullsrc=s=200x100, zmq [bg];
  17113. [bg][l] overlay [bg+l];
  17114. [bg+l][r] overlay@@my=x=100 "
  17115. @end example
  17116. To change the color of the left side of the video, the following
  17117. command can be used:
  17118. @example
  17119. echo Parsed_color_0 c yellow | tools/zmqsend
  17120. @end example
  17121. To change the right side:
  17122. @example
  17123. echo Parsed_color_1 c pink | tools/zmqsend
  17124. @end example
  17125. To change the position of the right side:
  17126. @example
  17127. echo overlay@@my x 150 | tools/zmqsend
  17128. @end example
  17129. @c man end MULTIMEDIA FILTERS
  17130. @chapter Multimedia Sources
  17131. @c man begin MULTIMEDIA SOURCES
  17132. Below is a description of the currently available multimedia sources.
  17133. @section amovie
  17134. This is the same as @ref{movie} source, except it selects an audio
  17135. stream by default.
  17136. @anchor{movie}
  17137. @section movie
  17138. Read audio and/or video stream(s) from a movie container.
  17139. It accepts the following parameters:
  17140. @table @option
  17141. @item filename
  17142. The name of the resource to read (not necessarily a file; it can also be a
  17143. device or a stream accessed through some protocol).
  17144. @item format_name, f
  17145. Specifies the format assumed for the movie to read, and can be either
  17146. the name of a container or an input device. If not specified, the
  17147. format is guessed from @var{movie_name} or by probing.
  17148. @item seek_point, sp
  17149. Specifies the seek point in seconds. The frames will be output
  17150. starting from this seek point. The parameter is evaluated with
  17151. @code{av_strtod}, so the numerical value may be suffixed by an IS
  17152. postfix. The default value is "0".
  17153. @item streams, s
  17154. Specifies the streams to read. Several streams can be specified,
  17155. separated by "+". The source will then have as many outputs, in the
  17156. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  17157. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  17158. respectively the default (best suited) video and audio stream. Default
  17159. is "dv", or "da" if the filter is called as "amovie".
  17160. @item stream_index, si
  17161. Specifies the index of the video stream to read. If the value is -1,
  17162. the most suitable video stream will be automatically selected. The default
  17163. value is "-1". Deprecated. If the filter is called "amovie", it will select
  17164. audio instead of video.
  17165. @item loop
  17166. Specifies how many times to read the stream in sequence.
  17167. If the value is 0, the stream will be looped infinitely.
  17168. Default value is "1".
  17169. Note that when the movie is looped the source timestamps are not
  17170. changed, so it will generate non monotonically increasing timestamps.
  17171. @item discontinuity
  17172. Specifies the time difference between frames above which the point is
  17173. considered a timestamp discontinuity which is removed by adjusting the later
  17174. timestamps.
  17175. @end table
  17176. It allows overlaying a second video on top of the main input of
  17177. a filtergraph, as shown in this graph:
  17178. @example
  17179. input -----------> deltapts0 --> overlay --> output
  17180. ^
  17181. |
  17182. movie --> scale--> deltapts1 -------+
  17183. @end example
  17184. @subsection Examples
  17185. @itemize
  17186. @item
  17187. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  17188. on top of the input labelled "in":
  17189. @example
  17190. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17191. [in] setpts=PTS-STARTPTS [main];
  17192. [main][over] overlay=16:16 [out]
  17193. @end example
  17194. @item
  17195. Read from a video4linux2 device, and overlay it on top of the input
  17196. labelled "in":
  17197. @example
  17198. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17199. [in] setpts=PTS-STARTPTS [main];
  17200. [main][over] overlay=16:16 [out]
  17201. @end example
  17202. @item
  17203. Read the first video stream and the audio stream with id 0x81 from
  17204. dvd.vob; the video is connected to the pad named "video" and the audio is
  17205. connected to the pad named "audio":
  17206. @example
  17207. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  17208. @end example
  17209. @end itemize
  17210. @subsection Commands
  17211. Both movie and amovie support the following commands:
  17212. @table @option
  17213. @item seek
  17214. Perform seek using "av_seek_frame".
  17215. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  17216. @itemize
  17217. @item
  17218. @var{stream_index}: If stream_index is -1, a default
  17219. stream is selected, and @var{timestamp} is automatically converted
  17220. from AV_TIME_BASE units to the stream specific time_base.
  17221. @item
  17222. @var{timestamp}: Timestamp in AVStream.time_base units
  17223. or, if no stream is specified, in AV_TIME_BASE units.
  17224. @item
  17225. @var{flags}: Flags which select direction and seeking mode.
  17226. @end itemize
  17227. @item get_duration
  17228. Get movie duration in AV_TIME_BASE units.
  17229. @end table
  17230. @c man end MULTIMEDIA SOURCES