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.

23305 lines
620KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item mode
  315. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  316. Default is @code{downward}.
  317. @item threshold
  318. If a signal of stream rises above this level it will affect the gain
  319. reduction.
  320. By default it is 0.125. Range is between 0.00097563 and 1.
  321. @item ratio
  322. Set a ratio by which the signal is reduced. 1:2 means that if the level
  323. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  324. Default is 2. Range is between 1 and 20.
  325. @item attack
  326. Amount of milliseconds the signal has to rise above the threshold before gain
  327. reduction starts. Default is 20. Range is between 0.01 and 2000.
  328. @item release
  329. Amount of milliseconds the signal has to fall below the threshold before
  330. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  331. @item makeup
  332. Set the amount by how much signal will be amplified after processing.
  333. Default is 1. Range is from 1 to 64.
  334. @item knee
  335. Curve the sharp knee around the threshold to enter gain reduction more softly.
  336. Default is 2.82843. Range is between 1 and 8.
  337. @item link
  338. Choose if the @code{average} level between all channels of input stream
  339. or the louder(@code{maximum}) channel of input stream affects the
  340. reduction. Default is @code{average}.
  341. @item detection
  342. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  343. of @code{rms}. Default is @code{rms} which is mostly smoother.
  344. @item mix
  345. How much to use compressed signal in output. Default is 1.
  346. Range is between 0 and 1.
  347. @end table
  348. @section acontrast
  349. Simple audio dynamic range compression/expansion filter.
  350. The filter accepts the following options:
  351. @table @option
  352. @item contrast
  353. Set contrast. Default is 33. Allowed range is between 0 and 100.
  354. @end table
  355. @section acopy
  356. Copy the input audio source unchanged to the output. This is mainly useful for
  357. testing purposes.
  358. @section acrossfade
  359. Apply cross fade from one input audio stream to another input audio stream.
  360. The cross fade is applied for specified duration near the end of first stream.
  361. The filter accepts the following options:
  362. @table @option
  363. @item nb_samples, ns
  364. Specify the number of samples for which the cross fade effect has to last.
  365. At the end of the cross fade effect the first input audio will be completely
  366. silent. Default is 44100.
  367. @item duration, d
  368. Specify the duration of the cross fade effect. See
  369. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  370. for the accepted syntax.
  371. By default the duration is determined by @var{nb_samples}.
  372. If set this option is used instead of @var{nb_samples}.
  373. @item overlap, o
  374. Should first stream end overlap with second stream start. Default is enabled.
  375. @item curve1
  376. Set curve for cross fade transition for first stream.
  377. @item curve2
  378. Set curve for cross fade transition for second stream.
  379. For description of available curve types see @ref{afade} filter description.
  380. @end table
  381. @subsection Examples
  382. @itemize
  383. @item
  384. Cross fade from one input to another:
  385. @example
  386. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  387. @end example
  388. @item
  389. Cross fade from one input to another but without overlapping:
  390. @example
  391. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  392. @end example
  393. @end itemize
  394. @section acrossover
  395. Split audio stream into several bands.
  396. This filter splits audio stream into two or more frequency ranges.
  397. Summing all streams back will give flat output.
  398. The filter accepts the following options:
  399. @table @option
  400. @item split
  401. Set split frequencies. Those must be positive and increasing.
  402. @item order
  403. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  404. Default is @var{4th}.
  405. @end table
  406. @section acrusher
  407. Reduce audio bit resolution.
  408. This filter is bit crusher with enhanced functionality. A bit crusher
  409. is used to audibly reduce number of bits an audio signal is sampled
  410. with. This doesn't change the bit depth at all, it just produces the
  411. effect. Material reduced in bit depth sounds more harsh and "digital".
  412. This filter is able to even round to continuous values instead of discrete
  413. bit depths.
  414. Additionally it has a D/C offset which results in different crushing of
  415. the lower and the upper half of the signal.
  416. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  417. Another feature of this filter is the logarithmic mode.
  418. This setting switches from linear distances between bits to logarithmic ones.
  419. The result is a much more "natural" sounding crusher which doesn't gate low
  420. signals for example. The human ear has a logarithmic perception,
  421. so this kind of crushing is much more pleasant.
  422. Logarithmic crushing is also able to get anti-aliased.
  423. The filter accepts the following options:
  424. @table @option
  425. @item level_in
  426. Set level in.
  427. @item level_out
  428. Set level out.
  429. @item bits
  430. Set bit reduction.
  431. @item mix
  432. Set mixing amount.
  433. @item mode
  434. Can be linear: @code{lin} or logarithmic: @code{log}.
  435. @item dc
  436. Set DC.
  437. @item aa
  438. Set anti-aliasing.
  439. @item samples
  440. Set sample reduction.
  441. @item lfo
  442. Enable LFO. By default disabled.
  443. @item lforange
  444. Set LFO range.
  445. @item lforate
  446. Set LFO rate.
  447. @end table
  448. @section acue
  449. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  450. filter.
  451. @section adeclick
  452. Remove impulsive noise from input audio.
  453. Samples detected as impulsive noise are replaced by interpolated samples using
  454. autoregressive modelling.
  455. @table @option
  456. @item w
  457. Set window size, in milliseconds. Allowed range is from @code{10} to
  458. @code{100}. Default value is @code{55} milliseconds.
  459. This sets size of window which will be processed at once.
  460. @item o
  461. Set window overlap, in percentage of window size. Allowed range is from
  462. @code{50} to @code{95}. Default value is @code{75} percent.
  463. Setting this to a very high value increases impulsive noise removal but makes
  464. whole process much slower.
  465. @item a
  466. Set autoregression order, in percentage of window size. Allowed range is from
  467. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  468. controls quality of interpolated samples using neighbour good samples.
  469. @item t
  470. Set threshold value. Allowed range is from @code{1} to @code{100}.
  471. Default value is @code{2}.
  472. This controls the strength of impulsive noise which is going to be removed.
  473. The lower value, the more samples will be detected as impulsive noise.
  474. @item b
  475. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  476. @code{10}. Default value is @code{2}.
  477. If any two samples detected as noise are spaced less than this value then any
  478. sample between those two samples will be also detected as noise.
  479. @item m
  480. Set overlap method.
  481. It accepts the following values:
  482. @table @option
  483. @item a
  484. Select overlap-add method. Even not interpolated samples are slightly
  485. changed with this method.
  486. @item s
  487. Select overlap-save method. Not interpolated samples remain unchanged.
  488. @end table
  489. Default value is @code{a}.
  490. @end table
  491. @section adeclip
  492. Remove clipped samples from input audio.
  493. Samples detected as clipped are replaced by interpolated samples using
  494. autoregressive modelling.
  495. @table @option
  496. @item w
  497. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  498. Default value is @code{55} milliseconds.
  499. This sets size of window which will be processed at once.
  500. @item o
  501. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  502. to @code{95}. Default value is @code{75} percent.
  503. @item a
  504. Set autoregression order, in percentage of window size. Allowed range is from
  505. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  506. quality of interpolated samples using neighbour good samples.
  507. @item t
  508. Set threshold value. Allowed range is from @code{1} to @code{100}.
  509. Default value is @code{10}. Higher values make clip detection less aggressive.
  510. @item n
  511. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  512. Default value is @code{1000}. Higher values make clip detection less aggressive.
  513. @item m
  514. Set overlap method.
  515. It accepts the following values:
  516. @table @option
  517. @item a
  518. Select overlap-add method. Even not interpolated samples are slightly changed
  519. with this method.
  520. @item s
  521. Select overlap-save method. Not interpolated samples remain unchanged.
  522. @end table
  523. Default value is @code{a}.
  524. @end table
  525. @section adelay
  526. Delay one or more audio channels.
  527. Samples in delayed channel are filled with silence.
  528. The filter accepts the following option:
  529. @table @option
  530. @item delays
  531. Set list of delays in milliseconds for each channel separated by '|'.
  532. Unused delays will be silently ignored. If number of given delays is
  533. smaller than number of channels all remaining channels will not be delayed.
  534. If you want to delay exact number of samples, append 'S' to number.
  535. If you want instead to delay in seconds, append 's' to number.
  536. @end table
  537. @subsection Examples
  538. @itemize
  539. @item
  540. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  541. the second channel (and any other channels that may be present) unchanged.
  542. @example
  543. adelay=1500|0|500
  544. @end example
  545. @item
  546. Delay second channel by 500 samples, the third channel by 700 samples and leave
  547. the first channel (and any other channels that may be present) unchanged.
  548. @example
  549. adelay=0|500S|700S
  550. @end example
  551. @end itemize
  552. @section aderivative, aintegral
  553. Compute derivative/integral of audio stream.
  554. Applying both filters one after another produces original audio.
  555. @section aecho
  556. Apply echoing to the input audio.
  557. Echoes are reflected sound and can occur naturally amongst mountains
  558. (and sometimes large buildings) when talking or shouting; digital echo
  559. effects emulate this behaviour and are often used to help fill out the
  560. sound of a single instrument or vocal. The time difference between the
  561. original signal and the reflection is the @code{delay}, and the
  562. loudness of the reflected signal is the @code{decay}.
  563. Multiple echoes can have different delays and decays.
  564. A description of the accepted parameters follows.
  565. @table @option
  566. @item in_gain
  567. Set input gain of reflected signal. Default is @code{0.6}.
  568. @item out_gain
  569. Set output gain of reflected signal. Default is @code{0.3}.
  570. @item delays
  571. Set list of time intervals in milliseconds between original signal and reflections
  572. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  573. Default is @code{1000}.
  574. @item decays
  575. Set list of loudness of reflected signals separated by '|'.
  576. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  577. Default is @code{0.5}.
  578. @end table
  579. @subsection Examples
  580. @itemize
  581. @item
  582. Make it sound as if there are twice as many instruments as are actually playing:
  583. @example
  584. aecho=0.8:0.88:60:0.4
  585. @end example
  586. @item
  587. If delay is very short, then it sound like a (metallic) robot playing music:
  588. @example
  589. aecho=0.8:0.88:6:0.4
  590. @end example
  591. @item
  592. A longer delay will sound like an open air concert in the mountains:
  593. @example
  594. aecho=0.8:0.9:1000:0.3
  595. @end example
  596. @item
  597. Same as above but with one more mountain:
  598. @example
  599. aecho=0.8:0.9:1000|1800:0.3|0.25
  600. @end example
  601. @end itemize
  602. @section aemphasis
  603. Audio emphasis filter creates or restores material directly taken from LPs or
  604. emphased CDs with different filter curves. E.g. to store music on vinyl the
  605. signal has to be altered by a filter first to even out the disadvantages of
  606. this recording medium.
  607. Once the material is played back the inverse filter has to be applied to
  608. restore the distortion of the frequency response.
  609. The filter accepts the following options:
  610. @table @option
  611. @item level_in
  612. Set input gain.
  613. @item level_out
  614. Set output gain.
  615. @item mode
  616. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  617. use @code{production} mode. Default is @code{reproduction} mode.
  618. @item type
  619. Set filter type. Selects medium. Can be one of the following:
  620. @table @option
  621. @item col
  622. select Columbia.
  623. @item emi
  624. select EMI.
  625. @item bsi
  626. select BSI (78RPM).
  627. @item riaa
  628. select RIAA.
  629. @item cd
  630. select Compact Disc (CD).
  631. @item 50fm
  632. select 50µs (FM).
  633. @item 75fm
  634. select 75µs (FM).
  635. @item 50kf
  636. select 50µs (FM-KF).
  637. @item 75kf
  638. select 75µs (FM-KF).
  639. @end table
  640. @end table
  641. @section aeval
  642. Modify an audio signal according to the specified expressions.
  643. This filter accepts one or more expressions (one for each channel),
  644. which are evaluated and used to modify a corresponding audio signal.
  645. It accepts the following parameters:
  646. @table @option
  647. @item exprs
  648. Set the '|'-separated expressions list for each separate channel. If
  649. the number of input channels is greater than the number of
  650. expressions, the last specified expression is used for the remaining
  651. output channels.
  652. @item channel_layout, c
  653. Set output channel layout. If not specified, the channel layout is
  654. specified by the number of expressions. If set to @samp{same}, it will
  655. use by default the same input channel layout.
  656. @end table
  657. Each expression in @var{exprs} can contain the following constants and functions:
  658. @table @option
  659. @item ch
  660. channel number of the current expression
  661. @item n
  662. number of the evaluated sample, starting from 0
  663. @item s
  664. sample rate
  665. @item t
  666. time of the evaluated sample expressed in seconds
  667. @item nb_in_channels
  668. @item nb_out_channels
  669. input and output number of channels
  670. @item val(CH)
  671. the value of input channel with number @var{CH}
  672. @end table
  673. Note: this filter is slow. For faster processing you should use a
  674. dedicated filter.
  675. @subsection Examples
  676. @itemize
  677. @item
  678. Half volume:
  679. @example
  680. aeval=val(ch)/2:c=same
  681. @end example
  682. @item
  683. Invert phase of the second channel:
  684. @example
  685. aeval=val(0)|-val(1)
  686. @end example
  687. @end itemize
  688. @anchor{afade}
  689. @section afade
  690. Apply fade-in/out effect to input audio.
  691. A description of the accepted parameters follows.
  692. @table @option
  693. @item type, t
  694. Specify the effect type, can be either @code{in} for fade-in, or
  695. @code{out} for a fade-out effect. Default is @code{in}.
  696. @item start_sample, ss
  697. Specify the number of the start sample for starting to apply the fade
  698. effect. Default is 0.
  699. @item nb_samples, ns
  700. Specify the number of samples for which the fade effect has to last. At
  701. the end of the fade-in effect the output audio will have the same
  702. volume as the input audio, at the end of the fade-out transition
  703. the output audio will be silence. Default is 44100.
  704. @item start_time, st
  705. Specify the start time of the fade effect. Default is 0.
  706. The value must be specified as a time duration; see
  707. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  708. for the accepted syntax.
  709. If set this option is used instead of @var{start_sample}.
  710. @item duration, d
  711. Specify the duration of the fade effect. See
  712. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  713. for the accepted syntax.
  714. At the end of the fade-in effect the output audio will have the same
  715. volume as the input audio, at the end of the fade-out transition
  716. the output audio will be silence.
  717. By default the duration is determined by @var{nb_samples}.
  718. If set this option is used instead of @var{nb_samples}.
  719. @item curve
  720. Set curve for fade transition.
  721. It accepts the following values:
  722. @table @option
  723. @item tri
  724. select triangular, linear slope (default)
  725. @item qsin
  726. select quarter of sine wave
  727. @item hsin
  728. select half of sine wave
  729. @item esin
  730. select exponential sine wave
  731. @item log
  732. select logarithmic
  733. @item ipar
  734. select inverted parabola
  735. @item qua
  736. select quadratic
  737. @item cub
  738. select cubic
  739. @item squ
  740. select square root
  741. @item cbr
  742. select cubic root
  743. @item par
  744. select parabola
  745. @item exp
  746. select exponential
  747. @item iqsin
  748. select inverted quarter of sine wave
  749. @item ihsin
  750. select inverted half of sine wave
  751. @item dese
  752. select double-exponential seat
  753. @item desi
  754. select double-exponential sigmoid
  755. @item losi
  756. select logistic sigmoid
  757. @item nofade
  758. no fade applied
  759. @end table
  760. @end table
  761. @subsection Examples
  762. @itemize
  763. @item
  764. Fade in first 15 seconds of audio:
  765. @example
  766. afade=t=in:ss=0:d=15
  767. @end example
  768. @item
  769. Fade out last 25 seconds of a 900 seconds audio:
  770. @example
  771. afade=t=out:st=875:d=25
  772. @end example
  773. @end itemize
  774. @section afftdn
  775. Denoise audio samples with FFT.
  776. A description of the accepted parameters follows.
  777. @table @option
  778. @item nr
  779. Set the noise reduction in dB, allowed range is 0.01 to 97.
  780. Default value is 12 dB.
  781. @item nf
  782. Set the noise floor in dB, allowed range is -80 to -20.
  783. Default value is -50 dB.
  784. @item nt
  785. Set the noise type.
  786. It accepts the following values:
  787. @table @option
  788. @item w
  789. Select white noise.
  790. @item v
  791. Select vinyl noise.
  792. @item s
  793. Select shellac noise.
  794. @item c
  795. Select custom noise, defined in @code{bn} option.
  796. Default value is white noise.
  797. @end table
  798. @item bn
  799. Set custom band noise for every one of 15 bands.
  800. Bands are separated by ' ' or '|'.
  801. @item rf
  802. Set the residual floor in dB, allowed range is -80 to -20.
  803. Default value is -38 dB.
  804. @item tn
  805. Enable noise tracking. By default is disabled.
  806. With this enabled, noise floor is automatically adjusted.
  807. @item tr
  808. Enable residual tracking. By default is disabled.
  809. @item om
  810. Set the output mode.
  811. It accepts the following values:
  812. @table @option
  813. @item i
  814. Pass input unchanged.
  815. @item o
  816. Pass noise filtered out.
  817. @item n
  818. Pass only noise.
  819. Default value is @var{o}.
  820. @end table
  821. @end table
  822. @subsection Commands
  823. This filter supports the following commands:
  824. @table @option
  825. @item sample_noise, sn
  826. Start or stop measuring noise profile.
  827. Syntax for the command is : "start" or "stop" string.
  828. After measuring noise profile is stopped it will be
  829. automatically applied in filtering.
  830. @item noise_reduction, nr
  831. Change noise reduction. Argument is single float number.
  832. Syntax for the command is : "@var{noise_reduction}"
  833. @item noise_floor, nf
  834. Change noise floor. Argument is single float number.
  835. Syntax for the command is : "@var{noise_floor}"
  836. @item output_mode, om
  837. Change output mode operation.
  838. Syntax for the command is : "i", "o" or "n" string.
  839. @end table
  840. @section afftfilt
  841. Apply arbitrary expressions to samples in frequency domain.
  842. @table @option
  843. @item real
  844. Set frequency domain real expression for each separate channel separated
  845. by '|'. Default is "re".
  846. If the number of input channels is greater than the number of
  847. expressions, the last specified expression is used for the remaining
  848. output channels.
  849. @item imag
  850. Set frequency domain imaginary expression for each separate channel
  851. separated by '|'. Default is "im".
  852. Each expression in @var{real} and @var{imag} can contain the following
  853. constants and functions:
  854. @table @option
  855. @item sr
  856. sample rate
  857. @item b
  858. current frequency bin number
  859. @item nb
  860. number of available bins
  861. @item ch
  862. channel number of the current expression
  863. @item chs
  864. number of channels
  865. @item pts
  866. current frame pts
  867. @item re
  868. current real part of frequency bin of current channel
  869. @item im
  870. current imaginary part of frequency bin of current channel
  871. @item real(b, ch)
  872. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  873. @item imag(b, ch)
  874. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  875. @end table
  876. @item win_size
  877. Set window size.
  878. It accepts the following values:
  879. @table @samp
  880. @item w16
  881. @item w32
  882. @item w64
  883. @item w128
  884. @item w256
  885. @item w512
  886. @item w1024
  887. @item w2048
  888. @item w4096
  889. @item w8192
  890. @item w16384
  891. @item w32768
  892. @item w65536
  893. @end table
  894. Default is @code{w4096}
  895. @item win_func
  896. Set window function. Default is @code{hann}.
  897. @item overlap
  898. Set window overlap. If set to 1, the recommended overlap for selected
  899. window function will be picked. Default is @code{0.75}.
  900. @end table
  901. @subsection Examples
  902. @itemize
  903. @item
  904. Leave almost only low frequencies in audio:
  905. @example
  906. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  907. @end example
  908. @end itemize
  909. @anchor{afir}
  910. @section afir
  911. Apply an arbitrary Frequency Impulse Response filter.
  912. This filter is designed for applying long FIR filters,
  913. up to 60 seconds long.
  914. It can be used as component for digital crossover filters,
  915. room equalization, cross talk cancellation, wavefield synthesis,
  916. auralization, ambiophonics, ambisonics and spatialization.
  917. This filter uses second stream as FIR coefficients.
  918. If second stream holds single channel, it will be used
  919. for all input channels in first stream, otherwise
  920. number of channels in second stream must be same as
  921. number of channels in first stream.
  922. It accepts the following parameters:
  923. @table @option
  924. @item dry
  925. Set dry gain. This sets input gain.
  926. @item wet
  927. Set wet gain. This sets final output gain.
  928. @item length
  929. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  930. @item gtype
  931. Enable applying gain measured from power of IR.
  932. Set which approach to use for auto gain measurement.
  933. @table @option
  934. @item none
  935. Do not apply any gain.
  936. @item peak
  937. select peak gain, very conservative approach. This is default value.
  938. @item dc
  939. select DC gain, limited application.
  940. @item gn
  941. select gain to noise approach, this is most popular one.
  942. @end table
  943. @item irgain
  944. Set gain to be applied to IR coefficients before filtering.
  945. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  946. @item irfmt
  947. Set format of IR stream. Can be @code{mono} or @code{input}.
  948. Default is @code{input}.
  949. @item maxir
  950. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  951. Allowed range is 0.1 to 60 seconds.
  952. @item response
  953. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  954. By default it is disabled.
  955. @item channel
  956. Set for which IR channel to display frequency response. By default is first channel
  957. displayed. This option is used only when @var{response} is enabled.
  958. @item size
  959. Set video stream size. This option is used only when @var{response} is enabled.
  960. @item rate
  961. Set video stream frame rate. This option is used only when @var{response} is enabled.
  962. @item minp
  963. Set minimal partition size used for convolution. Default is @var{8192}.
  964. Allowed range is from @var{8} to @var{32768}.
  965. Lower values decreases latency at cost of higher CPU usage.
  966. @item maxp
  967. Set maximal partition size used for convolution. Default is @var{8192}.
  968. Allowed range is from @var{8} to @var{32768}.
  969. Lower values may increase CPU usage.
  970. @end table
  971. @subsection Examples
  972. @itemize
  973. @item
  974. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  975. @example
  976. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  977. @end example
  978. @end itemize
  979. @anchor{aformat}
  980. @section aformat
  981. Set output format constraints for the input audio. The framework will
  982. negotiate the most appropriate format to minimize conversions.
  983. It accepts the following parameters:
  984. @table @option
  985. @item sample_fmts
  986. A '|'-separated list of requested sample formats.
  987. @item sample_rates
  988. A '|'-separated list of requested sample rates.
  989. @item channel_layouts
  990. A '|'-separated list of requested channel layouts.
  991. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  992. for the required syntax.
  993. @end table
  994. If a parameter is omitted, all values are allowed.
  995. Force the output to either unsigned 8-bit or signed 16-bit stereo
  996. @example
  997. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  998. @end example
  999. @section agate
  1000. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1001. processing reduces disturbing noise between useful signals.
  1002. Gating is done by detecting the volume below a chosen level @var{threshold}
  1003. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1004. floor is set via @var{range}. Because an exact manipulation of the signal
  1005. would cause distortion of the waveform the reduction can be levelled over
  1006. time. This is done by setting @var{attack} and @var{release}.
  1007. @var{attack} determines how long the signal has to fall below the threshold
  1008. before any reduction will occur and @var{release} sets the time the signal
  1009. has to rise above the threshold to reduce the reduction again.
  1010. Shorter signals than the chosen attack time will be left untouched.
  1011. @table @option
  1012. @item level_in
  1013. Set input level before filtering.
  1014. Default is 1. Allowed range is from 0.015625 to 64.
  1015. @item mode
  1016. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1017. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1018. will be amplified, expanding dynamic range in upward direction.
  1019. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1020. @item range
  1021. Set the level of gain reduction when the signal is below the threshold.
  1022. Default is 0.06125. Allowed range is from 0 to 1.
  1023. Setting this to 0 disables reduction and then filter behaves like expander.
  1024. @item threshold
  1025. If a signal rises above this level the gain reduction is released.
  1026. Default is 0.125. Allowed range is from 0 to 1.
  1027. @item ratio
  1028. Set a ratio by which the signal is reduced.
  1029. Default is 2. Allowed range is from 1 to 9000.
  1030. @item attack
  1031. Amount of milliseconds the signal has to rise above the threshold before gain
  1032. reduction stops.
  1033. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1034. @item release
  1035. Amount of milliseconds the signal has to fall below the threshold before the
  1036. reduction is increased again. Default is 250 milliseconds.
  1037. Allowed range is from 0.01 to 9000.
  1038. @item makeup
  1039. Set amount of amplification of signal after processing.
  1040. Default is 1. Allowed range is from 1 to 64.
  1041. @item knee
  1042. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1043. Default is 2.828427125. Allowed range is from 1 to 8.
  1044. @item detection
  1045. Choose if exact signal should be taken for detection or an RMS like one.
  1046. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1047. @item link
  1048. Choose if the average level between all channels or the louder channel affects
  1049. the reduction.
  1050. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1051. @end table
  1052. @section aiir
  1053. Apply an arbitrary Infinite Impulse Response filter.
  1054. It accepts the following parameters:
  1055. @table @option
  1056. @item z
  1057. Set numerator/zeros coefficients.
  1058. @item p
  1059. Set denominator/poles coefficients.
  1060. @item k
  1061. Set channels gains.
  1062. @item dry_gain
  1063. Set input gain.
  1064. @item wet_gain
  1065. Set output gain.
  1066. @item f
  1067. Set coefficients format.
  1068. @table @samp
  1069. @item tf
  1070. transfer function
  1071. @item zp
  1072. Z-plane zeros/poles, cartesian (default)
  1073. @item pr
  1074. Z-plane zeros/poles, polar radians
  1075. @item pd
  1076. Z-plane zeros/poles, polar degrees
  1077. @end table
  1078. @item r
  1079. Set kind of processing.
  1080. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1081. @item e
  1082. Set filtering precision.
  1083. @table @samp
  1084. @item dbl
  1085. double-precision floating-point (default)
  1086. @item flt
  1087. single-precision floating-point
  1088. @item i32
  1089. 32-bit integers
  1090. @item i16
  1091. 16-bit integers
  1092. @end table
  1093. @item response
  1094. Show IR frequency response, magnitude and phase in additional video stream.
  1095. By default it is disabled.
  1096. @item channel
  1097. Set for which IR channel to display frequency response. By default is first channel
  1098. displayed. This option is used only when @var{response} is enabled.
  1099. @item size
  1100. Set video stream size. This option is used only when @var{response} is enabled.
  1101. @end table
  1102. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1103. order.
  1104. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1105. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1106. imaginary unit.
  1107. Different coefficients and gains can be provided for every channel, in such case
  1108. use '|' to separate coefficients or gains. Last provided coefficients will be
  1109. used for all remaining channels.
  1110. @subsection Examples
  1111. @itemize
  1112. @item
  1113. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1114. @example
  1115. aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
  1116. @end example
  1117. @item
  1118. Same as above but in @code{zp} format:
  1119. @example
  1120. aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
  1121. @end example
  1122. @end itemize
  1123. @section alimiter
  1124. The limiter prevents an input signal from rising over a desired threshold.
  1125. This limiter uses lookahead technology to prevent your signal from distorting.
  1126. It means that there is a small delay after the signal is processed. Keep in mind
  1127. that the delay it produces is the attack time you set.
  1128. The filter accepts the following options:
  1129. @table @option
  1130. @item level_in
  1131. Set input gain. Default is 1.
  1132. @item level_out
  1133. Set output gain. Default is 1.
  1134. @item limit
  1135. Don't let signals above this level pass the limiter. Default is 1.
  1136. @item attack
  1137. The limiter will reach its attenuation level in this amount of time in
  1138. milliseconds. Default is 5 milliseconds.
  1139. @item release
  1140. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1141. Default is 50 milliseconds.
  1142. @item asc
  1143. When gain reduction is always needed ASC takes care of releasing to an
  1144. average reduction level rather than reaching a reduction of 0 in the release
  1145. time.
  1146. @item asc_level
  1147. Select how much the release time is affected by ASC, 0 means nearly no changes
  1148. in release time while 1 produces higher release times.
  1149. @item level
  1150. Auto level output signal. Default is enabled.
  1151. This normalizes audio back to 0dB if enabled.
  1152. @end table
  1153. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1154. with @ref{aresample} before applying this filter.
  1155. @section allpass
  1156. Apply a two-pole all-pass filter with central frequency (in Hz)
  1157. @var{frequency}, and filter-width @var{width}.
  1158. An all-pass filter changes the audio's frequency to phase relationship
  1159. without changing its frequency to amplitude relationship.
  1160. The filter accepts the following options:
  1161. @table @option
  1162. @item frequency, f
  1163. Set frequency in Hz.
  1164. @item width_type, t
  1165. Set method to specify band-width of filter.
  1166. @table @option
  1167. @item h
  1168. Hz
  1169. @item q
  1170. Q-Factor
  1171. @item o
  1172. octave
  1173. @item s
  1174. slope
  1175. @item k
  1176. kHz
  1177. @end table
  1178. @item width, w
  1179. Specify the band-width of a filter in width_type units.
  1180. @item channels, c
  1181. Specify which channels to filter, by default all available are filtered.
  1182. @end table
  1183. @subsection Commands
  1184. This filter supports the following commands:
  1185. @table @option
  1186. @item frequency, f
  1187. Change allpass frequency.
  1188. Syntax for the command is : "@var{frequency}"
  1189. @item width_type, t
  1190. Change allpass width_type.
  1191. Syntax for the command is : "@var{width_type}"
  1192. @item width, w
  1193. Change allpass width.
  1194. Syntax for the command is : "@var{width}"
  1195. @end table
  1196. @section aloop
  1197. Loop audio samples.
  1198. The filter accepts the following options:
  1199. @table @option
  1200. @item loop
  1201. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1202. Default is 0.
  1203. @item size
  1204. Set maximal number of samples. Default is 0.
  1205. @item start
  1206. Set first sample of loop. Default is 0.
  1207. @end table
  1208. @anchor{amerge}
  1209. @section amerge
  1210. Merge two or more audio streams into a single multi-channel stream.
  1211. The filter accepts the following options:
  1212. @table @option
  1213. @item inputs
  1214. Set the number of inputs. Default is 2.
  1215. @end table
  1216. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1217. the channel layout of the output will be set accordingly and the channels
  1218. will be reordered as necessary. If the channel layouts of the inputs are not
  1219. disjoint, the output will have all the channels of the first input then all
  1220. the channels of the second input, in that order, and the channel layout of
  1221. the output will be the default value corresponding to the total number of
  1222. channels.
  1223. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1224. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1225. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1226. first input, b1 is the first channel of the second input).
  1227. On the other hand, if both input are in stereo, the output channels will be
  1228. in the default order: a1, a2, b1, b2, and the channel layout will be
  1229. arbitrarily set to 4.0, which may or may not be the expected value.
  1230. All inputs must have the same sample rate, and format.
  1231. If inputs do not have the same duration, the output will stop with the
  1232. shortest.
  1233. @subsection Examples
  1234. @itemize
  1235. @item
  1236. Merge two mono files into a stereo stream:
  1237. @example
  1238. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1239. @end example
  1240. @item
  1241. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1242. @example
  1243. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  1244. @end example
  1245. @end itemize
  1246. @section amix
  1247. Mixes multiple audio inputs into a single output.
  1248. Note that this filter only supports float samples (the @var{amerge}
  1249. and @var{pan} audio filters support many formats). If the @var{amix}
  1250. input has integer samples then @ref{aresample} will be automatically
  1251. inserted to perform the conversion to float samples.
  1252. For example
  1253. @example
  1254. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1255. @end example
  1256. will mix 3 input audio streams to a single output with the same duration as the
  1257. first input and a dropout transition time of 3 seconds.
  1258. It accepts the following parameters:
  1259. @table @option
  1260. @item inputs
  1261. The number of inputs. If unspecified, it defaults to 2.
  1262. @item duration
  1263. How to determine the end-of-stream.
  1264. @table @option
  1265. @item longest
  1266. The duration of the longest input. (default)
  1267. @item shortest
  1268. The duration of the shortest input.
  1269. @item first
  1270. The duration of the first input.
  1271. @end table
  1272. @item dropout_transition
  1273. The transition time, in seconds, for volume renormalization when an input
  1274. stream ends. The default value is 2 seconds.
  1275. @item weights
  1276. Specify weight of each input audio stream as sequence.
  1277. Each weight is separated by space. By default all inputs have same weight.
  1278. @end table
  1279. @section amultiply
  1280. Multiply first audio stream with second audio stream and store result
  1281. in output audio stream. Multiplication is done by multiplying each
  1282. sample from first stream with sample at same position from second stream.
  1283. With this element-wise multiplication one can create amplitude fades and
  1284. amplitude modulations.
  1285. @section anequalizer
  1286. High-order parametric multiband equalizer for each channel.
  1287. It accepts the following parameters:
  1288. @table @option
  1289. @item params
  1290. This option string is in format:
  1291. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1292. Each equalizer band is separated by '|'.
  1293. @table @option
  1294. @item chn
  1295. Set channel number to which equalization will be applied.
  1296. If input doesn't have that channel the entry is ignored.
  1297. @item f
  1298. Set central frequency for band.
  1299. If input doesn't have that frequency the entry is ignored.
  1300. @item w
  1301. Set band width in hertz.
  1302. @item g
  1303. Set band gain in dB.
  1304. @item t
  1305. Set filter type for band, optional, can be:
  1306. @table @samp
  1307. @item 0
  1308. Butterworth, this is default.
  1309. @item 1
  1310. Chebyshev type 1.
  1311. @item 2
  1312. Chebyshev type 2.
  1313. @end table
  1314. @end table
  1315. @item curves
  1316. With this option activated frequency response of anequalizer is displayed
  1317. in video stream.
  1318. @item size
  1319. Set video stream size. Only useful if curves option is activated.
  1320. @item mgain
  1321. Set max gain that will be displayed. Only useful if curves option is activated.
  1322. Setting this to a reasonable value makes it possible to display gain which is derived from
  1323. neighbour bands which are too close to each other and thus produce higher gain
  1324. when both are activated.
  1325. @item fscale
  1326. Set frequency scale used to draw frequency response in video output.
  1327. Can be linear or logarithmic. Default is logarithmic.
  1328. @item colors
  1329. Set color for each channel curve which is going to be displayed in video stream.
  1330. This is list of color names separated by space or by '|'.
  1331. Unrecognised or missing colors will be replaced by white color.
  1332. @end table
  1333. @subsection Examples
  1334. @itemize
  1335. @item
  1336. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1337. for first 2 channels using Chebyshev type 1 filter:
  1338. @example
  1339. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1340. @end example
  1341. @end itemize
  1342. @subsection Commands
  1343. This filter supports the following commands:
  1344. @table @option
  1345. @item change
  1346. Alter existing filter parameters.
  1347. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1348. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1349. error is returned.
  1350. @var{freq} set new frequency parameter.
  1351. @var{width} set new width parameter in herz.
  1352. @var{gain} set new gain parameter in dB.
  1353. Full filter invocation with asendcmd may look like this:
  1354. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1355. @end table
  1356. @section anlmdn
  1357. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1358. Each sample is adjusted by looking for other samples with similar contexts. This
  1359. context similarity is defined by comparing their surrounding patches of size
  1360. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1361. The filter accepts the following options.
  1362. @table @option
  1363. @item s
  1364. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1365. @item p
  1366. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1367. Default value is 2 milliseconds.
  1368. @item r
  1369. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1370. Default value is 6 milliseconds.
  1371. @item o
  1372. Set the output mode.
  1373. It accepts the following values:
  1374. @table @option
  1375. @item i
  1376. Pass input unchanged.
  1377. @item o
  1378. Pass noise filtered out.
  1379. @item n
  1380. Pass only noise.
  1381. Default value is @var{o}.
  1382. @end table
  1383. @item m
  1384. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1385. @end table
  1386. @subsection Commands
  1387. This filter supports the following commands:
  1388. @table @option
  1389. @item s
  1390. Change denoise strength. Argument is single float number.
  1391. Syntax for the command is : "@var{s}"
  1392. @item o
  1393. Change output mode.
  1394. Syntax for the command is : "i", "o" or "n" string.
  1395. @end table
  1396. @section anull
  1397. Pass the audio source unchanged to the output.
  1398. @section apad
  1399. Pad the end of an audio stream with silence.
  1400. This can be used together with @command{ffmpeg} @option{-shortest} to
  1401. extend audio streams to the same length as the video stream.
  1402. A description of the accepted options follows.
  1403. @table @option
  1404. @item packet_size
  1405. Set silence packet size. Default value is 4096.
  1406. @item pad_len
  1407. Set the number of samples of silence to add to the end. After the
  1408. value is reached, the stream is terminated. This option is mutually
  1409. exclusive with @option{whole_len}.
  1410. @item whole_len
  1411. Set the minimum total number of samples in the output audio stream. If
  1412. the value is longer than the input audio length, silence is added to
  1413. the end, until the value is reached. This option is mutually exclusive
  1414. with @option{pad_len}.
  1415. @item pad_dur
  1416. Specify the duration of samples of silence to add. See
  1417. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1418. for the accepted syntax. Used only if set to non-zero value.
  1419. @item whole_dur
  1420. Specify the minimum total duration in the output audio stream. See
  1421. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1422. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1423. the input audio length, silence is added to the end, until the value is reached.
  1424. This option is mutually exclusive with @option{pad_dur}
  1425. @end table
  1426. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1427. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1428. the input stream indefinitely.
  1429. @subsection Examples
  1430. @itemize
  1431. @item
  1432. Add 1024 samples of silence to the end of the input:
  1433. @example
  1434. apad=pad_len=1024
  1435. @end example
  1436. @item
  1437. Make sure the audio output will contain at least 10000 samples, pad
  1438. the input with silence if required:
  1439. @example
  1440. apad=whole_len=10000
  1441. @end example
  1442. @item
  1443. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1444. video stream will always result the shortest and will be converted
  1445. until the end in the output file when using the @option{shortest}
  1446. option:
  1447. @example
  1448. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1449. @end example
  1450. @end itemize
  1451. @section aphaser
  1452. Add a phasing effect to the input audio.
  1453. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1454. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1455. A description of the accepted parameters follows.
  1456. @table @option
  1457. @item in_gain
  1458. Set input gain. Default is 0.4.
  1459. @item out_gain
  1460. Set output gain. Default is 0.74
  1461. @item delay
  1462. Set delay in milliseconds. Default is 3.0.
  1463. @item decay
  1464. Set decay. Default is 0.4.
  1465. @item speed
  1466. Set modulation speed in Hz. Default is 0.5.
  1467. @item type
  1468. Set modulation type. Default is triangular.
  1469. It accepts the following values:
  1470. @table @samp
  1471. @item triangular, t
  1472. @item sinusoidal, s
  1473. @end table
  1474. @end table
  1475. @section apulsator
  1476. Audio pulsator is something between an autopanner and a tremolo.
  1477. But it can produce funny stereo effects as well. Pulsator changes the volume
  1478. of the left and right channel based on a LFO (low frequency oscillator) with
  1479. different waveforms and shifted phases.
  1480. This filter have the ability to define an offset between left and right
  1481. channel. An offset of 0 means that both LFO shapes match each other.
  1482. The left and right channel are altered equally - a conventional tremolo.
  1483. An offset of 50% means that the shape of the right channel is exactly shifted
  1484. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1485. an autopanner. At 1 both curves match again. Every setting in between moves the
  1486. phase shift gapless between all stages and produces some "bypassing" sounds with
  1487. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1488. the 0.5) the faster the signal passes from the left to the right speaker.
  1489. The filter accepts the following options:
  1490. @table @option
  1491. @item level_in
  1492. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1493. @item level_out
  1494. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1495. @item mode
  1496. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1497. sawup or sawdown. Default is sine.
  1498. @item amount
  1499. Set modulation. Define how much of original signal is affected by the LFO.
  1500. @item offset_l
  1501. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1502. @item offset_r
  1503. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1504. @item width
  1505. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1506. @item timing
  1507. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1508. @item bpm
  1509. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1510. is set to bpm.
  1511. @item ms
  1512. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1513. is set to ms.
  1514. @item hz
  1515. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1516. if timing is set to hz.
  1517. @end table
  1518. @anchor{aresample}
  1519. @section aresample
  1520. Resample the input audio to the specified parameters, using the
  1521. libswresample library. If none are specified then the filter will
  1522. automatically convert between its input and output.
  1523. This filter is also able to stretch/squeeze the audio data to make it match
  1524. the timestamps or to inject silence / cut out audio to make it match the
  1525. timestamps, do a combination of both or do neither.
  1526. The filter accepts the syntax
  1527. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1528. expresses a sample rate and @var{resampler_options} is a list of
  1529. @var{key}=@var{value} pairs, separated by ":". See the
  1530. @ref{Resampler Options,,"Resampler Options" section in the
  1531. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1532. for the complete list of supported options.
  1533. @subsection Examples
  1534. @itemize
  1535. @item
  1536. Resample the input audio to 44100Hz:
  1537. @example
  1538. aresample=44100
  1539. @end example
  1540. @item
  1541. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1542. samples per second compensation:
  1543. @example
  1544. aresample=async=1000
  1545. @end example
  1546. @end itemize
  1547. @section areverse
  1548. Reverse an audio clip.
  1549. Warning: This filter requires memory to buffer the entire clip, so trimming
  1550. is suggested.
  1551. @subsection Examples
  1552. @itemize
  1553. @item
  1554. Take the first 5 seconds of a clip, and reverse it.
  1555. @example
  1556. atrim=end=5,areverse
  1557. @end example
  1558. @end itemize
  1559. @section asetnsamples
  1560. Set the number of samples per each output audio frame.
  1561. The last output packet may contain a different number of samples, as
  1562. the filter will flush all the remaining samples when the input audio
  1563. signals its end.
  1564. The filter accepts the following options:
  1565. @table @option
  1566. @item nb_out_samples, n
  1567. Set the number of frames per each output audio frame. The number is
  1568. intended as the number of samples @emph{per each channel}.
  1569. Default value is 1024.
  1570. @item pad, p
  1571. If set to 1, the filter will pad the last audio frame with zeroes, so
  1572. that the last frame will contain the same number of samples as the
  1573. previous ones. Default value is 1.
  1574. @end table
  1575. For example, to set the number of per-frame samples to 1234 and
  1576. disable padding for the last frame, use:
  1577. @example
  1578. asetnsamples=n=1234:p=0
  1579. @end example
  1580. @section asetrate
  1581. Set the sample rate without altering the PCM data.
  1582. This will result in a change of speed and pitch.
  1583. The filter accepts the following options:
  1584. @table @option
  1585. @item sample_rate, r
  1586. Set the output sample rate. Default is 44100 Hz.
  1587. @end table
  1588. @section ashowinfo
  1589. Show a line containing various information for each input audio frame.
  1590. The input audio is not modified.
  1591. The shown line contains a sequence of key/value pairs of the form
  1592. @var{key}:@var{value}.
  1593. The following values are shown in the output:
  1594. @table @option
  1595. @item n
  1596. The (sequential) number of the input frame, starting from 0.
  1597. @item pts
  1598. The presentation timestamp of the input frame, in time base units; the time base
  1599. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1600. @item pts_time
  1601. The presentation timestamp of the input frame in seconds.
  1602. @item pos
  1603. position of the frame in the input stream, -1 if this information in
  1604. unavailable and/or meaningless (for example in case of synthetic audio)
  1605. @item fmt
  1606. The sample format.
  1607. @item chlayout
  1608. The channel layout.
  1609. @item rate
  1610. The sample rate for the audio frame.
  1611. @item nb_samples
  1612. The number of samples (per channel) in the frame.
  1613. @item checksum
  1614. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1615. audio, the data is treated as if all the planes were concatenated.
  1616. @item plane_checksums
  1617. A list of Adler-32 checksums for each data plane.
  1618. @end table
  1619. @section asoftclip
  1620. Apply audio soft clipping.
  1621. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1622. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1623. This filter accepts the following options:
  1624. @table @option
  1625. @item type
  1626. Set type of soft-clipping.
  1627. It accepts the following values:
  1628. @table @option
  1629. @item tanh
  1630. @item atan
  1631. @item cubic
  1632. @item exp
  1633. @item alg
  1634. @item quintic
  1635. @item sin
  1636. @end table
  1637. @item param
  1638. Set additional parameter which controls sigmoid function.
  1639. @end table
  1640. @section asr
  1641. Automatic Speech Recognition
  1642. This filter uses PocketSphinx for speech recognition. To enable
  1643. compilation of this filter, you need to configure FFmpeg with
  1644. @code{--enable-pocketsphinx}.
  1645. It accepts the following options:
  1646. @table @option
  1647. @item rate
  1648. Set sampling rate of input audio. Defaults is @code{16000}.
  1649. This need to match speech models, otherwise one will get poor results.
  1650. @item hmm
  1651. Set dictionary containing acoustic model files.
  1652. @item dict
  1653. Set pronunciation dictionary.
  1654. @item lm
  1655. Set language model file.
  1656. @item lmctl
  1657. Set language model set.
  1658. @item lmname
  1659. Set which language model to use.
  1660. @item logfn
  1661. Set output for log messages.
  1662. @end table
  1663. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1664. @anchor{astats}
  1665. @section astats
  1666. Display time domain statistical information about the audio channels.
  1667. Statistics are calculated and displayed for each audio channel and,
  1668. where applicable, an overall figure is also given.
  1669. It accepts the following option:
  1670. @table @option
  1671. @item length
  1672. Short window length in seconds, used for peak and trough RMS measurement.
  1673. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1674. @item metadata
  1675. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1676. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1677. disabled.
  1678. Available keys for each channel are:
  1679. DC_offset
  1680. Min_level
  1681. Max_level
  1682. Min_difference
  1683. Max_difference
  1684. Mean_difference
  1685. RMS_difference
  1686. Peak_level
  1687. RMS_peak
  1688. RMS_trough
  1689. Crest_factor
  1690. Flat_factor
  1691. Peak_count
  1692. Bit_depth
  1693. Dynamic_range
  1694. Zero_crossings
  1695. Zero_crossings_rate
  1696. Number_of_NaNs
  1697. Number_of_Infs
  1698. Number_of_denormals
  1699. and for Overall:
  1700. DC_offset
  1701. Min_level
  1702. Max_level
  1703. Min_difference
  1704. Max_difference
  1705. Mean_difference
  1706. RMS_difference
  1707. Peak_level
  1708. RMS_level
  1709. RMS_peak
  1710. RMS_trough
  1711. Flat_factor
  1712. Peak_count
  1713. Bit_depth
  1714. Number_of_samples
  1715. Number_of_NaNs
  1716. Number_of_Infs
  1717. Number_of_denormals
  1718. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1719. this @code{lavfi.astats.Overall.Peak_count}.
  1720. For description what each key means read below.
  1721. @item reset
  1722. Set number of frame after which stats are going to be recalculated.
  1723. Default is disabled.
  1724. @item measure_perchannel
  1725. Select the entries which need to be measured per channel. The metadata keys can
  1726. be used as flags, default is @option{all} which measures everything.
  1727. @option{none} disables all per channel measurement.
  1728. @item measure_overall
  1729. Select the entries which need to be measured overall. The metadata keys can
  1730. be used as flags, default is @option{all} which measures everything.
  1731. @option{none} disables all overall measurement.
  1732. @end table
  1733. A description of each shown parameter follows:
  1734. @table @option
  1735. @item DC offset
  1736. Mean amplitude displacement from zero.
  1737. @item Min level
  1738. Minimal sample level.
  1739. @item Max level
  1740. Maximal sample level.
  1741. @item Min difference
  1742. Minimal difference between two consecutive samples.
  1743. @item Max difference
  1744. Maximal difference between two consecutive samples.
  1745. @item Mean difference
  1746. Mean difference between two consecutive samples.
  1747. The average of each difference between two consecutive samples.
  1748. @item RMS difference
  1749. Root Mean Square difference between two consecutive samples.
  1750. @item Peak level dB
  1751. @item RMS level dB
  1752. Standard peak and RMS level measured in dBFS.
  1753. @item RMS peak dB
  1754. @item RMS trough dB
  1755. Peak and trough values for RMS level measured over a short window.
  1756. @item Crest factor
  1757. Standard ratio of peak to RMS level (note: not in dB).
  1758. @item Flat factor
  1759. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1760. (i.e. either @var{Min level} or @var{Max level}).
  1761. @item Peak count
  1762. Number of occasions (not the number of samples) that the signal attained either
  1763. @var{Min level} or @var{Max level}.
  1764. @item Bit depth
  1765. Overall bit depth of audio. Number of bits used for each sample.
  1766. @item Dynamic range
  1767. Measured dynamic range of audio in dB.
  1768. @item Zero crossings
  1769. Number of points where the waveform crosses the zero level axis.
  1770. @item Zero crossings rate
  1771. Rate of Zero crossings and number of audio samples.
  1772. @end table
  1773. @section atempo
  1774. Adjust audio tempo.
  1775. The filter accepts exactly one parameter, the audio tempo. If not
  1776. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1777. be in the [0.5, 100.0] range.
  1778. Note that tempo greater than 2 will skip some samples rather than
  1779. blend them in. If for any reason this is a concern it is always
  1780. possible to daisy-chain several instances of atempo to achieve the
  1781. desired product tempo.
  1782. @subsection Examples
  1783. @itemize
  1784. @item
  1785. Slow down audio to 80% tempo:
  1786. @example
  1787. atempo=0.8
  1788. @end example
  1789. @item
  1790. To speed up audio to 300% tempo:
  1791. @example
  1792. atempo=3
  1793. @end example
  1794. @item
  1795. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1796. @example
  1797. atempo=sqrt(3),atempo=sqrt(3)
  1798. @end example
  1799. @end itemize
  1800. @section atrim
  1801. Trim the input so that the output contains one continuous subpart of the input.
  1802. It accepts the following parameters:
  1803. @table @option
  1804. @item start
  1805. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1806. sample with the timestamp @var{start} will be the first sample in the output.
  1807. @item end
  1808. Specify time of the first audio sample that will be dropped, i.e. the
  1809. audio sample immediately preceding the one with the timestamp @var{end} will be
  1810. the last sample in the output.
  1811. @item start_pts
  1812. Same as @var{start}, except this option sets the start timestamp in samples
  1813. instead of seconds.
  1814. @item end_pts
  1815. Same as @var{end}, except this option sets the end timestamp in samples instead
  1816. of seconds.
  1817. @item duration
  1818. The maximum duration of the output in seconds.
  1819. @item start_sample
  1820. The number of the first sample that should be output.
  1821. @item end_sample
  1822. The number of the first sample that should be dropped.
  1823. @end table
  1824. @option{start}, @option{end}, and @option{duration} are expressed as time
  1825. duration specifications; see
  1826. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1827. Note that the first two sets of the start/end options and the @option{duration}
  1828. option look at the frame timestamp, while the _sample options simply count the
  1829. samples that pass through the filter. So start/end_pts and start/end_sample will
  1830. give different results when the timestamps are wrong, inexact or do not start at
  1831. zero. Also note that this filter does not modify the timestamps. If you wish
  1832. to have the output timestamps start at zero, insert the asetpts filter after the
  1833. atrim filter.
  1834. If multiple start or end options are set, this filter tries to be greedy and
  1835. keep all samples that match at least one of the specified constraints. To keep
  1836. only the part that matches all the constraints at once, chain multiple atrim
  1837. filters.
  1838. The defaults are such that all the input is kept. So it is possible to set e.g.
  1839. just the end values to keep everything before the specified time.
  1840. Examples:
  1841. @itemize
  1842. @item
  1843. Drop everything except the second minute of input:
  1844. @example
  1845. ffmpeg -i INPUT -af atrim=60:120
  1846. @end example
  1847. @item
  1848. Keep only the first 1000 samples:
  1849. @example
  1850. ffmpeg -i INPUT -af atrim=end_sample=1000
  1851. @end example
  1852. @end itemize
  1853. @section bandpass
  1854. Apply a two-pole Butterworth band-pass filter with central
  1855. frequency @var{frequency}, and (3dB-point) band-width width.
  1856. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1857. instead of the default: constant 0dB peak gain.
  1858. The filter roll off at 6dB per octave (20dB per decade).
  1859. The filter accepts the following options:
  1860. @table @option
  1861. @item frequency, f
  1862. Set the filter's central frequency. Default is @code{3000}.
  1863. @item csg
  1864. Constant skirt gain if set to 1. Defaults to 0.
  1865. @item width_type, t
  1866. Set method to specify band-width of filter.
  1867. @table @option
  1868. @item h
  1869. Hz
  1870. @item q
  1871. Q-Factor
  1872. @item o
  1873. octave
  1874. @item s
  1875. slope
  1876. @item k
  1877. kHz
  1878. @end table
  1879. @item width, w
  1880. Specify the band-width of a filter in width_type units.
  1881. @item channels, c
  1882. Specify which channels to filter, by default all available are filtered.
  1883. @end table
  1884. @subsection Commands
  1885. This filter supports the following commands:
  1886. @table @option
  1887. @item frequency, f
  1888. Change bandpass frequency.
  1889. Syntax for the command is : "@var{frequency}"
  1890. @item width_type, t
  1891. Change bandpass width_type.
  1892. Syntax for the command is : "@var{width_type}"
  1893. @item width, w
  1894. Change bandpass width.
  1895. Syntax for the command is : "@var{width}"
  1896. @end table
  1897. @section bandreject
  1898. Apply a two-pole Butterworth band-reject filter with central
  1899. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1900. The filter roll off at 6dB per octave (20dB per decade).
  1901. The filter accepts the following options:
  1902. @table @option
  1903. @item frequency, f
  1904. Set the filter's central frequency. Default is @code{3000}.
  1905. @item width_type, t
  1906. Set method to specify band-width of filter.
  1907. @table @option
  1908. @item h
  1909. Hz
  1910. @item q
  1911. Q-Factor
  1912. @item o
  1913. octave
  1914. @item s
  1915. slope
  1916. @item k
  1917. kHz
  1918. @end table
  1919. @item width, w
  1920. Specify the band-width of a filter in width_type units.
  1921. @item channels, c
  1922. Specify which channels to filter, by default all available are filtered.
  1923. @end table
  1924. @subsection Commands
  1925. This filter supports the following commands:
  1926. @table @option
  1927. @item frequency, f
  1928. Change bandreject frequency.
  1929. Syntax for the command is : "@var{frequency}"
  1930. @item width_type, t
  1931. Change bandreject width_type.
  1932. Syntax for the command is : "@var{width_type}"
  1933. @item width, w
  1934. Change bandreject width.
  1935. Syntax for the command is : "@var{width}"
  1936. @end table
  1937. @section bass, lowshelf
  1938. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1939. shelving filter with a response similar to that of a standard
  1940. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1941. The filter accepts the following options:
  1942. @table @option
  1943. @item gain, g
  1944. Give the gain at 0 Hz. Its useful range is about -20
  1945. (for a large cut) to +20 (for a large boost).
  1946. Beware of clipping when using a positive gain.
  1947. @item frequency, f
  1948. Set the filter's central frequency and so can be used
  1949. to extend or reduce the frequency range to be boosted or cut.
  1950. The default value is @code{100} Hz.
  1951. @item width_type, t
  1952. Set method to specify band-width of filter.
  1953. @table @option
  1954. @item h
  1955. Hz
  1956. @item q
  1957. Q-Factor
  1958. @item o
  1959. octave
  1960. @item s
  1961. slope
  1962. @item k
  1963. kHz
  1964. @end table
  1965. @item width, w
  1966. Determine how steep is the filter's shelf transition.
  1967. @item channels, c
  1968. Specify which channels to filter, by default all available are filtered.
  1969. @end table
  1970. @subsection Commands
  1971. This filter supports the following commands:
  1972. @table @option
  1973. @item frequency, f
  1974. Change bass frequency.
  1975. Syntax for the command is : "@var{frequency}"
  1976. @item width_type, t
  1977. Change bass width_type.
  1978. Syntax for the command is : "@var{width_type}"
  1979. @item width, w
  1980. Change bass width.
  1981. Syntax for the command is : "@var{width}"
  1982. @item gain, g
  1983. Change bass gain.
  1984. Syntax for the command is : "@var{gain}"
  1985. @end table
  1986. @section biquad
  1987. Apply a biquad IIR filter with the given coefficients.
  1988. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1989. are the numerator and denominator coefficients respectively.
  1990. and @var{channels}, @var{c} specify which channels to filter, by default all
  1991. available are filtered.
  1992. @subsection Commands
  1993. This filter supports the following commands:
  1994. @table @option
  1995. @item a0
  1996. @item a1
  1997. @item a2
  1998. @item b0
  1999. @item b1
  2000. @item b2
  2001. Change biquad parameter.
  2002. Syntax for the command is : "@var{value}"
  2003. @end table
  2004. @section bs2b
  2005. Bauer stereo to binaural transformation, which improves headphone listening of
  2006. stereo audio records.
  2007. To enable compilation of this filter you need to configure FFmpeg with
  2008. @code{--enable-libbs2b}.
  2009. It accepts the following parameters:
  2010. @table @option
  2011. @item profile
  2012. Pre-defined crossfeed level.
  2013. @table @option
  2014. @item default
  2015. Default level (fcut=700, feed=50).
  2016. @item cmoy
  2017. Chu Moy circuit (fcut=700, feed=60).
  2018. @item jmeier
  2019. Jan Meier circuit (fcut=650, feed=95).
  2020. @end table
  2021. @item fcut
  2022. Cut frequency (in Hz).
  2023. @item feed
  2024. Feed level (in Hz).
  2025. @end table
  2026. @section channelmap
  2027. Remap input channels to new locations.
  2028. It accepts the following parameters:
  2029. @table @option
  2030. @item map
  2031. Map channels from input to output. The argument is a '|'-separated list of
  2032. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2033. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2034. channel (e.g. FL for front left) or its index in the input channel layout.
  2035. @var{out_channel} is the name of the output channel or its index in the output
  2036. channel layout. If @var{out_channel} is not given then it is implicitly an
  2037. index, starting with zero and increasing by one for each mapping.
  2038. @item channel_layout
  2039. The channel layout of the output stream.
  2040. @end table
  2041. If no mapping is present, the filter will implicitly map input channels to
  2042. output channels, preserving indices.
  2043. @subsection Examples
  2044. @itemize
  2045. @item
  2046. For example, assuming a 5.1+downmix input MOV file,
  2047. @example
  2048. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2049. @end example
  2050. will create an output WAV file tagged as stereo from the downmix channels of
  2051. the input.
  2052. @item
  2053. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2054. @example
  2055. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2056. @end example
  2057. @end itemize
  2058. @section channelsplit
  2059. Split each channel from an input audio stream into a separate output stream.
  2060. It accepts the following parameters:
  2061. @table @option
  2062. @item channel_layout
  2063. The channel layout of the input stream. The default is "stereo".
  2064. @item channels
  2065. A channel layout describing the channels to be extracted as separate output streams
  2066. or "all" to extract each input channel as a separate stream. The default is "all".
  2067. Choosing channels not present in channel layout in the input will result in an error.
  2068. @end table
  2069. @subsection Examples
  2070. @itemize
  2071. @item
  2072. For example, assuming a stereo input MP3 file,
  2073. @example
  2074. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2075. @end example
  2076. will create an output Matroska file with two audio streams, one containing only
  2077. the left channel and the other the right channel.
  2078. @item
  2079. Split a 5.1 WAV file into per-channel files:
  2080. @example
  2081. ffmpeg -i in.wav -filter_complex
  2082. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2083. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2084. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2085. side_right.wav
  2086. @end example
  2087. @item
  2088. Extract only LFE from a 5.1 WAV file:
  2089. @example
  2090. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2091. -map '[LFE]' lfe.wav
  2092. @end example
  2093. @end itemize
  2094. @section chorus
  2095. Add a chorus effect to the audio.
  2096. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2097. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2098. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2099. The modulation depth defines the range the modulated delay is played before or after
  2100. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2101. sound tuned around the original one, like in a chorus where some vocals are slightly
  2102. off key.
  2103. It accepts the following parameters:
  2104. @table @option
  2105. @item in_gain
  2106. Set input gain. Default is 0.4.
  2107. @item out_gain
  2108. Set output gain. Default is 0.4.
  2109. @item delays
  2110. Set delays. A typical delay is around 40ms to 60ms.
  2111. @item decays
  2112. Set decays.
  2113. @item speeds
  2114. Set speeds.
  2115. @item depths
  2116. Set depths.
  2117. @end table
  2118. @subsection Examples
  2119. @itemize
  2120. @item
  2121. A single delay:
  2122. @example
  2123. chorus=0.7:0.9:55:0.4:0.25:2
  2124. @end example
  2125. @item
  2126. Two delays:
  2127. @example
  2128. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2129. @end example
  2130. @item
  2131. Fuller sounding chorus with three delays:
  2132. @example
  2133. chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3
  2134. @end example
  2135. @end itemize
  2136. @section compand
  2137. Compress or expand the audio's dynamic range.
  2138. It accepts the following parameters:
  2139. @table @option
  2140. @item attacks
  2141. @item decays
  2142. A list of times in seconds for each channel over which the instantaneous level
  2143. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2144. increase of volume and @var{decays} refers to decrease of volume. For most
  2145. situations, the attack time (response to the audio getting louder) should be
  2146. shorter than the decay time, because the human ear is more sensitive to sudden
  2147. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2148. a typical value for decay is 0.8 seconds.
  2149. If specified number of attacks & decays is lower than number of channels, the last
  2150. set attack/decay will be used for all remaining channels.
  2151. @item points
  2152. A list of points for the transfer function, specified in dB relative to the
  2153. maximum possible signal amplitude. Each key points list must be defined using
  2154. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2155. @code{x0/y0 x1/y1 x2/y2 ....}
  2156. The input values must be in strictly increasing order but the transfer function
  2157. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2158. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2159. function are @code{-70/-70|-60/-20|1/0}.
  2160. @item soft-knee
  2161. Set the curve radius in dB for all joints. It defaults to 0.01.
  2162. @item gain
  2163. Set the additional gain in dB to be applied at all points on the transfer
  2164. function. This allows for easy adjustment of the overall gain.
  2165. It defaults to 0.
  2166. @item volume
  2167. Set an initial volume, in dB, to be assumed for each channel when filtering
  2168. starts. This permits the user to supply a nominal level initially, so that, for
  2169. example, a very large gain is not applied to initial signal levels before the
  2170. companding has begun to operate. A typical value for audio which is initially
  2171. quiet is -90 dB. It defaults to 0.
  2172. @item delay
  2173. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2174. delayed before being fed to the volume adjuster. Specifying a delay
  2175. approximately equal to the attack/decay times allows the filter to effectively
  2176. operate in predictive rather than reactive mode. It defaults to 0.
  2177. @end table
  2178. @subsection Examples
  2179. @itemize
  2180. @item
  2181. Make music with both quiet and loud passages suitable for listening to in a
  2182. noisy environment:
  2183. @example
  2184. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2185. @end example
  2186. Another example for audio with whisper and explosion parts:
  2187. @example
  2188. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2189. @end example
  2190. @item
  2191. A noise gate for when the noise is at a lower level than the signal:
  2192. @example
  2193. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2194. @end example
  2195. @item
  2196. Here is another noise gate, this time for when the noise is at a higher level
  2197. than the signal (making it, in some ways, similar to squelch):
  2198. @example
  2199. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2200. @end example
  2201. @item
  2202. 2:1 compression starting at -6dB:
  2203. @example
  2204. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2205. @end example
  2206. @item
  2207. 2:1 compression starting at -9dB:
  2208. @example
  2209. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2210. @end example
  2211. @item
  2212. 2:1 compression starting at -12dB:
  2213. @example
  2214. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2215. @end example
  2216. @item
  2217. 2:1 compression starting at -18dB:
  2218. @example
  2219. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2220. @end example
  2221. @item
  2222. 3:1 compression starting at -15dB:
  2223. @example
  2224. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2225. @end example
  2226. @item
  2227. Compressor/Gate:
  2228. @example
  2229. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2230. @end example
  2231. @item
  2232. Expander:
  2233. @example
  2234. compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3
  2235. @end example
  2236. @item
  2237. Hard limiter at -6dB:
  2238. @example
  2239. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2240. @end example
  2241. @item
  2242. Hard limiter at -12dB:
  2243. @example
  2244. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2245. @end example
  2246. @item
  2247. Hard noise gate at -35 dB:
  2248. @example
  2249. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2250. @end example
  2251. @item
  2252. Soft limiter:
  2253. @example
  2254. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2255. @end example
  2256. @end itemize
  2257. @section compensationdelay
  2258. Compensation Delay Line is a metric based delay to compensate differing
  2259. positions of microphones or speakers.
  2260. For example, you have recorded guitar with two microphones placed in
  2261. different location. Because the front of sound wave has fixed speed in
  2262. normal conditions, the phasing of microphones can vary and depends on
  2263. their location and interposition. The best sound mix can be achieved when
  2264. these microphones are in phase (synchronized). Note that distance of
  2265. ~30 cm between microphones makes one microphone to capture signal in
  2266. antiphase to another microphone. That makes the final mix sounding moody.
  2267. This filter helps to solve phasing problems by adding different delays
  2268. to each microphone track and make them synchronized.
  2269. The best result can be reached when you take one track as base and
  2270. synchronize other tracks one by one with it.
  2271. Remember that synchronization/delay tolerance depends on sample rate, too.
  2272. Higher sample rates will give more tolerance.
  2273. It accepts the following parameters:
  2274. @table @option
  2275. @item mm
  2276. Set millimeters distance. This is compensation distance for fine tuning.
  2277. Default is 0.
  2278. @item cm
  2279. Set cm distance. This is compensation distance for tightening distance setup.
  2280. Default is 0.
  2281. @item m
  2282. Set meters distance. This is compensation distance for hard distance setup.
  2283. Default is 0.
  2284. @item dry
  2285. Set dry amount. Amount of unprocessed (dry) signal.
  2286. Default is 0.
  2287. @item wet
  2288. Set wet amount. Amount of processed (wet) signal.
  2289. Default is 1.
  2290. @item temp
  2291. Set temperature degree in Celsius. This is the temperature of the environment.
  2292. Default is 20.
  2293. @end table
  2294. @section crossfeed
  2295. Apply headphone crossfeed filter.
  2296. Crossfeed is the process of blending the left and right channels of stereo
  2297. audio recording.
  2298. It is mainly used to reduce extreme stereo separation of low frequencies.
  2299. The intent is to produce more speaker like sound to the listener.
  2300. The filter accepts the following options:
  2301. @table @option
  2302. @item strength
  2303. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2304. This sets gain of low shelf filter for side part of stereo image.
  2305. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2306. @item range
  2307. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2308. This sets cut off frequency of low shelf filter. Default is cut off near
  2309. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2310. @item level_in
  2311. Set input gain. Default is 0.9.
  2312. @item level_out
  2313. Set output gain. Default is 1.
  2314. @end table
  2315. @section crystalizer
  2316. Simple algorithm to expand audio dynamic range.
  2317. The filter accepts the following options:
  2318. @table @option
  2319. @item i
  2320. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2321. (unchanged sound) to 10.0 (maximum effect).
  2322. @item c
  2323. Enable clipping. By default is enabled.
  2324. @end table
  2325. @section dcshift
  2326. Apply a DC shift to the audio.
  2327. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2328. in the recording chain) from the audio. The effect of a DC offset is reduced
  2329. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2330. a signal has a DC offset.
  2331. @table @option
  2332. @item shift
  2333. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2334. the audio.
  2335. @item limitergain
  2336. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2337. used to prevent clipping.
  2338. @end table
  2339. @section drmeter
  2340. Measure audio dynamic range.
  2341. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2342. is found in transition material. And anything less that 8 have very poor dynamics
  2343. and is very compressed.
  2344. The filter accepts the following options:
  2345. @table @option
  2346. @item length
  2347. Set window length in seconds used to split audio into segments of equal length.
  2348. Default is 3 seconds.
  2349. @end table
  2350. @section dynaudnorm
  2351. Dynamic Audio Normalizer.
  2352. This filter applies a certain amount of gain to the input audio in order
  2353. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2354. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2355. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2356. This allows for applying extra gain to the "quiet" sections of the audio
  2357. while avoiding distortions or clipping the "loud" sections. In other words:
  2358. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2359. sections, in the sense that the volume of each section is brought to the
  2360. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2361. this goal *without* applying "dynamic range compressing". It will retain 100%
  2362. of the dynamic range *within* each section of the audio file.
  2363. @table @option
  2364. @item f
  2365. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2366. Default is 500 milliseconds.
  2367. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2368. referred to as frames. This is required, because a peak magnitude has no
  2369. meaning for just a single sample value. Instead, we need to determine the
  2370. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2371. normalizer would simply use the peak magnitude of the complete file, the
  2372. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2373. frame. The length of a frame is specified in milliseconds. By default, the
  2374. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2375. been found to give good results with most files.
  2376. Note that the exact frame length, in number of samples, will be determined
  2377. automatically, based on the sampling rate of the individual input audio file.
  2378. @item g
  2379. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2380. number. Default is 31.
  2381. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2382. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2383. is specified in frames, centered around the current frame. For the sake of
  2384. simplicity, this must be an odd number. Consequently, the default value of 31
  2385. takes into account the current frame, as well as the 15 preceding frames and
  2386. the 15 subsequent frames. Using a larger window results in a stronger
  2387. smoothing effect and thus in less gain variation, i.e. slower gain
  2388. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2389. effect and thus in more gain variation, i.e. faster gain adaptation.
  2390. In other words, the more you increase this value, the more the Dynamic Audio
  2391. Normalizer will behave like a "traditional" normalization filter. On the
  2392. contrary, the more you decrease this value, the more the Dynamic Audio
  2393. Normalizer will behave like a dynamic range compressor.
  2394. @item p
  2395. Set the target peak value. This specifies the highest permissible magnitude
  2396. level for the normalized audio input. This filter will try to approach the
  2397. target peak magnitude as closely as possible, but at the same time it also
  2398. makes sure that the normalized signal will never exceed the peak magnitude.
  2399. A frame's maximum local gain factor is imposed directly by the target peak
  2400. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2401. It is not recommended to go above this value.
  2402. @item m
  2403. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2404. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2405. factor for each input frame, i.e. the maximum gain factor that does not
  2406. result in clipping or distortion. The maximum gain factor is determined by
  2407. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2408. additionally bounds the frame's maximum gain factor by a predetermined
  2409. (global) maximum gain factor. This is done in order to avoid excessive gain
  2410. factors in "silent" or almost silent frames. By default, the maximum gain
  2411. factor is 10.0, For most inputs the default value should be sufficient and
  2412. it usually is not recommended to increase this value. Though, for input
  2413. with an extremely low overall volume level, it may be necessary to allow even
  2414. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2415. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2416. Instead, a "sigmoid" threshold function will be applied. This way, the
  2417. gain factors will smoothly approach the threshold value, but never exceed that
  2418. value.
  2419. @item r
  2420. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2421. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2422. This means that the maximum local gain factor for each frame is defined
  2423. (only) by the frame's highest magnitude sample. This way, the samples can
  2424. be amplified as much as possible without exceeding the maximum signal
  2425. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2426. Normalizer can also take into account the frame's root mean square,
  2427. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2428. determine the power of a time-varying signal. It is therefore considered
  2429. that the RMS is a better approximation of the "perceived loudness" than
  2430. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2431. frames to a constant RMS value, a uniform "perceived loudness" can be
  2432. established. If a target RMS value has been specified, a frame's local gain
  2433. factor is defined as the factor that would result in exactly that RMS value.
  2434. Note, however, that the maximum local gain factor is still restricted by the
  2435. frame's highest magnitude sample, in order to prevent clipping.
  2436. @item n
  2437. Enable channels coupling. By default is enabled.
  2438. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2439. amount. This means the same gain factor will be applied to all channels, i.e.
  2440. the maximum possible gain factor is determined by the "loudest" channel.
  2441. However, in some recordings, it may happen that the volume of the different
  2442. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2443. In this case, this option can be used to disable the channel coupling. This way,
  2444. the gain factor will be determined independently for each channel, depending
  2445. only on the individual channel's highest magnitude sample. This allows for
  2446. harmonizing the volume of the different channels.
  2447. @item c
  2448. Enable DC bias correction. By default is disabled.
  2449. An audio signal (in the time domain) is a sequence of sample values.
  2450. In the Dynamic Audio Normalizer these sample values are represented in the
  2451. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2452. audio signal, or "waveform", should be centered around the zero point.
  2453. That means if we calculate the mean value of all samples in a file, or in a
  2454. single frame, then the result should be 0.0 or at least very close to that
  2455. value. If, however, there is a significant deviation of the mean value from
  2456. 0.0, in either positive or negative direction, this is referred to as a
  2457. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2458. Audio Normalizer provides optional DC bias correction.
  2459. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2460. the mean value, or "DC correction" offset, of each input frame and subtract
  2461. that value from all of the frame's sample values which ensures those samples
  2462. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2463. boundaries, the DC correction offset values will be interpolated smoothly
  2464. between neighbouring frames.
  2465. @item b
  2466. Enable alternative boundary mode. By default is disabled.
  2467. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2468. around each frame. This includes the preceding frames as well as the
  2469. subsequent frames. However, for the "boundary" frames, located at the very
  2470. beginning and at the very end of the audio file, not all neighbouring
  2471. frames are available. In particular, for the first few frames in the audio
  2472. file, the preceding frames are not known. And, similarly, for the last few
  2473. frames in the audio file, the subsequent frames are not known. Thus, the
  2474. question arises which gain factors should be assumed for the missing frames
  2475. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2476. to deal with this situation. The default boundary mode assumes a gain factor
  2477. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2478. "fade out" at the beginning and at the end of the input, respectively.
  2479. @item s
  2480. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2481. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2482. compression. This means that signal peaks will not be pruned and thus the
  2483. full dynamic range will be retained within each local neighbourhood. However,
  2484. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2485. normalization algorithm with a more "traditional" compression.
  2486. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2487. (thresholding) function. If (and only if) the compression feature is enabled,
  2488. all input frames will be processed by a soft knee thresholding function prior
  2489. to the actual normalization process. Put simply, the thresholding function is
  2490. going to prune all samples whose magnitude exceeds a certain threshold value.
  2491. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2492. value. Instead, the threshold value will be adjusted for each individual
  2493. frame.
  2494. In general, smaller parameters result in stronger compression, and vice versa.
  2495. Values below 3.0 are not recommended, because audible distortion may appear.
  2496. @end table
  2497. @section earwax
  2498. Make audio easier to listen to on headphones.
  2499. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2500. so that when listened to on headphones the stereo image is moved from
  2501. inside your head (standard for headphones) to outside and in front of
  2502. the listener (standard for speakers).
  2503. Ported from SoX.
  2504. @section equalizer
  2505. Apply a two-pole peaking equalisation (EQ) filter. With this
  2506. filter, the signal-level at and around a selected frequency can
  2507. be increased or decreased, whilst (unlike bandpass and bandreject
  2508. filters) that at all other frequencies is unchanged.
  2509. In order to produce complex equalisation curves, this filter can
  2510. be given several times, each with a different central frequency.
  2511. The filter accepts the following options:
  2512. @table @option
  2513. @item frequency, f
  2514. Set the filter's central frequency in Hz.
  2515. @item width_type, t
  2516. Set method to specify band-width of filter.
  2517. @table @option
  2518. @item h
  2519. Hz
  2520. @item q
  2521. Q-Factor
  2522. @item o
  2523. octave
  2524. @item s
  2525. slope
  2526. @item k
  2527. kHz
  2528. @end table
  2529. @item width, w
  2530. Specify the band-width of a filter in width_type units.
  2531. @item gain, g
  2532. Set the required gain or attenuation in dB.
  2533. Beware of clipping when using a positive gain.
  2534. @item channels, c
  2535. Specify which channels to filter, by default all available are filtered.
  2536. @end table
  2537. @subsection Examples
  2538. @itemize
  2539. @item
  2540. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2541. @example
  2542. equalizer=f=1000:t=h:width=200:g=-10
  2543. @end example
  2544. @item
  2545. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2546. @example
  2547. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2548. @end example
  2549. @end itemize
  2550. @subsection Commands
  2551. This filter supports the following commands:
  2552. @table @option
  2553. @item frequency, f
  2554. Change equalizer frequency.
  2555. Syntax for the command is : "@var{frequency}"
  2556. @item width_type, t
  2557. Change equalizer width_type.
  2558. Syntax for the command is : "@var{width_type}"
  2559. @item width, w
  2560. Change equalizer width.
  2561. Syntax for the command is : "@var{width}"
  2562. @item gain, g
  2563. Change equalizer gain.
  2564. Syntax for the command is : "@var{gain}"
  2565. @end table
  2566. @section extrastereo
  2567. Linearly increases the difference between left and right channels which
  2568. adds some sort of "live" effect to playback.
  2569. The filter accepts the following options:
  2570. @table @option
  2571. @item m
  2572. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2573. (average of both channels), with 1.0 sound will be unchanged, with
  2574. -1.0 left and right channels will be swapped.
  2575. @item c
  2576. Enable clipping. By default is enabled.
  2577. @end table
  2578. @section firequalizer
  2579. Apply FIR Equalization using arbitrary frequency response.
  2580. The filter accepts the following option:
  2581. @table @option
  2582. @item gain
  2583. Set gain curve equation (in dB). The expression can contain variables:
  2584. @table @option
  2585. @item f
  2586. the evaluated frequency
  2587. @item sr
  2588. sample rate
  2589. @item ch
  2590. channel number, set to 0 when multichannels evaluation is disabled
  2591. @item chid
  2592. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2593. multichannels evaluation is disabled
  2594. @item chs
  2595. number of channels
  2596. @item chlayout
  2597. channel_layout, see libavutil/channel_layout.h
  2598. @end table
  2599. and functions:
  2600. @table @option
  2601. @item gain_interpolate(f)
  2602. interpolate gain on frequency f based on gain_entry
  2603. @item cubic_interpolate(f)
  2604. same as gain_interpolate, but smoother
  2605. @end table
  2606. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2607. @item gain_entry
  2608. Set gain entry for gain_interpolate function. The expression can
  2609. contain functions:
  2610. @table @option
  2611. @item entry(f, g)
  2612. store gain entry at frequency f with value g
  2613. @end table
  2614. This option is also available as command.
  2615. @item delay
  2616. Set filter delay in seconds. Higher value means more accurate.
  2617. Default is @code{0.01}.
  2618. @item accuracy
  2619. Set filter accuracy in Hz. Lower value means more accurate.
  2620. Default is @code{5}.
  2621. @item wfunc
  2622. Set window function. Acceptable values are:
  2623. @table @option
  2624. @item rectangular
  2625. rectangular window, useful when gain curve is already smooth
  2626. @item hann
  2627. hann window (default)
  2628. @item hamming
  2629. hamming window
  2630. @item blackman
  2631. blackman window
  2632. @item nuttall3
  2633. 3-terms continuous 1st derivative nuttall window
  2634. @item mnuttall3
  2635. minimum 3-terms discontinuous nuttall window
  2636. @item nuttall
  2637. 4-terms continuous 1st derivative nuttall window
  2638. @item bnuttall
  2639. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2640. @item bharris
  2641. blackman-harris window
  2642. @item tukey
  2643. tukey window
  2644. @end table
  2645. @item fixed
  2646. If enabled, use fixed number of audio samples. This improves speed when
  2647. filtering with large delay. Default is disabled.
  2648. @item multi
  2649. Enable multichannels evaluation on gain. Default is disabled.
  2650. @item zero_phase
  2651. Enable zero phase mode by subtracting timestamp to compensate delay.
  2652. Default is disabled.
  2653. @item scale
  2654. Set scale used by gain. Acceptable values are:
  2655. @table @option
  2656. @item linlin
  2657. linear frequency, linear gain
  2658. @item linlog
  2659. linear frequency, logarithmic (in dB) gain (default)
  2660. @item loglin
  2661. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2662. @item loglog
  2663. logarithmic frequency, logarithmic gain
  2664. @end table
  2665. @item dumpfile
  2666. Set file for dumping, suitable for gnuplot.
  2667. @item dumpscale
  2668. Set scale for dumpfile. Acceptable values are same with scale option.
  2669. Default is linlog.
  2670. @item fft2
  2671. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2672. Default is disabled.
  2673. @item min_phase
  2674. Enable minimum phase impulse response. Default is disabled.
  2675. @end table
  2676. @subsection Examples
  2677. @itemize
  2678. @item
  2679. lowpass at 1000 Hz:
  2680. @example
  2681. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2682. @end example
  2683. @item
  2684. lowpass at 1000 Hz with gain_entry:
  2685. @example
  2686. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2687. @end example
  2688. @item
  2689. custom equalization:
  2690. @example
  2691. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2692. @end example
  2693. @item
  2694. higher delay with zero phase to compensate delay:
  2695. @example
  2696. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2697. @end example
  2698. @item
  2699. lowpass on left channel, highpass on right channel:
  2700. @example
  2701. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2702. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2703. @end example
  2704. @end itemize
  2705. @section flanger
  2706. Apply a flanging effect to the audio.
  2707. The filter accepts the following options:
  2708. @table @option
  2709. @item delay
  2710. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2711. @item depth
  2712. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2713. @item regen
  2714. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2715. Default value is 0.
  2716. @item width
  2717. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2718. Default value is 71.
  2719. @item speed
  2720. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2721. @item shape
  2722. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2723. Default value is @var{sinusoidal}.
  2724. @item phase
  2725. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2726. Default value is 25.
  2727. @item interp
  2728. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2729. Default is @var{linear}.
  2730. @end table
  2731. @section haas
  2732. Apply Haas effect to audio.
  2733. Note that this makes most sense to apply on mono signals.
  2734. With this filter applied to mono signals it give some directionality and
  2735. stretches its stereo image.
  2736. The filter accepts the following options:
  2737. @table @option
  2738. @item level_in
  2739. Set input level. By default is @var{1}, or 0dB
  2740. @item level_out
  2741. Set output level. By default is @var{1}, or 0dB.
  2742. @item side_gain
  2743. Set gain applied to side part of signal. By default is @var{1}.
  2744. @item middle_source
  2745. Set kind of middle source. Can be one of the following:
  2746. @table @samp
  2747. @item left
  2748. Pick left channel.
  2749. @item right
  2750. Pick right channel.
  2751. @item mid
  2752. Pick middle part signal of stereo image.
  2753. @item side
  2754. Pick side part signal of stereo image.
  2755. @end table
  2756. @item middle_phase
  2757. Change middle phase. By default is disabled.
  2758. @item left_delay
  2759. Set left channel delay. By default is @var{2.05} milliseconds.
  2760. @item left_balance
  2761. Set left channel balance. By default is @var{-1}.
  2762. @item left_gain
  2763. Set left channel gain. By default is @var{1}.
  2764. @item left_phase
  2765. Change left phase. By default is disabled.
  2766. @item right_delay
  2767. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2768. @item right_balance
  2769. Set right channel balance. By default is @var{1}.
  2770. @item right_gain
  2771. Set right channel gain. By default is @var{1}.
  2772. @item right_phase
  2773. Change right phase. By default is enabled.
  2774. @end table
  2775. @section hdcd
  2776. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2777. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2778. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2779. of HDCD, and detects the Transient Filter flag.
  2780. @example
  2781. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2782. @end example
  2783. When using the filter with wav, note the default encoding for wav is 16-bit,
  2784. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2785. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2786. @example
  2787. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2788. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2789. @end example
  2790. The filter accepts the following options:
  2791. @table @option
  2792. @item disable_autoconvert
  2793. Disable any automatic format conversion or resampling in the filter graph.
  2794. @item process_stereo
  2795. Process the stereo channels together. If target_gain does not match between
  2796. channels, consider it invalid and use the last valid target_gain.
  2797. @item cdt_ms
  2798. Set the code detect timer period in ms.
  2799. @item force_pe
  2800. Always extend peaks above -3dBFS even if PE isn't signaled.
  2801. @item analyze_mode
  2802. Replace audio with a solid tone and adjust the amplitude to signal some
  2803. specific aspect of the decoding process. The output file can be loaded in
  2804. an audio editor alongside the original to aid analysis.
  2805. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2806. Modes are:
  2807. @table @samp
  2808. @item 0, off
  2809. Disabled
  2810. @item 1, lle
  2811. Gain adjustment level at each sample
  2812. @item 2, pe
  2813. Samples where peak extend occurs
  2814. @item 3, cdt
  2815. Samples where the code detect timer is active
  2816. @item 4, tgm
  2817. Samples where the target gain does not match between channels
  2818. @end table
  2819. @end table
  2820. @section headphone
  2821. Apply head-related transfer functions (HRTFs) to create virtual
  2822. loudspeakers around the user for binaural listening via headphones.
  2823. The HRIRs are provided via additional streams, for each channel
  2824. one stereo input stream is needed.
  2825. The filter accepts the following options:
  2826. @table @option
  2827. @item map
  2828. Set mapping of input streams for convolution.
  2829. The argument is a '|'-separated list of channel names in order as they
  2830. are given as additional stream inputs for filter.
  2831. This also specify number of input streams. Number of input streams
  2832. must be not less than number of channels in first stream plus one.
  2833. @item gain
  2834. Set gain applied to audio. Value is in dB. Default is 0.
  2835. @item type
  2836. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2837. processing audio in time domain which is slow.
  2838. @var{freq} is processing audio in frequency domain which is fast.
  2839. Default is @var{freq}.
  2840. @item lfe
  2841. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2842. @item size
  2843. Set size of frame in number of samples which will be processed at once.
  2844. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2845. @item hrir
  2846. Set format of hrir stream.
  2847. Default value is @var{stereo}. Alternative value is @var{multich}.
  2848. If value is set to @var{stereo}, number of additional streams should
  2849. be greater or equal to number of input channels in first input stream.
  2850. Also each additional stream should have stereo number of channels.
  2851. If value is set to @var{multich}, number of additional streams should
  2852. be exactly one. Also number of input channels of additional stream
  2853. should be equal or greater than twice number of channels of first input
  2854. stream.
  2855. @end table
  2856. @subsection Examples
  2857. @itemize
  2858. @item
  2859. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2860. each amovie filter use stereo file with IR coefficients as input.
  2861. The files give coefficients for each position of virtual loudspeaker:
  2862. @example
  2863. ffmpeg -i input.wav
  2864. -filter_complex "amovie=azi_270_ele_0_DFC.wav[sr];amovie=azi_90_ele_0_DFC.wav[sl];amovie=azi_225_ele_0_DFC.wav[br];amovie=azi_135_ele_0_DFC.wav[bl];amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe];amovie=azi_35_ele_0_DFC.wav[fl];amovie=azi_325_ele_0_DFC.wav[fr];[0:a][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2865. output.wav
  2866. @end example
  2867. @item
  2868. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2869. but now in @var{multich} @var{hrir} format.
  2870. @example
  2871. ffmpeg -i input.wav -filter_complex "amovie=minp.wav[hrirs];[0:a][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  2872. output.wav
  2873. @end example
  2874. @end itemize
  2875. @section highpass
  2876. Apply a high-pass filter with 3dB point frequency.
  2877. The filter can be either single-pole, or double-pole (the default).
  2878. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2879. The filter accepts the following options:
  2880. @table @option
  2881. @item frequency, f
  2882. Set frequency in Hz. Default is 3000.
  2883. @item poles, p
  2884. Set number of poles. Default is 2.
  2885. @item width_type, t
  2886. Set method to specify band-width of filter.
  2887. @table @option
  2888. @item h
  2889. Hz
  2890. @item q
  2891. Q-Factor
  2892. @item o
  2893. octave
  2894. @item s
  2895. slope
  2896. @item k
  2897. kHz
  2898. @end table
  2899. @item width, w
  2900. Specify the band-width of a filter in width_type units.
  2901. Applies only to double-pole filter.
  2902. The default is 0.707q and gives a Butterworth response.
  2903. @item channels, c
  2904. Specify which channels to filter, by default all available are filtered.
  2905. @end table
  2906. @subsection Commands
  2907. This filter supports the following commands:
  2908. @table @option
  2909. @item frequency, f
  2910. Change highpass frequency.
  2911. Syntax for the command is : "@var{frequency}"
  2912. @item width_type, t
  2913. Change highpass width_type.
  2914. Syntax for the command is : "@var{width_type}"
  2915. @item width, w
  2916. Change highpass width.
  2917. Syntax for the command is : "@var{width}"
  2918. @end table
  2919. @section join
  2920. Join multiple input streams into one multi-channel stream.
  2921. It accepts the following parameters:
  2922. @table @option
  2923. @item inputs
  2924. The number of input streams. It defaults to 2.
  2925. @item channel_layout
  2926. The desired output channel layout. It defaults to stereo.
  2927. @item map
  2928. Map channels from inputs to output. The argument is a '|'-separated list of
  2929. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2930. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2931. can be either the name of the input channel (e.g. FL for front left) or its
  2932. index in the specified input stream. @var{out_channel} is the name of the output
  2933. channel.
  2934. @end table
  2935. The filter will attempt to guess the mappings when they are not specified
  2936. explicitly. It does so by first trying to find an unused matching input channel
  2937. and if that fails it picks the first unused input channel.
  2938. Join 3 inputs (with properly set channel layouts):
  2939. @example
  2940. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2941. @end example
  2942. Build a 5.1 output from 6 single-channel streams:
  2943. @example
  2944. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2945. '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'
  2946. out
  2947. @end example
  2948. @section ladspa
  2949. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2950. To enable compilation of this filter you need to configure FFmpeg with
  2951. @code{--enable-ladspa}.
  2952. @table @option
  2953. @item file, f
  2954. Specifies the name of LADSPA plugin library to load. If the environment
  2955. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2956. each one of the directories specified by the colon separated list in
  2957. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2958. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2959. @file{/usr/lib/ladspa/}.
  2960. @item plugin, p
  2961. Specifies the plugin within the library. Some libraries contain only
  2962. one plugin, but others contain many of them. If this is not set filter
  2963. will list all available plugins within the specified library.
  2964. @item controls, c
  2965. Set the '|' separated list of controls which are zero or more floating point
  2966. values that determine the behavior of the loaded plugin (for example delay,
  2967. threshold or gain).
  2968. Controls need to be defined using the following syntax:
  2969. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2970. @var{valuei} is the value set on the @var{i}-th control.
  2971. Alternatively they can be also defined using the following syntax:
  2972. @var{value0}|@var{value1}|@var{value2}|..., where
  2973. @var{valuei} is the value set on the @var{i}-th control.
  2974. If @option{controls} is set to @code{help}, all available controls and
  2975. their valid ranges are printed.
  2976. @item sample_rate, s
  2977. Specify the sample rate, default to 44100. Only used if plugin have
  2978. zero inputs.
  2979. @item nb_samples, n
  2980. Set the number of samples per channel per each output frame, default
  2981. is 1024. Only used if plugin have zero inputs.
  2982. @item duration, d
  2983. Set the minimum duration of the sourced audio. See
  2984. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2985. for the accepted syntax.
  2986. Note that the resulting duration may be greater than the specified duration,
  2987. as the generated audio is always cut at the end of a complete frame.
  2988. If not specified, or the expressed duration is negative, the audio is
  2989. supposed to be generated forever.
  2990. Only used if plugin have zero inputs.
  2991. @end table
  2992. @subsection Examples
  2993. @itemize
  2994. @item
  2995. List all available plugins within amp (LADSPA example plugin) library:
  2996. @example
  2997. ladspa=file=amp
  2998. @end example
  2999. @item
  3000. List all available controls and their valid ranges for @code{vcf_notch}
  3001. plugin from @code{VCF} library:
  3002. @example
  3003. ladspa=f=vcf:p=vcf_notch:c=help
  3004. @end example
  3005. @item
  3006. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3007. plugin library:
  3008. @example
  3009. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3010. @end example
  3011. @item
  3012. Add reverberation to the audio using TAP-plugins
  3013. (Tom's Audio Processing plugins):
  3014. @example
  3015. ladspa=file=tap_reverb:tap_reverb
  3016. @end example
  3017. @item
  3018. Generate white noise, with 0.2 amplitude:
  3019. @example
  3020. ladspa=file=cmt:noise_source_white:c=c0=.2
  3021. @end example
  3022. @item
  3023. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3024. @code{C* Audio Plugin Suite} (CAPS) library:
  3025. @example
  3026. ladspa=file=caps:Click:c=c1=20'
  3027. @end example
  3028. @item
  3029. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3030. @example
  3031. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3032. @end example
  3033. @item
  3034. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3035. @code{SWH Plugins} collection:
  3036. @example
  3037. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3038. @end example
  3039. @item
  3040. Attenuate low frequencies using Multiband EQ from Steve Harris
  3041. @code{SWH Plugins} collection:
  3042. @example
  3043. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3044. @end example
  3045. @item
  3046. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3047. (CAPS) library:
  3048. @example
  3049. ladspa=caps:Narrower
  3050. @end example
  3051. @item
  3052. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3053. @example
  3054. ladspa=caps:White:.2
  3055. @end example
  3056. @item
  3057. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3058. @example
  3059. ladspa=caps:Fractal:c=c1=1
  3060. @end example
  3061. @item
  3062. Dynamic volume normalization using @code{VLevel} plugin:
  3063. @example
  3064. ladspa=vlevel-ladspa:vlevel_mono
  3065. @end example
  3066. @end itemize
  3067. @subsection Commands
  3068. This filter supports the following commands:
  3069. @table @option
  3070. @item cN
  3071. Modify the @var{N}-th control value.
  3072. If the specified value is not valid, it is ignored and prior one is kept.
  3073. @end table
  3074. @section loudnorm
  3075. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3076. Support for both single pass (livestreams, files) and double pass (files) modes.
  3077. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3078. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3079. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3080. The filter accepts the following options:
  3081. @table @option
  3082. @item I, i
  3083. Set integrated loudness target.
  3084. Range is -70.0 - -5.0. Default value is -24.0.
  3085. @item LRA, lra
  3086. Set loudness range target.
  3087. Range is 1.0 - 20.0. Default value is 7.0.
  3088. @item TP, tp
  3089. Set maximum true peak.
  3090. Range is -9.0 - +0.0. Default value is -2.0.
  3091. @item measured_I, measured_i
  3092. Measured IL of input file.
  3093. Range is -99.0 - +0.0.
  3094. @item measured_LRA, measured_lra
  3095. Measured LRA of input file.
  3096. Range is 0.0 - 99.0.
  3097. @item measured_TP, measured_tp
  3098. Measured true peak of input file.
  3099. Range is -99.0 - +99.0.
  3100. @item measured_thresh
  3101. Measured threshold of input file.
  3102. Range is -99.0 - +0.0.
  3103. @item offset
  3104. Set offset gain. Gain is applied before the true-peak limiter.
  3105. Range is -99.0 - +99.0. Default is +0.0.
  3106. @item linear
  3107. Normalize linearly if possible.
  3108. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3109. to be specified in order to use this mode.
  3110. Options are true or false. Default is true.
  3111. @item dual_mono
  3112. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3113. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3114. If set to @code{true}, this option will compensate for this effect.
  3115. Multi-channel input files are not affected by this option.
  3116. Options are true or false. Default is false.
  3117. @item print_format
  3118. Set print format for stats. Options are summary, json, or none.
  3119. Default value is none.
  3120. @end table
  3121. @section lowpass
  3122. Apply a low-pass filter with 3dB point frequency.
  3123. The filter can be either single-pole or double-pole (the default).
  3124. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3125. The filter accepts the following options:
  3126. @table @option
  3127. @item frequency, f
  3128. Set frequency in Hz. Default is 500.
  3129. @item poles, p
  3130. Set number of poles. Default is 2.
  3131. @item width_type, t
  3132. Set method to specify band-width of filter.
  3133. @table @option
  3134. @item h
  3135. Hz
  3136. @item q
  3137. Q-Factor
  3138. @item o
  3139. octave
  3140. @item s
  3141. slope
  3142. @item k
  3143. kHz
  3144. @end table
  3145. @item width, w
  3146. Specify the band-width of a filter in width_type units.
  3147. Applies only to double-pole filter.
  3148. The default is 0.707q and gives a Butterworth response.
  3149. @item channels, c
  3150. Specify which channels to filter, by default all available are filtered.
  3151. @end table
  3152. @subsection Examples
  3153. @itemize
  3154. @item
  3155. Lowpass only LFE channel, it LFE is not present it does nothing:
  3156. @example
  3157. lowpass=c=LFE
  3158. @end example
  3159. @end itemize
  3160. @subsection Commands
  3161. This filter supports the following commands:
  3162. @table @option
  3163. @item frequency, f
  3164. Change lowpass frequency.
  3165. Syntax for the command is : "@var{frequency}"
  3166. @item width_type, t
  3167. Change lowpass width_type.
  3168. Syntax for the command is : "@var{width_type}"
  3169. @item width, w
  3170. Change lowpass width.
  3171. Syntax for the command is : "@var{width}"
  3172. @end table
  3173. @section lv2
  3174. Load a LV2 (LADSPA Version 2) plugin.
  3175. To enable compilation of this filter you need to configure FFmpeg with
  3176. @code{--enable-lv2}.
  3177. @table @option
  3178. @item plugin, p
  3179. Specifies the plugin URI. You may need to escape ':'.
  3180. @item controls, c
  3181. Set the '|' separated list of controls which are zero or more floating point
  3182. values that determine the behavior of the loaded plugin (for example delay,
  3183. threshold or gain).
  3184. If @option{controls} is set to @code{help}, all available controls and
  3185. their valid ranges are printed.
  3186. @item sample_rate, s
  3187. Specify the sample rate, default to 44100. Only used if plugin have
  3188. zero inputs.
  3189. @item nb_samples, n
  3190. Set the number of samples per channel per each output frame, default
  3191. is 1024. Only used if plugin have zero inputs.
  3192. @item duration, d
  3193. Set the minimum duration of the sourced audio. See
  3194. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3195. for the accepted syntax.
  3196. Note that the resulting duration may be greater than the specified duration,
  3197. as the generated audio is always cut at the end of a complete frame.
  3198. If not specified, or the expressed duration is negative, the audio is
  3199. supposed to be generated forever.
  3200. Only used if plugin have zero inputs.
  3201. @end table
  3202. @subsection Examples
  3203. @itemize
  3204. @item
  3205. Apply bass enhancer plugin from Calf:
  3206. @example
  3207. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3208. @end example
  3209. @item
  3210. Apply vinyl plugin from Calf:
  3211. @example
  3212. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3213. @end example
  3214. @item
  3215. Apply bit crusher plugin from ArtyFX:
  3216. @example
  3217. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3218. @end example
  3219. @end itemize
  3220. @section mcompand
  3221. Multiband Compress or expand the audio's dynamic range.
  3222. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3223. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3224. response when absent compander action.
  3225. It accepts the following parameters:
  3226. @table @option
  3227. @item args
  3228. This option syntax is:
  3229. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3230. For explanation of each item refer to compand filter documentation.
  3231. @end table
  3232. @anchor{pan}
  3233. @section pan
  3234. Mix channels with specific gain levels. The filter accepts the output
  3235. channel layout followed by a set of channels definitions.
  3236. This filter is also designed to efficiently remap the channels of an audio
  3237. stream.
  3238. The filter accepts parameters of the form:
  3239. "@var{l}|@var{outdef}|@var{outdef}|..."
  3240. @table @option
  3241. @item l
  3242. output channel layout or number of channels
  3243. @item outdef
  3244. output channel specification, of the form:
  3245. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3246. @item out_name
  3247. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3248. number (c0, c1, etc.)
  3249. @item gain
  3250. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3251. @item in_name
  3252. input channel to use, see out_name for details; it is not possible to mix
  3253. named and numbered input channels
  3254. @end table
  3255. If the `=' in a channel specification is replaced by `<', then the gains for
  3256. that specification will be renormalized so that the total is 1, thus
  3257. avoiding clipping noise.
  3258. @subsection Mixing examples
  3259. For example, if you want to down-mix from stereo to mono, but with a bigger
  3260. factor for the left channel:
  3261. @example
  3262. pan=1c|c0=0.9*c0+0.1*c1
  3263. @end example
  3264. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3265. 7-channels surround:
  3266. @example
  3267. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3268. @end example
  3269. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3270. that should be preferred (see "-ac" option) unless you have very specific
  3271. needs.
  3272. @subsection Remapping examples
  3273. The channel remapping will be effective if, and only if:
  3274. @itemize
  3275. @item gain coefficients are zeroes or ones,
  3276. @item only one input per channel output,
  3277. @end itemize
  3278. If all these conditions are satisfied, the filter will notify the user ("Pure
  3279. channel mapping detected"), and use an optimized and lossless method to do the
  3280. remapping.
  3281. For example, if you have a 5.1 source and want a stereo audio stream by
  3282. dropping the extra channels:
  3283. @example
  3284. pan="stereo| c0=FL | c1=FR"
  3285. @end example
  3286. Given the same source, you can also switch front left and front right channels
  3287. and keep the input channel layout:
  3288. @example
  3289. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3290. @end example
  3291. If the input is a stereo audio stream, you can mute the front left channel (and
  3292. still keep the stereo channel layout) with:
  3293. @example
  3294. pan="stereo|c1=c1"
  3295. @end example
  3296. Still with a stereo audio stream input, you can copy the right channel in both
  3297. front left and right:
  3298. @example
  3299. pan="stereo| c0=FR | c1=FR"
  3300. @end example
  3301. @section replaygain
  3302. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3303. outputs it unchanged.
  3304. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3305. @section resample
  3306. Convert the audio sample format, sample rate and channel layout. It is
  3307. not meant to be used directly.
  3308. @section rubberband
  3309. Apply time-stretching and pitch-shifting with librubberband.
  3310. To enable compilation of this filter, you need to configure FFmpeg with
  3311. @code{--enable-librubberband}.
  3312. The filter accepts the following options:
  3313. @table @option
  3314. @item tempo
  3315. Set tempo scale factor.
  3316. @item pitch
  3317. Set pitch scale factor.
  3318. @item transients
  3319. Set transients detector.
  3320. Possible values are:
  3321. @table @var
  3322. @item crisp
  3323. @item mixed
  3324. @item smooth
  3325. @end table
  3326. @item detector
  3327. Set detector.
  3328. Possible values are:
  3329. @table @var
  3330. @item compound
  3331. @item percussive
  3332. @item soft
  3333. @end table
  3334. @item phase
  3335. Set phase.
  3336. Possible values are:
  3337. @table @var
  3338. @item laminar
  3339. @item independent
  3340. @end table
  3341. @item window
  3342. Set processing window size.
  3343. Possible values are:
  3344. @table @var
  3345. @item standard
  3346. @item short
  3347. @item long
  3348. @end table
  3349. @item smoothing
  3350. Set smoothing.
  3351. Possible values are:
  3352. @table @var
  3353. @item off
  3354. @item on
  3355. @end table
  3356. @item formant
  3357. Enable formant preservation when shift pitching.
  3358. Possible values are:
  3359. @table @var
  3360. @item shifted
  3361. @item preserved
  3362. @end table
  3363. @item pitchq
  3364. Set pitch quality.
  3365. Possible values are:
  3366. @table @var
  3367. @item quality
  3368. @item speed
  3369. @item consistency
  3370. @end table
  3371. @item channels
  3372. Set channels.
  3373. Possible values are:
  3374. @table @var
  3375. @item apart
  3376. @item together
  3377. @end table
  3378. @end table
  3379. @section sidechaincompress
  3380. This filter acts like normal compressor but has the ability to compress
  3381. detected signal using second input signal.
  3382. It needs two input streams and returns one output stream.
  3383. First input stream will be processed depending on second stream signal.
  3384. The filtered signal then can be filtered with other filters in later stages of
  3385. processing. See @ref{pan} and @ref{amerge} filter.
  3386. The filter accepts the following options:
  3387. @table @option
  3388. @item level_in
  3389. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3390. @item mode
  3391. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3392. Default is @code{downward}.
  3393. @item threshold
  3394. If a signal of second stream raises above this level it will affect the gain
  3395. reduction of first stream.
  3396. By default is 0.125. Range is between 0.00097563 and 1.
  3397. @item ratio
  3398. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3399. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3400. Default is 2. Range is between 1 and 20.
  3401. @item attack
  3402. Amount of milliseconds the signal has to rise above the threshold before gain
  3403. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3404. @item release
  3405. Amount of milliseconds the signal has to fall below the threshold before
  3406. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3407. @item makeup
  3408. Set the amount by how much signal will be amplified after processing.
  3409. Default is 1. Range is from 1 to 64.
  3410. @item knee
  3411. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3412. Default is 2.82843. Range is between 1 and 8.
  3413. @item link
  3414. Choose if the @code{average} level between all channels of side-chain stream
  3415. or the louder(@code{maximum}) channel of side-chain stream affects the
  3416. reduction. Default is @code{average}.
  3417. @item detection
  3418. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3419. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3420. @item level_sc
  3421. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3422. @item mix
  3423. How much to use compressed signal in output. Default is 1.
  3424. Range is between 0 and 1.
  3425. @end table
  3426. @subsection Examples
  3427. @itemize
  3428. @item
  3429. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3430. depending on the signal of 2nd input and later compressed signal to be
  3431. merged with 2nd input:
  3432. @example
  3433. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3434. @end example
  3435. @end itemize
  3436. @section sidechaingate
  3437. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3438. filter the detected signal before sending it to the gain reduction stage.
  3439. Normally a gate uses the full range signal to detect a level above the
  3440. threshold.
  3441. For example: If you cut all lower frequencies from your sidechain signal
  3442. the gate will decrease the volume of your track only if not enough highs
  3443. appear. With this technique you are able to reduce the resonation of a
  3444. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3445. guitar.
  3446. It needs two input streams and returns one output stream.
  3447. First input stream will be processed depending on second stream signal.
  3448. The filter accepts the following options:
  3449. @table @option
  3450. @item level_in
  3451. Set input level before filtering.
  3452. Default is 1. Allowed range is from 0.015625 to 64.
  3453. @item mode
  3454. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3455. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3456. will be amplified, expanding dynamic range in upward direction.
  3457. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3458. @item range
  3459. Set the level of gain reduction when the signal is below the threshold.
  3460. Default is 0.06125. Allowed range is from 0 to 1.
  3461. Setting this to 0 disables reduction and then filter behaves like expander.
  3462. @item threshold
  3463. If a signal rises above this level the gain reduction is released.
  3464. Default is 0.125. Allowed range is from 0 to 1.
  3465. @item ratio
  3466. Set a ratio about which the signal is reduced.
  3467. Default is 2. Allowed range is from 1 to 9000.
  3468. @item attack
  3469. Amount of milliseconds the signal has to rise above the threshold before gain
  3470. reduction stops.
  3471. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3472. @item release
  3473. Amount of milliseconds the signal has to fall below the threshold before the
  3474. reduction is increased again. Default is 250 milliseconds.
  3475. Allowed range is from 0.01 to 9000.
  3476. @item makeup
  3477. Set amount of amplification of signal after processing.
  3478. Default is 1. Allowed range is from 1 to 64.
  3479. @item knee
  3480. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3481. Default is 2.828427125. Allowed range is from 1 to 8.
  3482. @item detection
  3483. Choose if exact signal should be taken for detection or an RMS like one.
  3484. Default is rms. Can be peak or rms.
  3485. @item link
  3486. Choose if the average level between all channels or the louder channel affects
  3487. the reduction.
  3488. Default is average. Can be average or maximum.
  3489. @item level_sc
  3490. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3491. @end table
  3492. @section silencedetect
  3493. Detect silence in an audio stream.
  3494. This filter logs a message when it detects that the input audio volume is less
  3495. or equal to a noise tolerance value for a duration greater or equal to the
  3496. minimum detected noise duration.
  3497. The printed times and duration are expressed in seconds.
  3498. The filter accepts the following options:
  3499. @table @option
  3500. @item noise, n
  3501. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3502. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3503. @item duration, d
  3504. Set silence duration until notification (default is 2 seconds).
  3505. @item mono, m
  3506. Process each channel separately, instead of combined. By default is disabled.
  3507. @end table
  3508. @subsection Examples
  3509. @itemize
  3510. @item
  3511. Detect 5 seconds of silence with -50dB noise tolerance:
  3512. @example
  3513. silencedetect=n=-50dB:d=5
  3514. @end example
  3515. @item
  3516. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3517. tolerance in @file{silence.mp3}:
  3518. @example
  3519. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3520. @end example
  3521. @end itemize
  3522. @section silenceremove
  3523. Remove silence from the beginning, middle or end of the audio.
  3524. The filter accepts the following options:
  3525. @table @option
  3526. @item start_periods
  3527. This value is used to indicate if audio should be trimmed at beginning of
  3528. the audio. A value of zero indicates no silence should be trimmed from the
  3529. beginning. When specifying a non-zero value, it trims audio up until it
  3530. finds non-silence. Normally, when trimming silence from beginning of audio
  3531. the @var{start_periods} will be @code{1} but it can be increased to higher
  3532. values to trim all audio up to specific count of non-silence periods.
  3533. Default value is @code{0}.
  3534. @item start_duration
  3535. Specify the amount of time that non-silence must be detected before it stops
  3536. trimming audio. By increasing the duration, bursts of noises can be treated
  3537. as silence and trimmed off. Default value is @code{0}.
  3538. @item start_threshold
  3539. This indicates what sample value should be treated as silence. For digital
  3540. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3541. you may wish to increase the value to account for background noise.
  3542. Can be specified in dB (in case "dB" is appended to the specified value)
  3543. or amplitude ratio. Default value is @code{0}.
  3544. @item start_silence
  3545. Specify max duration of silence at beginning that will be kept after
  3546. trimming. Default is 0, which is equal to trimming all samples detected
  3547. as silence.
  3548. @item start_mode
  3549. Specify mode of detection of silence end in start of multi-channel audio.
  3550. Can be @var{any} or @var{all}. Default is @var{any}.
  3551. With @var{any}, any sample that is detected as non-silence will cause
  3552. stopped trimming of silence.
  3553. With @var{all}, only if all channels are detected as non-silence will cause
  3554. stopped trimming of silence.
  3555. @item stop_periods
  3556. Set the count for trimming silence from the end of audio.
  3557. To remove silence from the middle of a file, specify a @var{stop_periods}
  3558. that is negative. This value is then treated as a positive value and is
  3559. used to indicate the effect should restart processing as specified by
  3560. @var{start_periods}, making it suitable for removing periods of silence
  3561. in the middle of the audio.
  3562. Default value is @code{0}.
  3563. @item stop_duration
  3564. Specify a duration of silence that must exist before audio is not copied any
  3565. more. By specifying a higher duration, silence that is wanted can be left in
  3566. the audio.
  3567. Default value is @code{0}.
  3568. @item stop_threshold
  3569. This is the same as @option{start_threshold} but for trimming silence from
  3570. the end of audio.
  3571. Can be specified in dB (in case "dB" is appended to the specified value)
  3572. or amplitude ratio. Default value is @code{0}.
  3573. @item stop_silence
  3574. Specify max duration of silence at end that will be kept after
  3575. trimming. Default is 0, which is equal to trimming all samples detected
  3576. as silence.
  3577. @item stop_mode
  3578. Specify mode of detection of silence start in end of multi-channel audio.
  3579. Can be @var{any} or @var{all}. Default is @var{any}.
  3580. With @var{any}, any sample that is detected as non-silence will cause
  3581. stopped trimming of silence.
  3582. With @var{all}, only if all channels are detected as non-silence will cause
  3583. stopped trimming of silence.
  3584. @item detection
  3585. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3586. and works better with digital silence which is exactly 0.
  3587. Default value is @code{rms}.
  3588. @item window
  3589. Set duration in number of seconds used to calculate size of window in number
  3590. of samples for detecting silence.
  3591. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3592. @end table
  3593. @subsection Examples
  3594. @itemize
  3595. @item
  3596. The following example shows how this filter can be used to start a recording
  3597. that does not contain the delay at the start which usually occurs between
  3598. pressing the record button and the start of the performance:
  3599. @example
  3600. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3601. @end example
  3602. @item
  3603. Trim all silence encountered from beginning to end where there is more than 1
  3604. second of silence in audio:
  3605. @example
  3606. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3607. @end example
  3608. @end itemize
  3609. @section sofalizer
  3610. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3611. loudspeakers around the user for binaural listening via headphones (audio
  3612. formats up to 9 channels supported).
  3613. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3614. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3615. Austrian Academy of Sciences.
  3616. To enable compilation of this filter you need to configure FFmpeg with
  3617. @code{--enable-libmysofa}.
  3618. The filter accepts the following options:
  3619. @table @option
  3620. @item sofa
  3621. Set the SOFA file used for rendering.
  3622. @item gain
  3623. Set gain applied to audio. Value is in dB. Default is 0.
  3624. @item rotation
  3625. Set rotation of virtual loudspeakers in deg. Default is 0.
  3626. @item elevation
  3627. Set elevation of virtual speakers in deg. Default is 0.
  3628. @item radius
  3629. Set distance in meters between loudspeakers and the listener with near-field
  3630. HRTFs. Default is 1.
  3631. @item type
  3632. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3633. processing audio in time domain which is slow.
  3634. @var{freq} is processing audio in frequency domain which is fast.
  3635. Default is @var{freq}.
  3636. @item speakers
  3637. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3638. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3639. Each virtual loudspeaker is described with short channel name following with
  3640. azimuth and elevation in degrees.
  3641. Each virtual loudspeaker description is separated by '|'.
  3642. For example to override front left and front right channel positions use:
  3643. 'speakers=FL 45 15|FR 345 15'.
  3644. Descriptions with unrecognised channel names are ignored.
  3645. @item lfegain
  3646. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3647. @item framesize
  3648. Set custom frame size in number of samples. Default is 1024.
  3649. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3650. is set to @var{freq}.
  3651. @item normalize
  3652. Should all IRs be normalized upon importing SOFA file.
  3653. By default is enabled.
  3654. @item interpolate
  3655. Should nearest IRs be interpolated with neighbor IRs if exact position
  3656. does not match. By default is disabled.
  3657. @item minphase
  3658. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3659. @item anglestep
  3660. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3661. @item radstep
  3662. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3663. @end table
  3664. @subsection Examples
  3665. @itemize
  3666. @item
  3667. Using ClubFritz6 sofa file:
  3668. @example
  3669. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3670. @end example
  3671. @item
  3672. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3673. @example
  3674. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3675. @end example
  3676. @item
  3677. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3678. and also with custom gain:
  3679. @example
  3680. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3681. @end example
  3682. @end itemize
  3683. @section stereotools
  3684. This filter has some handy utilities to manage stereo signals, for converting
  3685. M/S stereo recordings to L/R signal while having control over the parameters
  3686. or spreading the stereo image of master track.
  3687. The filter accepts the following options:
  3688. @table @option
  3689. @item level_in
  3690. Set input level before filtering for both channels. Defaults is 1.
  3691. Allowed range is from 0.015625 to 64.
  3692. @item level_out
  3693. Set output level after filtering for both channels. Defaults is 1.
  3694. Allowed range is from 0.015625 to 64.
  3695. @item balance_in
  3696. Set input balance between both channels. Default is 0.
  3697. Allowed range is from -1 to 1.
  3698. @item balance_out
  3699. Set output balance between both channels. Default is 0.
  3700. Allowed range is from -1 to 1.
  3701. @item softclip
  3702. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3703. clipping. Disabled by default.
  3704. @item mutel
  3705. Mute the left channel. Disabled by default.
  3706. @item muter
  3707. Mute the right channel. Disabled by default.
  3708. @item phasel
  3709. Change the phase of the left channel. Disabled by default.
  3710. @item phaser
  3711. Change the phase of the right channel. Disabled by default.
  3712. @item mode
  3713. Set stereo mode. Available values are:
  3714. @table @samp
  3715. @item lr>lr
  3716. Left/Right to Left/Right, this is default.
  3717. @item lr>ms
  3718. Left/Right to Mid/Side.
  3719. @item ms>lr
  3720. Mid/Side to Left/Right.
  3721. @item lr>ll
  3722. Left/Right to Left/Left.
  3723. @item lr>rr
  3724. Left/Right to Right/Right.
  3725. @item lr>l+r
  3726. Left/Right to Left + Right.
  3727. @item lr>rl
  3728. Left/Right to Right/Left.
  3729. @item ms>ll
  3730. Mid/Side to Left/Left.
  3731. @item ms>rr
  3732. Mid/Side to Right/Right.
  3733. @end table
  3734. @item slev
  3735. Set level of side signal. Default is 1.
  3736. Allowed range is from 0.015625 to 64.
  3737. @item sbal
  3738. Set balance of side signal. Default is 0.
  3739. Allowed range is from -1 to 1.
  3740. @item mlev
  3741. Set level of the middle signal. Default is 1.
  3742. Allowed range is from 0.015625 to 64.
  3743. @item mpan
  3744. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3745. @item base
  3746. Set stereo base between mono and inversed channels. Default is 0.
  3747. Allowed range is from -1 to 1.
  3748. @item delay
  3749. Set delay in milliseconds how much to delay left from right channel and
  3750. vice versa. Default is 0. Allowed range is from -20 to 20.
  3751. @item sclevel
  3752. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3753. @item phase
  3754. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3755. @item bmode_in, bmode_out
  3756. Set balance mode for balance_in/balance_out option.
  3757. Can be one of the following:
  3758. @table @samp
  3759. @item balance
  3760. Classic balance mode. Attenuate one channel at time.
  3761. Gain is raised up to 1.
  3762. @item amplitude
  3763. Similar as classic mode above but gain is raised up to 2.
  3764. @item power
  3765. Equal power distribution, from -6dB to +6dB range.
  3766. @end table
  3767. @end table
  3768. @subsection Examples
  3769. @itemize
  3770. @item
  3771. Apply karaoke like effect:
  3772. @example
  3773. stereotools=mlev=0.015625
  3774. @end example
  3775. @item
  3776. Convert M/S signal to L/R:
  3777. @example
  3778. "stereotools=mode=ms>lr"
  3779. @end example
  3780. @end itemize
  3781. @section stereowiden
  3782. This filter enhance the stereo effect by suppressing signal common to both
  3783. channels and by delaying the signal of left into right and vice versa,
  3784. thereby widening the stereo effect.
  3785. The filter accepts the following options:
  3786. @table @option
  3787. @item delay
  3788. Time in milliseconds of the delay of left signal into right and vice versa.
  3789. Default is 20 milliseconds.
  3790. @item feedback
  3791. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3792. effect of left signal in right output and vice versa which gives widening
  3793. effect. Default is 0.3.
  3794. @item crossfeed
  3795. Cross feed of left into right with inverted phase. This helps in suppressing
  3796. the mono. If the value is 1 it will cancel all the signal common to both
  3797. channels. Default is 0.3.
  3798. @item drymix
  3799. Set level of input signal of original channel. Default is 0.8.
  3800. @end table
  3801. @section superequalizer
  3802. Apply 18 band equalizer.
  3803. The filter accepts the following options:
  3804. @table @option
  3805. @item 1b
  3806. Set 65Hz band gain.
  3807. @item 2b
  3808. Set 92Hz band gain.
  3809. @item 3b
  3810. Set 131Hz band gain.
  3811. @item 4b
  3812. Set 185Hz band gain.
  3813. @item 5b
  3814. Set 262Hz band gain.
  3815. @item 6b
  3816. Set 370Hz band gain.
  3817. @item 7b
  3818. Set 523Hz band gain.
  3819. @item 8b
  3820. Set 740Hz band gain.
  3821. @item 9b
  3822. Set 1047Hz band gain.
  3823. @item 10b
  3824. Set 1480Hz band gain.
  3825. @item 11b
  3826. Set 2093Hz band gain.
  3827. @item 12b
  3828. Set 2960Hz band gain.
  3829. @item 13b
  3830. Set 4186Hz band gain.
  3831. @item 14b
  3832. Set 5920Hz band gain.
  3833. @item 15b
  3834. Set 8372Hz band gain.
  3835. @item 16b
  3836. Set 11840Hz band gain.
  3837. @item 17b
  3838. Set 16744Hz band gain.
  3839. @item 18b
  3840. Set 20000Hz band gain.
  3841. @end table
  3842. @section surround
  3843. Apply audio surround upmix filter.
  3844. This filter allows to produce multichannel output from audio stream.
  3845. The filter accepts the following options:
  3846. @table @option
  3847. @item chl_out
  3848. Set output channel layout. By default, this is @var{5.1}.
  3849. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3850. for the required syntax.
  3851. @item chl_in
  3852. Set input channel layout. By default, this is @var{stereo}.
  3853. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3854. for the required syntax.
  3855. @item level_in
  3856. Set input volume level. By default, this is @var{1}.
  3857. @item level_out
  3858. Set output volume level. By default, this is @var{1}.
  3859. @item lfe
  3860. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3861. @item lfe_low
  3862. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3863. @item lfe_high
  3864. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3865. @item lfe_mode
  3866. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  3867. In @var{add} mode, LFE channel is created from input audio and added to output.
  3868. In @var{sub} mode, LFE channel is created from input audio and added to output but
  3869. also all non-LFE output channels are subtracted with output LFE channel.
  3870. @item angle
  3871. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  3872. Default is @var{90}.
  3873. @item fc_in
  3874. Set front center input volume. By default, this is @var{1}.
  3875. @item fc_out
  3876. Set front center output volume. By default, this is @var{1}.
  3877. @item fl_in
  3878. Set front left input volume. By default, this is @var{1}.
  3879. @item fl_out
  3880. Set front left output volume. By default, this is @var{1}.
  3881. @item fr_in
  3882. Set front right input volume. By default, this is @var{1}.
  3883. @item fr_out
  3884. Set front right output volume. By default, this is @var{1}.
  3885. @item sl_in
  3886. Set side left input volume. By default, this is @var{1}.
  3887. @item sl_out
  3888. Set side left output volume. By default, this is @var{1}.
  3889. @item sr_in
  3890. Set side right input volume. By default, this is @var{1}.
  3891. @item sr_out
  3892. Set side right output volume. By default, this is @var{1}.
  3893. @item bl_in
  3894. Set back left input volume. By default, this is @var{1}.
  3895. @item bl_out
  3896. Set back left output volume. By default, this is @var{1}.
  3897. @item br_in
  3898. Set back right input volume. By default, this is @var{1}.
  3899. @item br_out
  3900. Set back right output volume. By default, this is @var{1}.
  3901. @item bc_in
  3902. Set back center input volume. By default, this is @var{1}.
  3903. @item bc_out
  3904. Set back center output volume. By default, this is @var{1}.
  3905. @item lfe_in
  3906. Set LFE input volume. By default, this is @var{1}.
  3907. @item lfe_out
  3908. Set LFE output volume. By default, this is @var{1}.
  3909. @item allx
  3910. Set spread usage of stereo image across X axis for all channels.
  3911. @item ally
  3912. Set spread usage of stereo image across Y axis for all channels.
  3913. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  3914. Set spread usage of stereo image across X axis for each channel.
  3915. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  3916. Set spread usage of stereo image across Y axis for each channel.
  3917. @item win_size
  3918. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  3919. @item win_func
  3920. Set window function.
  3921. It accepts the following values:
  3922. @table @samp
  3923. @item rect
  3924. @item bartlett
  3925. @item hann, hanning
  3926. @item hamming
  3927. @item blackman
  3928. @item welch
  3929. @item flattop
  3930. @item bharris
  3931. @item bnuttall
  3932. @item bhann
  3933. @item sine
  3934. @item nuttall
  3935. @item lanczos
  3936. @item gauss
  3937. @item tukey
  3938. @item dolph
  3939. @item cauchy
  3940. @item parzen
  3941. @item poisson
  3942. @item bohman
  3943. @end table
  3944. Default is @code{hann}.
  3945. @item overlap
  3946. Set window overlap. If set to 1, the recommended overlap for selected
  3947. window function will be picked. Default is @code{0.5}.
  3948. @end table
  3949. @section treble, highshelf
  3950. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3951. shelving filter with a response similar to that of a standard
  3952. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3953. The filter accepts the following options:
  3954. @table @option
  3955. @item gain, g
  3956. Give the gain at whichever is the lower of ~22 kHz and the
  3957. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3958. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3959. @item frequency, f
  3960. Set the filter's central frequency and so can be used
  3961. to extend or reduce the frequency range to be boosted or cut.
  3962. The default value is @code{3000} Hz.
  3963. @item width_type, t
  3964. Set method to specify band-width of filter.
  3965. @table @option
  3966. @item h
  3967. Hz
  3968. @item q
  3969. Q-Factor
  3970. @item o
  3971. octave
  3972. @item s
  3973. slope
  3974. @item k
  3975. kHz
  3976. @end table
  3977. @item width, w
  3978. Determine how steep is the filter's shelf transition.
  3979. @item channels, c
  3980. Specify which channels to filter, by default all available are filtered.
  3981. @end table
  3982. @subsection Commands
  3983. This filter supports the following commands:
  3984. @table @option
  3985. @item frequency, f
  3986. Change treble frequency.
  3987. Syntax for the command is : "@var{frequency}"
  3988. @item width_type, t
  3989. Change treble width_type.
  3990. Syntax for the command is : "@var{width_type}"
  3991. @item width, w
  3992. Change treble width.
  3993. Syntax for the command is : "@var{width}"
  3994. @item gain, g
  3995. Change treble gain.
  3996. Syntax for the command is : "@var{gain}"
  3997. @end table
  3998. @section tremolo
  3999. Sinusoidal amplitude modulation.
  4000. The filter accepts the following options:
  4001. @table @option
  4002. @item f
  4003. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4004. (20 Hz or lower) will result in a tremolo effect.
  4005. This filter may also be used as a ring modulator by specifying
  4006. a modulation frequency higher than 20 Hz.
  4007. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4008. @item d
  4009. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4010. Default value is 0.5.
  4011. @end table
  4012. @section vibrato
  4013. Sinusoidal phase modulation.
  4014. The filter accepts the following options:
  4015. @table @option
  4016. @item f
  4017. Modulation frequency in Hertz.
  4018. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4019. @item d
  4020. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4021. Default value is 0.5.
  4022. @end table
  4023. @section volume
  4024. Adjust the input audio volume.
  4025. It accepts the following parameters:
  4026. @table @option
  4027. @item volume
  4028. Set audio volume expression.
  4029. Output values are clipped to the maximum value.
  4030. The output audio volume is given by the relation:
  4031. @example
  4032. @var{output_volume} = @var{volume} * @var{input_volume}
  4033. @end example
  4034. The default value for @var{volume} is "1.0".
  4035. @item precision
  4036. This parameter represents the mathematical precision.
  4037. It determines which input sample formats will be allowed, which affects the
  4038. precision of the volume scaling.
  4039. @table @option
  4040. @item fixed
  4041. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4042. @item float
  4043. 32-bit floating-point; this limits input sample format to FLT. (default)
  4044. @item double
  4045. 64-bit floating-point; this limits input sample format to DBL.
  4046. @end table
  4047. @item replaygain
  4048. Choose the behaviour on encountering ReplayGain side data in input frames.
  4049. @table @option
  4050. @item drop
  4051. Remove ReplayGain side data, ignoring its contents (the default).
  4052. @item ignore
  4053. Ignore ReplayGain side data, but leave it in the frame.
  4054. @item track
  4055. Prefer the track gain, if present.
  4056. @item album
  4057. Prefer the album gain, if present.
  4058. @end table
  4059. @item replaygain_preamp
  4060. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4061. Default value for @var{replaygain_preamp} is 0.0.
  4062. @item eval
  4063. Set when the volume expression is evaluated.
  4064. It accepts the following values:
  4065. @table @samp
  4066. @item once
  4067. only evaluate expression once during the filter initialization, or
  4068. when the @samp{volume} command is sent
  4069. @item frame
  4070. evaluate expression for each incoming frame
  4071. @end table
  4072. Default value is @samp{once}.
  4073. @end table
  4074. The volume expression can contain the following parameters.
  4075. @table @option
  4076. @item n
  4077. frame number (starting at zero)
  4078. @item nb_channels
  4079. number of channels
  4080. @item nb_consumed_samples
  4081. number of samples consumed by the filter
  4082. @item nb_samples
  4083. number of samples in the current frame
  4084. @item pos
  4085. original frame position in the file
  4086. @item pts
  4087. frame PTS
  4088. @item sample_rate
  4089. sample rate
  4090. @item startpts
  4091. PTS at start of stream
  4092. @item startt
  4093. time at start of stream
  4094. @item t
  4095. frame time
  4096. @item tb
  4097. timestamp timebase
  4098. @item volume
  4099. last set volume value
  4100. @end table
  4101. Note that when @option{eval} is set to @samp{once} only the
  4102. @var{sample_rate} and @var{tb} variables are available, all other
  4103. variables will evaluate to NAN.
  4104. @subsection Commands
  4105. This filter supports the following commands:
  4106. @table @option
  4107. @item volume
  4108. Modify the volume expression.
  4109. The command accepts the same syntax of the corresponding option.
  4110. If the specified expression is not valid, it is kept at its current
  4111. value.
  4112. @item replaygain_noclip
  4113. Prevent clipping by limiting the gain applied.
  4114. Default value for @var{replaygain_noclip} is 1.
  4115. @end table
  4116. @subsection Examples
  4117. @itemize
  4118. @item
  4119. Halve the input audio volume:
  4120. @example
  4121. volume=volume=0.5
  4122. volume=volume=1/2
  4123. volume=volume=-6.0206dB
  4124. @end example
  4125. In all the above example the named key for @option{volume} can be
  4126. omitted, for example like in:
  4127. @example
  4128. volume=0.5
  4129. @end example
  4130. @item
  4131. Increase input audio power by 6 decibels using fixed-point precision:
  4132. @example
  4133. volume=volume=6dB:precision=fixed
  4134. @end example
  4135. @item
  4136. Fade volume after time 10 with an annihilation period of 5 seconds:
  4137. @example
  4138. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4139. @end example
  4140. @end itemize
  4141. @section volumedetect
  4142. Detect the volume of the input video.
  4143. The filter has no parameters. The input is not modified. Statistics about
  4144. the volume will be printed in the log when the input stream end is reached.
  4145. In particular it will show the mean volume (root mean square), maximum
  4146. volume (on a per-sample basis), and the beginning of a histogram of the
  4147. registered volume values (from the maximum value to a cumulated 1/1000 of
  4148. the samples).
  4149. All volumes are in decibels relative to the maximum PCM value.
  4150. @subsection Examples
  4151. Here is an excerpt of the output:
  4152. @example
  4153. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4154. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4155. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4156. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4157. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4158. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4159. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4160. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4161. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4162. @end example
  4163. It means that:
  4164. @itemize
  4165. @item
  4166. The mean square energy is approximately -27 dB, or 10^-2.7.
  4167. @item
  4168. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4169. @item
  4170. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4171. @end itemize
  4172. In other words, raising the volume by +4 dB does not cause any clipping,
  4173. raising it by +5 dB causes clipping for 6 samples, etc.
  4174. @c man end AUDIO FILTERS
  4175. @chapter Audio Sources
  4176. @c man begin AUDIO SOURCES
  4177. Below is a description of the currently available audio sources.
  4178. @section abuffer
  4179. Buffer audio frames, and make them available to the filter chain.
  4180. This source is mainly intended for a programmatic use, in particular
  4181. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4182. It accepts the following parameters:
  4183. @table @option
  4184. @item time_base
  4185. The timebase which will be used for timestamps of submitted frames. It must be
  4186. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4187. @item sample_rate
  4188. The sample rate of the incoming audio buffers.
  4189. @item sample_fmt
  4190. The sample format of the incoming audio buffers.
  4191. Either a sample format name or its corresponding integer representation from
  4192. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4193. @item channel_layout
  4194. The channel layout of the incoming audio buffers.
  4195. Either a channel layout name from channel_layout_map in
  4196. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4197. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4198. @item channels
  4199. The number of channels of the incoming audio buffers.
  4200. If both @var{channels} and @var{channel_layout} are specified, then they
  4201. must be consistent.
  4202. @end table
  4203. @subsection Examples
  4204. @example
  4205. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4206. @end example
  4207. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4208. Since the sample format with name "s16p" corresponds to the number
  4209. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4210. equivalent to:
  4211. @example
  4212. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4213. @end example
  4214. @section aevalsrc
  4215. Generate an audio signal specified by an expression.
  4216. This source accepts in input one or more expressions (one for each
  4217. channel), which are evaluated and used to generate a corresponding
  4218. audio signal.
  4219. This source accepts the following options:
  4220. @table @option
  4221. @item exprs
  4222. Set the '|'-separated expressions list for each separate channel. In case the
  4223. @option{channel_layout} option is not specified, the selected channel layout
  4224. depends on the number of provided expressions. Otherwise the last
  4225. specified expression is applied to the remaining output channels.
  4226. @item channel_layout, c
  4227. Set the channel layout. The number of channels in the specified layout
  4228. must be equal to the number of specified expressions.
  4229. @item duration, d
  4230. Set the minimum duration of the sourced audio. See
  4231. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4232. for the accepted syntax.
  4233. Note that the resulting duration may be greater than the specified
  4234. duration, as the generated audio is always cut at the end of a
  4235. complete frame.
  4236. If not specified, or the expressed duration is negative, the audio is
  4237. supposed to be generated forever.
  4238. @item nb_samples, n
  4239. Set the number of samples per channel per each output frame,
  4240. default to 1024.
  4241. @item sample_rate, s
  4242. Specify the sample rate, default to 44100.
  4243. @end table
  4244. Each expression in @var{exprs} can contain the following constants:
  4245. @table @option
  4246. @item n
  4247. number of the evaluated sample, starting from 0
  4248. @item t
  4249. time of the evaluated sample expressed in seconds, starting from 0
  4250. @item s
  4251. sample rate
  4252. @end table
  4253. @subsection Examples
  4254. @itemize
  4255. @item
  4256. Generate silence:
  4257. @example
  4258. aevalsrc=0
  4259. @end example
  4260. @item
  4261. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4262. 8000 Hz:
  4263. @example
  4264. aevalsrc="sin(440*2*PI*t):s=8000"
  4265. @end example
  4266. @item
  4267. Generate a two channels signal, specify the channel layout (Front
  4268. Center + Back Center) explicitly:
  4269. @example
  4270. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4271. @end example
  4272. @item
  4273. Generate white noise:
  4274. @example
  4275. aevalsrc="-2+random(0)"
  4276. @end example
  4277. @item
  4278. Generate an amplitude modulated signal:
  4279. @example
  4280. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4281. @end example
  4282. @item
  4283. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4284. @example
  4285. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4286. @end example
  4287. @end itemize
  4288. @section anullsrc
  4289. The null audio source, return unprocessed audio frames. It is mainly useful
  4290. as a template and to be employed in analysis / debugging tools, or as
  4291. the source for filters which ignore the input data (for example the sox
  4292. synth filter).
  4293. This source accepts the following options:
  4294. @table @option
  4295. @item channel_layout, cl
  4296. Specifies the channel layout, and can be either an integer or a string
  4297. representing a channel layout. The default value of @var{channel_layout}
  4298. is "stereo".
  4299. Check the channel_layout_map definition in
  4300. @file{libavutil/channel_layout.c} for the mapping between strings and
  4301. channel layout values.
  4302. @item sample_rate, r
  4303. Specifies the sample rate, and defaults to 44100.
  4304. @item nb_samples, n
  4305. Set the number of samples per requested frames.
  4306. @end table
  4307. @subsection Examples
  4308. @itemize
  4309. @item
  4310. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4311. @example
  4312. anullsrc=r=48000:cl=4
  4313. @end example
  4314. @item
  4315. Do the same operation with a more obvious syntax:
  4316. @example
  4317. anullsrc=r=48000:cl=mono
  4318. @end example
  4319. @end itemize
  4320. All the parameters need to be explicitly defined.
  4321. @section flite
  4322. Synthesize a voice utterance using the libflite library.
  4323. To enable compilation of this filter you need to configure FFmpeg with
  4324. @code{--enable-libflite}.
  4325. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4326. The filter accepts the following options:
  4327. @table @option
  4328. @item list_voices
  4329. If set to 1, list the names of the available voices and exit
  4330. immediately. Default value is 0.
  4331. @item nb_samples, n
  4332. Set the maximum number of samples per frame. Default value is 512.
  4333. @item textfile
  4334. Set the filename containing the text to speak.
  4335. @item text
  4336. Set the text to speak.
  4337. @item voice, v
  4338. Set the voice to use for the speech synthesis. Default value is
  4339. @code{kal}. See also the @var{list_voices} option.
  4340. @end table
  4341. @subsection Examples
  4342. @itemize
  4343. @item
  4344. Read from file @file{speech.txt}, and synthesize the text using the
  4345. standard flite voice:
  4346. @example
  4347. flite=textfile=speech.txt
  4348. @end example
  4349. @item
  4350. Read the specified text selecting the @code{slt} voice:
  4351. @example
  4352. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4353. @end example
  4354. @item
  4355. Input text to ffmpeg:
  4356. @example
  4357. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4358. @end example
  4359. @item
  4360. Make @file{ffplay} speak the specified text, using @code{flite} and
  4361. the @code{lavfi} device:
  4362. @example
  4363. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4364. @end example
  4365. @end itemize
  4366. For more information about libflite, check:
  4367. @url{http://www.festvox.org/flite/}
  4368. @section anoisesrc
  4369. Generate a noise audio signal.
  4370. The filter accepts the following options:
  4371. @table @option
  4372. @item sample_rate, r
  4373. Specify the sample rate. Default value is 48000 Hz.
  4374. @item amplitude, a
  4375. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4376. is 1.0.
  4377. @item duration, d
  4378. Specify the duration of the generated audio stream. Not specifying this option
  4379. results in noise with an infinite length.
  4380. @item color, colour, c
  4381. Specify the color of noise. Available noise colors are white, pink, brown,
  4382. blue and violet. Default color is white.
  4383. @item seed, s
  4384. Specify a value used to seed the PRNG.
  4385. @item nb_samples, n
  4386. Set the number of samples per each output frame, default is 1024.
  4387. @end table
  4388. @subsection Examples
  4389. @itemize
  4390. @item
  4391. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4392. @example
  4393. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4394. @end example
  4395. @end itemize
  4396. @section hilbert
  4397. Generate odd-tap Hilbert transform FIR coefficients.
  4398. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4399. the signal by 90 degrees.
  4400. This is used in many matrix coding schemes and for analytic signal generation.
  4401. The process is often written as a multiplication by i (or j), the imaginary unit.
  4402. The filter accepts the following options:
  4403. @table @option
  4404. @item sample_rate, s
  4405. Set sample rate, default is 44100.
  4406. @item taps, t
  4407. Set length of FIR filter, default is 22051.
  4408. @item nb_samples, n
  4409. Set number of samples per each frame.
  4410. @item win_func, w
  4411. Set window function to be used when generating FIR coefficients.
  4412. @end table
  4413. @section sinc
  4414. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4415. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4416. The filter accepts the following options:
  4417. @table @option
  4418. @item sample_rate, r
  4419. Set sample rate, default is 44100.
  4420. @item nb_samples, n
  4421. Set number of samples per each frame. Default is 1024.
  4422. @item hp
  4423. Set high-pass frequency. Default is 0.
  4424. @item lp
  4425. Set low-pass frequency. Default is 0.
  4426. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4427. is higher than 0 then filter will create band-pass filter coefficients,
  4428. otherwise band-reject filter coefficients.
  4429. @item phase
  4430. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4431. @item beta
  4432. Set Kaiser window beta.
  4433. @item att
  4434. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4435. @item round
  4436. Enable rounding, by default is disabled.
  4437. @item hptaps
  4438. Set number of taps for high-pass filter.
  4439. @item lptaps
  4440. Set number of taps for low-pass filter.
  4441. @end table
  4442. @section sine
  4443. Generate an audio signal made of a sine wave with amplitude 1/8.
  4444. The audio signal is bit-exact.
  4445. The filter accepts the following options:
  4446. @table @option
  4447. @item frequency, f
  4448. Set the carrier frequency. Default is 440 Hz.
  4449. @item beep_factor, b
  4450. Enable a periodic beep every second with frequency @var{beep_factor} times
  4451. the carrier frequency. Default is 0, meaning the beep is disabled.
  4452. @item sample_rate, r
  4453. Specify the sample rate, default is 44100.
  4454. @item duration, d
  4455. Specify the duration of the generated audio stream.
  4456. @item samples_per_frame
  4457. Set the number of samples per output frame.
  4458. The expression can contain the following constants:
  4459. @table @option
  4460. @item n
  4461. The (sequential) number of the output audio frame, starting from 0.
  4462. @item pts
  4463. The PTS (Presentation TimeStamp) of the output audio frame,
  4464. expressed in @var{TB} units.
  4465. @item t
  4466. The PTS of the output audio frame, expressed in seconds.
  4467. @item TB
  4468. The timebase of the output audio frames.
  4469. @end table
  4470. Default is @code{1024}.
  4471. @end table
  4472. @subsection Examples
  4473. @itemize
  4474. @item
  4475. Generate a simple 440 Hz sine wave:
  4476. @example
  4477. sine
  4478. @end example
  4479. @item
  4480. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4481. @example
  4482. sine=220:4:d=5
  4483. sine=f=220:b=4:d=5
  4484. sine=frequency=220:beep_factor=4:duration=5
  4485. @end example
  4486. @item
  4487. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4488. pattern:
  4489. @example
  4490. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4491. @end example
  4492. @end itemize
  4493. @c man end AUDIO SOURCES
  4494. @chapter Audio Sinks
  4495. @c man begin AUDIO SINKS
  4496. Below is a description of the currently available audio sinks.
  4497. @section abuffersink
  4498. Buffer audio frames, and make them available to the end of filter chain.
  4499. This sink is mainly intended for programmatic use, in particular
  4500. through the interface defined in @file{libavfilter/buffersink.h}
  4501. or the options system.
  4502. It accepts a pointer to an AVABufferSinkContext structure, which
  4503. defines the incoming buffers' formats, to be passed as the opaque
  4504. parameter to @code{avfilter_init_filter} for initialization.
  4505. @section anullsink
  4506. Null audio sink; do absolutely nothing with the input audio. It is
  4507. mainly useful as a template and for use in analysis / debugging
  4508. tools.
  4509. @c man end AUDIO SINKS
  4510. @chapter Video Filters
  4511. @c man begin VIDEO FILTERS
  4512. When you configure your FFmpeg build, you can disable any of the
  4513. existing filters using @code{--disable-filters}.
  4514. The configure output will show the video filters included in your
  4515. build.
  4516. Below is a description of the currently available video filters.
  4517. @section alphaextract
  4518. Extract the alpha component from the input as a grayscale video. This
  4519. is especially useful with the @var{alphamerge} filter.
  4520. @section alphamerge
  4521. Add or replace the alpha component of the primary input with the
  4522. grayscale value of a second input. This is intended for use with
  4523. @var{alphaextract} to allow the transmission or storage of frame
  4524. sequences that have alpha in a format that doesn't support an alpha
  4525. channel.
  4526. For example, to reconstruct full frames from a normal YUV-encoded video
  4527. and a separate video created with @var{alphaextract}, you might use:
  4528. @example
  4529. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4530. @end example
  4531. Since this filter is designed for reconstruction, it operates on frame
  4532. sequences without considering timestamps, and terminates when either
  4533. input reaches end of stream. This will cause problems if your encoding
  4534. pipeline drops frames. If you're trying to apply an image as an
  4535. overlay to a video stream, consider the @var{overlay} filter instead.
  4536. @section amplify
  4537. Amplify differences between current pixel and pixels of adjacent frames in
  4538. same pixel location.
  4539. This filter accepts the following options:
  4540. @table @option
  4541. @item radius
  4542. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4543. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4544. @item factor
  4545. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4546. @item threshold
  4547. Set threshold for difference amplification. Any difference greater or equal to
  4548. this value will not alter source pixel. Default is 10.
  4549. Allowed range is from 0 to 65535.
  4550. @item tolerance
  4551. Set tolerance for difference amplification. Any difference lower to
  4552. this value will not alter source pixel. Default is 0.
  4553. Allowed range is from 0 to 65535.
  4554. @item low
  4555. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4556. This option controls maximum possible value that will decrease source pixel value.
  4557. @item high
  4558. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4559. This option controls maximum possible value that will increase source pixel value.
  4560. @item planes
  4561. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4562. @end table
  4563. @section ass
  4564. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4565. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4566. Substation Alpha) subtitles files.
  4567. This filter accepts the following option in addition to the common options from
  4568. the @ref{subtitles} filter:
  4569. @table @option
  4570. @item shaping
  4571. Set the shaping engine
  4572. Available values are:
  4573. @table @samp
  4574. @item auto
  4575. The default libass shaping engine, which is the best available.
  4576. @item simple
  4577. Fast, font-agnostic shaper that can do only substitutions
  4578. @item complex
  4579. Slower shaper using OpenType for substitutions and positioning
  4580. @end table
  4581. The default is @code{auto}.
  4582. @end table
  4583. @section atadenoise
  4584. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4585. The filter accepts the following options:
  4586. @table @option
  4587. @item 0a
  4588. Set threshold A for 1st plane. Default is 0.02.
  4589. Valid range is 0 to 0.3.
  4590. @item 0b
  4591. Set threshold B for 1st plane. Default is 0.04.
  4592. Valid range is 0 to 5.
  4593. @item 1a
  4594. Set threshold A for 2nd plane. Default is 0.02.
  4595. Valid range is 0 to 0.3.
  4596. @item 1b
  4597. Set threshold B for 2nd plane. Default is 0.04.
  4598. Valid range is 0 to 5.
  4599. @item 2a
  4600. Set threshold A for 3rd plane. Default is 0.02.
  4601. Valid range is 0 to 0.3.
  4602. @item 2b
  4603. Set threshold B for 3rd plane. Default is 0.04.
  4604. Valid range is 0 to 5.
  4605. Threshold A is designed to react on abrupt changes in the input signal and
  4606. threshold B is designed to react on continuous changes in the input signal.
  4607. @item s
  4608. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4609. number in range [5, 129].
  4610. @item p
  4611. Set what planes of frame filter will use for averaging. Default is all.
  4612. @end table
  4613. @section avgblur
  4614. Apply average blur filter.
  4615. The filter accepts the following options:
  4616. @table @option
  4617. @item sizeX
  4618. Set horizontal radius size.
  4619. @item planes
  4620. Set which planes to filter. By default all planes are filtered.
  4621. @item sizeY
  4622. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4623. Default is @code{0}.
  4624. @end table
  4625. @section bbox
  4626. Compute the bounding box for the non-black pixels in the input frame
  4627. luminance plane.
  4628. This filter computes the bounding box containing all the pixels with a
  4629. luminance value greater than the minimum allowed value.
  4630. The parameters describing the bounding box are printed on the filter
  4631. log.
  4632. The filter accepts the following option:
  4633. @table @option
  4634. @item min_val
  4635. Set the minimal luminance value. Default is @code{16}.
  4636. @end table
  4637. @section bitplanenoise
  4638. Show and measure bit plane noise.
  4639. The filter accepts the following options:
  4640. @table @option
  4641. @item bitplane
  4642. Set which plane to analyze. Default is @code{1}.
  4643. @item filter
  4644. Filter out noisy pixels from @code{bitplane} set above.
  4645. Default is disabled.
  4646. @end table
  4647. @section blackdetect
  4648. Detect video intervals that are (almost) completely black. Can be
  4649. useful to detect chapter transitions, commercials, or invalid
  4650. recordings. Output lines contains the time for the start, end and
  4651. duration of the detected black interval expressed in seconds.
  4652. In order to display the output lines, you need to set the loglevel at
  4653. least to the AV_LOG_INFO value.
  4654. The filter accepts the following options:
  4655. @table @option
  4656. @item black_min_duration, d
  4657. Set the minimum detected black duration expressed in seconds. It must
  4658. be a non-negative floating point number.
  4659. Default value is 2.0.
  4660. @item picture_black_ratio_th, pic_th
  4661. Set the threshold for considering a picture "black".
  4662. Express the minimum value for the ratio:
  4663. @example
  4664. @var{nb_black_pixels} / @var{nb_pixels}
  4665. @end example
  4666. for which a picture is considered black.
  4667. Default value is 0.98.
  4668. @item pixel_black_th, pix_th
  4669. Set the threshold for considering a pixel "black".
  4670. The threshold expresses the maximum pixel luminance value for which a
  4671. pixel is considered "black". The provided value is scaled according to
  4672. the following equation:
  4673. @example
  4674. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4675. @end example
  4676. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4677. the input video format, the range is [0-255] for YUV full-range
  4678. formats and [16-235] for YUV non full-range formats.
  4679. Default value is 0.10.
  4680. @end table
  4681. The following example sets the maximum pixel threshold to the minimum
  4682. value, and detects only black intervals of 2 or more seconds:
  4683. @example
  4684. blackdetect=d=2:pix_th=0.00
  4685. @end example
  4686. @section blackframe
  4687. Detect frames that are (almost) completely black. Can be useful to
  4688. detect chapter transitions or commercials. Output lines consist of
  4689. the frame number of the detected frame, the percentage of blackness,
  4690. the position in the file if known or -1 and the timestamp in seconds.
  4691. In order to display the output lines, you need to set the loglevel at
  4692. least to the AV_LOG_INFO value.
  4693. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4694. The value represents the percentage of pixels in the picture that
  4695. are below the threshold value.
  4696. It accepts the following parameters:
  4697. @table @option
  4698. @item amount
  4699. The percentage of the pixels that have to be below the threshold; it defaults to
  4700. @code{98}.
  4701. @item threshold, thresh
  4702. The threshold below which a pixel value is considered black; it defaults to
  4703. @code{32}.
  4704. @end table
  4705. @section blend, tblend
  4706. Blend two video frames into each other.
  4707. The @code{blend} filter takes two input streams and outputs one
  4708. stream, the first input is the "top" layer and second input is
  4709. "bottom" layer. By default, the output terminates when the longest input terminates.
  4710. The @code{tblend} (time blend) filter takes two consecutive frames
  4711. from one single stream, and outputs the result obtained by blending
  4712. the new frame on top of the old frame.
  4713. A description of the accepted options follows.
  4714. @table @option
  4715. @item c0_mode
  4716. @item c1_mode
  4717. @item c2_mode
  4718. @item c3_mode
  4719. @item all_mode
  4720. Set blend mode for specific pixel component or all pixel components in case
  4721. of @var{all_mode}. Default value is @code{normal}.
  4722. Available values for component modes are:
  4723. @table @samp
  4724. @item addition
  4725. @item grainmerge
  4726. @item and
  4727. @item average
  4728. @item burn
  4729. @item darken
  4730. @item difference
  4731. @item grainextract
  4732. @item divide
  4733. @item dodge
  4734. @item freeze
  4735. @item exclusion
  4736. @item extremity
  4737. @item glow
  4738. @item hardlight
  4739. @item hardmix
  4740. @item heat
  4741. @item lighten
  4742. @item linearlight
  4743. @item multiply
  4744. @item multiply128
  4745. @item negation
  4746. @item normal
  4747. @item or
  4748. @item overlay
  4749. @item phoenix
  4750. @item pinlight
  4751. @item reflect
  4752. @item screen
  4753. @item softlight
  4754. @item subtract
  4755. @item vividlight
  4756. @item xor
  4757. @end table
  4758. @item c0_opacity
  4759. @item c1_opacity
  4760. @item c2_opacity
  4761. @item c3_opacity
  4762. @item all_opacity
  4763. Set blend opacity for specific pixel component or all pixel components in case
  4764. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4765. @item c0_expr
  4766. @item c1_expr
  4767. @item c2_expr
  4768. @item c3_expr
  4769. @item all_expr
  4770. Set blend expression for specific pixel component or all pixel components in case
  4771. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4772. The expressions can use the following variables:
  4773. @table @option
  4774. @item N
  4775. The sequential number of the filtered frame, starting from @code{0}.
  4776. @item X
  4777. @item Y
  4778. the coordinates of the current sample
  4779. @item W
  4780. @item H
  4781. the width and height of currently filtered plane
  4782. @item SW
  4783. @item SH
  4784. Width and height scale for the plane being filtered. It is the
  4785. ratio between the dimensions of the current plane to the luma plane,
  4786. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4787. the luma plane and @code{0.5,0.5} for the chroma planes.
  4788. @item T
  4789. Time of the current frame, expressed in seconds.
  4790. @item TOP, A
  4791. Value of pixel component at current location for first video frame (top layer).
  4792. @item BOTTOM, B
  4793. Value of pixel component at current location for second video frame (bottom layer).
  4794. @end table
  4795. @end table
  4796. The @code{blend} filter also supports the @ref{framesync} options.
  4797. @subsection Examples
  4798. @itemize
  4799. @item
  4800. Apply transition from bottom layer to top layer in first 10 seconds:
  4801. @example
  4802. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4803. @end example
  4804. @item
  4805. Apply linear horizontal transition from top layer to bottom layer:
  4806. @example
  4807. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4808. @end example
  4809. @item
  4810. Apply 1x1 checkerboard effect:
  4811. @example
  4812. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4813. @end example
  4814. @item
  4815. Apply uncover left effect:
  4816. @example
  4817. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4818. @end example
  4819. @item
  4820. Apply uncover down effect:
  4821. @example
  4822. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4823. @end example
  4824. @item
  4825. Apply uncover up-left effect:
  4826. @example
  4827. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4828. @end example
  4829. @item
  4830. Split diagonally video and shows top and bottom layer on each side:
  4831. @example
  4832. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4833. @end example
  4834. @item
  4835. Display differences between the current and the previous frame:
  4836. @example
  4837. tblend=all_mode=grainextract
  4838. @end example
  4839. @end itemize
  4840. @section bm3d
  4841. Denoise frames using Block-Matching 3D algorithm.
  4842. The filter accepts the following options.
  4843. @table @option
  4844. @item sigma
  4845. Set denoising strength. Default value is 1.
  4846. Allowed range is from 0 to 999.9.
  4847. The denoising algorithm is very sensitive to sigma, so adjust it
  4848. according to the source.
  4849. @item block
  4850. Set local patch size. This sets dimensions in 2D.
  4851. @item bstep
  4852. Set sliding step for processing blocks. Default value is 4.
  4853. Allowed range is from 1 to 64.
  4854. Smaller values allows processing more reference blocks and is slower.
  4855. @item group
  4856. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4857. When set to 1, no block matching is done. Larger values allows more blocks
  4858. in single group.
  4859. Allowed range is from 1 to 256.
  4860. @item range
  4861. Set radius for search block matching. Default is 9.
  4862. Allowed range is from 1 to INT32_MAX.
  4863. @item mstep
  4864. Set step between two search locations for block matching. Default is 1.
  4865. Allowed range is from 1 to 64. Smaller is slower.
  4866. @item thmse
  4867. Set threshold of mean square error for block matching. Valid range is 0 to
  4868. INT32_MAX.
  4869. @item hdthr
  4870. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4871. Larger values results in stronger hard-thresholding filtering in frequency
  4872. domain.
  4873. @item estim
  4874. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4875. Default is @code{basic}.
  4876. @item ref
  4877. If enabled, filter will use 2nd stream for block matching.
  4878. Default is disabled for @code{basic} value of @var{estim} option,
  4879. and always enabled if value of @var{estim} is @code{final}.
  4880. @item planes
  4881. Set planes to filter. Default is all available except alpha.
  4882. @end table
  4883. @subsection Examples
  4884. @itemize
  4885. @item
  4886. Basic filtering with bm3d:
  4887. @example
  4888. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4889. @end example
  4890. @item
  4891. Same as above, but filtering only luma:
  4892. @example
  4893. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4894. @end example
  4895. @item
  4896. Same as above, but with both estimation modes:
  4897. @example
  4898. 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
  4899. @end example
  4900. @item
  4901. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4902. @example
  4903. 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
  4904. @end example
  4905. @end itemize
  4906. @section boxblur
  4907. Apply a boxblur algorithm to the input video.
  4908. It accepts the following parameters:
  4909. @table @option
  4910. @item luma_radius, lr
  4911. @item luma_power, lp
  4912. @item chroma_radius, cr
  4913. @item chroma_power, cp
  4914. @item alpha_radius, ar
  4915. @item alpha_power, ap
  4916. @end table
  4917. A description of the accepted options follows.
  4918. @table @option
  4919. @item luma_radius, lr
  4920. @item chroma_radius, cr
  4921. @item alpha_radius, ar
  4922. Set an expression for the box radius in pixels used for blurring the
  4923. corresponding input plane.
  4924. The radius value must be a non-negative number, and must not be
  4925. greater than the value of the expression @code{min(w,h)/2} for the
  4926. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4927. planes.
  4928. Default value for @option{luma_radius} is "2". If not specified,
  4929. @option{chroma_radius} and @option{alpha_radius} default to the
  4930. corresponding value set for @option{luma_radius}.
  4931. The expressions can contain the following constants:
  4932. @table @option
  4933. @item w
  4934. @item h
  4935. The input width and height in pixels.
  4936. @item cw
  4937. @item ch
  4938. The input chroma image width and height in pixels.
  4939. @item hsub
  4940. @item vsub
  4941. The horizontal and vertical chroma subsample values. For example, for the
  4942. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4943. @end table
  4944. @item luma_power, lp
  4945. @item chroma_power, cp
  4946. @item alpha_power, ap
  4947. Specify how many times the boxblur filter is applied to the
  4948. corresponding plane.
  4949. Default value for @option{luma_power} is 2. If not specified,
  4950. @option{chroma_power} and @option{alpha_power} default to the
  4951. corresponding value set for @option{luma_power}.
  4952. A value of 0 will disable the effect.
  4953. @end table
  4954. @subsection Examples
  4955. @itemize
  4956. @item
  4957. Apply a boxblur filter with the luma, chroma, and alpha radii
  4958. set to 2:
  4959. @example
  4960. boxblur=luma_radius=2:luma_power=1
  4961. boxblur=2:1
  4962. @end example
  4963. @item
  4964. Set the luma radius to 2, and alpha and chroma radius to 0:
  4965. @example
  4966. boxblur=2:1:cr=0:ar=0
  4967. @end example
  4968. @item
  4969. Set the luma and chroma radii to a fraction of the video dimension:
  4970. @example
  4971. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4972. @end example
  4973. @end itemize
  4974. @section bwdif
  4975. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4976. Deinterlacing Filter").
  4977. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4978. interpolation algorithms.
  4979. It accepts the following parameters:
  4980. @table @option
  4981. @item mode
  4982. The interlacing mode to adopt. It accepts one of the following values:
  4983. @table @option
  4984. @item 0, send_frame
  4985. Output one frame for each frame.
  4986. @item 1, send_field
  4987. Output one frame for each field.
  4988. @end table
  4989. The default value is @code{send_field}.
  4990. @item parity
  4991. The picture field parity assumed for the input interlaced video. It accepts one
  4992. of the following values:
  4993. @table @option
  4994. @item 0, tff
  4995. Assume the top field is first.
  4996. @item 1, bff
  4997. Assume the bottom field is first.
  4998. @item -1, auto
  4999. Enable automatic detection of field parity.
  5000. @end table
  5001. The default value is @code{auto}.
  5002. If the interlacing is unknown or the decoder does not export this information,
  5003. top field first will be assumed.
  5004. @item deint
  5005. Specify which frames to deinterlace. Accept one of the following
  5006. values:
  5007. @table @option
  5008. @item 0, all
  5009. Deinterlace all frames.
  5010. @item 1, interlaced
  5011. Only deinterlace frames marked as interlaced.
  5012. @end table
  5013. The default value is @code{all}.
  5014. @end table
  5015. @section chromahold
  5016. Remove all color information for all colors except for certain one.
  5017. The filter accepts the following options:
  5018. @table @option
  5019. @item color
  5020. The color which will not be replaced with neutral chroma.
  5021. @item similarity
  5022. Similarity percentage with the above color.
  5023. 0.01 matches only the exact key color, while 1.0 matches everything.
  5024. @item blend
  5025. Blend percentage.
  5026. 0.0 makes pixels either fully gray, or not gray at all.
  5027. Higher values result in more preserved color.
  5028. @item yuv
  5029. Signals that the color passed is already in YUV instead of RGB.
  5030. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5031. This can be used to pass exact YUV values as hexadecimal numbers.
  5032. @end table
  5033. @section chromakey
  5034. YUV colorspace color/chroma keying.
  5035. The filter accepts the following options:
  5036. @table @option
  5037. @item color
  5038. The color which will be replaced with transparency.
  5039. @item similarity
  5040. Similarity percentage with the key color.
  5041. 0.01 matches only the exact key color, while 1.0 matches everything.
  5042. @item blend
  5043. Blend percentage.
  5044. 0.0 makes pixels either fully transparent, or not transparent at all.
  5045. Higher values result in semi-transparent pixels, with a higher transparency
  5046. the more similar the pixels color is to the key color.
  5047. @item yuv
  5048. Signals that the color passed is already in YUV instead of RGB.
  5049. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5050. This can be used to pass exact YUV values as hexadecimal numbers.
  5051. @end table
  5052. @subsection Examples
  5053. @itemize
  5054. @item
  5055. Make every green pixel in the input image transparent:
  5056. @example
  5057. ffmpeg -i input.png -vf chromakey=green out.png
  5058. @end example
  5059. @item
  5060. Overlay a greenscreen-video on top of a static black background.
  5061. @example
  5062. 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
  5063. @end example
  5064. @end itemize
  5065. @section chromashift
  5066. Shift chroma pixels horizontally and/or vertically.
  5067. The filter accepts the following options:
  5068. @table @option
  5069. @item cbh
  5070. Set amount to shift chroma-blue horizontally.
  5071. @item cbv
  5072. Set amount to shift chroma-blue vertically.
  5073. @item crh
  5074. Set amount to shift chroma-red horizontally.
  5075. @item crv
  5076. Set amount to shift chroma-red vertically.
  5077. @item edge
  5078. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5079. @end table
  5080. @section ciescope
  5081. Display CIE color diagram with pixels overlaid onto it.
  5082. The filter accepts the following options:
  5083. @table @option
  5084. @item system
  5085. Set color system.
  5086. @table @samp
  5087. @item ntsc, 470m
  5088. @item ebu, 470bg
  5089. @item smpte
  5090. @item 240m
  5091. @item apple
  5092. @item widergb
  5093. @item cie1931
  5094. @item rec709, hdtv
  5095. @item uhdtv, rec2020
  5096. @end table
  5097. @item cie
  5098. Set CIE system.
  5099. @table @samp
  5100. @item xyy
  5101. @item ucs
  5102. @item luv
  5103. @end table
  5104. @item gamuts
  5105. Set what gamuts to draw.
  5106. See @code{system} option for available values.
  5107. @item size, s
  5108. Set ciescope size, by default set to 512.
  5109. @item intensity, i
  5110. Set intensity used to map input pixel values to CIE diagram.
  5111. @item contrast
  5112. Set contrast used to draw tongue colors that are out of active color system gamut.
  5113. @item corrgamma
  5114. Correct gamma displayed on scope, by default enabled.
  5115. @item showwhite
  5116. Show white point on CIE diagram, by default disabled.
  5117. @item gamma
  5118. Set input gamma. Used only with XYZ input color space.
  5119. @end table
  5120. @section codecview
  5121. Visualize information exported by some codecs.
  5122. Some codecs can export information through frames using side-data or other
  5123. means. For example, some MPEG based codecs export motion vectors through the
  5124. @var{export_mvs} flag in the codec @option{flags2} option.
  5125. The filter accepts the following option:
  5126. @table @option
  5127. @item mv
  5128. Set motion vectors to visualize.
  5129. Available flags for @var{mv} are:
  5130. @table @samp
  5131. @item pf
  5132. forward predicted MVs of P-frames
  5133. @item bf
  5134. forward predicted MVs of B-frames
  5135. @item bb
  5136. backward predicted MVs of B-frames
  5137. @end table
  5138. @item qp
  5139. Display quantization parameters using the chroma planes.
  5140. @item mv_type, mvt
  5141. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5142. Available flags for @var{mv_type} are:
  5143. @table @samp
  5144. @item fp
  5145. forward predicted MVs
  5146. @item bp
  5147. backward predicted MVs
  5148. @end table
  5149. @item frame_type, ft
  5150. Set frame type to visualize motion vectors of.
  5151. Available flags for @var{frame_type} are:
  5152. @table @samp
  5153. @item if
  5154. intra-coded frames (I-frames)
  5155. @item pf
  5156. predicted frames (P-frames)
  5157. @item bf
  5158. bi-directionally predicted frames (B-frames)
  5159. @end table
  5160. @end table
  5161. @subsection Examples
  5162. @itemize
  5163. @item
  5164. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5165. @example
  5166. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5167. @end example
  5168. @item
  5169. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5170. @example
  5171. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5172. @end example
  5173. @end itemize
  5174. @section colorbalance
  5175. Modify intensity of primary colors (red, green and blue) of input frames.
  5176. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5177. regions for the red-cyan, green-magenta or blue-yellow balance.
  5178. A positive adjustment value shifts the balance towards the primary color, a negative
  5179. value towards the complementary color.
  5180. The filter accepts the following options:
  5181. @table @option
  5182. @item rs
  5183. @item gs
  5184. @item bs
  5185. Adjust red, green and blue shadows (darkest pixels).
  5186. @item rm
  5187. @item gm
  5188. @item bm
  5189. Adjust red, green and blue midtones (medium pixels).
  5190. @item rh
  5191. @item gh
  5192. @item bh
  5193. Adjust red, green and blue highlights (brightest pixels).
  5194. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5195. @end table
  5196. @subsection Examples
  5197. @itemize
  5198. @item
  5199. Add red color cast to shadows:
  5200. @example
  5201. colorbalance=rs=.3
  5202. @end example
  5203. @end itemize
  5204. @section colorkey
  5205. RGB colorspace color keying.
  5206. The filter accepts the following options:
  5207. @table @option
  5208. @item color
  5209. The color which will be replaced with transparency.
  5210. @item similarity
  5211. Similarity percentage with the key color.
  5212. 0.01 matches only the exact key color, while 1.0 matches everything.
  5213. @item blend
  5214. Blend percentage.
  5215. 0.0 makes pixels either fully transparent, or not transparent at all.
  5216. Higher values result in semi-transparent pixels, with a higher transparency
  5217. the more similar the pixels color is to the key color.
  5218. @end table
  5219. @subsection Examples
  5220. @itemize
  5221. @item
  5222. Make every green pixel in the input image transparent:
  5223. @example
  5224. ffmpeg -i input.png -vf colorkey=green out.png
  5225. @end example
  5226. @item
  5227. Overlay a greenscreen-video on top of a static background image.
  5228. @example
  5229. 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
  5230. @end example
  5231. @end itemize
  5232. @section colorhold
  5233. Remove all color information for all RGB colors except for certain one.
  5234. The filter accepts the following options:
  5235. @table @option
  5236. @item color
  5237. The color which will not be replaced with neutral gray.
  5238. @item similarity
  5239. Similarity percentage with the above color.
  5240. 0.01 matches only the exact key color, while 1.0 matches everything.
  5241. @item blend
  5242. Blend percentage. 0.0 makes pixels fully gray.
  5243. Higher values result in more preserved color.
  5244. @end table
  5245. @section colorlevels
  5246. Adjust video input frames using levels.
  5247. The filter accepts the following options:
  5248. @table @option
  5249. @item rimin
  5250. @item gimin
  5251. @item bimin
  5252. @item aimin
  5253. Adjust red, green, blue and alpha input black point.
  5254. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5255. @item rimax
  5256. @item gimax
  5257. @item bimax
  5258. @item aimax
  5259. Adjust red, green, blue and alpha input white point.
  5260. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5261. Input levels are used to lighten highlights (bright tones), darken shadows
  5262. (dark tones), change the balance of bright and dark tones.
  5263. @item romin
  5264. @item gomin
  5265. @item bomin
  5266. @item aomin
  5267. Adjust red, green, blue and alpha output black point.
  5268. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5269. @item romax
  5270. @item gomax
  5271. @item bomax
  5272. @item aomax
  5273. Adjust red, green, blue and alpha output white point.
  5274. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5275. Output levels allows manual selection of a constrained output level range.
  5276. @end table
  5277. @subsection Examples
  5278. @itemize
  5279. @item
  5280. Make video output darker:
  5281. @example
  5282. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5283. @end example
  5284. @item
  5285. Increase contrast:
  5286. @example
  5287. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5288. @end example
  5289. @item
  5290. Make video output lighter:
  5291. @example
  5292. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5293. @end example
  5294. @item
  5295. Increase brightness:
  5296. @example
  5297. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5298. @end example
  5299. @end itemize
  5300. @section colorchannelmixer
  5301. Adjust video input frames by re-mixing color channels.
  5302. This filter modifies a color channel by adding the values associated to
  5303. the other channels of the same pixels. For example if the value to
  5304. modify is red, the output value will be:
  5305. @example
  5306. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5307. @end example
  5308. The filter accepts the following options:
  5309. @table @option
  5310. @item rr
  5311. @item rg
  5312. @item rb
  5313. @item ra
  5314. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5315. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5316. @item gr
  5317. @item gg
  5318. @item gb
  5319. @item ga
  5320. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5321. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5322. @item br
  5323. @item bg
  5324. @item bb
  5325. @item ba
  5326. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5327. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5328. @item ar
  5329. @item ag
  5330. @item ab
  5331. @item aa
  5332. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5333. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5334. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5335. @end table
  5336. @subsection Examples
  5337. @itemize
  5338. @item
  5339. Convert source to grayscale:
  5340. @example
  5341. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5342. @end example
  5343. @item
  5344. Simulate sepia tones:
  5345. @example
  5346. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5347. @end example
  5348. @end itemize
  5349. @section colormatrix
  5350. Convert color matrix.
  5351. The filter accepts the following options:
  5352. @table @option
  5353. @item src
  5354. @item dst
  5355. Specify the source and destination color matrix. Both values must be
  5356. specified.
  5357. The accepted values are:
  5358. @table @samp
  5359. @item bt709
  5360. BT.709
  5361. @item fcc
  5362. FCC
  5363. @item bt601
  5364. BT.601
  5365. @item bt470
  5366. BT.470
  5367. @item bt470bg
  5368. BT.470BG
  5369. @item smpte170m
  5370. SMPTE-170M
  5371. @item smpte240m
  5372. SMPTE-240M
  5373. @item bt2020
  5374. BT.2020
  5375. @end table
  5376. @end table
  5377. For example to convert from BT.601 to SMPTE-240M, use the command:
  5378. @example
  5379. colormatrix=bt601:smpte240m
  5380. @end example
  5381. @section colorspace
  5382. Convert colorspace, transfer characteristics or color primaries.
  5383. Input video needs to have an even size.
  5384. The filter accepts the following options:
  5385. @table @option
  5386. @anchor{all}
  5387. @item all
  5388. Specify all color properties at once.
  5389. The accepted values are:
  5390. @table @samp
  5391. @item bt470m
  5392. BT.470M
  5393. @item bt470bg
  5394. BT.470BG
  5395. @item bt601-6-525
  5396. BT.601-6 525
  5397. @item bt601-6-625
  5398. BT.601-6 625
  5399. @item bt709
  5400. BT.709
  5401. @item smpte170m
  5402. SMPTE-170M
  5403. @item smpte240m
  5404. SMPTE-240M
  5405. @item bt2020
  5406. BT.2020
  5407. @end table
  5408. @anchor{space}
  5409. @item space
  5410. Specify output colorspace.
  5411. The accepted values are:
  5412. @table @samp
  5413. @item bt709
  5414. BT.709
  5415. @item fcc
  5416. FCC
  5417. @item bt470bg
  5418. BT.470BG or BT.601-6 625
  5419. @item smpte170m
  5420. SMPTE-170M or BT.601-6 525
  5421. @item smpte240m
  5422. SMPTE-240M
  5423. @item ycgco
  5424. YCgCo
  5425. @item bt2020ncl
  5426. BT.2020 with non-constant luminance
  5427. @end table
  5428. @anchor{trc}
  5429. @item trc
  5430. Specify output transfer characteristics.
  5431. The accepted values are:
  5432. @table @samp
  5433. @item bt709
  5434. BT.709
  5435. @item bt470m
  5436. BT.470M
  5437. @item bt470bg
  5438. BT.470BG
  5439. @item gamma22
  5440. Constant gamma of 2.2
  5441. @item gamma28
  5442. Constant gamma of 2.8
  5443. @item smpte170m
  5444. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5445. @item smpte240m
  5446. SMPTE-240M
  5447. @item srgb
  5448. SRGB
  5449. @item iec61966-2-1
  5450. iec61966-2-1
  5451. @item iec61966-2-4
  5452. iec61966-2-4
  5453. @item xvycc
  5454. xvycc
  5455. @item bt2020-10
  5456. BT.2020 for 10-bits content
  5457. @item bt2020-12
  5458. BT.2020 for 12-bits content
  5459. @end table
  5460. @anchor{primaries}
  5461. @item primaries
  5462. Specify output color primaries.
  5463. The accepted values are:
  5464. @table @samp
  5465. @item bt709
  5466. BT.709
  5467. @item bt470m
  5468. BT.470M
  5469. @item bt470bg
  5470. BT.470BG or BT.601-6 625
  5471. @item smpte170m
  5472. SMPTE-170M or BT.601-6 525
  5473. @item smpte240m
  5474. SMPTE-240M
  5475. @item film
  5476. film
  5477. @item smpte431
  5478. SMPTE-431
  5479. @item smpte432
  5480. SMPTE-432
  5481. @item bt2020
  5482. BT.2020
  5483. @item jedec-p22
  5484. JEDEC P22 phosphors
  5485. @end table
  5486. @anchor{range}
  5487. @item range
  5488. Specify output color range.
  5489. The accepted values are:
  5490. @table @samp
  5491. @item tv
  5492. TV (restricted) range
  5493. @item mpeg
  5494. MPEG (restricted) range
  5495. @item pc
  5496. PC (full) range
  5497. @item jpeg
  5498. JPEG (full) range
  5499. @end table
  5500. @item format
  5501. Specify output color format.
  5502. The accepted values are:
  5503. @table @samp
  5504. @item yuv420p
  5505. YUV 4:2:0 planar 8-bits
  5506. @item yuv420p10
  5507. YUV 4:2:0 planar 10-bits
  5508. @item yuv420p12
  5509. YUV 4:2:0 planar 12-bits
  5510. @item yuv422p
  5511. YUV 4:2:2 planar 8-bits
  5512. @item yuv422p10
  5513. YUV 4:2:2 planar 10-bits
  5514. @item yuv422p12
  5515. YUV 4:2:2 planar 12-bits
  5516. @item yuv444p
  5517. YUV 4:4:4 planar 8-bits
  5518. @item yuv444p10
  5519. YUV 4:4:4 planar 10-bits
  5520. @item yuv444p12
  5521. YUV 4:4:4 planar 12-bits
  5522. @end table
  5523. @item fast
  5524. Do a fast conversion, which skips gamma/primary correction. This will take
  5525. significantly less CPU, but will be mathematically incorrect. To get output
  5526. compatible with that produced by the colormatrix filter, use fast=1.
  5527. @item dither
  5528. Specify dithering mode.
  5529. The accepted values are:
  5530. @table @samp
  5531. @item none
  5532. No dithering
  5533. @item fsb
  5534. Floyd-Steinberg dithering
  5535. @end table
  5536. @item wpadapt
  5537. Whitepoint adaptation mode.
  5538. The accepted values are:
  5539. @table @samp
  5540. @item bradford
  5541. Bradford whitepoint adaptation
  5542. @item vonkries
  5543. von Kries whitepoint adaptation
  5544. @item identity
  5545. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5546. @end table
  5547. @item iall
  5548. Override all input properties at once. Same accepted values as @ref{all}.
  5549. @item ispace
  5550. Override input colorspace. Same accepted values as @ref{space}.
  5551. @item iprimaries
  5552. Override input color primaries. Same accepted values as @ref{primaries}.
  5553. @item itrc
  5554. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5555. @item irange
  5556. Override input color range. Same accepted values as @ref{range}.
  5557. @end table
  5558. The filter converts the transfer characteristics, color space and color
  5559. primaries to the specified user values. The output value, if not specified,
  5560. is set to a default value based on the "all" property. If that property is
  5561. also not specified, the filter will log an error. The output color range and
  5562. format default to the same value as the input color range and format. The
  5563. input transfer characteristics, color space, color primaries and color range
  5564. should be set on the input data. If any of these are missing, the filter will
  5565. log an error and no conversion will take place.
  5566. For example to convert the input to SMPTE-240M, use the command:
  5567. @example
  5568. colorspace=smpte240m
  5569. @end example
  5570. @section convolution
  5571. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5572. The filter accepts the following options:
  5573. @table @option
  5574. @item 0m
  5575. @item 1m
  5576. @item 2m
  5577. @item 3m
  5578. Set matrix for each plane.
  5579. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5580. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5581. @item 0rdiv
  5582. @item 1rdiv
  5583. @item 2rdiv
  5584. @item 3rdiv
  5585. Set multiplier for calculated value for each plane.
  5586. If unset or 0, it will be sum of all matrix elements.
  5587. @item 0bias
  5588. @item 1bias
  5589. @item 2bias
  5590. @item 3bias
  5591. Set bias for each plane. This value is added to the result of the multiplication.
  5592. Useful for making the overall image brighter or darker. Default is 0.0.
  5593. @item 0mode
  5594. @item 1mode
  5595. @item 2mode
  5596. @item 3mode
  5597. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5598. Default is @var{square}.
  5599. @end table
  5600. @subsection Examples
  5601. @itemize
  5602. @item
  5603. Apply sharpen:
  5604. @example
  5605. 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"
  5606. @end example
  5607. @item
  5608. Apply blur:
  5609. @example
  5610. 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"
  5611. @end example
  5612. @item
  5613. Apply edge enhance:
  5614. @example
  5615. 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"
  5616. @end example
  5617. @item
  5618. Apply edge detect:
  5619. @example
  5620. 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"
  5621. @end example
  5622. @item
  5623. Apply laplacian edge detector which includes diagonals:
  5624. @example
  5625. 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"
  5626. @end example
  5627. @item
  5628. Apply emboss:
  5629. @example
  5630. 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"
  5631. @end example
  5632. @end itemize
  5633. @section convolve
  5634. Apply 2D convolution of video stream in frequency domain using second stream
  5635. as impulse.
  5636. The filter accepts the following options:
  5637. @table @option
  5638. @item planes
  5639. Set which planes to process.
  5640. @item impulse
  5641. Set which impulse video frames will be processed, can be @var{first}
  5642. or @var{all}. Default is @var{all}.
  5643. @end table
  5644. The @code{convolve} filter also supports the @ref{framesync} options.
  5645. @section copy
  5646. Copy the input video source unchanged to the output. This is mainly useful for
  5647. testing purposes.
  5648. @anchor{coreimage}
  5649. @section coreimage
  5650. Video filtering on GPU using Apple's CoreImage API on OSX.
  5651. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5652. processed by video hardware. However, software-based OpenGL implementations
  5653. exist which means there is no guarantee for hardware processing. It depends on
  5654. the respective OSX.
  5655. There are many filters and image generators provided by Apple that come with a
  5656. large variety of options. The filter has to be referenced by its name along
  5657. with its options.
  5658. The coreimage filter accepts the following options:
  5659. @table @option
  5660. @item list_filters
  5661. List all available filters and generators along with all their respective
  5662. options as well as possible minimum and maximum values along with the default
  5663. values.
  5664. @example
  5665. list_filters=true
  5666. @end example
  5667. @item filter
  5668. Specify all filters by their respective name and options.
  5669. Use @var{list_filters} to determine all valid filter names and options.
  5670. Numerical options are specified by a float value and are automatically clamped
  5671. to their respective value range. Vector and color options have to be specified
  5672. by a list of space separated float values. Character escaping has to be done.
  5673. A special option name @code{default} is available to use default options for a
  5674. filter.
  5675. It is required to specify either @code{default} or at least one of the filter options.
  5676. All omitted options are used with their default values.
  5677. The syntax of the filter string is as follows:
  5678. @example
  5679. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5680. @end example
  5681. @item output_rect
  5682. Specify a rectangle where the output of the filter chain is copied into the
  5683. input image. It is given by a list of space separated float values:
  5684. @example
  5685. output_rect=x\ y\ width\ height
  5686. @end example
  5687. If not given, the output rectangle equals the dimensions of the input image.
  5688. The output rectangle is automatically cropped at the borders of the input
  5689. image. Negative values are valid for each component.
  5690. @example
  5691. output_rect=25\ 25\ 100\ 100
  5692. @end example
  5693. @end table
  5694. Several filters can be chained for successive processing without GPU-HOST
  5695. transfers allowing for fast processing of complex filter chains.
  5696. Currently, only filters with zero (generators) or exactly one (filters) input
  5697. image and one output image are supported. Also, transition filters are not yet
  5698. usable as intended.
  5699. Some filters generate output images with additional padding depending on the
  5700. respective filter kernel. The padding is automatically removed to ensure the
  5701. filter output has the same size as the input image.
  5702. For image generators, the size of the output image is determined by the
  5703. previous output image of the filter chain or the input image of the whole
  5704. filterchain, respectively. The generators do not use the pixel information of
  5705. this image to generate their output. However, the generated output is
  5706. blended onto this image, resulting in partial or complete coverage of the
  5707. output image.
  5708. The @ref{coreimagesrc} video source can be used for generating input images
  5709. which are directly fed into the filter chain. By using it, providing input
  5710. images by another video source or an input video is not required.
  5711. @subsection Examples
  5712. @itemize
  5713. @item
  5714. List all filters available:
  5715. @example
  5716. coreimage=list_filters=true
  5717. @end example
  5718. @item
  5719. Use the CIBoxBlur filter with default options to blur an image:
  5720. @example
  5721. coreimage=filter=CIBoxBlur@@default
  5722. @end example
  5723. @item
  5724. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5725. its center at 100x100 and a radius of 50 pixels:
  5726. @example
  5727. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5728. @end example
  5729. @item
  5730. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5731. given as complete and escaped command-line for Apple's standard bash shell:
  5732. @example
  5733. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5734. @end example
  5735. @end itemize
  5736. @section crop
  5737. Crop the input video to given dimensions.
  5738. It accepts the following parameters:
  5739. @table @option
  5740. @item w, out_w
  5741. The width of the output video. It defaults to @code{iw}.
  5742. This expression is evaluated only once during the filter
  5743. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5744. @item h, out_h
  5745. The height of the output video. It defaults to @code{ih}.
  5746. This expression is evaluated only once during the filter
  5747. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5748. @item x
  5749. The horizontal position, in the input video, of the left edge of the output
  5750. video. It defaults to @code{(in_w-out_w)/2}.
  5751. This expression is evaluated per-frame.
  5752. @item y
  5753. The vertical position, in the input video, of the top edge of the output video.
  5754. It defaults to @code{(in_h-out_h)/2}.
  5755. This expression is evaluated per-frame.
  5756. @item keep_aspect
  5757. If set to 1 will force the output display aspect ratio
  5758. to be the same of the input, by changing the output sample aspect
  5759. ratio. It defaults to 0.
  5760. @item exact
  5761. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5762. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5763. It defaults to 0.
  5764. @end table
  5765. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5766. expressions containing the following constants:
  5767. @table @option
  5768. @item x
  5769. @item y
  5770. The computed values for @var{x} and @var{y}. They are evaluated for
  5771. each new frame.
  5772. @item in_w
  5773. @item in_h
  5774. The input width and height.
  5775. @item iw
  5776. @item ih
  5777. These are the same as @var{in_w} and @var{in_h}.
  5778. @item out_w
  5779. @item out_h
  5780. The output (cropped) width and height.
  5781. @item ow
  5782. @item oh
  5783. These are the same as @var{out_w} and @var{out_h}.
  5784. @item a
  5785. same as @var{iw} / @var{ih}
  5786. @item sar
  5787. input sample aspect ratio
  5788. @item dar
  5789. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5790. @item hsub
  5791. @item vsub
  5792. horizontal and vertical chroma subsample values. For example for the
  5793. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5794. @item n
  5795. The number of the input frame, starting from 0.
  5796. @item pos
  5797. the position in the file of the input frame, NAN if unknown
  5798. @item t
  5799. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5800. @end table
  5801. The expression for @var{out_w} may depend on the value of @var{out_h},
  5802. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5803. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5804. evaluated after @var{out_w} and @var{out_h}.
  5805. The @var{x} and @var{y} parameters specify the expressions for the
  5806. position of the top-left corner of the output (non-cropped) area. They
  5807. are evaluated for each frame. If the evaluated value is not valid, it
  5808. is approximated to the nearest valid value.
  5809. The expression for @var{x} may depend on @var{y}, and the expression
  5810. for @var{y} may depend on @var{x}.
  5811. @subsection Examples
  5812. @itemize
  5813. @item
  5814. Crop area with size 100x100 at position (12,34).
  5815. @example
  5816. crop=100:100:12:34
  5817. @end example
  5818. Using named options, the example above becomes:
  5819. @example
  5820. crop=w=100:h=100:x=12:y=34
  5821. @end example
  5822. @item
  5823. Crop the central input area with size 100x100:
  5824. @example
  5825. crop=100:100
  5826. @end example
  5827. @item
  5828. Crop the central input area with size 2/3 of the input video:
  5829. @example
  5830. crop=2/3*in_w:2/3*in_h
  5831. @end example
  5832. @item
  5833. Crop the input video central square:
  5834. @example
  5835. crop=out_w=in_h
  5836. crop=in_h
  5837. @end example
  5838. @item
  5839. Delimit the rectangle with the top-left corner placed at position
  5840. 100:100 and the right-bottom corner corresponding to the right-bottom
  5841. corner of the input image.
  5842. @example
  5843. crop=in_w-100:in_h-100:100:100
  5844. @end example
  5845. @item
  5846. Crop 10 pixels from the left and right borders, and 20 pixels from
  5847. the top and bottom borders
  5848. @example
  5849. crop=in_w-2*10:in_h-2*20
  5850. @end example
  5851. @item
  5852. Keep only the bottom right quarter of the input image:
  5853. @example
  5854. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5855. @end example
  5856. @item
  5857. Crop height for getting Greek harmony:
  5858. @example
  5859. crop=in_w:1/PHI*in_w
  5860. @end example
  5861. @item
  5862. Apply trembling effect:
  5863. @example
  5864. 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)
  5865. @end example
  5866. @item
  5867. Apply erratic camera effect depending on timestamp:
  5868. @example
  5869. 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)"
  5870. @end example
  5871. @item
  5872. Set x depending on the value of y:
  5873. @example
  5874. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5875. @end example
  5876. @end itemize
  5877. @subsection Commands
  5878. This filter supports the following commands:
  5879. @table @option
  5880. @item w, out_w
  5881. @item h, out_h
  5882. @item x
  5883. @item y
  5884. Set width/height of the output video and the horizontal/vertical position
  5885. in the input video.
  5886. The command accepts the same syntax of the corresponding option.
  5887. If the specified expression is not valid, it is kept at its current
  5888. value.
  5889. @end table
  5890. @section cropdetect
  5891. Auto-detect the crop size.
  5892. It calculates the necessary cropping parameters and prints the
  5893. recommended parameters via the logging system. The detected dimensions
  5894. correspond to the non-black area of the input video.
  5895. It accepts the following parameters:
  5896. @table @option
  5897. @item limit
  5898. Set higher black value threshold, which can be optionally specified
  5899. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5900. value greater to the set value is considered non-black. It defaults to 24.
  5901. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5902. on the bitdepth of the pixel format.
  5903. @item round
  5904. The value which the width/height should be divisible by. It defaults to
  5905. 16. The offset is automatically adjusted to center the video. Use 2 to
  5906. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5907. encoding to most video codecs.
  5908. @item reset_count, reset
  5909. Set the counter that determines after how many frames cropdetect will
  5910. reset the previously detected largest video area and start over to
  5911. detect the current optimal crop area. Default value is 0.
  5912. This can be useful when channel logos distort the video area. 0
  5913. indicates 'never reset', and returns the largest area encountered during
  5914. playback.
  5915. @end table
  5916. @anchor{cue}
  5917. @section cue
  5918. Delay video filtering until a given wallclock timestamp. The filter first
  5919. passes on @option{preroll} amount of frames, then it buffers at most
  5920. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5921. it forwards the buffered frames and also any subsequent frames coming in its
  5922. input.
  5923. The filter can be used synchronize the output of multiple ffmpeg processes for
  5924. realtime output devices like decklink. By putting the delay in the filtering
  5925. chain and pre-buffering frames the process can pass on data to output almost
  5926. immediately after the target wallclock timestamp is reached.
  5927. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5928. some use cases.
  5929. @table @option
  5930. @item cue
  5931. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5932. @item preroll
  5933. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5934. @item buffer
  5935. The maximum duration of content to buffer before waiting for the cue expressed
  5936. in seconds. Default is 0.
  5937. @end table
  5938. @anchor{curves}
  5939. @section curves
  5940. Apply color adjustments using curves.
  5941. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5942. component (red, green and blue) has its values defined by @var{N} key points
  5943. tied from each other using a smooth curve. The x-axis represents the pixel
  5944. values from the input frame, and the y-axis the new pixel values to be set for
  5945. the output frame.
  5946. By default, a component curve is defined by the two points @var{(0;0)} and
  5947. @var{(1;1)}. This creates a straight line where each original pixel value is
  5948. "adjusted" to its own value, which means no change to the image.
  5949. The filter allows you to redefine these two points and add some more. A new
  5950. curve (using a natural cubic spline interpolation) will be define to pass
  5951. smoothly through all these new coordinates. The new defined points needs to be
  5952. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5953. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5954. the vector spaces, the values will be clipped accordingly.
  5955. The filter accepts the following options:
  5956. @table @option
  5957. @item preset
  5958. Select one of the available color presets. This option can be used in addition
  5959. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5960. options takes priority on the preset values.
  5961. Available presets are:
  5962. @table @samp
  5963. @item none
  5964. @item color_negative
  5965. @item cross_process
  5966. @item darker
  5967. @item increase_contrast
  5968. @item lighter
  5969. @item linear_contrast
  5970. @item medium_contrast
  5971. @item negative
  5972. @item strong_contrast
  5973. @item vintage
  5974. @end table
  5975. Default is @code{none}.
  5976. @item master, m
  5977. Set the master key points. These points will define a second pass mapping. It
  5978. is sometimes called a "luminance" or "value" mapping. It can be used with
  5979. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5980. post-processing LUT.
  5981. @item red, r
  5982. Set the key points for the red component.
  5983. @item green, g
  5984. Set the key points for the green component.
  5985. @item blue, b
  5986. Set the key points for the blue component.
  5987. @item all
  5988. Set the key points for all components (not including master).
  5989. Can be used in addition to the other key points component
  5990. options. In this case, the unset component(s) will fallback on this
  5991. @option{all} setting.
  5992. @item psfile
  5993. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5994. @item plot
  5995. Save Gnuplot script of the curves in specified file.
  5996. @end table
  5997. To avoid some filtergraph syntax conflicts, each key points list need to be
  5998. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5999. @subsection Examples
  6000. @itemize
  6001. @item
  6002. Increase slightly the middle level of blue:
  6003. @example
  6004. curves=blue='0/0 0.5/0.58 1/1'
  6005. @end example
  6006. @item
  6007. Vintage effect:
  6008. @example
  6009. 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'
  6010. @end example
  6011. Here we obtain the following coordinates for each components:
  6012. @table @var
  6013. @item red
  6014. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6015. @item green
  6016. @code{(0;0) (0.50;0.48) (1;1)}
  6017. @item blue
  6018. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6019. @end table
  6020. @item
  6021. The previous example can also be achieved with the associated built-in preset:
  6022. @example
  6023. curves=preset=vintage
  6024. @end example
  6025. @item
  6026. Or simply:
  6027. @example
  6028. curves=vintage
  6029. @end example
  6030. @item
  6031. Use a Photoshop preset and redefine the points of the green component:
  6032. @example
  6033. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6034. @end example
  6035. @item
  6036. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6037. and @command{gnuplot}:
  6038. @example
  6039. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6040. gnuplot -p /tmp/curves.plt
  6041. @end example
  6042. @end itemize
  6043. @section datascope
  6044. Video data analysis filter.
  6045. This filter shows hexadecimal pixel values of part of video.
  6046. The filter accepts the following options:
  6047. @table @option
  6048. @item size, s
  6049. Set output video size.
  6050. @item x
  6051. Set x offset from where to pick pixels.
  6052. @item y
  6053. Set y offset from where to pick pixels.
  6054. @item mode
  6055. Set scope mode, can be one of the following:
  6056. @table @samp
  6057. @item mono
  6058. Draw hexadecimal pixel values with white color on black background.
  6059. @item color
  6060. Draw hexadecimal pixel values with input video pixel color on black
  6061. background.
  6062. @item color2
  6063. Draw hexadecimal pixel values on color background picked from input video,
  6064. the text color is picked in such way so its always visible.
  6065. @end table
  6066. @item axis
  6067. Draw rows and columns numbers on left and top of video.
  6068. @item opacity
  6069. Set background opacity.
  6070. @end table
  6071. @section dctdnoiz
  6072. Denoise frames using 2D DCT (frequency domain filtering).
  6073. This filter is not designed for real time.
  6074. The filter accepts the following options:
  6075. @table @option
  6076. @item sigma, s
  6077. Set the noise sigma constant.
  6078. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6079. coefficient (absolute value) below this threshold with be dropped.
  6080. If you need a more advanced filtering, see @option{expr}.
  6081. Default is @code{0}.
  6082. @item overlap
  6083. Set number overlapping pixels for each block. Since the filter can be slow, you
  6084. may want to reduce this value, at the cost of a less effective filter and the
  6085. risk of various artefacts.
  6086. If the overlapping value doesn't permit processing the whole input width or
  6087. height, a warning will be displayed and according borders won't be denoised.
  6088. Default value is @var{blocksize}-1, which is the best possible setting.
  6089. @item expr, e
  6090. Set the coefficient factor expression.
  6091. For each coefficient of a DCT block, this expression will be evaluated as a
  6092. multiplier value for the coefficient.
  6093. If this is option is set, the @option{sigma} option will be ignored.
  6094. The absolute value of the coefficient can be accessed through the @var{c}
  6095. variable.
  6096. @item n
  6097. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6098. @var{blocksize}, which is the width and height of the processed blocks.
  6099. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6100. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6101. on the speed processing. Also, a larger block size does not necessarily means a
  6102. better de-noising.
  6103. @end table
  6104. @subsection Examples
  6105. Apply a denoise with a @option{sigma} of @code{4.5}:
  6106. @example
  6107. dctdnoiz=4.5
  6108. @end example
  6109. The same operation can be achieved using the expression system:
  6110. @example
  6111. dctdnoiz=e='gte(c, 4.5*3)'
  6112. @end example
  6113. Violent denoise using a block size of @code{16x16}:
  6114. @example
  6115. dctdnoiz=15:n=4
  6116. @end example
  6117. @section deband
  6118. Remove banding artifacts from input video.
  6119. It works by replacing banded pixels with average value of referenced pixels.
  6120. The filter accepts the following options:
  6121. @table @option
  6122. @item 1thr
  6123. @item 2thr
  6124. @item 3thr
  6125. @item 4thr
  6126. Set banding detection threshold for each plane. Default is 0.02.
  6127. Valid range is 0.00003 to 0.5.
  6128. If difference between current pixel and reference pixel is less than threshold,
  6129. it will be considered as banded.
  6130. @item range, r
  6131. Banding detection range in pixels. Default is 16. If positive, random number
  6132. in range 0 to set value will be used. If negative, exact absolute value
  6133. will be used.
  6134. The range defines square of four pixels around current pixel.
  6135. @item direction, d
  6136. Set direction in radians from which four pixel will be compared. If positive,
  6137. random direction from 0 to set direction will be picked. If negative, exact of
  6138. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6139. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6140. column.
  6141. @item blur, b
  6142. If enabled, current pixel is compared with average value of all four
  6143. surrounding pixels. The default is enabled. If disabled current pixel is
  6144. compared with all four surrounding pixels. The pixel is considered banded
  6145. if only all four differences with surrounding pixels are less than threshold.
  6146. @item coupling, c
  6147. If enabled, current pixel is changed if and only if all pixel components are banded,
  6148. e.g. banding detection threshold is triggered for all color components.
  6149. The default is disabled.
  6150. @end table
  6151. @section deblock
  6152. Remove blocking artifacts from input video.
  6153. The filter accepts the following options:
  6154. @table @option
  6155. @item filter
  6156. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6157. This controls what kind of deblocking is applied.
  6158. @item block
  6159. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6160. @item alpha
  6161. @item beta
  6162. @item gamma
  6163. @item delta
  6164. Set blocking detection thresholds. Allowed range is 0 to 1.
  6165. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6166. Using higher threshold gives more deblocking strength.
  6167. Setting @var{alpha} controls threshold detection at exact edge of block.
  6168. Remaining options controls threshold detection near the edge. Each one for
  6169. below/above or left/right. Setting any of those to @var{0} disables
  6170. deblocking.
  6171. @item planes
  6172. Set planes to filter. Default is to filter all available planes.
  6173. @end table
  6174. @subsection Examples
  6175. @itemize
  6176. @item
  6177. Deblock using weak filter and block size of 4 pixels.
  6178. @example
  6179. deblock=filter=weak:block=4
  6180. @end example
  6181. @item
  6182. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6183. deblocking more edges.
  6184. @example
  6185. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6186. @end example
  6187. @item
  6188. Similar as above, but filter only first plane.
  6189. @example
  6190. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6191. @end example
  6192. @item
  6193. Similar as above, but filter only second and third plane.
  6194. @example
  6195. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6196. @end example
  6197. @end itemize
  6198. @anchor{decimate}
  6199. @section decimate
  6200. Drop duplicated frames at regular intervals.
  6201. The filter accepts the following options:
  6202. @table @option
  6203. @item cycle
  6204. Set the number of frames from which one will be dropped. Setting this to
  6205. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6206. Default is @code{5}.
  6207. @item dupthresh
  6208. Set the threshold for duplicate detection. If the difference metric for a frame
  6209. is less than or equal to this value, then it is declared as duplicate. Default
  6210. is @code{1.1}
  6211. @item scthresh
  6212. Set scene change threshold. Default is @code{15}.
  6213. @item blockx
  6214. @item blocky
  6215. Set the size of the x and y-axis blocks used during metric calculations.
  6216. Larger blocks give better noise suppression, but also give worse detection of
  6217. small movements. Must be a power of two. Default is @code{32}.
  6218. @item ppsrc
  6219. Mark main input as a pre-processed input and activate clean source input
  6220. stream. This allows the input to be pre-processed with various filters to help
  6221. the metrics calculation while keeping the frame selection lossless. When set to
  6222. @code{1}, the first stream is for the pre-processed input, and the second
  6223. stream is the clean source from where the kept frames are chosen. Default is
  6224. @code{0}.
  6225. @item chroma
  6226. Set whether or not chroma is considered in the metric calculations. Default is
  6227. @code{1}.
  6228. @end table
  6229. @section deconvolve
  6230. Apply 2D deconvolution of video stream in frequency domain using second stream
  6231. as impulse.
  6232. The filter accepts the following options:
  6233. @table @option
  6234. @item planes
  6235. Set which planes to process.
  6236. @item impulse
  6237. Set which impulse video frames will be processed, can be @var{first}
  6238. or @var{all}. Default is @var{all}.
  6239. @item noise
  6240. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6241. and height are not same and not power of 2 or if stream prior to convolving
  6242. had noise.
  6243. @end table
  6244. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6245. @section dedot
  6246. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6247. It accepts the following options:
  6248. @table @option
  6249. @item m
  6250. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6251. @var{rainbows} for cross-color reduction.
  6252. @item lt
  6253. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6254. @item tl
  6255. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6256. @item tc
  6257. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6258. @item ct
  6259. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6260. @end table
  6261. @section deflate
  6262. Apply deflate effect to the video.
  6263. This filter replaces the pixel by the local(3x3) average by taking into account
  6264. only values lower than the pixel.
  6265. It accepts the following options:
  6266. @table @option
  6267. @item threshold0
  6268. @item threshold1
  6269. @item threshold2
  6270. @item threshold3
  6271. Limit the maximum change for each plane, default is 65535.
  6272. If 0, plane will remain unchanged.
  6273. @end table
  6274. @section deflicker
  6275. Remove temporal frame luminance variations.
  6276. It accepts the following options:
  6277. @table @option
  6278. @item size, s
  6279. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6280. @item mode, m
  6281. Set averaging mode to smooth temporal luminance variations.
  6282. Available values are:
  6283. @table @samp
  6284. @item am
  6285. Arithmetic mean
  6286. @item gm
  6287. Geometric mean
  6288. @item hm
  6289. Harmonic mean
  6290. @item qm
  6291. Quadratic mean
  6292. @item cm
  6293. Cubic mean
  6294. @item pm
  6295. Power mean
  6296. @item median
  6297. Median
  6298. @end table
  6299. @item bypass
  6300. Do not actually modify frame. Useful when one only wants metadata.
  6301. @end table
  6302. @section dejudder
  6303. Remove judder produced by partially interlaced telecined content.
  6304. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6305. source was partially telecined content then the output of @code{pullup,dejudder}
  6306. will have a variable frame rate. May change the recorded frame rate of the
  6307. container. Aside from that change, this filter will not affect constant frame
  6308. rate video.
  6309. The option available in this filter is:
  6310. @table @option
  6311. @item cycle
  6312. Specify the length of the window over which the judder repeats.
  6313. Accepts any integer greater than 1. Useful values are:
  6314. @table @samp
  6315. @item 4
  6316. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6317. @item 5
  6318. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6319. @item 20
  6320. If a mixture of the two.
  6321. @end table
  6322. The default is @samp{4}.
  6323. @end table
  6324. @section delogo
  6325. Suppress a TV station logo by a simple interpolation of the surrounding
  6326. pixels. Just set a rectangle covering the logo and watch it disappear
  6327. (and sometimes something even uglier appear - your mileage may vary).
  6328. It accepts the following parameters:
  6329. @table @option
  6330. @item x
  6331. @item y
  6332. Specify the top left corner coordinates of the logo. They must be
  6333. specified.
  6334. @item w
  6335. @item h
  6336. Specify the width and height of the logo to clear. They must be
  6337. specified.
  6338. @item band, t
  6339. Specify the thickness of the fuzzy edge of the rectangle (added to
  6340. @var{w} and @var{h}). The default value is 1. This option is
  6341. deprecated, setting higher values should no longer be necessary and
  6342. is not recommended.
  6343. @item show
  6344. When set to 1, a green rectangle is drawn on the screen to simplify
  6345. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6346. The default value is 0.
  6347. The rectangle is drawn on the outermost pixels which will be (partly)
  6348. replaced with interpolated values. The values of the next pixels
  6349. immediately outside this rectangle in each direction will be used to
  6350. compute the interpolated pixel values inside the rectangle.
  6351. @end table
  6352. @subsection Examples
  6353. @itemize
  6354. @item
  6355. Set a rectangle covering the area with top left corner coordinates 0,0
  6356. and size 100x77, and a band of size 10:
  6357. @example
  6358. delogo=x=0:y=0:w=100:h=77:band=10
  6359. @end example
  6360. @end itemize
  6361. @section derain
  6362. Remove the rain in the input image/video by applying the derain methods based on
  6363. convolutional neural networks. Supported models:
  6364. @itemize
  6365. @item
  6366. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6367. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6368. @end itemize
  6369. Training scripts as well as scripts for model generation are provided in
  6370. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6371. The filter accepts the following options:
  6372. @table @option
  6373. @item dnn_backend
  6374. Specify which DNN backend to use for model loading and execution. This option accepts
  6375. the following values:
  6376. @table @samp
  6377. @item native
  6378. Native implementation of DNN loading and execution.
  6379. @end table
  6380. Default value is @samp{native}.
  6381. @item model
  6382. Set path to model file specifying network architecture and its parameters.
  6383. Note that different backends use different file formats. TensorFlow backend
  6384. can load files for both formats, while native backend can load files for only
  6385. its format.
  6386. @end table
  6387. @section deshake
  6388. Attempt to fix small changes in horizontal and/or vertical shift. This
  6389. filter helps remove camera shake from hand-holding a camera, bumping a
  6390. tripod, moving on a vehicle, etc.
  6391. The filter accepts the following options:
  6392. @table @option
  6393. @item x
  6394. @item y
  6395. @item w
  6396. @item h
  6397. Specify a rectangular area where to limit the search for motion
  6398. vectors.
  6399. If desired the search for motion vectors can be limited to a
  6400. rectangular area of the frame defined by its top left corner, width
  6401. and height. These parameters have the same meaning as the drawbox
  6402. filter which can be used to visualise the position of the bounding
  6403. box.
  6404. This is useful when simultaneous movement of subjects within the frame
  6405. might be confused for camera motion by the motion vector search.
  6406. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6407. then the full frame is used. This allows later options to be set
  6408. without specifying the bounding box for the motion vector search.
  6409. Default - search the whole frame.
  6410. @item rx
  6411. @item ry
  6412. Specify the maximum extent of movement in x and y directions in the
  6413. range 0-64 pixels. Default 16.
  6414. @item edge
  6415. Specify how to generate pixels to fill blanks at the edge of the
  6416. frame. Available values are:
  6417. @table @samp
  6418. @item blank, 0
  6419. Fill zeroes at blank locations
  6420. @item original, 1
  6421. Original image at blank locations
  6422. @item clamp, 2
  6423. Extruded edge value at blank locations
  6424. @item mirror, 3
  6425. Mirrored edge at blank locations
  6426. @end table
  6427. Default value is @samp{mirror}.
  6428. @item blocksize
  6429. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6430. default 8.
  6431. @item contrast
  6432. Specify the contrast threshold for blocks. Only blocks with more than
  6433. the specified contrast (difference between darkest and lightest
  6434. pixels) will be considered. Range 1-255, default 125.
  6435. @item search
  6436. Specify the search strategy. Available values are:
  6437. @table @samp
  6438. @item exhaustive, 0
  6439. Set exhaustive search
  6440. @item less, 1
  6441. Set less exhaustive search.
  6442. @end table
  6443. Default value is @samp{exhaustive}.
  6444. @item filename
  6445. If set then a detailed log of the motion search is written to the
  6446. specified file.
  6447. @end table
  6448. @section despill
  6449. Remove unwanted contamination of foreground colors, caused by reflected color of
  6450. greenscreen or bluescreen.
  6451. This filter accepts the following options:
  6452. @table @option
  6453. @item type
  6454. Set what type of despill to use.
  6455. @item mix
  6456. Set how spillmap will be generated.
  6457. @item expand
  6458. Set how much to get rid of still remaining spill.
  6459. @item red
  6460. Controls amount of red in spill area.
  6461. @item green
  6462. Controls amount of green in spill area.
  6463. Should be -1 for greenscreen.
  6464. @item blue
  6465. Controls amount of blue in spill area.
  6466. Should be -1 for bluescreen.
  6467. @item brightness
  6468. Controls brightness of spill area, preserving colors.
  6469. @item alpha
  6470. Modify alpha from generated spillmap.
  6471. @end table
  6472. @section detelecine
  6473. Apply an exact inverse of the telecine operation. It requires a predefined
  6474. pattern specified using the pattern option which must be the same as that passed
  6475. to the telecine filter.
  6476. This filter accepts the following options:
  6477. @table @option
  6478. @item first_field
  6479. @table @samp
  6480. @item top, t
  6481. top field first
  6482. @item bottom, b
  6483. bottom field first
  6484. The default value is @code{top}.
  6485. @end table
  6486. @item pattern
  6487. A string of numbers representing the pulldown pattern you wish to apply.
  6488. The default value is @code{23}.
  6489. @item start_frame
  6490. A number representing position of the first frame with respect to the telecine
  6491. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6492. @end table
  6493. @section dilation
  6494. Apply dilation effect to the video.
  6495. This filter replaces the pixel by the local(3x3) maximum.
  6496. It accepts the following options:
  6497. @table @option
  6498. @item threshold0
  6499. @item threshold1
  6500. @item threshold2
  6501. @item threshold3
  6502. Limit the maximum change for each plane, default is 65535.
  6503. If 0, plane will remain unchanged.
  6504. @item coordinates
  6505. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6506. pixels are used.
  6507. Flags to local 3x3 coordinates maps like this:
  6508. 1 2 3
  6509. 4 5
  6510. 6 7 8
  6511. @end table
  6512. @section displace
  6513. Displace pixels as indicated by second and third input stream.
  6514. It takes three input streams and outputs one stream, the first input is the
  6515. source, and second and third input are displacement maps.
  6516. The second input specifies how much to displace pixels along the
  6517. x-axis, while the third input specifies how much to displace pixels
  6518. along the y-axis.
  6519. If one of displacement map streams terminates, last frame from that
  6520. displacement map will be used.
  6521. Note that once generated, displacements maps can be reused over and over again.
  6522. A description of the accepted options follows.
  6523. @table @option
  6524. @item edge
  6525. Set displace behavior for pixels that are out of range.
  6526. Available values are:
  6527. @table @samp
  6528. @item blank
  6529. Missing pixels are replaced by black pixels.
  6530. @item smear
  6531. Adjacent pixels will spread out to replace missing pixels.
  6532. @item wrap
  6533. Out of range pixels are wrapped so they point to pixels of other side.
  6534. @item mirror
  6535. Out of range pixels will be replaced with mirrored pixels.
  6536. @end table
  6537. Default is @samp{smear}.
  6538. @end table
  6539. @subsection Examples
  6540. @itemize
  6541. @item
  6542. Add ripple effect to rgb input of video size hd720:
  6543. @example
  6544. 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
  6545. @end example
  6546. @item
  6547. Add wave effect to rgb input of video size hd720:
  6548. @example
  6549. 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
  6550. @end example
  6551. @end itemize
  6552. @section drawbox
  6553. Draw a colored box on the input image.
  6554. It accepts the following parameters:
  6555. @table @option
  6556. @item x
  6557. @item y
  6558. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6559. @item width, w
  6560. @item height, h
  6561. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6562. the input width and height. It defaults to 0.
  6563. @item color, c
  6564. Specify the color of the box to write. For the general syntax of this option,
  6565. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6566. value @code{invert} is used, the box edge color is the same as the
  6567. video with inverted luma.
  6568. @item thickness, t
  6569. The expression which sets the thickness of the box edge.
  6570. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6571. See below for the list of accepted constants.
  6572. @item replace
  6573. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6574. will overwrite the video's color and alpha pixels.
  6575. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6576. @end table
  6577. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6578. following constants:
  6579. @table @option
  6580. @item dar
  6581. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6582. @item hsub
  6583. @item vsub
  6584. horizontal and vertical chroma subsample values. For example for the
  6585. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6586. @item in_h, ih
  6587. @item in_w, iw
  6588. The input width and height.
  6589. @item sar
  6590. The input sample aspect ratio.
  6591. @item x
  6592. @item y
  6593. The x and y offset coordinates where the box is drawn.
  6594. @item w
  6595. @item h
  6596. The width and height of the drawn box.
  6597. @item t
  6598. The thickness of the drawn box.
  6599. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6600. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6601. @end table
  6602. @subsection Examples
  6603. @itemize
  6604. @item
  6605. Draw a black box around the edge of the input image:
  6606. @example
  6607. drawbox
  6608. @end example
  6609. @item
  6610. Draw a box with color red and an opacity of 50%:
  6611. @example
  6612. drawbox=10:20:200:60:red@@0.5
  6613. @end example
  6614. The previous example can be specified as:
  6615. @example
  6616. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6617. @end example
  6618. @item
  6619. Fill the box with pink color:
  6620. @example
  6621. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6622. @end example
  6623. @item
  6624. Draw a 2-pixel red 2.40:1 mask:
  6625. @example
  6626. 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
  6627. @end example
  6628. @end itemize
  6629. @section drawgrid
  6630. Draw a grid on the input image.
  6631. It accepts the following parameters:
  6632. @table @option
  6633. @item x
  6634. @item y
  6635. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6636. @item width, w
  6637. @item height, h
  6638. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6639. input width and height, respectively, minus @code{thickness}, so image gets
  6640. framed. Default to 0.
  6641. @item color, c
  6642. Specify the color of the grid. For the general syntax of this option,
  6643. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6644. value @code{invert} is used, the grid color is the same as the
  6645. video with inverted luma.
  6646. @item thickness, t
  6647. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6648. See below for the list of accepted constants.
  6649. @item replace
  6650. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6651. will overwrite the video's color and alpha pixels.
  6652. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6653. @end table
  6654. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6655. following constants:
  6656. @table @option
  6657. @item dar
  6658. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6659. @item hsub
  6660. @item vsub
  6661. horizontal and vertical chroma subsample values. For example for the
  6662. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6663. @item in_h, ih
  6664. @item in_w, iw
  6665. The input grid cell width and height.
  6666. @item sar
  6667. The input sample aspect ratio.
  6668. @item x
  6669. @item y
  6670. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6671. @item w
  6672. @item h
  6673. The width and height of the drawn cell.
  6674. @item t
  6675. The thickness of the drawn cell.
  6676. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6677. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6678. @end table
  6679. @subsection Examples
  6680. @itemize
  6681. @item
  6682. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6683. @example
  6684. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6685. @end example
  6686. @item
  6687. Draw a white 3x3 grid with an opacity of 50%:
  6688. @example
  6689. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6690. @end example
  6691. @end itemize
  6692. @anchor{drawtext}
  6693. @section drawtext
  6694. Draw a text string or text from a specified file on top of a video, using the
  6695. libfreetype library.
  6696. To enable compilation of this filter, you need to configure FFmpeg with
  6697. @code{--enable-libfreetype}.
  6698. To enable default font fallback and the @var{font} option you need to
  6699. configure FFmpeg with @code{--enable-libfontconfig}.
  6700. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6701. @code{--enable-libfribidi}.
  6702. @subsection Syntax
  6703. It accepts the following parameters:
  6704. @table @option
  6705. @item box
  6706. Used to draw a box around text using the background color.
  6707. The value must be either 1 (enable) or 0 (disable).
  6708. The default value of @var{box} is 0.
  6709. @item boxborderw
  6710. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6711. The default value of @var{boxborderw} is 0.
  6712. @item boxcolor
  6713. The color to be used for drawing box around text. For the syntax of this
  6714. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6715. The default value of @var{boxcolor} is "white".
  6716. @item line_spacing
  6717. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6718. The default value of @var{line_spacing} is 0.
  6719. @item borderw
  6720. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6721. The default value of @var{borderw} is 0.
  6722. @item bordercolor
  6723. Set the color to be used for drawing border around text. For the syntax of this
  6724. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6725. The default value of @var{bordercolor} is "black".
  6726. @item expansion
  6727. Select how the @var{text} is expanded. Can be either @code{none},
  6728. @code{strftime} (deprecated) or
  6729. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6730. below for details.
  6731. @item basetime
  6732. Set a start time for the count. Value is in microseconds. Only applied
  6733. in the deprecated strftime expansion mode. To emulate in normal expansion
  6734. mode use the @code{pts} function, supplying the start time (in seconds)
  6735. as the second argument.
  6736. @item fix_bounds
  6737. If true, check and fix text coords to avoid clipping.
  6738. @item fontcolor
  6739. The color to be used for drawing fonts. For the syntax of this option, check
  6740. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6741. The default value of @var{fontcolor} is "black".
  6742. @item fontcolor_expr
  6743. String which is expanded the same way as @var{text} to obtain dynamic
  6744. @var{fontcolor} value. By default this option has empty value and is not
  6745. processed. When this option is set, it overrides @var{fontcolor} option.
  6746. @item font
  6747. The font family to be used for drawing text. By default Sans.
  6748. @item fontfile
  6749. The font file to be used for drawing text. The path must be included.
  6750. This parameter is mandatory if the fontconfig support is disabled.
  6751. @item alpha
  6752. Draw the text applying alpha blending. The value can
  6753. be a number between 0.0 and 1.0.
  6754. The expression accepts the same variables @var{x, y} as well.
  6755. The default value is 1.
  6756. Please see @var{fontcolor_expr}.
  6757. @item fontsize
  6758. The font size to be used for drawing text.
  6759. The default value of @var{fontsize} is 16.
  6760. @item text_shaping
  6761. If set to 1, attempt to shape the text (for example, reverse the order of
  6762. right-to-left text and join Arabic characters) before drawing it.
  6763. Otherwise, just draw the text exactly as given.
  6764. By default 1 (if supported).
  6765. @item ft_load_flags
  6766. The flags to be used for loading the fonts.
  6767. The flags map the corresponding flags supported by libfreetype, and are
  6768. a combination of the following values:
  6769. @table @var
  6770. @item default
  6771. @item no_scale
  6772. @item no_hinting
  6773. @item render
  6774. @item no_bitmap
  6775. @item vertical_layout
  6776. @item force_autohint
  6777. @item crop_bitmap
  6778. @item pedantic
  6779. @item ignore_global_advance_width
  6780. @item no_recurse
  6781. @item ignore_transform
  6782. @item monochrome
  6783. @item linear_design
  6784. @item no_autohint
  6785. @end table
  6786. Default value is "default".
  6787. For more information consult the documentation for the FT_LOAD_*
  6788. libfreetype flags.
  6789. @item shadowcolor
  6790. The color to be used for drawing a shadow behind the drawn text. For the
  6791. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6792. ffmpeg-utils manual,ffmpeg-utils}.
  6793. The default value of @var{shadowcolor} is "black".
  6794. @item shadowx
  6795. @item shadowy
  6796. The x and y offsets for the text shadow position with respect to the
  6797. position of the text. They can be either positive or negative
  6798. values. The default value for both is "0".
  6799. @item start_number
  6800. The starting frame number for the n/frame_num variable. The default value
  6801. is "0".
  6802. @item tabsize
  6803. The size in number of spaces to use for rendering the tab.
  6804. Default value is 4.
  6805. @item timecode
  6806. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6807. format. It can be used with or without text parameter. @var{timecode_rate}
  6808. option must be specified.
  6809. @item timecode_rate, rate, r
  6810. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6811. integer. Minimum value is "1".
  6812. Drop-frame timecode is supported for frame rates 30 & 60.
  6813. @item tc24hmax
  6814. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6815. Default is 0 (disabled).
  6816. @item text
  6817. The text string to be drawn. The text must be a sequence of UTF-8
  6818. encoded characters.
  6819. This parameter is mandatory if no file is specified with the parameter
  6820. @var{textfile}.
  6821. @item textfile
  6822. A text file containing text to be drawn. The text must be a sequence
  6823. of UTF-8 encoded characters.
  6824. This parameter is mandatory if no text string is specified with the
  6825. parameter @var{text}.
  6826. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6827. @item reload
  6828. If set to 1, the @var{textfile} will be reloaded before each frame.
  6829. Be sure to update it atomically, or it may be read partially, or even fail.
  6830. @item x
  6831. @item y
  6832. The expressions which specify the offsets where text will be drawn
  6833. within the video frame. They are relative to the top/left border of the
  6834. output image.
  6835. The default value of @var{x} and @var{y} is "0".
  6836. See below for the list of accepted constants and functions.
  6837. @end table
  6838. The parameters for @var{x} and @var{y} are expressions containing the
  6839. following constants and functions:
  6840. @table @option
  6841. @item dar
  6842. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6843. @item hsub
  6844. @item vsub
  6845. horizontal and vertical chroma subsample values. For example for the
  6846. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6847. @item line_h, lh
  6848. the height of each text line
  6849. @item main_h, h, H
  6850. the input height
  6851. @item main_w, w, W
  6852. the input width
  6853. @item max_glyph_a, ascent
  6854. the maximum distance from the baseline to the highest/upper grid
  6855. coordinate used to place a glyph outline point, for all the rendered
  6856. glyphs.
  6857. It is a positive value, due to the grid's orientation with the Y axis
  6858. upwards.
  6859. @item max_glyph_d, descent
  6860. the maximum distance from the baseline to the lowest grid coordinate
  6861. used to place a glyph outline point, for all the rendered glyphs.
  6862. This is a negative value, due to the grid's orientation, with the Y axis
  6863. upwards.
  6864. @item max_glyph_h
  6865. maximum glyph height, that is the maximum height for all the glyphs
  6866. contained in the rendered text, it is equivalent to @var{ascent} -
  6867. @var{descent}.
  6868. @item max_glyph_w
  6869. maximum glyph width, that is the maximum width for all the glyphs
  6870. contained in the rendered text
  6871. @item n
  6872. the number of input frame, starting from 0
  6873. @item rand(min, max)
  6874. return a random number included between @var{min} and @var{max}
  6875. @item sar
  6876. The input sample aspect ratio.
  6877. @item t
  6878. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6879. @item text_h, th
  6880. the height of the rendered text
  6881. @item text_w, tw
  6882. the width of the rendered text
  6883. @item x
  6884. @item y
  6885. the x and y offset coordinates where the text is drawn.
  6886. These parameters allow the @var{x} and @var{y} expressions to refer
  6887. each other, so you can for example specify @code{y=x/dar}.
  6888. @end table
  6889. @anchor{drawtext_expansion}
  6890. @subsection Text expansion
  6891. If @option{expansion} is set to @code{strftime},
  6892. the filter recognizes strftime() sequences in the provided text and
  6893. expands them accordingly. Check the documentation of strftime(). This
  6894. feature is deprecated.
  6895. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6896. If @option{expansion} is set to @code{normal} (which is the default),
  6897. the following expansion mechanism is used.
  6898. The backslash character @samp{\}, followed by any character, always expands to
  6899. the second character.
  6900. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6901. braces is a function name, possibly followed by arguments separated by ':'.
  6902. If the arguments contain special characters or delimiters (':' or '@}'),
  6903. they should be escaped.
  6904. Note that they probably must also be escaped as the value for the
  6905. @option{text} option in the filter argument string and as the filter
  6906. argument in the filtergraph description, and possibly also for the shell,
  6907. that makes up to four levels of escaping; using a text file avoids these
  6908. problems.
  6909. The following functions are available:
  6910. @table @command
  6911. @item expr, e
  6912. The expression evaluation result.
  6913. It must take one argument specifying the expression to be evaluated,
  6914. which accepts the same constants and functions as the @var{x} and
  6915. @var{y} values. Note that not all constants should be used, for
  6916. example the text size is not known when evaluating the expression, so
  6917. the constants @var{text_w} and @var{text_h} will have an undefined
  6918. value.
  6919. @item expr_int_format, eif
  6920. Evaluate the expression's value and output as formatted integer.
  6921. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6922. The second argument specifies the output format. Allowed values are @samp{x},
  6923. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6924. @code{printf} function.
  6925. The third parameter is optional and sets the number of positions taken by the output.
  6926. It can be used to add padding with zeros from the left.
  6927. @item gmtime
  6928. The time at which the filter is running, expressed in UTC.
  6929. It can accept an argument: a strftime() format string.
  6930. @item localtime
  6931. The time at which the filter is running, expressed in the local time zone.
  6932. It can accept an argument: a strftime() format string.
  6933. @item metadata
  6934. Frame metadata. Takes one or two arguments.
  6935. The first argument is mandatory and specifies the metadata key.
  6936. The second argument is optional and specifies a default value, used when the
  6937. metadata key is not found or empty.
  6938. @item n, frame_num
  6939. The frame number, starting from 0.
  6940. @item pict_type
  6941. A 1 character description of the current picture type.
  6942. @item pts
  6943. The timestamp of the current frame.
  6944. It can take up to three arguments.
  6945. The first argument is the format of the timestamp; it defaults to @code{flt}
  6946. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6947. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6948. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6949. @code{localtime} stands for the timestamp of the frame formatted as
  6950. local time zone time.
  6951. The second argument is an offset added to the timestamp.
  6952. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6953. supplied to present the hour part of the formatted timestamp in 24h format
  6954. (00-23).
  6955. If the format is set to @code{localtime} or @code{gmtime},
  6956. a third argument may be supplied: a strftime() format string.
  6957. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6958. @end table
  6959. @subsection Commands
  6960. This filter supports altering parameters via commands:
  6961. @table @option
  6962. @item reinit
  6963. Alter existing filter parameters.
  6964. Syntax for the argument is the same as for filter invocation, e.g.
  6965. @example
  6966. fontsize=56:fontcolor=green:text='Hello World'
  6967. @end example
  6968. Full filter invocation with sendcmd would look like this:
  6969. @example
  6970. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  6971. @end example
  6972. @end table
  6973. If the entire argument can't be parsed or applied as valid values then the filter will
  6974. continue with its existing parameters.
  6975. @subsection Examples
  6976. @itemize
  6977. @item
  6978. Draw "Test Text" with font FreeSerif, using the default values for the
  6979. optional parameters.
  6980. @example
  6981. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6982. @end example
  6983. @item
  6984. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6985. and y=50 (counting from the top-left corner of the screen), text is
  6986. yellow with a red box around it. Both the text and the box have an
  6987. opacity of 20%.
  6988. @example
  6989. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6990. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6991. @end example
  6992. Note that the double quotes are not necessary if spaces are not used
  6993. within the parameter list.
  6994. @item
  6995. Show the text at the center of the video frame:
  6996. @example
  6997. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6998. @end example
  6999. @item
  7000. Show the text at a random position, switching to a new position every 30 seconds:
  7001. @example
  7002. 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)"
  7003. @end example
  7004. @item
  7005. Show a text line sliding from right to left in the last row of the video
  7006. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7007. with no newlines.
  7008. @example
  7009. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7010. @end example
  7011. @item
  7012. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7013. @example
  7014. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7015. @end example
  7016. @item
  7017. Draw a single green letter "g", at the center of the input video.
  7018. The glyph baseline is placed at half screen height.
  7019. @example
  7020. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7021. @end example
  7022. @item
  7023. Show text for 1 second every 3 seconds:
  7024. @example
  7025. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7026. @end example
  7027. @item
  7028. Use fontconfig to set the font. Note that the colons need to be escaped.
  7029. @example
  7030. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7031. @end example
  7032. @item
  7033. Print the date of a real-time encoding (see strftime(3)):
  7034. @example
  7035. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7036. @end example
  7037. @item
  7038. Show text fading in and out (appearing/disappearing):
  7039. @example
  7040. #!/bin/sh
  7041. DS=1.0 # display start
  7042. DE=10.0 # display end
  7043. FID=1.5 # fade in duration
  7044. FOD=5 # fade out duration
  7045. 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 @}"
  7046. @end example
  7047. @item
  7048. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7049. and the @option{fontsize} value are included in the @option{y} offset.
  7050. @example
  7051. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7052. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7053. @end example
  7054. @end itemize
  7055. For more information about libfreetype, check:
  7056. @url{http://www.freetype.org/}.
  7057. For more information about fontconfig, check:
  7058. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7059. For more information about libfribidi, check:
  7060. @url{http://fribidi.org/}.
  7061. @section edgedetect
  7062. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7063. The filter accepts the following options:
  7064. @table @option
  7065. @item low
  7066. @item high
  7067. Set low and high threshold values used by the Canny thresholding
  7068. algorithm.
  7069. The high threshold selects the "strong" edge pixels, which are then
  7070. connected through 8-connectivity with the "weak" edge pixels selected
  7071. by the low threshold.
  7072. @var{low} and @var{high} threshold values must be chosen in the range
  7073. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7074. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7075. is @code{50/255}.
  7076. @item mode
  7077. Define the drawing mode.
  7078. @table @samp
  7079. @item wires
  7080. Draw white/gray wires on black background.
  7081. @item colormix
  7082. Mix the colors to create a paint/cartoon effect.
  7083. @item canny
  7084. Apply Canny edge detector on all selected planes.
  7085. @end table
  7086. Default value is @var{wires}.
  7087. @item planes
  7088. Select planes for filtering. By default all available planes are filtered.
  7089. @end table
  7090. @subsection Examples
  7091. @itemize
  7092. @item
  7093. Standard edge detection with custom values for the hysteresis thresholding:
  7094. @example
  7095. edgedetect=low=0.1:high=0.4
  7096. @end example
  7097. @item
  7098. Painting effect without thresholding:
  7099. @example
  7100. edgedetect=mode=colormix:high=0
  7101. @end example
  7102. @end itemize
  7103. @section eq
  7104. Set brightness, contrast, saturation and approximate gamma adjustment.
  7105. The filter accepts the following options:
  7106. @table @option
  7107. @item contrast
  7108. Set the contrast expression. The value must be a float value in range
  7109. @code{-2.0} to @code{2.0}. The default value is "1".
  7110. @item brightness
  7111. Set the brightness expression. The value must be a float value in
  7112. range @code{-1.0} to @code{1.0}. The default value is "0".
  7113. @item saturation
  7114. Set the saturation expression. The value must be a float in
  7115. range @code{0.0} to @code{3.0}. The default value is "1".
  7116. @item gamma
  7117. Set the gamma expression. The value must be a float in range
  7118. @code{0.1} to @code{10.0}. The default value is "1".
  7119. @item gamma_r
  7120. Set the gamma expression for red. The value must be a float in
  7121. range @code{0.1} to @code{10.0}. The default value is "1".
  7122. @item gamma_g
  7123. Set the gamma expression for green. The value must be a float in range
  7124. @code{0.1} to @code{10.0}. The default value is "1".
  7125. @item gamma_b
  7126. Set the gamma expression for blue. The value must be a float in range
  7127. @code{0.1} to @code{10.0}. The default value is "1".
  7128. @item gamma_weight
  7129. Set the gamma weight expression. It can be used to reduce the effect
  7130. of a high gamma value on bright image areas, e.g. keep them from
  7131. getting overamplified and just plain white. The value must be a float
  7132. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7133. gamma correction all the way down while @code{1.0} leaves it at its
  7134. full strength. Default is "1".
  7135. @item eval
  7136. Set when the expressions for brightness, contrast, saturation and
  7137. gamma expressions are evaluated.
  7138. It accepts the following values:
  7139. @table @samp
  7140. @item init
  7141. only evaluate expressions once during the filter initialization or
  7142. when a command is processed
  7143. @item frame
  7144. evaluate expressions for each incoming frame
  7145. @end table
  7146. Default value is @samp{init}.
  7147. @end table
  7148. The expressions accept the following parameters:
  7149. @table @option
  7150. @item n
  7151. frame count of the input frame starting from 0
  7152. @item pos
  7153. byte position of the corresponding packet in the input file, NAN if
  7154. unspecified
  7155. @item r
  7156. frame rate of the input video, NAN if the input frame rate is unknown
  7157. @item t
  7158. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7159. @end table
  7160. @subsection Commands
  7161. The filter supports the following commands:
  7162. @table @option
  7163. @item contrast
  7164. Set the contrast expression.
  7165. @item brightness
  7166. Set the brightness expression.
  7167. @item saturation
  7168. Set the saturation expression.
  7169. @item gamma
  7170. Set the gamma expression.
  7171. @item gamma_r
  7172. Set the gamma_r expression.
  7173. @item gamma_g
  7174. Set gamma_g expression.
  7175. @item gamma_b
  7176. Set gamma_b expression.
  7177. @item gamma_weight
  7178. Set gamma_weight expression.
  7179. The command accepts the same syntax of the corresponding option.
  7180. If the specified expression is not valid, it is kept at its current
  7181. value.
  7182. @end table
  7183. @section erosion
  7184. Apply erosion effect to the video.
  7185. This filter replaces the pixel by the local(3x3) minimum.
  7186. It accepts the following options:
  7187. @table @option
  7188. @item threshold0
  7189. @item threshold1
  7190. @item threshold2
  7191. @item threshold3
  7192. Limit the maximum change for each plane, default is 65535.
  7193. If 0, plane will remain unchanged.
  7194. @item coordinates
  7195. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7196. pixels are used.
  7197. Flags to local 3x3 coordinates maps like this:
  7198. 1 2 3
  7199. 4 5
  7200. 6 7 8
  7201. @end table
  7202. @section extractplanes
  7203. Extract color channel components from input video stream into
  7204. separate grayscale video streams.
  7205. The filter accepts the following option:
  7206. @table @option
  7207. @item planes
  7208. Set plane(s) to extract.
  7209. Available values for planes are:
  7210. @table @samp
  7211. @item y
  7212. @item u
  7213. @item v
  7214. @item a
  7215. @item r
  7216. @item g
  7217. @item b
  7218. @end table
  7219. Choosing planes not available in the input will result in an error.
  7220. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7221. with @code{y}, @code{u}, @code{v} planes at same time.
  7222. @end table
  7223. @subsection Examples
  7224. @itemize
  7225. @item
  7226. Extract luma, u and v color channel component from input video frame
  7227. into 3 grayscale outputs:
  7228. @example
  7229. 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
  7230. @end example
  7231. @end itemize
  7232. @section elbg
  7233. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7234. For each input image, the filter will compute the optimal mapping from
  7235. the input to the output given the codebook length, that is the number
  7236. of distinct output colors.
  7237. This filter accepts the following options.
  7238. @table @option
  7239. @item codebook_length, l
  7240. Set codebook length. The value must be a positive integer, and
  7241. represents the number of distinct output colors. Default value is 256.
  7242. @item nb_steps, n
  7243. Set the maximum number of iterations to apply for computing the optimal
  7244. mapping. The higher the value the better the result and the higher the
  7245. computation time. Default value is 1.
  7246. @item seed, s
  7247. Set a random seed, must be an integer included between 0 and
  7248. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7249. will try to use a good random seed on a best effort basis.
  7250. @item pal8
  7251. Set pal8 output pixel format. This option does not work with codebook
  7252. length greater than 256.
  7253. @end table
  7254. @section entropy
  7255. Measure graylevel entropy in histogram of color channels of video frames.
  7256. It accepts the following parameters:
  7257. @table @option
  7258. @item mode
  7259. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7260. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7261. between neighbour histogram values.
  7262. @end table
  7263. @section fade
  7264. Apply a fade-in/out effect to the input video.
  7265. It accepts the following parameters:
  7266. @table @option
  7267. @item type, t
  7268. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7269. effect.
  7270. Default is @code{in}.
  7271. @item start_frame, s
  7272. Specify the number of the frame to start applying the fade
  7273. effect at. Default is 0.
  7274. @item nb_frames, n
  7275. The number of frames that the fade effect lasts. At the end of the
  7276. fade-in effect, the output video will have the same intensity as the input video.
  7277. At the end of the fade-out transition, the output video will be filled with the
  7278. selected @option{color}.
  7279. Default is 25.
  7280. @item alpha
  7281. If set to 1, fade only alpha channel, if one exists on the input.
  7282. Default value is 0.
  7283. @item start_time, st
  7284. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7285. effect. If both start_frame and start_time are specified, the fade will start at
  7286. whichever comes last. Default is 0.
  7287. @item duration, d
  7288. The number of seconds for which the fade effect has to last. At the end of the
  7289. fade-in effect the output video will have the same intensity as the input video,
  7290. at the end of the fade-out transition the output video will be filled with the
  7291. selected @option{color}.
  7292. If both duration and nb_frames are specified, duration is used. Default is 0
  7293. (nb_frames is used by default).
  7294. @item color, c
  7295. Specify the color of the fade. Default is "black".
  7296. @end table
  7297. @subsection Examples
  7298. @itemize
  7299. @item
  7300. Fade in the first 30 frames of video:
  7301. @example
  7302. fade=in:0:30
  7303. @end example
  7304. The command above is equivalent to:
  7305. @example
  7306. fade=t=in:s=0:n=30
  7307. @end example
  7308. @item
  7309. Fade out the last 45 frames of a 200-frame video:
  7310. @example
  7311. fade=out:155:45
  7312. fade=type=out:start_frame=155:nb_frames=45
  7313. @end example
  7314. @item
  7315. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7316. @example
  7317. fade=in:0:25, fade=out:975:25
  7318. @end example
  7319. @item
  7320. Make the first 5 frames yellow, then fade in from frame 5-24:
  7321. @example
  7322. fade=in:5:20:color=yellow
  7323. @end example
  7324. @item
  7325. Fade in alpha over first 25 frames of video:
  7326. @example
  7327. fade=in:0:25:alpha=1
  7328. @end example
  7329. @item
  7330. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7331. @example
  7332. fade=t=in:st=5.5:d=0.5
  7333. @end example
  7334. @end itemize
  7335. @section fftfilt
  7336. Apply arbitrary expressions to samples in frequency domain
  7337. @table @option
  7338. @item dc_Y
  7339. Adjust the dc value (gain) of the luma plane of the image. The filter
  7340. accepts an integer value in range @code{0} to @code{1000}. The default
  7341. value is set to @code{0}.
  7342. @item dc_U
  7343. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7344. filter accepts an integer value in range @code{0} to @code{1000}. The
  7345. default value is set to @code{0}.
  7346. @item dc_V
  7347. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7348. filter accepts an integer value in range @code{0} to @code{1000}. The
  7349. default value is set to @code{0}.
  7350. @item weight_Y
  7351. Set the frequency domain weight expression for the luma plane.
  7352. @item weight_U
  7353. Set the frequency domain weight expression for the 1st chroma plane.
  7354. @item weight_V
  7355. Set the frequency domain weight expression for the 2nd chroma plane.
  7356. @item eval
  7357. Set when the expressions are evaluated.
  7358. It accepts the following values:
  7359. @table @samp
  7360. @item init
  7361. Only evaluate expressions once during the filter initialization.
  7362. @item frame
  7363. Evaluate expressions for each incoming frame.
  7364. @end table
  7365. Default value is @samp{init}.
  7366. The filter accepts the following variables:
  7367. @item X
  7368. @item Y
  7369. The coordinates of the current sample.
  7370. @item W
  7371. @item H
  7372. The width and height of the image.
  7373. @item N
  7374. The number of input frame, starting from 0.
  7375. @end table
  7376. @subsection Examples
  7377. @itemize
  7378. @item
  7379. High-pass:
  7380. @example
  7381. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7382. @end example
  7383. @item
  7384. Low-pass:
  7385. @example
  7386. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7387. @end example
  7388. @item
  7389. Sharpen:
  7390. @example
  7391. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7392. @end example
  7393. @item
  7394. Blur:
  7395. @example
  7396. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7397. @end example
  7398. @end itemize
  7399. @section fftdnoiz
  7400. Denoise frames using 3D FFT (frequency domain filtering).
  7401. The filter accepts the following options:
  7402. @table @option
  7403. @item sigma
  7404. Set the noise sigma constant. This sets denoising strength.
  7405. Default value is 1. Allowed range is from 0 to 30.
  7406. Using very high sigma with low overlap may give blocking artifacts.
  7407. @item amount
  7408. Set amount of denoising. By default all detected noise is reduced.
  7409. Default value is 1. Allowed range is from 0 to 1.
  7410. @item block
  7411. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7412. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7413. block size in pixels is 2^4 which is 16.
  7414. @item overlap
  7415. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7416. @item prev
  7417. Set number of previous frames to use for denoising. By default is set to 0.
  7418. @item next
  7419. Set number of next frames to to use for denoising. By default is set to 0.
  7420. @item planes
  7421. Set planes which will be filtered, by default are all available filtered
  7422. except alpha.
  7423. @end table
  7424. @section field
  7425. Extract a single field from an interlaced image using stride
  7426. arithmetic to avoid wasting CPU time. The output frames are marked as
  7427. non-interlaced.
  7428. The filter accepts the following options:
  7429. @table @option
  7430. @item type
  7431. Specify whether to extract the top (if the value is @code{0} or
  7432. @code{top}) or the bottom field (if the value is @code{1} or
  7433. @code{bottom}).
  7434. @end table
  7435. @section fieldhint
  7436. Create new frames by copying the top and bottom fields from surrounding frames
  7437. supplied as numbers by the hint file.
  7438. @table @option
  7439. @item hint
  7440. Set file containing hints: absolute/relative frame numbers.
  7441. There must be one line for each frame in a clip. Each line must contain two
  7442. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7443. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7444. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7445. for @code{relative} mode. First number tells from which frame to pick up top
  7446. field and second number tells from which frame to pick up bottom field.
  7447. If optionally followed by @code{+} output frame will be marked as interlaced,
  7448. else if followed by @code{-} output frame will be marked as progressive, else
  7449. it will be marked same as input frame.
  7450. If line starts with @code{#} or @code{;} that line is skipped.
  7451. @item mode
  7452. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7453. @end table
  7454. Example of first several lines of @code{hint} file for @code{relative} mode:
  7455. @example
  7456. 0,0 - # first frame
  7457. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7458. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7459. 1,0 -
  7460. 0,0 -
  7461. 0,0 -
  7462. 1,0 -
  7463. 1,0 -
  7464. 1,0 -
  7465. 0,0 -
  7466. 0,0 -
  7467. 1,0 -
  7468. 1,0 -
  7469. 1,0 -
  7470. 0,0 -
  7471. @end example
  7472. @section fieldmatch
  7473. Field matching filter for inverse telecine. It is meant to reconstruct the
  7474. progressive frames from a telecined stream. The filter does not drop duplicated
  7475. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7476. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7477. The separation of the field matching and the decimation is notably motivated by
  7478. the possibility of inserting a de-interlacing filter fallback between the two.
  7479. If the source has mixed telecined and real interlaced content,
  7480. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7481. But these remaining combed frames will be marked as interlaced, and thus can be
  7482. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7483. In addition to the various configuration options, @code{fieldmatch} can take an
  7484. optional second stream, activated through the @option{ppsrc} option. If
  7485. enabled, the frames reconstruction will be based on the fields and frames from
  7486. this second stream. This allows the first input to be pre-processed in order to
  7487. help the various algorithms of the filter, while keeping the output lossless
  7488. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7489. or brightness/contrast adjustments can help.
  7490. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7491. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7492. which @code{fieldmatch} is based on. While the semantic and usage are very
  7493. close, some behaviour and options names can differ.
  7494. The @ref{decimate} filter currently only works for constant frame rate input.
  7495. If your input has mixed telecined (30fps) and progressive content with a lower
  7496. framerate like 24fps use the following filterchain to produce the necessary cfr
  7497. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7498. The filter accepts the following options:
  7499. @table @option
  7500. @item order
  7501. Specify the assumed field order of the input stream. Available values are:
  7502. @table @samp
  7503. @item auto
  7504. Auto detect parity (use FFmpeg's internal parity value).
  7505. @item bff
  7506. Assume bottom field first.
  7507. @item tff
  7508. Assume top field first.
  7509. @end table
  7510. Note that it is sometimes recommended not to trust the parity announced by the
  7511. stream.
  7512. Default value is @var{auto}.
  7513. @item mode
  7514. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7515. sense that it won't risk creating jerkiness due to duplicate frames when
  7516. possible, but if there are bad edits or blended fields it will end up
  7517. outputting combed frames when a good match might actually exist. On the other
  7518. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7519. but will almost always find a good frame if there is one. The other values are
  7520. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7521. jerkiness and creating duplicate frames versus finding good matches in sections
  7522. with bad edits, orphaned fields, blended fields, etc.
  7523. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7524. Available values are:
  7525. @table @samp
  7526. @item pc
  7527. 2-way matching (p/c)
  7528. @item pc_n
  7529. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7530. @item pc_u
  7531. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7532. @item pc_n_ub
  7533. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7534. still combed (p/c + n + u/b)
  7535. @item pcn
  7536. 3-way matching (p/c/n)
  7537. @item pcn_ub
  7538. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7539. detected as combed (p/c/n + u/b)
  7540. @end table
  7541. The parenthesis at the end indicate the matches that would be used for that
  7542. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7543. @var{top}).
  7544. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7545. the slowest.
  7546. Default value is @var{pc_n}.
  7547. @item ppsrc
  7548. Mark the main input stream as a pre-processed input, and enable the secondary
  7549. input stream as the clean source to pick the fields from. See the filter
  7550. introduction for more details. It is similar to the @option{clip2} feature from
  7551. VFM/TFM.
  7552. Default value is @code{0} (disabled).
  7553. @item field
  7554. Set the field to match from. It is recommended to set this to the same value as
  7555. @option{order} unless you experience matching failures with that setting. In
  7556. certain circumstances changing the field that is used to match from can have a
  7557. large impact on matching performance. Available values are:
  7558. @table @samp
  7559. @item auto
  7560. Automatic (same value as @option{order}).
  7561. @item bottom
  7562. Match from the bottom field.
  7563. @item top
  7564. Match from the top field.
  7565. @end table
  7566. Default value is @var{auto}.
  7567. @item mchroma
  7568. Set whether or not chroma is included during the match comparisons. In most
  7569. cases it is recommended to leave this enabled. You should set this to @code{0}
  7570. only if your clip has bad chroma problems such as heavy rainbowing or other
  7571. artifacts. Setting this to @code{0} could also be used to speed things up at
  7572. the cost of some accuracy.
  7573. Default value is @code{1}.
  7574. @item y0
  7575. @item y1
  7576. These define an exclusion band which excludes the lines between @option{y0} and
  7577. @option{y1} from being included in the field matching decision. An exclusion
  7578. band can be used to ignore subtitles, a logo, or other things that may
  7579. interfere with the matching. @option{y0} sets the starting scan line and
  7580. @option{y1} sets the ending line; all lines in between @option{y0} and
  7581. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7582. @option{y0} and @option{y1} to the same value will disable the feature.
  7583. @option{y0} and @option{y1} defaults to @code{0}.
  7584. @item scthresh
  7585. Set the scene change detection threshold as a percentage of maximum change on
  7586. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7587. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7588. @option{scthresh} is @code{[0.0, 100.0]}.
  7589. Default value is @code{12.0}.
  7590. @item combmatch
  7591. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7592. account the combed scores of matches when deciding what match to use as the
  7593. final match. Available values are:
  7594. @table @samp
  7595. @item none
  7596. No final matching based on combed scores.
  7597. @item sc
  7598. Combed scores are only used when a scene change is detected.
  7599. @item full
  7600. Use combed scores all the time.
  7601. @end table
  7602. Default is @var{sc}.
  7603. @item combdbg
  7604. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7605. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7606. Available values are:
  7607. @table @samp
  7608. @item none
  7609. No forced calculation.
  7610. @item pcn
  7611. Force p/c/n calculations.
  7612. @item pcnub
  7613. Force p/c/n/u/b calculations.
  7614. @end table
  7615. Default value is @var{none}.
  7616. @item cthresh
  7617. This is the area combing threshold used for combed frame detection. This
  7618. essentially controls how "strong" or "visible" combing must be to be detected.
  7619. Larger values mean combing must be more visible and smaller values mean combing
  7620. can be less visible or strong and still be detected. Valid settings are from
  7621. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7622. be detected as combed). This is basically a pixel difference value. A good
  7623. range is @code{[8, 12]}.
  7624. Default value is @code{9}.
  7625. @item chroma
  7626. Sets whether or not chroma is considered in the combed frame decision. Only
  7627. disable this if your source has chroma problems (rainbowing, etc.) that are
  7628. causing problems for the combed frame detection with chroma enabled. Actually,
  7629. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7630. where there is chroma only combing in the source.
  7631. Default value is @code{0}.
  7632. @item blockx
  7633. @item blocky
  7634. Respectively set the x-axis and y-axis size of the window used during combed
  7635. frame detection. This has to do with the size of the area in which
  7636. @option{combpel} pixels are required to be detected as combed for a frame to be
  7637. declared combed. See the @option{combpel} parameter description for more info.
  7638. Possible values are any number that is a power of 2 starting at 4 and going up
  7639. to 512.
  7640. Default value is @code{16}.
  7641. @item combpel
  7642. The number of combed pixels inside any of the @option{blocky} by
  7643. @option{blockx} size blocks on the frame for the frame to be detected as
  7644. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7645. setting controls "how much" combing there must be in any localized area (a
  7646. window defined by the @option{blockx} and @option{blocky} settings) on the
  7647. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7648. which point no frames will ever be detected as combed). This setting is known
  7649. as @option{MI} in TFM/VFM vocabulary.
  7650. Default value is @code{80}.
  7651. @end table
  7652. @anchor{p/c/n/u/b meaning}
  7653. @subsection p/c/n/u/b meaning
  7654. @subsubsection p/c/n
  7655. We assume the following telecined stream:
  7656. @example
  7657. Top fields: 1 2 2 3 4
  7658. Bottom fields: 1 2 3 4 4
  7659. @end example
  7660. The numbers correspond to the progressive frame the fields relate to. Here, the
  7661. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7662. When @code{fieldmatch} is configured to run a matching from bottom
  7663. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7664. @example
  7665. Input stream:
  7666. T 1 2 2 3 4
  7667. B 1 2 3 4 4 <-- matching reference
  7668. Matches: c c n n c
  7669. Output stream:
  7670. T 1 2 3 4 4
  7671. B 1 2 3 4 4
  7672. @end example
  7673. As a result of the field matching, we can see that some frames get duplicated.
  7674. To perform a complete inverse telecine, you need to rely on a decimation filter
  7675. after this operation. See for instance the @ref{decimate} filter.
  7676. The same operation now matching from top fields (@option{field}=@var{top})
  7677. looks like this:
  7678. @example
  7679. Input stream:
  7680. T 1 2 2 3 4 <-- matching reference
  7681. B 1 2 3 4 4
  7682. Matches: c c p p c
  7683. Output stream:
  7684. T 1 2 2 3 4
  7685. B 1 2 2 3 4
  7686. @end example
  7687. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7688. basically, they refer to the frame and field of the opposite parity:
  7689. @itemize
  7690. @item @var{p} matches the field of the opposite parity in the previous frame
  7691. @item @var{c} matches the field of the opposite parity in the current frame
  7692. @item @var{n} matches the field of the opposite parity in the next frame
  7693. @end itemize
  7694. @subsubsection u/b
  7695. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7696. from the opposite parity flag. In the following examples, we assume that we are
  7697. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7698. 'x' is placed above and below each matched fields.
  7699. With bottom matching (@option{field}=@var{bottom}):
  7700. @example
  7701. Match: c p n b u
  7702. x x x x x
  7703. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7704. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7705. x x x x x
  7706. Output frames:
  7707. 2 1 2 2 2
  7708. 2 2 2 1 3
  7709. @end example
  7710. With top matching (@option{field}=@var{top}):
  7711. @example
  7712. Match: c p n b u
  7713. x x x x x
  7714. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7715. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7716. x x x x x
  7717. Output frames:
  7718. 2 2 2 1 2
  7719. 2 1 3 2 2
  7720. @end example
  7721. @subsection Examples
  7722. Simple IVTC of a top field first telecined stream:
  7723. @example
  7724. fieldmatch=order=tff:combmatch=none, decimate
  7725. @end example
  7726. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7727. @example
  7728. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7729. @end example
  7730. @section fieldorder
  7731. Transform the field order of the input video.
  7732. It accepts the following parameters:
  7733. @table @option
  7734. @item order
  7735. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7736. for bottom field first.
  7737. @end table
  7738. The default value is @samp{tff}.
  7739. The transformation is done by shifting the picture content up or down
  7740. by one line, and filling the remaining line with appropriate picture content.
  7741. This method is consistent with most broadcast field order converters.
  7742. If the input video is not flagged as being interlaced, or it is already
  7743. flagged as being of the required output field order, then this filter does
  7744. not alter the incoming video.
  7745. It is very useful when converting to or from PAL DV material,
  7746. which is bottom field first.
  7747. For example:
  7748. @example
  7749. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7750. @end example
  7751. @section fifo, afifo
  7752. Buffer input images and send them when they are requested.
  7753. It is mainly useful when auto-inserted by the libavfilter
  7754. framework.
  7755. It does not take parameters.
  7756. @section fillborders
  7757. Fill borders of the input video, without changing video stream dimensions.
  7758. Sometimes video can have garbage at the four edges and you may not want to
  7759. crop video input to keep size multiple of some number.
  7760. This filter accepts the following options:
  7761. @table @option
  7762. @item left
  7763. Number of pixels to fill from left border.
  7764. @item right
  7765. Number of pixels to fill from right border.
  7766. @item top
  7767. Number of pixels to fill from top border.
  7768. @item bottom
  7769. Number of pixels to fill from bottom border.
  7770. @item mode
  7771. Set fill mode.
  7772. It accepts the following values:
  7773. @table @samp
  7774. @item smear
  7775. fill pixels using outermost pixels
  7776. @item mirror
  7777. fill pixels using mirroring
  7778. @item fixed
  7779. fill pixels with constant value
  7780. @end table
  7781. Default is @var{smear}.
  7782. @item color
  7783. Set color for pixels in fixed mode. Default is @var{black}.
  7784. @end table
  7785. @section find_rect
  7786. Find a rectangular object
  7787. It accepts the following options:
  7788. @table @option
  7789. @item object
  7790. Filepath of the object image, needs to be in gray8.
  7791. @item threshold
  7792. Detection threshold, default is 0.5.
  7793. @item mipmaps
  7794. Number of mipmaps, default is 3.
  7795. @item xmin, ymin, xmax, ymax
  7796. Specifies the rectangle in which to search.
  7797. @end table
  7798. @subsection Examples
  7799. @itemize
  7800. @item
  7801. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7802. @example
  7803. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7804. @end example
  7805. @end itemize
  7806. @section cover_rect
  7807. Cover a rectangular object
  7808. It accepts the following options:
  7809. @table @option
  7810. @item cover
  7811. Filepath of the optional cover image, needs to be in yuv420.
  7812. @item mode
  7813. Set covering mode.
  7814. It accepts the following values:
  7815. @table @samp
  7816. @item cover
  7817. cover it by the supplied image
  7818. @item blur
  7819. cover it by interpolating the surrounding pixels
  7820. @end table
  7821. Default value is @var{blur}.
  7822. @end table
  7823. @subsection Examples
  7824. @itemize
  7825. @item
  7826. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7827. @example
  7828. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7829. @end example
  7830. @end itemize
  7831. @section floodfill
  7832. Flood area with values of same pixel components with another values.
  7833. It accepts the following options:
  7834. @table @option
  7835. @item x
  7836. Set pixel x coordinate.
  7837. @item y
  7838. Set pixel y coordinate.
  7839. @item s0
  7840. Set source #0 component value.
  7841. @item s1
  7842. Set source #1 component value.
  7843. @item s2
  7844. Set source #2 component value.
  7845. @item s3
  7846. Set source #3 component value.
  7847. @item d0
  7848. Set destination #0 component value.
  7849. @item d1
  7850. Set destination #1 component value.
  7851. @item d2
  7852. Set destination #2 component value.
  7853. @item d3
  7854. Set destination #3 component value.
  7855. @end table
  7856. @anchor{format}
  7857. @section format
  7858. Convert the input video to one of the specified pixel formats.
  7859. Libavfilter will try to pick one that is suitable as input to
  7860. the next filter.
  7861. It accepts the following parameters:
  7862. @table @option
  7863. @item pix_fmts
  7864. A '|'-separated list of pixel format names, such as
  7865. "pix_fmts=yuv420p|monow|rgb24".
  7866. @end table
  7867. @subsection Examples
  7868. @itemize
  7869. @item
  7870. Convert the input video to the @var{yuv420p} format
  7871. @example
  7872. format=pix_fmts=yuv420p
  7873. @end example
  7874. Convert the input video to any of the formats in the list
  7875. @example
  7876. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7877. @end example
  7878. @end itemize
  7879. @anchor{fps}
  7880. @section fps
  7881. Convert the video to specified constant frame rate by duplicating or dropping
  7882. frames as necessary.
  7883. It accepts the following parameters:
  7884. @table @option
  7885. @item fps
  7886. The desired output frame rate. The default is @code{25}.
  7887. @item start_time
  7888. Assume the first PTS should be the given value, in seconds. This allows for
  7889. padding/trimming at the start of stream. By default, no assumption is made
  7890. about the first frame's expected PTS, so no padding or trimming is done.
  7891. For example, this could be set to 0 to pad the beginning with duplicates of
  7892. the first frame if a video stream starts after the audio stream or to trim any
  7893. frames with a negative PTS.
  7894. @item round
  7895. Timestamp (PTS) rounding method.
  7896. Possible values are:
  7897. @table @option
  7898. @item zero
  7899. round towards 0
  7900. @item inf
  7901. round away from 0
  7902. @item down
  7903. round towards -infinity
  7904. @item up
  7905. round towards +infinity
  7906. @item near
  7907. round to nearest
  7908. @end table
  7909. The default is @code{near}.
  7910. @item eof_action
  7911. Action performed when reading the last frame.
  7912. Possible values are:
  7913. @table @option
  7914. @item round
  7915. Use same timestamp rounding method as used for other frames.
  7916. @item pass
  7917. Pass through last frame if input duration has not been reached yet.
  7918. @end table
  7919. The default is @code{round}.
  7920. @end table
  7921. Alternatively, the options can be specified as a flat string:
  7922. @var{fps}[:@var{start_time}[:@var{round}]].
  7923. See also the @ref{setpts} filter.
  7924. @subsection Examples
  7925. @itemize
  7926. @item
  7927. A typical usage in order to set the fps to 25:
  7928. @example
  7929. fps=fps=25
  7930. @end example
  7931. @item
  7932. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7933. @example
  7934. fps=fps=film:round=near
  7935. @end example
  7936. @end itemize
  7937. @section framepack
  7938. Pack two different video streams into a stereoscopic video, setting proper
  7939. metadata on supported codecs. The two views should have the same size and
  7940. framerate and processing will stop when the shorter video ends. Please note
  7941. that you may conveniently adjust view properties with the @ref{scale} and
  7942. @ref{fps} filters.
  7943. It accepts the following parameters:
  7944. @table @option
  7945. @item format
  7946. The desired packing format. Supported values are:
  7947. @table @option
  7948. @item sbs
  7949. The views are next to each other (default).
  7950. @item tab
  7951. The views are on top of each other.
  7952. @item lines
  7953. The views are packed by line.
  7954. @item columns
  7955. The views are packed by column.
  7956. @item frameseq
  7957. The views are temporally interleaved.
  7958. @end table
  7959. @end table
  7960. Some examples:
  7961. @example
  7962. # Convert left and right views into a frame-sequential video
  7963. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7964. # Convert views into a side-by-side video with the same output resolution as the input
  7965. 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
  7966. @end example
  7967. @section framerate
  7968. Change the frame rate by interpolating new video output frames from the source
  7969. frames.
  7970. This filter is not designed to function correctly with interlaced media. If
  7971. you wish to change the frame rate of interlaced media then you are required
  7972. to deinterlace before this filter and re-interlace after this filter.
  7973. A description of the accepted options follows.
  7974. @table @option
  7975. @item fps
  7976. Specify the output frames per second. This option can also be specified
  7977. as a value alone. The default is @code{50}.
  7978. @item interp_start
  7979. Specify the start of a range where the output frame will be created as a
  7980. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7981. the default is @code{15}.
  7982. @item interp_end
  7983. Specify the end of a range where the output frame will be created as a
  7984. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7985. the default is @code{240}.
  7986. @item scene
  7987. Specify the level at which a scene change is detected as a value between
  7988. 0 and 100 to indicate a new scene; a low value reflects a low
  7989. probability for the current frame to introduce a new scene, while a higher
  7990. value means the current frame is more likely to be one.
  7991. The default is @code{8.2}.
  7992. @item flags
  7993. Specify flags influencing the filter process.
  7994. Available value for @var{flags} is:
  7995. @table @option
  7996. @item scene_change_detect, scd
  7997. Enable scene change detection using the value of the option @var{scene}.
  7998. This flag is enabled by default.
  7999. @end table
  8000. @end table
  8001. @section framestep
  8002. Select one frame every N-th frame.
  8003. This filter accepts the following option:
  8004. @table @option
  8005. @item step
  8006. Select frame after every @code{step} frames.
  8007. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8008. @end table
  8009. @section freezedetect
  8010. Detect frozen video.
  8011. This filter logs a message and sets frame metadata when it detects that the
  8012. input video has no significant change in content during a specified duration.
  8013. Video freeze detection calculates the mean average absolute difference of all
  8014. the components of video frames and compares it to a noise floor.
  8015. The printed times and duration are expressed in seconds. The
  8016. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8017. whose timestamp equals or exceeds the detection duration and it contains the
  8018. timestamp of the first frame of the freeze. The
  8019. @code{lavfi.freezedetect.freeze_duration} and
  8020. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8021. after the freeze.
  8022. The filter accepts the following options:
  8023. @table @option
  8024. @item noise, n
  8025. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8026. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8027. 0.001.
  8028. @item duration, d
  8029. Set freeze duration until notification (default is 2 seconds).
  8030. @end table
  8031. @anchor{frei0r}
  8032. @section frei0r
  8033. Apply a frei0r effect to the input video.
  8034. To enable the compilation of this filter, you need to install the frei0r
  8035. header and configure FFmpeg with @code{--enable-frei0r}.
  8036. It accepts the following parameters:
  8037. @table @option
  8038. @item filter_name
  8039. The name of the frei0r effect to load. If the environment variable
  8040. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8041. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8042. Otherwise, the standard frei0r paths are searched, in this order:
  8043. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8044. @file{/usr/lib/frei0r-1/}.
  8045. @item filter_params
  8046. A '|'-separated list of parameters to pass to the frei0r effect.
  8047. @end table
  8048. A frei0r effect parameter can be a boolean (its value is either
  8049. "y" or "n"), a double, a color (specified as
  8050. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8051. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8052. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8053. a position (specified as @var{X}/@var{Y}, where
  8054. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8055. The number and types of parameters depend on the loaded effect. If an
  8056. effect parameter is not specified, the default value is set.
  8057. @subsection Examples
  8058. @itemize
  8059. @item
  8060. Apply the distort0r effect, setting the first two double parameters:
  8061. @example
  8062. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8063. @end example
  8064. @item
  8065. Apply the colordistance effect, taking a color as the first parameter:
  8066. @example
  8067. frei0r=colordistance:0.2/0.3/0.4
  8068. frei0r=colordistance:violet
  8069. frei0r=colordistance:0x112233
  8070. @end example
  8071. @item
  8072. Apply the perspective effect, specifying the top left and top right image
  8073. positions:
  8074. @example
  8075. frei0r=perspective:0.2/0.2|0.8/0.2
  8076. @end example
  8077. @end itemize
  8078. For more information, see
  8079. @url{http://frei0r.dyne.org}
  8080. @section fspp
  8081. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8082. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8083. processing filter, one of them is performed once per block, not per pixel.
  8084. This allows for much higher speed.
  8085. The filter accepts the following options:
  8086. @table @option
  8087. @item quality
  8088. Set quality. This option defines the number of levels for averaging. It accepts
  8089. an integer in the range 4-5. Default value is @code{4}.
  8090. @item qp
  8091. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8092. If not set, the filter will use the QP from the video stream (if available).
  8093. @item strength
  8094. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8095. more details but also more artifacts, while higher values make the image smoother
  8096. but also blurrier. Default value is @code{0} − PSNR optimal.
  8097. @item use_bframe_qp
  8098. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8099. option may cause flicker since the B-Frames have often larger QP. Default is
  8100. @code{0} (not enabled).
  8101. @end table
  8102. @section gblur
  8103. Apply Gaussian blur filter.
  8104. The filter accepts the following options:
  8105. @table @option
  8106. @item sigma
  8107. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8108. @item steps
  8109. Set number of steps for Gaussian approximation. Default is @code{1}.
  8110. @item planes
  8111. Set which planes to filter. By default all planes are filtered.
  8112. @item sigmaV
  8113. Set vertical sigma, if negative it will be same as @code{sigma}.
  8114. Default is @code{-1}.
  8115. @end table
  8116. @section geq
  8117. Apply generic equation to each pixel.
  8118. The filter accepts the following options:
  8119. @table @option
  8120. @item lum_expr, lum
  8121. Set the luminance expression.
  8122. @item cb_expr, cb
  8123. Set the chrominance blue expression.
  8124. @item cr_expr, cr
  8125. Set the chrominance red expression.
  8126. @item alpha_expr, a
  8127. Set the alpha expression.
  8128. @item red_expr, r
  8129. Set the red expression.
  8130. @item green_expr, g
  8131. Set the green expression.
  8132. @item blue_expr, b
  8133. Set the blue expression.
  8134. @end table
  8135. The colorspace is selected according to the specified options. If one
  8136. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8137. options is specified, the filter will automatically select a YCbCr
  8138. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8139. @option{blue_expr} options is specified, it will select an RGB
  8140. colorspace.
  8141. If one of the chrominance expression is not defined, it falls back on the other
  8142. one. If no alpha expression is specified it will evaluate to opaque value.
  8143. If none of chrominance expressions are specified, they will evaluate
  8144. to the luminance expression.
  8145. The expressions can use the following variables and functions:
  8146. @table @option
  8147. @item N
  8148. The sequential number of the filtered frame, starting from @code{0}.
  8149. @item X
  8150. @item Y
  8151. The coordinates of the current sample.
  8152. @item W
  8153. @item H
  8154. The width and height of the image.
  8155. @item SW
  8156. @item SH
  8157. Width and height scale depending on the currently filtered plane. It is the
  8158. ratio between the corresponding luma plane number of pixels and the current
  8159. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8160. @code{0.5,0.5} for chroma planes.
  8161. @item T
  8162. Time of the current frame, expressed in seconds.
  8163. @item p(x, y)
  8164. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8165. plane.
  8166. @item lum(x, y)
  8167. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8168. plane.
  8169. @item cb(x, y)
  8170. Return the value of the pixel at location (@var{x},@var{y}) of the
  8171. blue-difference chroma plane. Return 0 if there is no such plane.
  8172. @item cr(x, y)
  8173. Return the value of the pixel at location (@var{x},@var{y}) of the
  8174. red-difference chroma plane. Return 0 if there is no such plane.
  8175. @item r(x, y)
  8176. @item g(x, y)
  8177. @item b(x, y)
  8178. Return the value of the pixel at location (@var{x},@var{y}) of the
  8179. red/green/blue component. Return 0 if there is no such component.
  8180. @item alpha(x, y)
  8181. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8182. plane. Return 0 if there is no such plane.
  8183. @end table
  8184. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8185. automatically clipped to the closer edge.
  8186. @subsection Examples
  8187. @itemize
  8188. @item
  8189. Flip the image horizontally:
  8190. @example
  8191. geq=p(W-X\,Y)
  8192. @end example
  8193. @item
  8194. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8195. wavelength of 100 pixels:
  8196. @example
  8197. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8198. @end example
  8199. @item
  8200. Generate a fancy enigmatic moving light:
  8201. @example
  8202. 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
  8203. @end example
  8204. @item
  8205. Generate a quick emboss effect:
  8206. @example
  8207. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8208. @end example
  8209. @item
  8210. Modify RGB components depending on pixel position:
  8211. @example
  8212. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8213. @end example
  8214. @item
  8215. Create a radial gradient that is the same size as the input (also see
  8216. the @ref{vignette} filter):
  8217. @example
  8218. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8219. @end example
  8220. @end itemize
  8221. @section gradfun
  8222. Fix the banding artifacts that are sometimes introduced into nearly flat
  8223. regions by truncation to 8-bit color depth.
  8224. Interpolate the gradients that should go where the bands are, and
  8225. dither them.
  8226. It is designed for playback only. Do not use it prior to
  8227. lossy compression, because compression tends to lose the dither and
  8228. bring back the bands.
  8229. It accepts the following parameters:
  8230. @table @option
  8231. @item strength
  8232. The maximum amount by which the filter will change any one pixel. This is also
  8233. the threshold for detecting nearly flat regions. Acceptable values range from
  8234. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8235. valid range.
  8236. @item radius
  8237. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8238. gradients, but also prevents the filter from modifying the pixels near detailed
  8239. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8240. values will be clipped to the valid range.
  8241. @end table
  8242. Alternatively, the options can be specified as a flat string:
  8243. @var{strength}[:@var{radius}]
  8244. @subsection Examples
  8245. @itemize
  8246. @item
  8247. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8248. @example
  8249. gradfun=3.5:8
  8250. @end example
  8251. @item
  8252. Specify radius, omitting the strength (which will fall-back to the default
  8253. value):
  8254. @example
  8255. gradfun=radius=8
  8256. @end example
  8257. @end itemize
  8258. @section graphmonitor, agraphmonitor
  8259. Show various filtergraph stats.
  8260. With this filter one can debug complete filtergraph.
  8261. Especially issues with links filling with queued frames.
  8262. The filter accepts the following options:
  8263. @table @option
  8264. @item size, s
  8265. Set video output size. Default is @var{hd720}.
  8266. @item opacity, o
  8267. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8268. @item mode, m
  8269. Set output mode, can be @var{fulll} or @var{compact}.
  8270. In @var{compact} mode only filters with some queued frames have displayed stats.
  8271. @item flags, f
  8272. Set flags which enable which stats are shown in video.
  8273. Available values for flags are:
  8274. @table @samp
  8275. @item queue
  8276. Display number of queued frames in each link.
  8277. @item frame_count_in
  8278. Display number of frames taken from filter.
  8279. @item frame_count_out
  8280. Display number of frames given out from filter.
  8281. @item pts
  8282. Display current filtered frame pts.
  8283. @item time
  8284. Display current filtered frame time.
  8285. @item timebase
  8286. Display time base for filter link.
  8287. @item format
  8288. Display used format for filter link.
  8289. @item size
  8290. Display video size or number of audio channels in case of audio used by filter link.
  8291. @item rate
  8292. Display video frame rate or sample rate in case of audio used by filter link.
  8293. @end table
  8294. @item rate, r
  8295. Set upper limit for video rate of output stream, Default value is @var{25}.
  8296. This guarantee that output video frame rate will not be higher than this value.
  8297. @end table
  8298. @section greyedge
  8299. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8300. and corrects the scene colors accordingly.
  8301. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8302. The filter accepts the following options:
  8303. @table @option
  8304. @item difford
  8305. The order of differentiation to be applied on the scene. Must be chosen in the range
  8306. [0,2] and default value is 1.
  8307. @item minknorm
  8308. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8309. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8310. max value instead of calculating Minkowski distance.
  8311. @item sigma
  8312. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8313. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8314. can't be equal to 0 if @var{difford} is greater than 0.
  8315. @end table
  8316. @subsection Examples
  8317. @itemize
  8318. @item
  8319. Grey Edge:
  8320. @example
  8321. greyedge=difford=1:minknorm=5:sigma=2
  8322. @end example
  8323. @item
  8324. Max Edge:
  8325. @example
  8326. greyedge=difford=1:minknorm=0:sigma=2
  8327. @end example
  8328. @end itemize
  8329. @anchor{haldclut}
  8330. @section haldclut
  8331. Apply a Hald CLUT to a video stream.
  8332. First input is the video stream to process, and second one is the Hald CLUT.
  8333. The Hald CLUT input can be a simple picture or a complete video stream.
  8334. The filter accepts the following options:
  8335. @table @option
  8336. @item shortest
  8337. Force termination when the shortest input terminates. Default is @code{0}.
  8338. @item repeatlast
  8339. Continue applying the last CLUT after the end of the stream. A value of
  8340. @code{0} disable the filter after the last frame of the CLUT is reached.
  8341. Default is @code{1}.
  8342. @end table
  8343. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8344. filters share the same internals).
  8345. This filter also supports the @ref{framesync} options.
  8346. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8347. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8348. @subsection Workflow examples
  8349. @subsubsection Hald CLUT video stream
  8350. Generate an identity Hald CLUT stream altered with various effects:
  8351. @example
  8352. 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
  8353. @end example
  8354. Note: make sure you use a lossless codec.
  8355. Then use it with @code{haldclut} to apply it on some random stream:
  8356. @example
  8357. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8358. @end example
  8359. The Hald CLUT will be applied to the 10 first seconds (duration of
  8360. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8361. to the remaining frames of the @code{mandelbrot} stream.
  8362. @subsubsection Hald CLUT with preview
  8363. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8364. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8365. biggest possible square starting at the top left of the picture. The remaining
  8366. padding pixels (bottom or right) will be ignored. This area can be used to add
  8367. a preview of the Hald CLUT.
  8368. Typically, the following generated Hald CLUT will be supported by the
  8369. @code{haldclut} filter:
  8370. @example
  8371. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8372. pad=iw+320 [padded_clut];
  8373. smptebars=s=320x256, split [a][b];
  8374. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8375. [main][b] overlay=W-320" -frames:v 1 clut.png
  8376. @end example
  8377. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8378. bars are displayed on the right-top, and below the same color bars processed by
  8379. the color changes.
  8380. Then, the effect of this Hald CLUT can be visualized with:
  8381. @example
  8382. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8383. @end example
  8384. @section hflip
  8385. Flip the input video horizontally.
  8386. For example, to horizontally flip the input video with @command{ffmpeg}:
  8387. @example
  8388. ffmpeg -i in.avi -vf "hflip" out.avi
  8389. @end example
  8390. @section histeq
  8391. This filter applies a global color histogram equalization on a
  8392. per-frame basis.
  8393. It can be used to correct video that has a compressed range of pixel
  8394. intensities. The filter redistributes the pixel intensities to
  8395. equalize their distribution across the intensity range. It may be
  8396. viewed as an "automatically adjusting contrast filter". This filter is
  8397. useful only for correcting degraded or poorly captured source
  8398. video.
  8399. The filter accepts the following options:
  8400. @table @option
  8401. @item strength
  8402. Determine the amount of equalization to be applied. As the strength
  8403. is reduced, the distribution of pixel intensities more-and-more
  8404. approaches that of the input frame. The value must be a float number
  8405. in the range [0,1] and defaults to 0.200.
  8406. @item intensity
  8407. Set the maximum intensity that can generated and scale the output
  8408. values appropriately. The strength should be set as desired and then
  8409. the intensity can be limited if needed to avoid washing-out. The value
  8410. must be a float number in the range [0,1] and defaults to 0.210.
  8411. @item antibanding
  8412. Set the antibanding level. If enabled the filter will randomly vary
  8413. the luminance of output pixels by a small amount to avoid banding of
  8414. the histogram. Possible values are @code{none}, @code{weak} or
  8415. @code{strong}. It defaults to @code{none}.
  8416. @end table
  8417. @section histogram
  8418. Compute and draw a color distribution histogram for the input video.
  8419. The computed histogram is a representation of the color component
  8420. distribution in an image.
  8421. Standard histogram displays the color components distribution in an image.
  8422. Displays color graph for each color component. Shows distribution of
  8423. the Y, U, V, A or R, G, B components, depending on input format, in the
  8424. current frame. Below each graph a color component scale meter is shown.
  8425. The filter accepts the following options:
  8426. @table @option
  8427. @item level_height
  8428. Set height of level. Default value is @code{200}.
  8429. Allowed range is [50, 2048].
  8430. @item scale_height
  8431. Set height of color scale. Default value is @code{12}.
  8432. Allowed range is [0, 40].
  8433. @item display_mode
  8434. Set display mode.
  8435. It accepts the following values:
  8436. @table @samp
  8437. @item stack
  8438. Per color component graphs are placed below each other.
  8439. @item parade
  8440. Per color component graphs are placed side by side.
  8441. @item overlay
  8442. Presents information identical to that in the @code{parade}, except
  8443. that the graphs representing color components are superimposed directly
  8444. over one another.
  8445. @end table
  8446. Default is @code{stack}.
  8447. @item levels_mode
  8448. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8449. Default is @code{linear}.
  8450. @item components
  8451. Set what color components to display.
  8452. Default is @code{7}.
  8453. @item fgopacity
  8454. Set foreground opacity. Default is @code{0.7}.
  8455. @item bgopacity
  8456. Set background opacity. Default is @code{0.5}.
  8457. @end table
  8458. @subsection Examples
  8459. @itemize
  8460. @item
  8461. Calculate and draw histogram:
  8462. @example
  8463. ffplay -i input -vf histogram
  8464. @end example
  8465. @end itemize
  8466. @anchor{hqdn3d}
  8467. @section hqdn3d
  8468. This is a high precision/quality 3d denoise filter. It aims to reduce
  8469. image noise, producing smooth images and making still images really
  8470. still. It should enhance compressibility.
  8471. It accepts the following optional parameters:
  8472. @table @option
  8473. @item luma_spatial
  8474. A non-negative floating point number which specifies spatial luma strength.
  8475. It defaults to 4.0.
  8476. @item chroma_spatial
  8477. A non-negative floating point number which specifies spatial chroma strength.
  8478. It defaults to 3.0*@var{luma_spatial}/4.0.
  8479. @item luma_tmp
  8480. A floating point number which specifies luma temporal strength. It defaults to
  8481. 6.0*@var{luma_spatial}/4.0.
  8482. @item chroma_tmp
  8483. A floating point number which specifies chroma temporal strength. It defaults to
  8484. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8485. @end table
  8486. @anchor{hwdownload}
  8487. @section hwdownload
  8488. Download hardware frames to system memory.
  8489. The input must be in hardware frames, and the output a non-hardware format.
  8490. Not all formats will be supported on the output - it may be necessary to insert
  8491. an additional @option{format} filter immediately following in the graph to get
  8492. the output in a supported format.
  8493. @section hwmap
  8494. Map hardware frames to system memory or to another device.
  8495. This filter has several different modes of operation; which one is used depends
  8496. on the input and output formats:
  8497. @itemize
  8498. @item
  8499. Hardware frame input, normal frame output
  8500. Map the input frames to system memory and pass them to the output. If the
  8501. original hardware frame is later required (for example, after overlaying
  8502. something else on part of it), the @option{hwmap} filter can be used again
  8503. in the next mode to retrieve it.
  8504. @item
  8505. Normal frame input, hardware frame output
  8506. If the input is actually a software-mapped hardware frame, then unmap it -
  8507. that is, return the original hardware frame.
  8508. Otherwise, a device must be provided. Create new hardware surfaces on that
  8509. device for the output, then map them back to the software format at the input
  8510. and give those frames to the preceding filter. This will then act like the
  8511. @option{hwupload} filter, but may be able to avoid an additional copy when
  8512. the input is already in a compatible format.
  8513. @item
  8514. Hardware frame input and output
  8515. A device must be supplied for the output, either directly or with the
  8516. @option{derive_device} option. The input and output devices must be of
  8517. different types and compatible - the exact meaning of this is
  8518. system-dependent, but typically it means that they must refer to the same
  8519. underlying hardware context (for example, refer to the same graphics card).
  8520. If the input frames were originally created on the output device, then unmap
  8521. to retrieve the original frames.
  8522. Otherwise, map the frames to the output device - create new hardware frames
  8523. on the output corresponding to the frames on the input.
  8524. @end itemize
  8525. The following additional parameters are accepted:
  8526. @table @option
  8527. @item mode
  8528. Set the frame mapping mode. Some combination of:
  8529. @table @var
  8530. @item read
  8531. The mapped frame should be readable.
  8532. @item write
  8533. The mapped frame should be writeable.
  8534. @item overwrite
  8535. The mapping will always overwrite the entire frame.
  8536. This may improve performance in some cases, as the original contents of the
  8537. frame need not be loaded.
  8538. @item direct
  8539. The mapping must not involve any copying.
  8540. Indirect mappings to copies of frames are created in some cases where either
  8541. direct mapping is not possible or it would have unexpected properties.
  8542. Setting this flag ensures that the mapping is direct and will fail if that is
  8543. not possible.
  8544. @end table
  8545. Defaults to @var{read+write} if not specified.
  8546. @item derive_device @var{type}
  8547. Rather than using the device supplied at initialisation, instead derive a new
  8548. device of type @var{type} from the device the input frames exist on.
  8549. @item reverse
  8550. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8551. and map them back to the source. This may be necessary in some cases where
  8552. a mapping in one direction is required but only the opposite direction is
  8553. supported by the devices being used.
  8554. This option is dangerous - it may break the preceding filter in undefined
  8555. ways if there are any additional constraints on that filter's output.
  8556. Do not use it without fully understanding the implications of its use.
  8557. @end table
  8558. @anchor{hwupload}
  8559. @section hwupload
  8560. Upload system memory frames to hardware surfaces.
  8561. The device to upload to must be supplied when the filter is initialised. If
  8562. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8563. option.
  8564. @anchor{hwupload_cuda}
  8565. @section hwupload_cuda
  8566. Upload system memory frames to a CUDA device.
  8567. It accepts the following optional parameters:
  8568. @table @option
  8569. @item device
  8570. The number of the CUDA device to use
  8571. @end table
  8572. @section hqx
  8573. Apply a high-quality magnification filter designed for pixel art. This filter
  8574. was originally created by Maxim Stepin.
  8575. It accepts the following option:
  8576. @table @option
  8577. @item n
  8578. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8579. @code{hq3x} and @code{4} for @code{hq4x}.
  8580. Default is @code{3}.
  8581. @end table
  8582. @section hstack
  8583. Stack input videos horizontally.
  8584. All streams must be of same pixel format and of same height.
  8585. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8586. to create same output.
  8587. The filter accept the following option:
  8588. @table @option
  8589. @item inputs
  8590. Set number of input streams. Default is 2.
  8591. @item shortest
  8592. If set to 1, force the output to terminate when the shortest input
  8593. terminates. Default value is 0.
  8594. @end table
  8595. @section hue
  8596. Modify the hue and/or the saturation of the input.
  8597. It accepts the following parameters:
  8598. @table @option
  8599. @item h
  8600. Specify the hue angle as a number of degrees. It accepts an expression,
  8601. and defaults to "0".
  8602. @item s
  8603. Specify the saturation in the [-10,10] range. It accepts an expression and
  8604. defaults to "1".
  8605. @item H
  8606. Specify the hue angle as a number of radians. It accepts an
  8607. expression, and defaults to "0".
  8608. @item b
  8609. Specify the brightness in the [-10,10] range. It accepts an expression and
  8610. defaults to "0".
  8611. @end table
  8612. @option{h} and @option{H} are mutually exclusive, and can't be
  8613. specified at the same time.
  8614. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8615. expressions containing the following constants:
  8616. @table @option
  8617. @item n
  8618. frame count of the input frame starting from 0
  8619. @item pts
  8620. presentation timestamp of the input frame expressed in time base units
  8621. @item r
  8622. frame rate of the input video, NAN if the input frame rate is unknown
  8623. @item t
  8624. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8625. @item tb
  8626. time base of the input video
  8627. @end table
  8628. @subsection Examples
  8629. @itemize
  8630. @item
  8631. Set the hue to 90 degrees and the saturation to 1.0:
  8632. @example
  8633. hue=h=90:s=1
  8634. @end example
  8635. @item
  8636. Same command but expressing the hue in radians:
  8637. @example
  8638. hue=H=PI/2:s=1
  8639. @end example
  8640. @item
  8641. Rotate hue and make the saturation swing between 0
  8642. and 2 over a period of 1 second:
  8643. @example
  8644. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8645. @end example
  8646. @item
  8647. Apply a 3 seconds saturation fade-in effect starting at 0:
  8648. @example
  8649. hue="s=min(t/3\,1)"
  8650. @end example
  8651. The general fade-in expression can be written as:
  8652. @example
  8653. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8654. @end example
  8655. @item
  8656. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8657. @example
  8658. hue="s=max(0\, min(1\, (8-t)/3))"
  8659. @end example
  8660. The general fade-out expression can be written as:
  8661. @example
  8662. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8663. @end example
  8664. @end itemize
  8665. @subsection Commands
  8666. This filter supports the following commands:
  8667. @table @option
  8668. @item b
  8669. @item s
  8670. @item h
  8671. @item H
  8672. Modify the hue and/or the saturation and/or brightness of the input video.
  8673. The command accepts the same syntax of the corresponding option.
  8674. If the specified expression is not valid, it is kept at its current
  8675. value.
  8676. @end table
  8677. @section hysteresis
  8678. Grow first stream into second stream by connecting components.
  8679. This makes it possible to build more robust edge masks.
  8680. This filter accepts the following options:
  8681. @table @option
  8682. @item planes
  8683. Set which planes will be processed as bitmap, unprocessed planes will be
  8684. copied from first stream.
  8685. By default value 0xf, all planes will be processed.
  8686. @item threshold
  8687. Set threshold which is used in filtering. If pixel component value is higher than
  8688. this value filter algorithm for connecting components is activated.
  8689. By default value is 0.
  8690. @end table
  8691. @section idet
  8692. Detect video interlacing type.
  8693. This filter tries to detect if the input frames are interlaced, progressive,
  8694. top or bottom field first. It will also try to detect fields that are
  8695. repeated between adjacent frames (a sign of telecine).
  8696. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8697. Multiple frame detection incorporates the classification history of previous frames.
  8698. The filter will log these metadata values:
  8699. @table @option
  8700. @item single.current_frame
  8701. Detected type of current frame using single-frame detection. One of:
  8702. ``tff'' (top field first), ``bff'' (bottom field first),
  8703. ``progressive'', or ``undetermined''
  8704. @item single.tff
  8705. Cumulative number of frames detected as top field first using single-frame detection.
  8706. @item multiple.tff
  8707. Cumulative number of frames detected as top field first using multiple-frame detection.
  8708. @item single.bff
  8709. Cumulative number of frames detected as bottom field first using single-frame detection.
  8710. @item multiple.current_frame
  8711. Detected type of current frame using multiple-frame detection. One of:
  8712. ``tff'' (top field first), ``bff'' (bottom field first),
  8713. ``progressive'', or ``undetermined''
  8714. @item multiple.bff
  8715. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8716. @item single.progressive
  8717. Cumulative number of frames detected as progressive using single-frame detection.
  8718. @item multiple.progressive
  8719. Cumulative number of frames detected as progressive using multiple-frame detection.
  8720. @item single.undetermined
  8721. Cumulative number of frames that could not be classified using single-frame detection.
  8722. @item multiple.undetermined
  8723. Cumulative number of frames that could not be classified using multiple-frame detection.
  8724. @item repeated.current_frame
  8725. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8726. @item repeated.neither
  8727. Cumulative number of frames with no repeated field.
  8728. @item repeated.top
  8729. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8730. @item repeated.bottom
  8731. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8732. @end table
  8733. The filter accepts the following options:
  8734. @table @option
  8735. @item intl_thres
  8736. Set interlacing threshold.
  8737. @item prog_thres
  8738. Set progressive threshold.
  8739. @item rep_thres
  8740. Threshold for repeated field detection.
  8741. @item half_life
  8742. Number of frames after which a given frame's contribution to the
  8743. statistics is halved (i.e., it contributes only 0.5 to its
  8744. classification). The default of 0 means that all frames seen are given
  8745. full weight of 1.0 forever.
  8746. @item analyze_interlaced_flag
  8747. When this is not 0 then idet will use the specified number of frames to determine
  8748. if the interlaced flag is accurate, it will not count undetermined frames.
  8749. If the flag is found to be accurate it will be used without any further
  8750. computations, if it is found to be inaccurate it will be cleared without any
  8751. further computations. This allows inserting the idet filter as a low computational
  8752. method to clean up the interlaced flag
  8753. @end table
  8754. @section il
  8755. Deinterleave or interleave fields.
  8756. This filter allows one to process interlaced images fields without
  8757. deinterlacing them. Deinterleaving splits the input frame into 2
  8758. fields (so called half pictures). Odd lines are moved to the top
  8759. half of the output image, even lines to the bottom half.
  8760. You can process (filter) them independently and then re-interleave them.
  8761. The filter accepts the following options:
  8762. @table @option
  8763. @item luma_mode, l
  8764. @item chroma_mode, c
  8765. @item alpha_mode, a
  8766. Available values for @var{luma_mode}, @var{chroma_mode} and
  8767. @var{alpha_mode} are:
  8768. @table @samp
  8769. @item none
  8770. Do nothing.
  8771. @item deinterleave, d
  8772. Deinterleave fields, placing one above the other.
  8773. @item interleave, i
  8774. Interleave fields. Reverse the effect of deinterleaving.
  8775. @end table
  8776. Default value is @code{none}.
  8777. @item luma_swap, ls
  8778. @item chroma_swap, cs
  8779. @item alpha_swap, as
  8780. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8781. @end table
  8782. @section inflate
  8783. Apply inflate effect to the video.
  8784. This filter replaces the pixel by the local(3x3) average by taking into account
  8785. only values higher than the pixel.
  8786. It accepts the following options:
  8787. @table @option
  8788. @item threshold0
  8789. @item threshold1
  8790. @item threshold2
  8791. @item threshold3
  8792. Limit the maximum change for each plane, default is 65535.
  8793. If 0, plane will remain unchanged.
  8794. @end table
  8795. @section interlace
  8796. Simple interlacing filter from progressive contents. This interleaves upper (or
  8797. lower) lines from odd frames with lower (or upper) lines from even frames,
  8798. halving the frame rate and preserving image height.
  8799. @example
  8800. Original Original New Frame
  8801. Frame 'j' Frame 'j+1' (tff)
  8802. ========== =========== ==================
  8803. Line 0 --------------------> Frame 'j' Line 0
  8804. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8805. Line 2 ---------------------> Frame 'j' Line 2
  8806. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8807. ... ... ...
  8808. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8809. @end example
  8810. It accepts the following optional parameters:
  8811. @table @option
  8812. @item scan
  8813. This determines whether the interlaced frame is taken from the even
  8814. (tff - default) or odd (bff) lines of the progressive frame.
  8815. @item lowpass
  8816. Vertical lowpass filter to avoid twitter interlacing and
  8817. reduce moire patterns.
  8818. @table @samp
  8819. @item 0, off
  8820. Disable vertical lowpass filter
  8821. @item 1, linear
  8822. Enable linear filter (default)
  8823. @item 2, complex
  8824. Enable complex filter. This will slightly less reduce twitter and moire
  8825. but better retain detail and subjective sharpness impression.
  8826. @end table
  8827. @end table
  8828. @section kerndeint
  8829. Deinterlace input video by applying Donald Graft's adaptive kernel
  8830. deinterling. Work on interlaced parts of a video to produce
  8831. progressive frames.
  8832. The description of the accepted parameters follows.
  8833. @table @option
  8834. @item thresh
  8835. Set the threshold which affects the filter's tolerance when
  8836. determining if a pixel line must be processed. It must be an integer
  8837. in the range [0,255] and defaults to 10. A value of 0 will result in
  8838. applying the process on every pixels.
  8839. @item map
  8840. Paint pixels exceeding the threshold value to white if set to 1.
  8841. Default is 0.
  8842. @item order
  8843. Set the fields order. Swap fields if set to 1, leave fields alone if
  8844. 0. Default is 0.
  8845. @item sharp
  8846. Enable additional sharpening if set to 1. Default is 0.
  8847. @item twoway
  8848. Enable twoway sharpening if set to 1. Default is 0.
  8849. @end table
  8850. @subsection Examples
  8851. @itemize
  8852. @item
  8853. Apply default values:
  8854. @example
  8855. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8856. @end example
  8857. @item
  8858. Enable additional sharpening:
  8859. @example
  8860. kerndeint=sharp=1
  8861. @end example
  8862. @item
  8863. Paint processed pixels in white:
  8864. @example
  8865. kerndeint=map=1
  8866. @end example
  8867. @end itemize
  8868. @section lagfun
  8869. Slowly update darker pixels.
  8870. This filter makes short flashes of light appear longer.
  8871. This filter accepts the following options:
  8872. @table @option
  8873. @item decay
  8874. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  8875. @item planes
  8876. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  8877. @end table
  8878. @section lenscorrection
  8879. Correct radial lens distortion
  8880. This filter can be used to correct for radial distortion as can result from the use
  8881. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8882. one can use tools available for example as part of opencv or simply trial-and-error.
  8883. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8884. and extract the k1 and k2 coefficients from the resulting matrix.
  8885. Note that effectively the same filter is available in the open-source tools Krita and
  8886. Digikam from the KDE project.
  8887. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8888. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8889. brightness distribution, so you may want to use both filters together in certain
  8890. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8891. be applied before or after lens correction.
  8892. @subsection Options
  8893. The filter accepts the following options:
  8894. @table @option
  8895. @item cx
  8896. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8897. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8898. width. Default is 0.5.
  8899. @item cy
  8900. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8901. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8902. height. Default is 0.5.
  8903. @item k1
  8904. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8905. no correction. Default is 0.
  8906. @item k2
  8907. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8908. 0 means no correction. Default is 0.
  8909. @end table
  8910. The formula that generates the correction is:
  8911. @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)
  8912. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8913. distances from the focal point in the source and target images, respectively.
  8914. @section lensfun
  8915. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8916. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8917. to apply the lens correction. The filter will load the lensfun database and
  8918. query it to find the corresponding camera and lens entries in the database. As
  8919. long as these entries can be found with the given options, the filter can
  8920. perform corrections on frames. Note that incomplete strings will result in the
  8921. filter choosing the best match with the given options, and the filter will
  8922. output the chosen camera and lens models (logged with level "info"). You must
  8923. provide the make, camera model, and lens model as they are required.
  8924. The filter accepts the following options:
  8925. @table @option
  8926. @item make
  8927. The make of the camera (for example, "Canon"). This option is required.
  8928. @item model
  8929. The model of the camera (for example, "Canon EOS 100D"). This option is
  8930. required.
  8931. @item lens_model
  8932. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8933. option is required.
  8934. @item mode
  8935. The type of correction to apply. The following values are valid options:
  8936. @table @samp
  8937. @item vignetting
  8938. Enables fixing lens vignetting.
  8939. @item geometry
  8940. Enables fixing lens geometry. This is the default.
  8941. @item subpixel
  8942. Enables fixing chromatic aberrations.
  8943. @item vig_geo
  8944. Enables fixing lens vignetting and lens geometry.
  8945. @item vig_subpixel
  8946. Enables fixing lens vignetting and chromatic aberrations.
  8947. @item distortion
  8948. Enables fixing both lens geometry and chromatic aberrations.
  8949. @item all
  8950. Enables all possible corrections.
  8951. @end table
  8952. @item focal_length
  8953. The focal length of the image/video (zoom; expected constant for video). For
  8954. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8955. range should be chosen when using that lens. Default 18.
  8956. @item aperture
  8957. The aperture of the image/video (expected constant for video). Note that
  8958. aperture is only used for vignetting correction. Default 3.5.
  8959. @item focus_distance
  8960. The focus distance of the image/video (expected constant for video). Note that
  8961. focus distance is only used for vignetting and only slightly affects the
  8962. vignetting correction process. If unknown, leave it at the default value (which
  8963. is 1000).
  8964. @item scale
  8965. The scale factor which is applied after transformation. After correction the
  8966. video is no longer necessarily rectangular. This parameter controls how much of
  8967. the resulting image is visible. The value 0 means that a value will be chosen
  8968. automatically such that there is little or no unmapped area in the output
  8969. image. 1.0 means that no additional scaling is done. Lower values may result
  8970. in more of the corrected image being visible, while higher values may avoid
  8971. unmapped areas in the output.
  8972. @item target_geometry
  8973. The target geometry of the output image/video. The following values are valid
  8974. options:
  8975. @table @samp
  8976. @item rectilinear (default)
  8977. @item fisheye
  8978. @item panoramic
  8979. @item equirectangular
  8980. @item fisheye_orthographic
  8981. @item fisheye_stereographic
  8982. @item fisheye_equisolid
  8983. @item fisheye_thoby
  8984. @end table
  8985. @item reverse
  8986. Apply the reverse of image correction (instead of correcting distortion, apply
  8987. it).
  8988. @item interpolation
  8989. The type of interpolation used when correcting distortion. The following values
  8990. are valid options:
  8991. @table @samp
  8992. @item nearest
  8993. @item linear (default)
  8994. @item lanczos
  8995. @end table
  8996. @end table
  8997. @subsection Examples
  8998. @itemize
  8999. @item
  9000. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9001. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9002. aperture of "8.0".
  9003. @example
  9004. 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
  9005. @end example
  9006. @item
  9007. Apply the same as before, but only for the first 5 seconds of video.
  9008. @example
  9009. 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
  9010. @end example
  9011. @end itemize
  9012. @section libvmaf
  9013. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9014. score between two input videos.
  9015. The obtained VMAF score is printed through the logging system.
  9016. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9017. After installing the library it can be enabled using:
  9018. @code{./configure --enable-libvmaf --enable-version3}.
  9019. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9020. The filter has following options:
  9021. @table @option
  9022. @item model_path
  9023. Set the model path which is to be used for SVM.
  9024. Default value: @code{"vmaf_v0.6.1.pkl"}
  9025. @item log_path
  9026. Set the file path to be used to store logs.
  9027. @item log_fmt
  9028. Set the format of the log file (xml or json).
  9029. @item enable_transform
  9030. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9031. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9032. Default value: @code{false}
  9033. @item phone_model
  9034. Invokes the phone model which will generate VMAF scores higher than in the
  9035. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9036. @item psnr
  9037. Enables computing psnr along with vmaf.
  9038. @item ssim
  9039. Enables computing ssim along with vmaf.
  9040. @item ms_ssim
  9041. Enables computing ms_ssim along with vmaf.
  9042. @item pool
  9043. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  9044. @item n_threads
  9045. Set number of threads to be used when computing vmaf.
  9046. @item n_subsample
  9047. Set interval for frame subsampling used when computing vmaf.
  9048. @item enable_conf_interval
  9049. Enables confidence interval.
  9050. @end table
  9051. This filter also supports the @ref{framesync} options.
  9052. On the below examples the input file @file{main.mpg} being processed is
  9053. compared with the reference file @file{ref.mpg}.
  9054. @example
  9055. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9056. @end example
  9057. Example with options:
  9058. @example
  9059. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9060. @end example
  9061. @section limiter
  9062. Limits the pixel components values to the specified range [min, max].
  9063. The filter accepts the following options:
  9064. @table @option
  9065. @item min
  9066. Lower bound. Defaults to the lowest allowed value for the input.
  9067. @item max
  9068. Upper bound. Defaults to the highest allowed value for the input.
  9069. @item planes
  9070. Specify which planes will be processed. Defaults to all available.
  9071. @end table
  9072. @section loop
  9073. Loop video frames.
  9074. The filter accepts the following options:
  9075. @table @option
  9076. @item loop
  9077. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9078. Default is 0.
  9079. @item size
  9080. Set maximal size in number of frames. Default is 0.
  9081. @item start
  9082. Set first frame of loop. Default is 0.
  9083. @end table
  9084. @subsection Examples
  9085. @itemize
  9086. @item
  9087. Loop single first frame infinitely:
  9088. @example
  9089. loop=loop=-1:size=1:start=0
  9090. @end example
  9091. @item
  9092. Loop single first frame 10 times:
  9093. @example
  9094. loop=loop=10:size=1:start=0
  9095. @end example
  9096. @item
  9097. Loop 10 first frames 5 times:
  9098. @example
  9099. loop=loop=5:size=10:start=0
  9100. @end example
  9101. @end itemize
  9102. @section lut1d
  9103. Apply a 1D LUT to an input video.
  9104. The filter accepts the following options:
  9105. @table @option
  9106. @item file
  9107. Set the 1D LUT file name.
  9108. Currently supported formats:
  9109. @table @samp
  9110. @item cube
  9111. Iridas
  9112. @item csp
  9113. cineSpace
  9114. @end table
  9115. @item interp
  9116. Select interpolation mode.
  9117. Available values are:
  9118. @table @samp
  9119. @item nearest
  9120. Use values from the nearest defined point.
  9121. @item linear
  9122. Interpolate values using the linear interpolation.
  9123. @item cosine
  9124. Interpolate values using the cosine interpolation.
  9125. @item cubic
  9126. Interpolate values using the cubic interpolation.
  9127. @item spline
  9128. Interpolate values using the spline interpolation.
  9129. @end table
  9130. @end table
  9131. @anchor{lut3d}
  9132. @section lut3d
  9133. Apply a 3D LUT to an input video.
  9134. The filter accepts the following options:
  9135. @table @option
  9136. @item file
  9137. Set the 3D LUT file name.
  9138. Currently supported formats:
  9139. @table @samp
  9140. @item 3dl
  9141. AfterEffects
  9142. @item cube
  9143. Iridas
  9144. @item dat
  9145. DaVinci
  9146. @item m3d
  9147. Pandora
  9148. @item csp
  9149. cineSpace
  9150. @end table
  9151. @item interp
  9152. Select interpolation mode.
  9153. Available values are:
  9154. @table @samp
  9155. @item nearest
  9156. Use values from the nearest defined point.
  9157. @item trilinear
  9158. Interpolate values using the 8 points defining a cube.
  9159. @item tetrahedral
  9160. Interpolate values using a tetrahedron.
  9161. @end table
  9162. @end table
  9163. @section lumakey
  9164. Turn certain luma values into transparency.
  9165. The filter accepts the following options:
  9166. @table @option
  9167. @item threshold
  9168. Set the luma which will be used as base for transparency.
  9169. Default value is @code{0}.
  9170. @item tolerance
  9171. Set the range of luma values to be keyed out.
  9172. Default value is @code{0}.
  9173. @item softness
  9174. Set the range of softness. Default value is @code{0}.
  9175. Use this to control gradual transition from zero to full transparency.
  9176. @end table
  9177. @section lut, lutrgb, lutyuv
  9178. Compute a look-up table for binding each pixel component input value
  9179. to an output value, and apply it to the input video.
  9180. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9181. to an RGB input video.
  9182. These filters accept the following parameters:
  9183. @table @option
  9184. @item c0
  9185. set first pixel component expression
  9186. @item c1
  9187. set second pixel component expression
  9188. @item c2
  9189. set third pixel component expression
  9190. @item c3
  9191. set fourth pixel component expression, corresponds to the alpha component
  9192. @item r
  9193. set red component expression
  9194. @item g
  9195. set green component expression
  9196. @item b
  9197. set blue component expression
  9198. @item a
  9199. alpha component expression
  9200. @item y
  9201. set Y/luminance component expression
  9202. @item u
  9203. set U/Cb component expression
  9204. @item v
  9205. set V/Cr component expression
  9206. @end table
  9207. Each of them specifies the expression to use for computing the lookup table for
  9208. the corresponding pixel component values.
  9209. The exact component associated to each of the @var{c*} options depends on the
  9210. format in input.
  9211. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9212. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9213. The expressions can contain the following constants and functions:
  9214. @table @option
  9215. @item w
  9216. @item h
  9217. The input width and height.
  9218. @item val
  9219. The input value for the pixel component.
  9220. @item clipval
  9221. The input value, clipped to the @var{minval}-@var{maxval} range.
  9222. @item maxval
  9223. The maximum value for the pixel component.
  9224. @item minval
  9225. The minimum value for the pixel component.
  9226. @item negval
  9227. The negated value for the pixel component value, clipped to the
  9228. @var{minval}-@var{maxval} range; it corresponds to the expression
  9229. "maxval-clipval+minval".
  9230. @item clip(val)
  9231. The computed value in @var{val}, clipped to the
  9232. @var{minval}-@var{maxval} range.
  9233. @item gammaval(gamma)
  9234. The computed gamma correction value of the pixel component value,
  9235. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9236. expression
  9237. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9238. @end table
  9239. All expressions default to "val".
  9240. @subsection Examples
  9241. @itemize
  9242. @item
  9243. Negate input video:
  9244. @example
  9245. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9246. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9247. @end example
  9248. The above is the same as:
  9249. @example
  9250. lutrgb="r=negval:g=negval:b=negval"
  9251. lutyuv="y=negval:u=negval:v=negval"
  9252. @end example
  9253. @item
  9254. Negate luminance:
  9255. @example
  9256. lutyuv=y=negval
  9257. @end example
  9258. @item
  9259. Remove chroma components, turning the video into a graytone image:
  9260. @example
  9261. lutyuv="u=128:v=128"
  9262. @end example
  9263. @item
  9264. Apply a luma burning effect:
  9265. @example
  9266. lutyuv="y=2*val"
  9267. @end example
  9268. @item
  9269. Remove green and blue components:
  9270. @example
  9271. lutrgb="g=0:b=0"
  9272. @end example
  9273. @item
  9274. Set a constant alpha channel value on input:
  9275. @example
  9276. format=rgba,lutrgb=a="maxval-minval/2"
  9277. @end example
  9278. @item
  9279. Correct luminance gamma by a factor of 0.5:
  9280. @example
  9281. lutyuv=y=gammaval(0.5)
  9282. @end example
  9283. @item
  9284. Discard least significant bits of luma:
  9285. @example
  9286. lutyuv=y='bitand(val, 128+64+32)'
  9287. @end example
  9288. @item
  9289. Technicolor like effect:
  9290. @example
  9291. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9292. @end example
  9293. @end itemize
  9294. @section lut2, tlut2
  9295. The @code{lut2} filter takes two input streams and outputs one
  9296. stream.
  9297. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9298. from one single stream.
  9299. This filter accepts the following parameters:
  9300. @table @option
  9301. @item c0
  9302. set first pixel component expression
  9303. @item c1
  9304. set second pixel component expression
  9305. @item c2
  9306. set third pixel component expression
  9307. @item c3
  9308. set fourth pixel component expression, corresponds to the alpha component
  9309. @item d
  9310. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9311. which means bit depth is automatically picked from first input format.
  9312. @end table
  9313. Each of them specifies the expression to use for computing the lookup table for
  9314. the corresponding pixel component values.
  9315. The exact component associated to each of the @var{c*} options depends on the
  9316. format in inputs.
  9317. The expressions can contain the following constants:
  9318. @table @option
  9319. @item w
  9320. @item h
  9321. The input width and height.
  9322. @item x
  9323. The first input value for the pixel component.
  9324. @item y
  9325. The second input value for the pixel component.
  9326. @item bdx
  9327. The first input video bit depth.
  9328. @item bdy
  9329. The second input video bit depth.
  9330. @end table
  9331. All expressions default to "x".
  9332. @subsection Examples
  9333. @itemize
  9334. @item
  9335. Highlight differences between two RGB video streams:
  9336. @example
  9337. 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)'
  9338. @end example
  9339. @item
  9340. Highlight differences between two YUV video streams:
  9341. @example
  9342. 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)'
  9343. @end example
  9344. @item
  9345. Show max difference between two video streams:
  9346. @example
  9347. 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)))'
  9348. @end example
  9349. @end itemize
  9350. @section maskedclamp
  9351. Clamp the first input stream with the second input and third input stream.
  9352. Returns the value of first stream to be between second input
  9353. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9354. This filter accepts the following options:
  9355. @table @option
  9356. @item undershoot
  9357. Default value is @code{0}.
  9358. @item overshoot
  9359. Default value is @code{0}.
  9360. @item planes
  9361. Set which planes will be processed as bitmap, unprocessed planes will be
  9362. copied from first stream.
  9363. By default value 0xf, all planes will be processed.
  9364. @end table
  9365. @section maskedmerge
  9366. Merge the first input stream with the second input stream using per pixel
  9367. weights in the third input stream.
  9368. A value of 0 in the third stream pixel component means that pixel component
  9369. from first stream is returned unchanged, while maximum value (eg. 255 for
  9370. 8-bit videos) means that pixel component from second stream is returned
  9371. unchanged. Intermediate values define the amount of merging between both
  9372. input stream's pixel components.
  9373. This filter accepts the following options:
  9374. @table @option
  9375. @item planes
  9376. Set which planes will be processed as bitmap, unprocessed planes will be
  9377. copied from first stream.
  9378. By default value 0xf, all planes will be processed.
  9379. @end table
  9380. @section maskfun
  9381. Create mask from input video.
  9382. For example it is useful to create motion masks after @code{tblend} filter.
  9383. This filter accepts the following options:
  9384. @table @option
  9385. @item low
  9386. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9387. @item high
  9388. Set high threshold. Any pixel component higher than this value will be set to max value
  9389. allowed for current pixel format.
  9390. @item planes
  9391. Set planes to filter, by default all available planes are filtered.
  9392. @item fill
  9393. Fill all frame pixels with this value.
  9394. @item sum
  9395. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9396. average, output frame will be completely filled with value set by @var{fill} option.
  9397. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9398. @end table
  9399. @section mcdeint
  9400. Apply motion-compensation deinterlacing.
  9401. It needs one field per frame as input and must thus be used together
  9402. with yadif=1/3 or equivalent.
  9403. This filter accepts the following options:
  9404. @table @option
  9405. @item mode
  9406. Set the deinterlacing mode.
  9407. It accepts one of the following values:
  9408. @table @samp
  9409. @item fast
  9410. @item medium
  9411. @item slow
  9412. use iterative motion estimation
  9413. @item extra_slow
  9414. like @samp{slow}, but use multiple reference frames.
  9415. @end table
  9416. Default value is @samp{fast}.
  9417. @item parity
  9418. Set the picture field parity assumed for the input video. It must be
  9419. one of the following values:
  9420. @table @samp
  9421. @item 0, tff
  9422. assume top field first
  9423. @item 1, bff
  9424. assume bottom field first
  9425. @end table
  9426. Default value is @samp{bff}.
  9427. @item qp
  9428. Set per-block quantization parameter (QP) used by the internal
  9429. encoder.
  9430. Higher values should result in a smoother motion vector field but less
  9431. optimal individual vectors. Default value is 1.
  9432. @end table
  9433. @section mergeplanes
  9434. Merge color channel components from several video streams.
  9435. The filter accepts up to 4 input streams, and merge selected input
  9436. planes to the output video.
  9437. This filter accepts the following options:
  9438. @table @option
  9439. @item mapping
  9440. Set input to output plane mapping. Default is @code{0}.
  9441. The mappings is specified as a bitmap. It should be specified as a
  9442. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9443. mapping for the first plane of the output stream. 'A' sets the number of
  9444. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9445. corresponding input to use (from 0 to 3). The rest of the mappings is
  9446. similar, 'Bb' describes the mapping for the output stream second
  9447. plane, 'Cc' describes the mapping for the output stream third plane and
  9448. 'Dd' describes the mapping for the output stream fourth plane.
  9449. @item format
  9450. Set output pixel format. Default is @code{yuva444p}.
  9451. @end table
  9452. @subsection Examples
  9453. @itemize
  9454. @item
  9455. Merge three gray video streams of same width and height into single video stream:
  9456. @example
  9457. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9458. @end example
  9459. @item
  9460. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9461. @example
  9462. [a0][a1]mergeplanes=0x00010210:yuva444p
  9463. @end example
  9464. @item
  9465. Swap Y and A plane in yuva444p stream:
  9466. @example
  9467. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9468. @end example
  9469. @item
  9470. Swap U and V plane in yuv420p stream:
  9471. @example
  9472. format=yuv420p,mergeplanes=0x000201:yuv420p
  9473. @end example
  9474. @item
  9475. Cast a rgb24 clip to yuv444p:
  9476. @example
  9477. format=rgb24,mergeplanes=0x000102:yuv444p
  9478. @end example
  9479. @end itemize
  9480. @section mestimate
  9481. Estimate and export motion vectors using block matching algorithms.
  9482. Motion vectors are stored in frame side data to be used by other filters.
  9483. This filter accepts the following options:
  9484. @table @option
  9485. @item method
  9486. Specify the motion estimation method. Accepts one of the following values:
  9487. @table @samp
  9488. @item esa
  9489. Exhaustive search algorithm.
  9490. @item tss
  9491. Three step search algorithm.
  9492. @item tdls
  9493. Two dimensional logarithmic search algorithm.
  9494. @item ntss
  9495. New three step search algorithm.
  9496. @item fss
  9497. Four step search algorithm.
  9498. @item ds
  9499. Diamond search algorithm.
  9500. @item hexbs
  9501. Hexagon-based search algorithm.
  9502. @item epzs
  9503. Enhanced predictive zonal search algorithm.
  9504. @item umh
  9505. Uneven multi-hexagon search algorithm.
  9506. @end table
  9507. Default value is @samp{esa}.
  9508. @item mb_size
  9509. Macroblock size. Default @code{16}.
  9510. @item search_param
  9511. Search parameter. Default @code{7}.
  9512. @end table
  9513. @section midequalizer
  9514. Apply Midway Image Equalization effect using two video streams.
  9515. Midway Image Equalization adjusts a pair of images to have the same
  9516. histogram, while maintaining their dynamics as much as possible. It's
  9517. useful for e.g. matching exposures from a pair of stereo cameras.
  9518. This filter has two inputs and one output, which must be of same pixel format, but
  9519. may be of different sizes. The output of filter is first input adjusted with
  9520. midway histogram of both inputs.
  9521. This filter accepts the following option:
  9522. @table @option
  9523. @item planes
  9524. Set which planes to process. Default is @code{15}, which is all available planes.
  9525. @end table
  9526. @section minterpolate
  9527. Convert the video to specified frame rate using motion interpolation.
  9528. This filter accepts the following options:
  9529. @table @option
  9530. @item fps
  9531. 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}.
  9532. @item mi_mode
  9533. Motion interpolation mode. Following values are accepted:
  9534. @table @samp
  9535. @item dup
  9536. Duplicate previous or next frame for interpolating new ones.
  9537. @item blend
  9538. Blend source frames. Interpolated frame is mean of previous and next frames.
  9539. @item mci
  9540. Motion compensated interpolation. Following options are effective when this mode is selected:
  9541. @table @samp
  9542. @item mc_mode
  9543. Motion compensation mode. Following values are accepted:
  9544. @table @samp
  9545. @item obmc
  9546. Overlapped block motion compensation.
  9547. @item aobmc
  9548. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9549. @end table
  9550. Default mode is @samp{obmc}.
  9551. @item me_mode
  9552. Motion estimation mode. Following values are accepted:
  9553. @table @samp
  9554. @item bidir
  9555. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9556. @item bilat
  9557. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9558. @end table
  9559. Default mode is @samp{bilat}.
  9560. @item me
  9561. The algorithm to be used for motion estimation. Following values are accepted:
  9562. @table @samp
  9563. @item esa
  9564. Exhaustive search algorithm.
  9565. @item tss
  9566. Three step search algorithm.
  9567. @item tdls
  9568. Two dimensional logarithmic search algorithm.
  9569. @item ntss
  9570. New three step search algorithm.
  9571. @item fss
  9572. Four step search algorithm.
  9573. @item ds
  9574. Diamond search algorithm.
  9575. @item hexbs
  9576. Hexagon-based search algorithm.
  9577. @item epzs
  9578. Enhanced predictive zonal search algorithm.
  9579. @item umh
  9580. Uneven multi-hexagon search algorithm.
  9581. @end table
  9582. Default algorithm is @samp{epzs}.
  9583. @item mb_size
  9584. Macroblock size. Default @code{16}.
  9585. @item search_param
  9586. Motion estimation search parameter. Default @code{32}.
  9587. @item vsbmc
  9588. 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).
  9589. @end table
  9590. @end table
  9591. @item scd
  9592. 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:
  9593. @table @samp
  9594. @item none
  9595. Disable scene change detection.
  9596. @item fdiff
  9597. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9598. @end table
  9599. Default method is @samp{fdiff}.
  9600. @item scd_threshold
  9601. Scene change detection threshold. Default is @code{5.0}.
  9602. @end table
  9603. @section mix
  9604. Mix several video input streams into one video stream.
  9605. A description of the accepted options follows.
  9606. @table @option
  9607. @item nb_inputs
  9608. The number of inputs. If unspecified, it defaults to 2.
  9609. @item weights
  9610. Specify weight of each input video stream as sequence.
  9611. Each weight is separated by space. If number of weights
  9612. is smaller than number of @var{frames} last specified
  9613. weight will be used for all remaining unset weights.
  9614. @item scale
  9615. Specify scale, if it is set it will be multiplied with sum
  9616. of each weight multiplied with pixel values to give final destination
  9617. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9618. @item duration
  9619. Specify how end of stream is determined.
  9620. @table @samp
  9621. @item longest
  9622. The duration of the longest input. (default)
  9623. @item shortest
  9624. The duration of the shortest input.
  9625. @item first
  9626. The duration of the first input.
  9627. @end table
  9628. @end table
  9629. @section mpdecimate
  9630. Drop frames that do not differ greatly from the previous frame in
  9631. order to reduce frame rate.
  9632. The main use of this filter is for very-low-bitrate encoding
  9633. (e.g. streaming over dialup modem), but it could in theory be used for
  9634. fixing movies that were inverse-telecined incorrectly.
  9635. A description of the accepted options follows.
  9636. @table @option
  9637. @item max
  9638. Set the maximum number of consecutive frames which can be dropped (if
  9639. positive), or the minimum interval between dropped frames (if
  9640. negative). If the value is 0, the frame is dropped disregarding the
  9641. number of previous sequentially dropped frames.
  9642. Default value is 0.
  9643. @item hi
  9644. @item lo
  9645. @item frac
  9646. Set the dropping threshold values.
  9647. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9648. represent actual pixel value differences, so a threshold of 64
  9649. corresponds to 1 unit of difference for each pixel, or the same spread
  9650. out differently over the block.
  9651. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9652. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9653. meaning the whole image) differ by more than a threshold of @option{lo}.
  9654. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9655. 64*5, and default value for @option{frac} is 0.33.
  9656. @end table
  9657. @section negate
  9658. Negate (invert) the input video.
  9659. It accepts the following option:
  9660. @table @option
  9661. @item negate_alpha
  9662. With value 1, it negates the alpha component, if present. Default value is 0.
  9663. @end table
  9664. @anchor{nlmeans}
  9665. @section nlmeans
  9666. Denoise frames using Non-Local Means algorithm.
  9667. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9668. context similarity is defined by comparing their surrounding patches of size
  9669. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9670. around the pixel.
  9671. Note that the research area defines centers for patches, which means some
  9672. patches will be made of pixels outside that research area.
  9673. The filter accepts the following options.
  9674. @table @option
  9675. @item s
  9676. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9677. @item p
  9678. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9679. @item pc
  9680. Same as @option{p} but for chroma planes.
  9681. The default value is @var{0} and means automatic.
  9682. @item r
  9683. Set research size. Default is 15. Must be odd number in range [0, 99].
  9684. @item rc
  9685. Same as @option{r} but for chroma planes.
  9686. The default value is @var{0} and means automatic.
  9687. @end table
  9688. @section nnedi
  9689. Deinterlace video using neural network edge directed interpolation.
  9690. This filter accepts the following options:
  9691. @table @option
  9692. @item weights
  9693. Mandatory option, without binary file filter can not work.
  9694. Currently file can be found here:
  9695. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9696. @item deint
  9697. Set which frames to deinterlace, by default it is @code{all}.
  9698. Can be @code{all} or @code{interlaced}.
  9699. @item field
  9700. Set mode of operation.
  9701. Can be one of the following:
  9702. @table @samp
  9703. @item af
  9704. Use frame flags, both fields.
  9705. @item a
  9706. Use frame flags, single field.
  9707. @item t
  9708. Use top field only.
  9709. @item b
  9710. Use bottom field only.
  9711. @item tf
  9712. Use both fields, top first.
  9713. @item bf
  9714. Use both fields, bottom first.
  9715. @end table
  9716. @item planes
  9717. Set which planes to process, by default filter process all frames.
  9718. @item nsize
  9719. Set size of local neighborhood around each pixel, used by the predictor neural
  9720. network.
  9721. Can be one of the following:
  9722. @table @samp
  9723. @item s8x6
  9724. @item s16x6
  9725. @item s32x6
  9726. @item s48x6
  9727. @item s8x4
  9728. @item s16x4
  9729. @item s32x4
  9730. @end table
  9731. @item nns
  9732. Set the number of neurons in predictor neural network.
  9733. Can be one of the following:
  9734. @table @samp
  9735. @item n16
  9736. @item n32
  9737. @item n64
  9738. @item n128
  9739. @item n256
  9740. @end table
  9741. @item qual
  9742. Controls the number of different neural network predictions that are blended
  9743. together to compute the final output value. Can be @code{fast}, default or
  9744. @code{slow}.
  9745. @item etype
  9746. Set which set of weights to use in the predictor.
  9747. Can be one of the following:
  9748. @table @samp
  9749. @item a
  9750. weights trained to minimize absolute error
  9751. @item s
  9752. weights trained to minimize squared error
  9753. @end table
  9754. @item pscrn
  9755. Controls whether or not the prescreener neural network is used to decide
  9756. which pixels should be processed by the predictor neural network and which
  9757. can be handled by simple cubic interpolation.
  9758. The prescreener is trained to know whether cubic interpolation will be
  9759. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9760. The computational complexity of the prescreener nn is much less than that of
  9761. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9762. using the prescreener generally results in much faster processing.
  9763. The prescreener is pretty accurate, so the difference between using it and not
  9764. using it is almost always unnoticeable.
  9765. Can be one of the following:
  9766. @table @samp
  9767. @item none
  9768. @item original
  9769. @item new
  9770. @end table
  9771. Default is @code{new}.
  9772. @item fapprox
  9773. Set various debugging flags.
  9774. @end table
  9775. @section noformat
  9776. Force libavfilter not to use any of the specified pixel formats for the
  9777. input to the next filter.
  9778. It accepts the following parameters:
  9779. @table @option
  9780. @item pix_fmts
  9781. A '|'-separated list of pixel format names, such as
  9782. pix_fmts=yuv420p|monow|rgb24".
  9783. @end table
  9784. @subsection Examples
  9785. @itemize
  9786. @item
  9787. Force libavfilter to use a format different from @var{yuv420p} for the
  9788. input to the vflip filter:
  9789. @example
  9790. noformat=pix_fmts=yuv420p,vflip
  9791. @end example
  9792. @item
  9793. Convert the input video to any of the formats not contained in the list:
  9794. @example
  9795. noformat=yuv420p|yuv444p|yuv410p
  9796. @end example
  9797. @end itemize
  9798. @section noise
  9799. Add noise on video input frame.
  9800. The filter accepts the following options:
  9801. @table @option
  9802. @item all_seed
  9803. @item c0_seed
  9804. @item c1_seed
  9805. @item c2_seed
  9806. @item c3_seed
  9807. Set noise seed for specific pixel component or all pixel components in case
  9808. of @var{all_seed}. Default value is @code{123457}.
  9809. @item all_strength, alls
  9810. @item c0_strength, c0s
  9811. @item c1_strength, c1s
  9812. @item c2_strength, c2s
  9813. @item c3_strength, c3s
  9814. Set noise strength for specific pixel component or all pixel components in case
  9815. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9816. @item all_flags, allf
  9817. @item c0_flags, c0f
  9818. @item c1_flags, c1f
  9819. @item c2_flags, c2f
  9820. @item c3_flags, c3f
  9821. Set pixel component flags or set flags for all components if @var{all_flags}.
  9822. Available values for component flags are:
  9823. @table @samp
  9824. @item a
  9825. averaged temporal noise (smoother)
  9826. @item p
  9827. mix random noise with a (semi)regular pattern
  9828. @item t
  9829. temporal noise (noise pattern changes between frames)
  9830. @item u
  9831. uniform noise (gaussian otherwise)
  9832. @end table
  9833. @end table
  9834. @subsection Examples
  9835. Add temporal and uniform noise to input video:
  9836. @example
  9837. noise=alls=20:allf=t+u
  9838. @end example
  9839. @section normalize
  9840. Normalize RGB video (aka histogram stretching, contrast stretching).
  9841. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9842. For each channel of each frame, the filter computes the input range and maps
  9843. it linearly to the user-specified output range. The output range defaults
  9844. to the full dynamic range from pure black to pure white.
  9845. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9846. changes in brightness) caused when small dark or bright objects enter or leave
  9847. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9848. video camera, and, like a video camera, it may cause a period of over- or
  9849. under-exposure of the video.
  9850. The R,G,B channels can be normalized independently, which may cause some
  9851. color shifting, or linked together as a single channel, which prevents
  9852. color shifting. Linked normalization preserves hue. Independent normalization
  9853. does not, so it can be used to remove some color casts. Independent and linked
  9854. normalization can be combined in any ratio.
  9855. The normalize filter accepts the following options:
  9856. @table @option
  9857. @item blackpt
  9858. @item whitept
  9859. Colors which define the output range. The minimum input value is mapped to
  9860. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9861. The defaults are black and white respectively. Specifying white for
  9862. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9863. normalized video. Shades of grey can be used to reduce the dynamic range
  9864. (contrast). Specifying saturated colors here can create some interesting
  9865. effects.
  9866. @item smoothing
  9867. The number of previous frames to use for temporal smoothing. The input range
  9868. of each channel is smoothed using a rolling average over the current frame
  9869. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9870. smoothing).
  9871. @item independence
  9872. Controls the ratio of independent (color shifting) channel normalization to
  9873. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9874. independent. Defaults to 1.0 (fully independent).
  9875. @item strength
  9876. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9877. expensive no-op. Defaults to 1.0 (full strength).
  9878. @end table
  9879. @subsection Examples
  9880. Stretch video contrast to use the full dynamic range, with no temporal
  9881. smoothing; may flicker depending on the source content:
  9882. @example
  9883. normalize=blackpt=black:whitept=white:smoothing=0
  9884. @end example
  9885. As above, but with 50 frames of temporal smoothing; flicker should be
  9886. reduced, depending on the source content:
  9887. @example
  9888. normalize=blackpt=black:whitept=white:smoothing=50
  9889. @end example
  9890. As above, but with hue-preserving linked channel normalization:
  9891. @example
  9892. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9893. @end example
  9894. As above, but with half strength:
  9895. @example
  9896. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9897. @end example
  9898. Map the darkest input color to red, the brightest input color to cyan:
  9899. @example
  9900. normalize=blackpt=red:whitept=cyan
  9901. @end example
  9902. @section null
  9903. Pass the video source unchanged to the output.
  9904. @section ocr
  9905. Optical Character Recognition
  9906. This filter uses Tesseract for optical character recognition. To enable
  9907. compilation of this filter, you need to configure FFmpeg with
  9908. @code{--enable-libtesseract}.
  9909. It accepts the following options:
  9910. @table @option
  9911. @item datapath
  9912. Set datapath to tesseract data. Default is to use whatever was
  9913. set at installation.
  9914. @item language
  9915. Set language, default is "eng".
  9916. @item whitelist
  9917. Set character whitelist.
  9918. @item blacklist
  9919. Set character blacklist.
  9920. @end table
  9921. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9922. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  9923. @section ocv
  9924. Apply a video transform using libopencv.
  9925. To enable this filter, install the libopencv library and headers and
  9926. configure FFmpeg with @code{--enable-libopencv}.
  9927. It accepts the following parameters:
  9928. @table @option
  9929. @item filter_name
  9930. The name of the libopencv filter to apply.
  9931. @item filter_params
  9932. The parameters to pass to the libopencv filter. If not specified, the default
  9933. values are assumed.
  9934. @end table
  9935. Refer to the official libopencv documentation for more precise
  9936. information:
  9937. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9938. Several libopencv filters are supported; see the following subsections.
  9939. @anchor{dilate}
  9940. @subsection dilate
  9941. Dilate an image by using a specific structuring element.
  9942. It corresponds to the libopencv function @code{cvDilate}.
  9943. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9944. @var{struct_el} represents a structuring element, and has the syntax:
  9945. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9946. @var{cols} and @var{rows} represent the number of columns and rows of
  9947. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9948. point, and @var{shape} the shape for the structuring element. @var{shape}
  9949. must be "rect", "cross", "ellipse", or "custom".
  9950. If the value for @var{shape} is "custom", it must be followed by a
  9951. string of the form "=@var{filename}". The file with name
  9952. @var{filename} is assumed to represent a binary image, with each
  9953. printable character corresponding to a bright pixel. When a custom
  9954. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9955. or columns and rows of the read file are assumed instead.
  9956. The default value for @var{struct_el} is "3x3+0x0/rect".
  9957. @var{nb_iterations} specifies the number of times the transform is
  9958. applied to the image, and defaults to 1.
  9959. Some examples:
  9960. @example
  9961. # Use the default values
  9962. ocv=dilate
  9963. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9964. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9965. # Read the shape from the file diamond.shape, iterating two times.
  9966. # The file diamond.shape may contain a pattern of characters like this
  9967. # *
  9968. # ***
  9969. # *****
  9970. # ***
  9971. # *
  9972. # The specified columns and rows are ignored
  9973. # but the anchor point coordinates are not
  9974. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9975. @end example
  9976. @subsection erode
  9977. Erode an image by using a specific structuring element.
  9978. It corresponds to the libopencv function @code{cvErode}.
  9979. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9980. with the same syntax and semantics as the @ref{dilate} filter.
  9981. @subsection smooth
  9982. Smooth the input video.
  9983. The filter takes the following parameters:
  9984. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9985. @var{type} is the type of smooth filter to apply, and must be one of
  9986. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9987. or "bilateral". The default value is "gaussian".
  9988. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9989. depend on the smooth type. @var{param1} and
  9990. @var{param2} accept integer positive values or 0. @var{param3} and
  9991. @var{param4} accept floating point values.
  9992. The default value for @var{param1} is 3. The default value for the
  9993. other parameters is 0.
  9994. These parameters correspond to the parameters assigned to the
  9995. libopencv function @code{cvSmooth}.
  9996. @section oscilloscope
  9997. 2D Video Oscilloscope.
  9998. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9999. It accepts the following parameters:
  10000. @table @option
  10001. @item x
  10002. Set scope center x position.
  10003. @item y
  10004. Set scope center y position.
  10005. @item s
  10006. Set scope size, relative to frame diagonal.
  10007. @item t
  10008. Set scope tilt/rotation.
  10009. @item o
  10010. Set trace opacity.
  10011. @item tx
  10012. Set trace center x position.
  10013. @item ty
  10014. Set trace center y position.
  10015. @item tw
  10016. Set trace width, relative to width of frame.
  10017. @item th
  10018. Set trace height, relative to height of frame.
  10019. @item c
  10020. Set which components to trace. By default it traces first three components.
  10021. @item g
  10022. Draw trace grid. By default is enabled.
  10023. @item st
  10024. Draw some statistics. By default is enabled.
  10025. @item sc
  10026. Draw scope. By default is enabled.
  10027. @end table
  10028. @subsection Examples
  10029. @itemize
  10030. @item
  10031. Inspect full first row of video frame.
  10032. @example
  10033. oscilloscope=x=0.5:y=0:s=1
  10034. @end example
  10035. @item
  10036. Inspect full last row of video frame.
  10037. @example
  10038. oscilloscope=x=0.5:y=1:s=1
  10039. @end example
  10040. @item
  10041. Inspect full 5th line of video frame of height 1080.
  10042. @example
  10043. oscilloscope=x=0.5:y=5/1080:s=1
  10044. @end example
  10045. @item
  10046. Inspect full last column of video frame.
  10047. @example
  10048. oscilloscope=x=1:y=0.5:s=1:t=1
  10049. @end example
  10050. @end itemize
  10051. @anchor{overlay}
  10052. @section overlay
  10053. Overlay one video on top of another.
  10054. It takes two inputs and has one output. The first input is the "main"
  10055. video on which the second input is overlaid.
  10056. It accepts the following parameters:
  10057. A description of the accepted options follows.
  10058. @table @option
  10059. @item x
  10060. @item y
  10061. Set the expression for the x and y coordinates of the overlaid video
  10062. on the main video. Default value is "0" for both expressions. In case
  10063. the expression is invalid, it is set to a huge value (meaning that the
  10064. overlay will not be displayed within the output visible area).
  10065. @item eof_action
  10066. See @ref{framesync}.
  10067. @item eval
  10068. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10069. It accepts the following values:
  10070. @table @samp
  10071. @item init
  10072. only evaluate expressions once during the filter initialization or
  10073. when a command is processed
  10074. @item frame
  10075. evaluate expressions for each incoming frame
  10076. @end table
  10077. Default value is @samp{frame}.
  10078. @item shortest
  10079. See @ref{framesync}.
  10080. @item format
  10081. Set the format for the output video.
  10082. It accepts the following values:
  10083. @table @samp
  10084. @item yuv420
  10085. force YUV420 output
  10086. @item yuv422
  10087. force YUV422 output
  10088. @item yuv444
  10089. force YUV444 output
  10090. @item rgb
  10091. force packed RGB output
  10092. @item gbrp
  10093. force planar RGB output
  10094. @item auto
  10095. automatically pick format
  10096. @end table
  10097. Default value is @samp{yuv420}.
  10098. @item repeatlast
  10099. See @ref{framesync}.
  10100. @item alpha
  10101. Set format of alpha of the overlaid video, it can be @var{straight} or
  10102. @var{premultiplied}. Default is @var{straight}.
  10103. @end table
  10104. The @option{x}, and @option{y} expressions can contain the following
  10105. parameters.
  10106. @table @option
  10107. @item main_w, W
  10108. @item main_h, H
  10109. The main input width and height.
  10110. @item overlay_w, w
  10111. @item overlay_h, h
  10112. The overlay input width and height.
  10113. @item x
  10114. @item y
  10115. The computed values for @var{x} and @var{y}. They are evaluated for
  10116. each new frame.
  10117. @item hsub
  10118. @item vsub
  10119. horizontal and vertical chroma subsample values of the output
  10120. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10121. @var{vsub} is 1.
  10122. @item n
  10123. the number of input frame, starting from 0
  10124. @item pos
  10125. the position in the file of the input frame, NAN if unknown
  10126. @item t
  10127. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10128. @end table
  10129. This filter also supports the @ref{framesync} options.
  10130. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10131. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10132. when @option{eval} is set to @samp{init}.
  10133. Be aware that frames are taken from each input video in timestamp
  10134. order, hence, if their initial timestamps differ, it is a good idea
  10135. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10136. have them begin in the same zero timestamp, as the example for
  10137. the @var{movie} filter does.
  10138. You can chain together more overlays but you should test the
  10139. efficiency of such approach.
  10140. @subsection Commands
  10141. This filter supports the following commands:
  10142. @table @option
  10143. @item x
  10144. @item y
  10145. Modify the x and y of the overlay input.
  10146. The command accepts the same syntax of the corresponding option.
  10147. If the specified expression is not valid, it is kept at its current
  10148. value.
  10149. @end table
  10150. @subsection Examples
  10151. @itemize
  10152. @item
  10153. Draw the overlay at 10 pixels from the bottom right corner of the main
  10154. video:
  10155. @example
  10156. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10157. @end example
  10158. Using named options the example above becomes:
  10159. @example
  10160. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10161. @end example
  10162. @item
  10163. Insert a transparent PNG logo in the bottom left corner of the input,
  10164. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10165. @example
  10166. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10167. @end example
  10168. @item
  10169. Insert 2 different transparent PNG logos (second logo on bottom
  10170. right corner) using the @command{ffmpeg} tool:
  10171. @example
  10172. 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
  10173. @end example
  10174. @item
  10175. Add a transparent color layer on top of the main video; @code{WxH}
  10176. must specify the size of the main input to the overlay filter:
  10177. @example
  10178. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10179. @end example
  10180. @item
  10181. Play an original video and a filtered version (here with the deshake
  10182. filter) side by side using the @command{ffplay} tool:
  10183. @example
  10184. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10185. @end example
  10186. The above command is the same as:
  10187. @example
  10188. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10189. @end example
  10190. @item
  10191. Make a sliding overlay appearing from the left to the right top part of the
  10192. screen starting since time 2:
  10193. @example
  10194. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10195. @end example
  10196. @item
  10197. Compose output by putting two input videos side to side:
  10198. @example
  10199. ffmpeg -i left.avi -i right.avi -filter_complex "
  10200. nullsrc=size=200x100 [background];
  10201. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10202. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10203. [background][left] overlay=shortest=1 [background+left];
  10204. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10205. "
  10206. @end example
  10207. @item
  10208. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10209. @example
  10210. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10211. -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]'
  10212. masked.avi
  10213. @end example
  10214. @item
  10215. Chain several overlays in cascade:
  10216. @example
  10217. nullsrc=s=200x200 [bg];
  10218. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10219. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10220. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10221. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10222. [in3] null, [mid2] overlay=100:100 [out0]
  10223. @end example
  10224. @end itemize
  10225. @section owdenoise
  10226. Apply Overcomplete Wavelet denoiser.
  10227. The filter accepts the following options:
  10228. @table @option
  10229. @item depth
  10230. Set depth.
  10231. Larger depth values will denoise lower frequency components more, but
  10232. slow down filtering.
  10233. Must be an int in the range 8-16, default is @code{8}.
  10234. @item luma_strength, ls
  10235. Set luma strength.
  10236. Must be a double value in the range 0-1000, default is @code{1.0}.
  10237. @item chroma_strength, cs
  10238. Set chroma strength.
  10239. Must be a double value in the range 0-1000, default is @code{1.0}.
  10240. @end table
  10241. @anchor{pad}
  10242. @section pad
  10243. Add paddings to the input image, and place the original input at the
  10244. provided @var{x}, @var{y} coordinates.
  10245. It accepts the following parameters:
  10246. @table @option
  10247. @item width, w
  10248. @item height, h
  10249. Specify an expression for the size of the output image with the
  10250. paddings added. If the value for @var{width} or @var{height} is 0, the
  10251. corresponding input size is used for the output.
  10252. The @var{width} expression can reference the value set by the
  10253. @var{height} expression, and vice versa.
  10254. The default value of @var{width} and @var{height} is 0.
  10255. @item x
  10256. @item y
  10257. Specify the offsets to place the input image at within the padded area,
  10258. with respect to the top/left border of the output image.
  10259. The @var{x} expression can reference the value set by the @var{y}
  10260. expression, and vice versa.
  10261. The default value of @var{x} and @var{y} is 0.
  10262. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10263. so the input image is centered on the padded area.
  10264. @item color
  10265. Specify the color of the padded area. For the syntax of this option,
  10266. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10267. manual,ffmpeg-utils}.
  10268. The default value of @var{color} is "black".
  10269. @item eval
  10270. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10271. It accepts the following values:
  10272. @table @samp
  10273. @item init
  10274. Only evaluate expressions once during the filter initialization or when
  10275. a command is processed.
  10276. @item frame
  10277. Evaluate expressions for each incoming frame.
  10278. @end table
  10279. Default value is @samp{init}.
  10280. @item aspect
  10281. Pad to aspect instead to a resolution.
  10282. @end table
  10283. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10284. options are expressions containing the following constants:
  10285. @table @option
  10286. @item in_w
  10287. @item in_h
  10288. The input video width and height.
  10289. @item iw
  10290. @item ih
  10291. These are the same as @var{in_w} and @var{in_h}.
  10292. @item out_w
  10293. @item out_h
  10294. The output width and height (the size of the padded area), as
  10295. specified by the @var{width} and @var{height} expressions.
  10296. @item ow
  10297. @item oh
  10298. These are the same as @var{out_w} and @var{out_h}.
  10299. @item x
  10300. @item y
  10301. The x and y offsets as specified by the @var{x} and @var{y}
  10302. expressions, or NAN if not yet specified.
  10303. @item a
  10304. same as @var{iw} / @var{ih}
  10305. @item sar
  10306. input sample aspect ratio
  10307. @item dar
  10308. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10309. @item hsub
  10310. @item vsub
  10311. The horizontal and vertical chroma subsample values. For example for the
  10312. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10313. @end table
  10314. @subsection Examples
  10315. @itemize
  10316. @item
  10317. Add paddings with the color "violet" to the input video. The output video
  10318. size is 640x480, and the top-left corner of the input video is placed at
  10319. column 0, row 40
  10320. @example
  10321. pad=640:480:0:40:violet
  10322. @end example
  10323. The example above is equivalent to the following command:
  10324. @example
  10325. pad=width=640:height=480:x=0:y=40:color=violet
  10326. @end example
  10327. @item
  10328. Pad the input to get an output with dimensions increased by 3/2,
  10329. and put the input video at the center of the padded area:
  10330. @example
  10331. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10332. @end example
  10333. @item
  10334. Pad the input to get a squared output with size equal to the maximum
  10335. value between the input width and height, and put the input video at
  10336. the center of the padded area:
  10337. @example
  10338. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10339. @end example
  10340. @item
  10341. Pad the input to get a final w/h ratio of 16:9:
  10342. @example
  10343. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10344. @end example
  10345. @item
  10346. In case of anamorphic video, in order to set the output display aspect
  10347. correctly, it is necessary to use @var{sar} in the expression,
  10348. according to the relation:
  10349. @example
  10350. (ih * X / ih) * sar = output_dar
  10351. X = output_dar / sar
  10352. @end example
  10353. Thus the previous example needs to be modified to:
  10354. @example
  10355. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10356. @end example
  10357. @item
  10358. Double the output size and put the input video in the bottom-right
  10359. corner of the output padded area:
  10360. @example
  10361. pad="2*iw:2*ih:ow-iw:oh-ih"
  10362. @end example
  10363. @end itemize
  10364. @anchor{palettegen}
  10365. @section palettegen
  10366. Generate one palette for a whole video stream.
  10367. It accepts the following options:
  10368. @table @option
  10369. @item max_colors
  10370. Set the maximum number of colors to quantize in the palette.
  10371. Note: the palette will still contain 256 colors; the unused palette entries
  10372. will be black.
  10373. @item reserve_transparent
  10374. Create a palette of 255 colors maximum and reserve the last one for
  10375. transparency. Reserving the transparency color is useful for GIF optimization.
  10376. If not set, the maximum of colors in the palette will be 256. You probably want
  10377. to disable this option for a standalone image.
  10378. Set by default.
  10379. @item transparency_color
  10380. Set the color that will be used as background for transparency.
  10381. @item stats_mode
  10382. Set statistics mode.
  10383. It accepts the following values:
  10384. @table @samp
  10385. @item full
  10386. Compute full frame histograms.
  10387. @item diff
  10388. Compute histograms only for the part that differs from previous frame. This
  10389. might be relevant to give more importance to the moving part of your input if
  10390. the background is static.
  10391. @item single
  10392. Compute new histogram for each frame.
  10393. @end table
  10394. Default value is @var{full}.
  10395. @end table
  10396. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10397. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10398. color quantization of the palette. This information is also visible at
  10399. @var{info} logging level.
  10400. @subsection Examples
  10401. @itemize
  10402. @item
  10403. Generate a representative palette of a given video using @command{ffmpeg}:
  10404. @example
  10405. ffmpeg -i input.mkv -vf palettegen palette.png
  10406. @end example
  10407. @end itemize
  10408. @section paletteuse
  10409. Use a palette to downsample an input video stream.
  10410. The filter takes two inputs: one video stream and a palette. The palette must
  10411. be a 256 pixels image.
  10412. It accepts the following options:
  10413. @table @option
  10414. @item dither
  10415. Select dithering mode. Available algorithms are:
  10416. @table @samp
  10417. @item bayer
  10418. Ordered 8x8 bayer dithering (deterministic)
  10419. @item heckbert
  10420. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10421. Note: this dithering is sometimes considered "wrong" and is included as a
  10422. reference.
  10423. @item floyd_steinberg
  10424. Floyd and Steingberg dithering (error diffusion)
  10425. @item sierra2
  10426. Frankie Sierra dithering v2 (error diffusion)
  10427. @item sierra2_4a
  10428. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10429. @end table
  10430. Default is @var{sierra2_4a}.
  10431. @item bayer_scale
  10432. When @var{bayer} dithering is selected, this option defines the scale of the
  10433. pattern (how much the crosshatch pattern is visible). A low value means more
  10434. visible pattern for less banding, and higher value means less visible pattern
  10435. at the cost of more banding.
  10436. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10437. @item diff_mode
  10438. If set, define the zone to process
  10439. @table @samp
  10440. @item rectangle
  10441. Only the changing rectangle will be reprocessed. This is similar to GIF
  10442. cropping/offsetting compression mechanism. This option can be useful for speed
  10443. if only a part of the image is changing, and has use cases such as limiting the
  10444. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10445. moving scene (it leads to more deterministic output if the scene doesn't change
  10446. much, and as a result less moving noise and better GIF compression).
  10447. @end table
  10448. Default is @var{none}.
  10449. @item new
  10450. Take new palette for each output frame.
  10451. @item alpha_threshold
  10452. Sets the alpha threshold for transparency. Alpha values above this threshold
  10453. will be treated as completely opaque, and values below this threshold will be
  10454. treated as completely transparent.
  10455. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10456. @end table
  10457. @subsection Examples
  10458. @itemize
  10459. @item
  10460. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10461. using @command{ffmpeg}:
  10462. @example
  10463. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10464. @end example
  10465. @end itemize
  10466. @section perspective
  10467. Correct perspective of video not recorded perpendicular to the screen.
  10468. A description of the accepted parameters follows.
  10469. @table @option
  10470. @item x0
  10471. @item y0
  10472. @item x1
  10473. @item y1
  10474. @item x2
  10475. @item y2
  10476. @item x3
  10477. @item y3
  10478. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10479. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10480. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10481. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10482. then the corners of the source will be sent to the specified coordinates.
  10483. The expressions can use the following variables:
  10484. @table @option
  10485. @item W
  10486. @item H
  10487. the width and height of video frame.
  10488. @item in
  10489. Input frame count.
  10490. @item on
  10491. Output frame count.
  10492. @end table
  10493. @item interpolation
  10494. Set interpolation for perspective correction.
  10495. It accepts the following values:
  10496. @table @samp
  10497. @item linear
  10498. @item cubic
  10499. @end table
  10500. Default value is @samp{linear}.
  10501. @item sense
  10502. Set interpretation of coordinate options.
  10503. It accepts the following values:
  10504. @table @samp
  10505. @item 0, source
  10506. Send point in the source specified by the given coordinates to
  10507. the corners of the destination.
  10508. @item 1, destination
  10509. Send the corners of the source to the point in the destination specified
  10510. by the given coordinates.
  10511. Default value is @samp{source}.
  10512. @end table
  10513. @item eval
  10514. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10515. It accepts the following values:
  10516. @table @samp
  10517. @item init
  10518. only evaluate expressions once during the filter initialization or
  10519. when a command is processed
  10520. @item frame
  10521. evaluate expressions for each incoming frame
  10522. @end table
  10523. Default value is @samp{init}.
  10524. @end table
  10525. @section phase
  10526. Delay interlaced video by one field time so that the field order changes.
  10527. The intended use is to fix PAL movies that have been captured with the
  10528. opposite field order to the film-to-video transfer.
  10529. A description of the accepted parameters follows.
  10530. @table @option
  10531. @item mode
  10532. Set phase mode.
  10533. It accepts the following values:
  10534. @table @samp
  10535. @item t
  10536. Capture field order top-first, transfer bottom-first.
  10537. Filter will delay the bottom field.
  10538. @item b
  10539. Capture field order bottom-first, transfer top-first.
  10540. Filter will delay the top field.
  10541. @item p
  10542. Capture and transfer with the same field order. This mode only exists
  10543. for the documentation of the other options to refer to, but if you
  10544. actually select it, the filter will faithfully do nothing.
  10545. @item a
  10546. Capture field order determined automatically by field flags, transfer
  10547. opposite.
  10548. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10549. basis using field flags. If no field information is available,
  10550. then this works just like @samp{u}.
  10551. @item u
  10552. Capture unknown or varying, transfer opposite.
  10553. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10554. analyzing the images and selecting the alternative that produces best
  10555. match between the fields.
  10556. @item T
  10557. Capture top-first, transfer unknown or varying.
  10558. Filter selects among @samp{t} and @samp{p} using image analysis.
  10559. @item B
  10560. Capture bottom-first, transfer unknown or varying.
  10561. Filter selects among @samp{b} and @samp{p} using image analysis.
  10562. @item A
  10563. Capture determined by field flags, transfer unknown or varying.
  10564. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10565. image analysis. If no field information is available, then this works just
  10566. like @samp{U}. This is the default mode.
  10567. @item U
  10568. Both capture and transfer unknown or varying.
  10569. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10570. @end table
  10571. @end table
  10572. @section pixdesctest
  10573. Pixel format descriptor test filter, mainly useful for internal
  10574. testing. The output video should be equal to the input video.
  10575. For example:
  10576. @example
  10577. format=monow, pixdesctest
  10578. @end example
  10579. can be used to test the monowhite pixel format descriptor definition.
  10580. @section pixscope
  10581. Display sample values of color channels. Mainly useful for checking color
  10582. and levels. Minimum supported resolution is 640x480.
  10583. The filters accept the following options:
  10584. @table @option
  10585. @item x
  10586. Set scope X position, relative offset on X axis.
  10587. @item y
  10588. Set scope Y position, relative offset on Y axis.
  10589. @item w
  10590. Set scope width.
  10591. @item h
  10592. Set scope height.
  10593. @item o
  10594. Set window opacity. This window also holds statistics about pixel area.
  10595. @item wx
  10596. Set window X position, relative offset on X axis.
  10597. @item wy
  10598. Set window Y position, relative offset on Y axis.
  10599. @end table
  10600. @section pp
  10601. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10602. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10603. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10604. Each subfilter and some options have a short and a long name that can be used
  10605. interchangeably, i.e. dr/dering are the same.
  10606. The filters accept the following options:
  10607. @table @option
  10608. @item subfilters
  10609. Set postprocessing subfilters string.
  10610. @end table
  10611. All subfilters share common options to determine their scope:
  10612. @table @option
  10613. @item a/autoq
  10614. Honor the quality commands for this subfilter.
  10615. @item c/chrom
  10616. Do chrominance filtering, too (default).
  10617. @item y/nochrom
  10618. Do luminance filtering only (no chrominance).
  10619. @item n/noluma
  10620. Do chrominance filtering only (no luminance).
  10621. @end table
  10622. These options can be appended after the subfilter name, separated by a '|'.
  10623. Available subfilters are:
  10624. @table @option
  10625. @item hb/hdeblock[|difference[|flatness]]
  10626. Horizontal deblocking filter
  10627. @table @option
  10628. @item difference
  10629. Difference factor where higher values mean more deblocking (default: @code{32}).
  10630. @item flatness
  10631. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10632. @end table
  10633. @item vb/vdeblock[|difference[|flatness]]
  10634. Vertical deblocking filter
  10635. @table @option
  10636. @item difference
  10637. Difference factor where higher values mean more deblocking (default: @code{32}).
  10638. @item flatness
  10639. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10640. @end table
  10641. @item ha/hadeblock[|difference[|flatness]]
  10642. Accurate horizontal deblocking filter
  10643. @table @option
  10644. @item difference
  10645. Difference factor where higher values mean more deblocking (default: @code{32}).
  10646. @item flatness
  10647. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10648. @end table
  10649. @item va/vadeblock[|difference[|flatness]]
  10650. Accurate vertical deblocking filter
  10651. @table @option
  10652. @item difference
  10653. Difference factor where higher values mean more deblocking (default: @code{32}).
  10654. @item flatness
  10655. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10656. @end table
  10657. @end table
  10658. The horizontal and vertical deblocking filters share the difference and
  10659. flatness values so you cannot set different horizontal and vertical
  10660. thresholds.
  10661. @table @option
  10662. @item h1/x1hdeblock
  10663. Experimental horizontal deblocking filter
  10664. @item v1/x1vdeblock
  10665. Experimental vertical deblocking filter
  10666. @item dr/dering
  10667. Deringing filter
  10668. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10669. @table @option
  10670. @item threshold1
  10671. larger -> stronger filtering
  10672. @item threshold2
  10673. larger -> stronger filtering
  10674. @item threshold3
  10675. larger -> stronger filtering
  10676. @end table
  10677. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10678. @table @option
  10679. @item f/fullyrange
  10680. Stretch luminance to @code{0-255}.
  10681. @end table
  10682. @item lb/linblenddeint
  10683. Linear blend deinterlacing filter that deinterlaces the given block by
  10684. filtering all lines with a @code{(1 2 1)} filter.
  10685. @item li/linipoldeint
  10686. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10687. linearly interpolating every second line.
  10688. @item ci/cubicipoldeint
  10689. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10690. cubically interpolating every second line.
  10691. @item md/mediandeint
  10692. Median deinterlacing filter that deinterlaces the given block by applying a
  10693. median filter to every second line.
  10694. @item fd/ffmpegdeint
  10695. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10696. second line with a @code{(-1 4 2 4 -1)} filter.
  10697. @item l5/lowpass5
  10698. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10699. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10700. @item fq/forceQuant[|quantizer]
  10701. Overrides the quantizer table from the input with the constant quantizer you
  10702. specify.
  10703. @table @option
  10704. @item quantizer
  10705. Quantizer to use
  10706. @end table
  10707. @item de/default
  10708. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10709. @item fa/fast
  10710. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10711. @item ac
  10712. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10713. @end table
  10714. @subsection Examples
  10715. @itemize
  10716. @item
  10717. Apply horizontal and vertical deblocking, deringing and automatic
  10718. brightness/contrast:
  10719. @example
  10720. pp=hb/vb/dr/al
  10721. @end example
  10722. @item
  10723. Apply default filters without brightness/contrast correction:
  10724. @example
  10725. pp=de/-al
  10726. @end example
  10727. @item
  10728. Apply default filters and temporal denoiser:
  10729. @example
  10730. pp=default/tmpnoise|1|2|3
  10731. @end example
  10732. @item
  10733. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10734. automatically depending on available CPU time:
  10735. @example
  10736. pp=hb|y/vb|a
  10737. @end example
  10738. @end itemize
  10739. @section pp7
  10740. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10741. similar to spp = 6 with 7 point DCT, where only the center sample is
  10742. used after IDCT.
  10743. The filter accepts the following options:
  10744. @table @option
  10745. @item qp
  10746. Force a constant quantization parameter. It accepts an integer in range
  10747. 0 to 63. If not set, the filter will use the QP from the video stream
  10748. (if available).
  10749. @item mode
  10750. Set thresholding mode. Available modes are:
  10751. @table @samp
  10752. @item hard
  10753. Set hard thresholding.
  10754. @item soft
  10755. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10756. @item medium
  10757. Set medium thresholding (good results, default).
  10758. @end table
  10759. @end table
  10760. @section premultiply
  10761. Apply alpha premultiply effect to input video stream using first plane
  10762. of second stream as alpha.
  10763. Both streams must have same dimensions and same pixel format.
  10764. The filter accepts the following option:
  10765. @table @option
  10766. @item planes
  10767. Set which planes will be processed, unprocessed planes will be copied.
  10768. By default value 0xf, all planes will be processed.
  10769. @item inplace
  10770. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10771. @end table
  10772. @section prewitt
  10773. Apply prewitt operator to input video stream.
  10774. The filter accepts the following option:
  10775. @table @option
  10776. @item planes
  10777. Set which planes will be processed, unprocessed planes will be copied.
  10778. By default value 0xf, all planes will be processed.
  10779. @item scale
  10780. Set value which will be multiplied with filtered result.
  10781. @item delta
  10782. Set value which will be added to filtered result.
  10783. @end table
  10784. @anchor{program_opencl}
  10785. @section program_opencl
  10786. Filter video using an OpenCL program.
  10787. @table @option
  10788. @item source
  10789. OpenCL program source file.
  10790. @item kernel
  10791. Kernel name in program.
  10792. @item inputs
  10793. Number of inputs to the filter. Defaults to 1.
  10794. @item size, s
  10795. Size of output frames. Defaults to the same as the first input.
  10796. @end table
  10797. The program source file must contain a kernel function with the given name,
  10798. which will be run once for each plane of the output. Each run on a plane
  10799. gets enqueued as a separate 2D global NDRange with one work-item for each
  10800. pixel to be generated. The global ID offset for each work-item is therefore
  10801. the coordinates of a pixel in the destination image.
  10802. The kernel function needs to take the following arguments:
  10803. @itemize
  10804. @item
  10805. Destination image, @var{__write_only image2d_t}.
  10806. This image will become the output; the kernel should write all of it.
  10807. @item
  10808. Frame index, @var{unsigned int}.
  10809. This is a counter starting from zero and increasing by one for each frame.
  10810. @item
  10811. Source images, @var{__read_only image2d_t}.
  10812. These are the most recent images on each input. The kernel may read from
  10813. them to generate the output, but they can't be written to.
  10814. @end itemize
  10815. Example programs:
  10816. @itemize
  10817. @item
  10818. Copy the input to the output (output must be the same size as the input).
  10819. @verbatim
  10820. __kernel void copy(__write_only image2d_t destination,
  10821. unsigned int index,
  10822. __read_only image2d_t source)
  10823. {
  10824. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10825. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10826. float4 value = read_imagef(source, sampler, location);
  10827. write_imagef(destination, location, value);
  10828. }
  10829. @end verbatim
  10830. @item
  10831. Apply a simple transformation, rotating the input by an amount increasing
  10832. with the index counter. Pixel values are linearly interpolated by the
  10833. sampler, and the output need not have the same dimensions as the input.
  10834. @verbatim
  10835. __kernel void rotate_image(__write_only image2d_t dst,
  10836. unsigned int index,
  10837. __read_only image2d_t src)
  10838. {
  10839. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10840. CLK_FILTER_LINEAR);
  10841. float angle = (float)index / 100.0f;
  10842. float2 dst_dim = convert_float2(get_image_dim(dst));
  10843. float2 src_dim = convert_float2(get_image_dim(src));
  10844. float2 dst_cen = dst_dim / 2.0f;
  10845. float2 src_cen = src_dim / 2.0f;
  10846. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10847. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10848. float2 src_pos = {
  10849. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10850. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10851. };
  10852. src_pos = src_pos * src_dim / dst_dim;
  10853. float2 src_loc = src_pos + src_cen;
  10854. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10855. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10856. write_imagef(dst, dst_loc, 0.5f);
  10857. else
  10858. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10859. }
  10860. @end verbatim
  10861. @item
  10862. Blend two inputs together, with the amount of each input used varying
  10863. with the index counter.
  10864. @verbatim
  10865. __kernel void blend_images(__write_only image2d_t dst,
  10866. unsigned int index,
  10867. __read_only image2d_t src1,
  10868. __read_only image2d_t src2)
  10869. {
  10870. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10871. CLK_FILTER_LINEAR);
  10872. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10873. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10874. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10875. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10876. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10877. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10878. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10879. }
  10880. @end verbatim
  10881. @end itemize
  10882. @section pseudocolor
  10883. Alter frame colors in video with pseudocolors.
  10884. This filter accept the following options:
  10885. @table @option
  10886. @item c0
  10887. set pixel first component expression
  10888. @item c1
  10889. set pixel second component expression
  10890. @item c2
  10891. set pixel third component expression
  10892. @item c3
  10893. set pixel fourth component expression, corresponds to the alpha component
  10894. @item i
  10895. set component to use as base for altering colors
  10896. @end table
  10897. Each of them specifies the expression to use for computing the lookup table for
  10898. the corresponding pixel component values.
  10899. The expressions can contain the following constants and functions:
  10900. @table @option
  10901. @item w
  10902. @item h
  10903. The input width and height.
  10904. @item val
  10905. The input value for the pixel component.
  10906. @item ymin, umin, vmin, amin
  10907. The minimum allowed component value.
  10908. @item ymax, umax, vmax, amax
  10909. The maximum allowed component value.
  10910. @end table
  10911. All expressions default to "val".
  10912. @subsection Examples
  10913. @itemize
  10914. @item
  10915. Change too high luma values to gradient:
  10916. @example
  10917. 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'"
  10918. @end example
  10919. @end itemize
  10920. @section psnr
  10921. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10922. Ratio) between two input videos.
  10923. This filter takes in input two input videos, the first input is
  10924. considered the "main" source and is passed unchanged to the
  10925. output. The second input is used as a "reference" video for computing
  10926. the PSNR.
  10927. Both video inputs must have the same resolution and pixel format for
  10928. this filter to work correctly. Also it assumes that both inputs
  10929. have the same number of frames, which are compared one by one.
  10930. The obtained average PSNR is printed through the logging system.
  10931. The filter stores the accumulated MSE (mean squared error) of each
  10932. frame, and at the end of the processing it is averaged across all frames
  10933. equally, and the following formula is applied to obtain the PSNR:
  10934. @example
  10935. PSNR = 10*log10(MAX^2/MSE)
  10936. @end example
  10937. Where MAX is the average of the maximum values of each component of the
  10938. image.
  10939. The description of the accepted parameters follows.
  10940. @table @option
  10941. @item stats_file, f
  10942. If specified the filter will use the named file to save the PSNR of
  10943. each individual frame. When filename equals "-" the data is sent to
  10944. standard output.
  10945. @item stats_version
  10946. Specifies which version of the stats file format to use. Details of
  10947. each format are written below.
  10948. Default value is 1.
  10949. @item stats_add_max
  10950. Determines whether the max value is output to the stats log.
  10951. Default value is 0.
  10952. Requires stats_version >= 2. If this is set and stats_version < 2,
  10953. the filter will return an error.
  10954. @end table
  10955. This filter also supports the @ref{framesync} options.
  10956. The file printed if @var{stats_file} is selected, contains a sequence of
  10957. key/value pairs of the form @var{key}:@var{value} for each compared
  10958. couple of frames.
  10959. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10960. the list of per-frame-pair stats, with key value pairs following the frame
  10961. format with the following parameters:
  10962. @table @option
  10963. @item psnr_log_version
  10964. The version of the log file format. Will match @var{stats_version}.
  10965. @item fields
  10966. A comma separated list of the per-frame-pair parameters included in
  10967. the log.
  10968. @end table
  10969. A description of each shown per-frame-pair parameter follows:
  10970. @table @option
  10971. @item n
  10972. sequential number of the input frame, starting from 1
  10973. @item mse_avg
  10974. Mean Square Error pixel-by-pixel average difference of the compared
  10975. frames, averaged over all the image components.
  10976. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10977. Mean Square Error pixel-by-pixel average difference of the compared
  10978. frames for the component specified by the suffix.
  10979. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10980. Peak Signal to Noise ratio of the compared frames for the component
  10981. specified by the suffix.
  10982. @item max_avg, max_y, max_u, max_v
  10983. Maximum allowed value for each channel, and average over all
  10984. channels.
  10985. @end table
  10986. For example:
  10987. @example
  10988. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10989. [main][ref] psnr="stats_file=stats.log" [out]
  10990. @end example
  10991. On this example the input file being processed is compared with the
  10992. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10993. is stored in @file{stats.log}.
  10994. @anchor{pullup}
  10995. @section pullup
  10996. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10997. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10998. content.
  10999. The pullup filter is designed to take advantage of future context in making
  11000. its decisions. This filter is stateless in the sense that it does not lock
  11001. onto a pattern to follow, but it instead looks forward to the following
  11002. fields in order to identify matches and rebuild progressive frames.
  11003. To produce content with an even framerate, insert the fps filter after
  11004. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11005. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11006. The filter accepts the following options:
  11007. @table @option
  11008. @item jl
  11009. @item jr
  11010. @item jt
  11011. @item jb
  11012. These options set the amount of "junk" to ignore at the left, right, top, and
  11013. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11014. while top and bottom are in units of 2 lines.
  11015. The default is 8 pixels on each side.
  11016. @item sb
  11017. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11018. filter generating an occasional mismatched frame, but it may also cause an
  11019. excessive number of frames to be dropped during high motion sequences.
  11020. Conversely, setting it to -1 will make filter match fields more easily.
  11021. This may help processing of video where there is slight blurring between
  11022. the fields, but may also cause there to be interlaced frames in the output.
  11023. Default value is @code{0}.
  11024. @item mp
  11025. Set the metric plane to use. It accepts the following values:
  11026. @table @samp
  11027. @item l
  11028. Use luma plane.
  11029. @item u
  11030. Use chroma blue plane.
  11031. @item v
  11032. Use chroma red plane.
  11033. @end table
  11034. This option may be set to use chroma plane instead of the default luma plane
  11035. for doing filter's computations. This may improve accuracy on very clean
  11036. source material, but more likely will decrease accuracy, especially if there
  11037. is chroma noise (rainbow effect) or any grayscale video.
  11038. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11039. load and make pullup usable in realtime on slow machines.
  11040. @end table
  11041. For best results (without duplicated frames in the output file) it is
  11042. necessary to change the output frame rate. For example, to inverse
  11043. telecine NTSC input:
  11044. @example
  11045. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11046. @end example
  11047. @section qp
  11048. Change video quantization parameters (QP).
  11049. The filter accepts the following option:
  11050. @table @option
  11051. @item qp
  11052. Set expression for quantization parameter.
  11053. @end table
  11054. The expression is evaluated through the eval API and can contain, among others,
  11055. the following constants:
  11056. @table @var
  11057. @item known
  11058. 1 if index is not 129, 0 otherwise.
  11059. @item qp
  11060. Sequential index starting from -129 to 128.
  11061. @end table
  11062. @subsection Examples
  11063. @itemize
  11064. @item
  11065. Some equation like:
  11066. @example
  11067. qp=2+2*sin(PI*qp)
  11068. @end example
  11069. @end itemize
  11070. @section random
  11071. Flush video frames from internal cache of frames into a random order.
  11072. No frame is discarded.
  11073. Inspired by @ref{frei0r} nervous filter.
  11074. @table @option
  11075. @item frames
  11076. Set size in number of frames of internal cache, in range from @code{2} to
  11077. @code{512}. Default is @code{30}.
  11078. @item seed
  11079. Set seed for random number generator, must be an integer included between
  11080. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11081. less than @code{0}, the filter will try to use a good random seed on a
  11082. best effort basis.
  11083. @end table
  11084. @section readeia608
  11085. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11086. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11087. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11088. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11089. @table @option
  11090. @item lavfi.readeia608.X.cc
  11091. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11092. @item lavfi.readeia608.X.line
  11093. The number of the line on which the EIA-608 data was identified and read.
  11094. @end table
  11095. This filter accepts the following options:
  11096. @table @option
  11097. @item scan_min
  11098. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11099. @item scan_max
  11100. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11101. @item mac
  11102. Set minimal acceptable amplitude change for sync codes detection.
  11103. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  11104. @item spw
  11105. Set the ratio of width reserved for sync code detection.
  11106. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  11107. @item mhd
  11108. Set the max peaks height difference for sync code detection.
  11109. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11110. @item mpd
  11111. Set max peaks period difference for sync code detection.
  11112. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11113. @item msd
  11114. Set the first two max start code bits differences.
  11115. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  11116. @item bhd
  11117. Set the minimum ratio of bits height compared to 3rd start code bit.
  11118. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  11119. @item th_w
  11120. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  11121. @item th_b
  11122. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  11123. @item chp
  11124. Enable checking the parity bit. In the event of a parity error, the filter will output
  11125. @code{0x00} for that character. Default is false.
  11126. @end table
  11127. @subsection Examples
  11128. @itemize
  11129. @item
  11130. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11131. @example
  11132. 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
  11133. @end example
  11134. @end itemize
  11135. @section readvitc
  11136. Read vertical interval timecode (VITC) information from the top lines of a
  11137. video frame.
  11138. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11139. timecode value, if a valid timecode has been detected. Further metadata key
  11140. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11141. timecode data has been found or not.
  11142. This filter accepts the following options:
  11143. @table @option
  11144. @item scan_max
  11145. Set the maximum number of lines to scan for VITC data. If the value is set to
  11146. @code{-1} the full video frame is scanned. Default is @code{45}.
  11147. @item thr_b
  11148. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11149. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11150. @item thr_w
  11151. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11152. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11153. @end table
  11154. @subsection Examples
  11155. @itemize
  11156. @item
  11157. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11158. draw @code{--:--:--:--} as a placeholder:
  11159. @example
  11160. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11161. @end example
  11162. @end itemize
  11163. @section remap
  11164. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11165. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11166. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11167. value for pixel will be used for destination pixel.
  11168. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11169. will have Xmap/Ymap video stream dimensions.
  11170. Xmap and Ymap input video streams are 16bit depth, single channel.
  11171. @section removegrain
  11172. The removegrain filter is a spatial denoiser for progressive video.
  11173. @table @option
  11174. @item m0
  11175. Set mode for the first plane.
  11176. @item m1
  11177. Set mode for the second plane.
  11178. @item m2
  11179. Set mode for the third plane.
  11180. @item m3
  11181. Set mode for the fourth plane.
  11182. @end table
  11183. Range of mode is from 0 to 24. Description of each mode follows:
  11184. @table @var
  11185. @item 0
  11186. Leave input plane unchanged. Default.
  11187. @item 1
  11188. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11189. @item 2
  11190. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11191. @item 3
  11192. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11193. @item 4
  11194. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11195. This is equivalent to a median filter.
  11196. @item 5
  11197. Line-sensitive clipping giving the minimal change.
  11198. @item 6
  11199. Line-sensitive clipping, intermediate.
  11200. @item 7
  11201. Line-sensitive clipping, intermediate.
  11202. @item 8
  11203. Line-sensitive clipping, intermediate.
  11204. @item 9
  11205. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11206. @item 10
  11207. Replaces the target pixel with the closest neighbour.
  11208. @item 11
  11209. [1 2 1] horizontal and vertical kernel blur.
  11210. @item 12
  11211. Same as mode 11.
  11212. @item 13
  11213. Bob mode, interpolates top field from the line where the neighbours
  11214. pixels are the closest.
  11215. @item 14
  11216. Bob mode, interpolates bottom field from the line where the neighbours
  11217. pixels are the closest.
  11218. @item 15
  11219. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11220. interpolation formula.
  11221. @item 16
  11222. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11223. interpolation formula.
  11224. @item 17
  11225. Clips the pixel with the minimum and maximum of respectively the maximum and
  11226. minimum of each pair of opposite neighbour pixels.
  11227. @item 18
  11228. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11229. the current pixel is minimal.
  11230. @item 19
  11231. Replaces the pixel with the average of its 8 neighbours.
  11232. @item 20
  11233. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11234. @item 21
  11235. Clips pixels using the averages of opposite neighbour.
  11236. @item 22
  11237. Same as mode 21 but simpler and faster.
  11238. @item 23
  11239. Small edge and halo removal, but reputed useless.
  11240. @item 24
  11241. Similar as 23.
  11242. @end table
  11243. @section removelogo
  11244. Suppress a TV station logo, using an image file to determine which
  11245. pixels comprise the logo. It works by filling in the pixels that
  11246. comprise the logo with neighboring pixels.
  11247. The filter accepts the following options:
  11248. @table @option
  11249. @item filename, f
  11250. Set the filter bitmap file, which can be any image format supported by
  11251. libavformat. The width and height of the image file must match those of the
  11252. video stream being processed.
  11253. @end table
  11254. Pixels in the provided bitmap image with a value of zero are not
  11255. considered part of the logo, non-zero pixels are considered part of
  11256. the logo. If you use white (255) for the logo and black (0) for the
  11257. rest, you will be safe. For making the filter bitmap, it is
  11258. recommended to take a screen capture of a black frame with the logo
  11259. visible, and then using a threshold filter followed by the erode
  11260. filter once or twice.
  11261. If needed, little splotches can be fixed manually. Remember that if
  11262. logo pixels are not covered, the filter quality will be much
  11263. reduced. Marking too many pixels as part of the logo does not hurt as
  11264. much, but it will increase the amount of blurring needed to cover over
  11265. the image and will destroy more information than necessary, and extra
  11266. pixels will slow things down on a large logo.
  11267. @section repeatfields
  11268. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11269. fields based on its value.
  11270. @section reverse
  11271. Reverse a video clip.
  11272. Warning: This filter requires memory to buffer the entire clip, so trimming
  11273. is suggested.
  11274. @subsection Examples
  11275. @itemize
  11276. @item
  11277. Take the first 5 seconds of a clip, and reverse it.
  11278. @example
  11279. trim=end=5,reverse
  11280. @end example
  11281. @end itemize
  11282. @section rgbashift
  11283. Shift R/G/B/A pixels horizontally and/or vertically.
  11284. The filter accepts the following options:
  11285. @table @option
  11286. @item rh
  11287. Set amount to shift red horizontally.
  11288. @item rv
  11289. Set amount to shift red vertically.
  11290. @item gh
  11291. Set amount to shift green horizontally.
  11292. @item gv
  11293. Set amount to shift green vertically.
  11294. @item bh
  11295. Set amount to shift blue horizontally.
  11296. @item bv
  11297. Set amount to shift blue vertically.
  11298. @item ah
  11299. Set amount to shift alpha horizontally.
  11300. @item av
  11301. Set amount to shift alpha vertically.
  11302. @item edge
  11303. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11304. @end table
  11305. @section roberts
  11306. Apply roberts cross operator to input video stream.
  11307. The filter accepts the following option:
  11308. @table @option
  11309. @item planes
  11310. Set which planes will be processed, unprocessed planes will be copied.
  11311. By default value 0xf, all planes will be processed.
  11312. @item scale
  11313. Set value which will be multiplied with filtered result.
  11314. @item delta
  11315. Set value which will be added to filtered result.
  11316. @end table
  11317. @section rotate
  11318. Rotate video by an arbitrary angle expressed in radians.
  11319. The filter accepts the following options:
  11320. A description of the optional parameters follows.
  11321. @table @option
  11322. @item angle, a
  11323. Set an expression for the angle by which to rotate the input video
  11324. clockwise, expressed as a number of radians. A negative value will
  11325. result in a counter-clockwise rotation. By default it is set to "0".
  11326. This expression is evaluated for each frame.
  11327. @item out_w, ow
  11328. Set the output width expression, default value is "iw".
  11329. This expression is evaluated just once during configuration.
  11330. @item out_h, oh
  11331. Set the output height expression, default value is "ih".
  11332. This expression is evaluated just once during configuration.
  11333. @item bilinear
  11334. Enable bilinear interpolation if set to 1, a value of 0 disables
  11335. it. Default value is 1.
  11336. @item fillcolor, c
  11337. Set the color used to fill the output area not covered by the rotated
  11338. image. For the general syntax of this option, check the
  11339. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11340. If the special value "none" is selected then no
  11341. background is printed (useful for example if the background is never shown).
  11342. Default value is "black".
  11343. @end table
  11344. The expressions for the angle and the output size can contain the
  11345. following constants and functions:
  11346. @table @option
  11347. @item n
  11348. sequential number of the input frame, starting from 0. It is always NAN
  11349. before the first frame is filtered.
  11350. @item t
  11351. time in seconds of the input frame, it is set to 0 when the filter is
  11352. configured. It is always NAN before the first frame is filtered.
  11353. @item hsub
  11354. @item vsub
  11355. horizontal and vertical chroma subsample values. For example for the
  11356. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11357. @item in_w, iw
  11358. @item in_h, ih
  11359. the input video width and height
  11360. @item out_w, ow
  11361. @item out_h, oh
  11362. the output width and height, that is the size of the padded area as
  11363. specified by the @var{width} and @var{height} expressions
  11364. @item rotw(a)
  11365. @item roth(a)
  11366. the minimal width/height required for completely containing the input
  11367. video rotated by @var{a} radians.
  11368. These are only available when computing the @option{out_w} and
  11369. @option{out_h} expressions.
  11370. @end table
  11371. @subsection Examples
  11372. @itemize
  11373. @item
  11374. Rotate the input by PI/6 radians clockwise:
  11375. @example
  11376. rotate=PI/6
  11377. @end example
  11378. @item
  11379. Rotate the input by PI/6 radians counter-clockwise:
  11380. @example
  11381. rotate=-PI/6
  11382. @end example
  11383. @item
  11384. Rotate the input by 45 degrees clockwise:
  11385. @example
  11386. rotate=45*PI/180
  11387. @end example
  11388. @item
  11389. Apply a constant rotation with period T, starting from an angle of PI/3:
  11390. @example
  11391. rotate=PI/3+2*PI*t/T
  11392. @end example
  11393. @item
  11394. Make the input video rotation oscillating with a period of T
  11395. seconds and an amplitude of A radians:
  11396. @example
  11397. rotate=A*sin(2*PI/T*t)
  11398. @end example
  11399. @item
  11400. Rotate the video, output size is chosen so that the whole rotating
  11401. input video is always completely contained in the output:
  11402. @example
  11403. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11404. @end example
  11405. @item
  11406. Rotate the video, reduce the output size so that no background is ever
  11407. shown:
  11408. @example
  11409. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11410. @end example
  11411. @end itemize
  11412. @subsection Commands
  11413. The filter supports the following commands:
  11414. @table @option
  11415. @item a, angle
  11416. Set the angle expression.
  11417. The command accepts the same syntax of the corresponding option.
  11418. If the specified expression is not valid, it is kept at its current
  11419. value.
  11420. @end table
  11421. @section sab
  11422. Apply Shape Adaptive Blur.
  11423. The filter accepts the following options:
  11424. @table @option
  11425. @item luma_radius, lr
  11426. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11427. value is 1.0. A greater value will result in a more blurred image, and
  11428. in slower processing.
  11429. @item luma_pre_filter_radius, lpfr
  11430. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11431. value is 1.0.
  11432. @item luma_strength, ls
  11433. Set luma maximum difference between pixels to still be considered, must
  11434. be a value in the 0.1-100.0 range, default value is 1.0.
  11435. @item chroma_radius, cr
  11436. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11437. greater value will result in a more blurred image, and in slower
  11438. processing.
  11439. @item chroma_pre_filter_radius, cpfr
  11440. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11441. @item chroma_strength, cs
  11442. Set chroma maximum difference between pixels to still be considered,
  11443. must be a value in the -0.9-100.0 range.
  11444. @end table
  11445. Each chroma option value, if not explicitly specified, is set to the
  11446. corresponding luma option value.
  11447. @anchor{scale}
  11448. @section scale
  11449. Scale (resize) the input video, using the libswscale library.
  11450. The scale filter forces the output display aspect ratio to be the same
  11451. of the input, by changing the output sample aspect ratio.
  11452. If the input image format is different from the format requested by
  11453. the next filter, the scale filter will convert the input to the
  11454. requested format.
  11455. @subsection Options
  11456. The filter accepts the following options, or any of the options
  11457. supported by the libswscale scaler.
  11458. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11459. the complete list of scaler options.
  11460. @table @option
  11461. @item width, w
  11462. @item height, h
  11463. Set the output video dimension expression. Default value is the input
  11464. dimension.
  11465. If the @var{width} or @var{w} value is 0, the input width is used for
  11466. the output. If the @var{height} or @var{h} value is 0, the input height
  11467. is used for the output.
  11468. If one and only one of the values is -n with n >= 1, the scale filter
  11469. will use a value that maintains the aspect ratio of the input image,
  11470. calculated from the other specified dimension. After that it will,
  11471. however, make sure that the calculated dimension is divisible by n and
  11472. adjust the value if necessary.
  11473. If both values are -n with n >= 1, the behavior will be identical to
  11474. both values being set to 0 as previously detailed.
  11475. See below for the list of accepted constants for use in the dimension
  11476. expression.
  11477. @item eval
  11478. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11479. @table @samp
  11480. @item init
  11481. Only evaluate expressions once during the filter initialization or when a command is processed.
  11482. @item frame
  11483. Evaluate expressions for each incoming frame.
  11484. @end table
  11485. Default value is @samp{init}.
  11486. @item interl
  11487. Set the interlacing mode. It accepts the following values:
  11488. @table @samp
  11489. @item 1
  11490. Force interlaced aware scaling.
  11491. @item 0
  11492. Do not apply interlaced scaling.
  11493. @item -1
  11494. Select interlaced aware scaling depending on whether the source frames
  11495. are flagged as interlaced or not.
  11496. @end table
  11497. Default value is @samp{0}.
  11498. @item flags
  11499. Set libswscale scaling flags. See
  11500. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11501. complete list of values. If not explicitly specified the filter applies
  11502. the default flags.
  11503. @item param0, param1
  11504. Set libswscale input parameters for scaling algorithms that need them. See
  11505. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11506. complete documentation. If not explicitly specified the filter applies
  11507. empty parameters.
  11508. @item size, s
  11509. Set the video size. For the syntax of this option, check the
  11510. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11511. @item in_color_matrix
  11512. @item out_color_matrix
  11513. Set in/output YCbCr color space type.
  11514. This allows the autodetected value to be overridden as well as allows forcing
  11515. a specific value used for the output and encoder.
  11516. If not specified, the color space type depends on the pixel format.
  11517. Possible values:
  11518. @table @samp
  11519. @item auto
  11520. Choose automatically.
  11521. @item bt709
  11522. Format conforming to International Telecommunication Union (ITU)
  11523. Recommendation BT.709.
  11524. @item fcc
  11525. Set color space conforming to the United States Federal Communications
  11526. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11527. @item bt601
  11528. Set color space conforming to:
  11529. @itemize
  11530. @item
  11531. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11532. @item
  11533. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11534. @item
  11535. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11536. @end itemize
  11537. @item smpte240m
  11538. Set color space conforming to SMPTE ST 240:1999.
  11539. @end table
  11540. @item in_range
  11541. @item out_range
  11542. Set in/output YCbCr sample range.
  11543. This allows the autodetected value to be overridden as well as allows forcing
  11544. a specific value used for the output and encoder. If not specified, the
  11545. range depends on the pixel format. Possible values:
  11546. @table @samp
  11547. @item auto/unknown
  11548. Choose automatically.
  11549. @item jpeg/full/pc
  11550. Set full range (0-255 in case of 8-bit luma).
  11551. @item mpeg/limited/tv
  11552. Set "MPEG" range (16-235 in case of 8-bit luma).
  11553. @end table
  11554. @item force_original_aspect_ratio
  11555. Enable decreasing or increasing output video width or height if necessary to
  11556. keep the original aspect ratio. Possible values:
  11557. @table @samp
  11558. @item disable
  11559. Scale the video as specified and disable this feature.
  11560. @item decrease
  11561. The output video dimensions will automatically be decreased if needed.
  11562. @item increase
  11563. The output video dimensions will automatically be increased if needed.
  11564. @end table
  11565. One useful instance of this option is that when you know a specific device's
  11566. maximum allowed resolution, you can use this to limit the output video to
  11567. that, while retaining the aspect ratio. For example, device A allows
  11568. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11569. decrease) and specifying 1280x720 to the command line makes the output
  11570. 1280x533.
  11571. Please note that this is a different thing than specifying -1 for @option{w}
  11572. or @option{h}, you still need to specify the output resolution for this option
  11573. to work.
  11574. @end table
  11575. The values of the @option{w} and @option{h} options are expressions
  11576. containing the following constants:
  11577. @table @var
  11578. @item in_w
  11579. @item in_h
  11580. The input width and height
  11581. @item iw
  11582. @item ih
  11583. These are the same as @var{in_w} and @var{in_h}.
  11584. @item out_w
  11585. @item out_h
  11586. The output (scaled) width and height
  11587. @item ow
  11588. @item oh
  11589. These are the same as @var{out_w} and @var{out_h}
  11590. @item a
  11591. The same as @var{iw} / @var{ih}
  11592. @item sar
  11593. input sample aspect ratio
  11594. @item dar
  11595. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11596. @item hsub
  11597. @item vsub
  11598. horizontal and vertical input chroma subsample values. For example for the
  11599. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11600. @item ohsub
  11601. @item ovsub
  11602. horizontal and vertical output chroma subsample values. For example for the
  11603. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11604. @end table
  11605. @subsection Examples
  11606. @itemize
  11607. @item
  11608. Scale the input video to a size of 200x100
  11609. @example
  11610. scale=w=200:h=100
  11611. @end example
  11612. This is equivalent to:
  11613. @example
  11614. scale=200:100
  11615. @end example
  11616. or:
  11617. @example
  11618. scale=200x100
  11619. @end example
  11620. @item
  11621. Specify a size abbreviation for the output size:
  11622. @example
  11623. scale=qcif
  11624. @end example
  11625. which can also be written as:
  11626. @example
  11627. scale=size=qcif
  11628. @end example
  11629. @item
  11630. Scale the input to 2x:
  11631. @example
  11632. scale=w=2*iw:h=2*ih
  11633. @end example
  11634. @item
  11635. The above is the same as:
  11636. @example
  11637. scale=2*in_w:2*in_h
  11638. @end example
  11639. @item
  11640. Scale the input to 2x with forced interlaced scaling:
  11641. @example
  11642. scale=2*iw:2*ih:interl=1
  11643. @end example
  11644. @item
  11645. Scale the input to half size:
  11646. @example
  11647. scale=w=iw/2:h=ih/2
  11648. @end example
  11649. @item
  11650. Increase the width, and set the height to the same size:
  11651. @example
  11652. scale=3/2*iw:ow
  11653. @end example
  11654. @item
  11655. Seek Greek harmony:
  11656. @example
  11657. scale=iw:1/PHI*iw
  11658. scale=ih*PHI:ih
  11659. @end example
  11660. @item
  11661. Increase the height, and set the width to 3/2 of the height:
  11662. @example
  11663. scale=w=3/2*oh:h=3/5*ih
  11664. @end example
  11665. @item
  11666. Increase the size, making the size a multiple of the chroma
  11667. subsample values:
  11668. @example
  11669. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11670. @end example
  11671. @item
  11672. Increase the width to a maximum of 500 pixels,
  11673. keeping the same aspect ratio as the input:
  11674. @example
  11675. scale=w='min(500\, iw*3/2):h=-1'
  11676. @end example
  11677. @item
  11678. Make pixels square by combining scale and setsar:
  11679. @example
  11680. scale='trunc(ih*dar):ih',setsar=1/1
  11681. @end example
  11682. @item
  11683. Make pixels square by combining scale and setsar,
  11684. making sure the resulting resolution is even (required by some codecs):
  11685. @example
  11686. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11687. @end example
  11688. @end itemize
  11689. @subsection Commands
  11690. This filter supports the following commands:
  11691. @table @option
  11692. @item width, w
  11693. @item height, h
  11694. Set the output video dimension expression.
  11695. The command accepts the same syntax of the corresponding option.
  11696. If the specified expression is not valid, it is kept at its current
  11697. value.
  11698. @end table
  11699. @section scale_npp
  11700. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11701. format conversion on CUDA video frames. Setting the output width and height
  11702. works in the same way as for the @var{scale} filter.
  11703. The following additional options are accepted:
  11704. @table @option
  11705. @item format
  11706. The pixel format of the output CUDA frames. If set to the string "same" (the
  11707. default), the input format will be kept. Note that automatic format negotiation
  11708. and conversion is not yet supported for hardware frames
  11709. @item interp_algo
  11710. The interpolation algorithm used for resizing. One of the following:
  11711. @table @option
  11712. @item nn
  11713. Nearest neighbour.
  11714. @item linear
  11715. @item cubic
  11716. @item cubic2p_bspline
  11717. 2-parameter cubic (B=1, C=0)
  11718. @item cubic2p_catmullrom
  11719. 2-parameter cubic (B=0, C=1/2)
  11720. @item cubic2p_b05c03
  11721. 2-parameter cubic (B=1/2, C=3/10)
  11722. @item super
  11723. Supersampling
  11724. @item lanczos
  11725. @end table
  11726. @end table
  11727. @section scale2ref
  11728. Scale (resize) the input video, based on a reference video.
  11729. See the scale filter for available options, scale2ref supports the same but
  11730. uses the reference video instead of the main input as basis. scale2ref also
  11731. supports the following additional constants for the @option{w} and
  11732. @option{h} options:
  11733. @table @var
  11734. @item main_w
  11735. @item main_h
  11736. The main input video's width and height
  11737. @item main_a
  11738. The same as @var{main_w} / @var{main_h}
  11739. @item main_sar
  11740. The main input video's sample aspect ratio
  11741. @item main_dar, mdar
  11742. The main input video's display aspect ratio. Calculated from
  11743. @code{(main_w / main_h) * main_sar}.
  11744. @item main_hsub
  11745. @item main_vsub
  11746. The main input video's horizontal and vertical chroma subsample values.
  11747. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11748. is 1.
  11749. @end table
  11750. @subsection Examples
  11751. @itemize
  11752. @item
  11753. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11754. @example
  11755. 'scale2ref[b][a];[a][b]overlay'
  11756. @end example
  11757. @item
  11758. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  11759. @example
  11760. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  11761. @end example
  11762. @end itemize
  11763. @anchor{selectivecolor}
  11764. @section selectivecolor
  11765. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11766. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11767. by the "purity" of the color (that is, how saturated it already is).
  11768. This filter is similar to the Adobe Photoshop Selective Color tool.
  11769. The filter accepts the following options:
  11770. @table @option
  11771. @item correction_method
  11772. Select color correction method.
  11773. Available values are:
  11774. @table @samp
  11775. @item absolute
  11776. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11777. component value).
  11778. @item relative
  11779. Specified adjustments are relative to the original component value.
  11780. @end table
  11781. Default is @code{absolute}.
  11782. @item reds
  11783. Adjustments for red pixels (pixels where the red component is the maximum)
  11784. @item yellows
  11785. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11786. @item greens
  11787. Adjustments for green pixels (pixels where the green component is the maximum)
  11788. @item cyans
  11789. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11790. @item blues
  11791. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11792. @item magentas
  11793. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11794. @item whites
  11795. Adjustments for white pixels (pixels where all components are greater than 128)
  11796. @item neutrals
  11797. Adjustments for all pixels except pure black and pure white
  11798. @item blacks
  11799. Adjustments for black pixels (pixels where all components are lesser than 128)
  11800. @item psfile
  11801. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11802. @end table
  11803. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11804. 4 space separated floating point adjustment values in the [-1,1] range,
  11805. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11806. pixels of its range.
  11807. @subsection Examples
  11808. @itemize
  11809. @item
  11810. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11811. increase magenta by 27% in blue areas:
  11812. @example
  11813. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11814. @end example
  11815. @item
  11816. Use a Photoshop selective color preset:
  11817. @example
  11818. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11819. @end example
  11820. @end itemize
  11821. @anchor{separatefields}
  11822. @section separatefields
  11823. The @code{separatefields} takes a frame-based video input and splits
  11824. each frame into its components fields, producing a new half height clip
  11825. with twice the frame rate and twice the frame count.
  11826. This filter use field-dominance information in frame to decide which
  11827. of each pair of fields to place first in the output.
  11828. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11829. @section setdar, setsar
  11830. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11831. output video.
  11832. This is done by changing the specified Sample (aka Pixel) Aspect
  11833. Ratio, according to the following equation:
  11834. @example
  11835. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11836. @end example
  11837. Keep in mind that the @code{setdar} filter does not modify the pixel
  11838. dimensions of the video frame. Also, the display aspect ratio set by
  11839. this filter may be changed by later filters in the filterchain,
  11840. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11841. applied.
  11842. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11843. the filter output video.
  11844. Note that as a consequence of the application of this filter, the
  11845. output display aspect ratio will change according to the equation
  11846. above.
  11847. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11848. filter may be changed by later filters in the filterchain, e.g. if
  11849. another "setsar" or a "setdar" filter is applied.
  11850. It accepts the following parameters:
  11851. @table @option
  11852. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11853. Set the aspect ratio used by the filter.
  11854. The parameter can be a floating point number string, an expression, or
  11855. a string of the form @var{num}:@var{den}, where @var{num} and
  11856. @var{den} are the numerator and denominator of the aspect ratio. If
  11857. the parameter is not specified, it is assumed the value "0".
  11858. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11859. should be escaped.
  11860. @item max
  11861. Set the maximum integer value to use for expressing numerator and
  11862. denominator when reducing the expressed aspect ratio to a rational.
  11863. Default value is @code{100}.
  11864. @end table
  11865. The parameter @var{sar} is an expression containing
  11866. the following constants:
  11867. @table @option
  11868. @item E, PI, PHI
  11869. These are approximated values for the mathematical constants e
  11870. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11871. @item w, h
  11872. The input width and height.
  11873. @item a
  11874. These are the same as @var{w} / @var{h}.
  11875. @item sar
  11876. The input sample aspect ratio.
  11877. @item dar
  11878. The input display aspect ratio. It is the same as
  11879. (@var{w} / @var{h}) * @var{sar}.
  11880. @item hsub, vsub
  11881. Horizontal and vertical chroma subsample values. For example, for the
  11882. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11883. @end table
  11884. @subsection Examples
  11885. @itemize
  11886. @item
  11887. To change the display aspect ratio to 16:9, specify one of the following:
  11888. @example
  11889. setdar=dar=1.77777
  11890. setdar=dar=16/9
  11891. @end example
  11892. @item
  11893. To change the sample aspect ratio to 10:11, specify:
  11894. @example
  11895. setsar=sar=10/11
  11896. @end example
  11897. @item
  11898. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11899. 1000 in the aspect ratio reduction, use the command:
  11900. @example
  11901. setdar=ratio=16/9:max=1000
  11902. @end example
  11903. @end itemize
  11904. @anchor{setfield}
  11905. @section setfield
  11906. Force field for the output video frame.
  11907. The @code{setfield} filter marks the interlace type field for the
  11908. output frames. It does not change the input frame, but only sets the
  11909. corresponding property, which affects how the frame is treated by
  11910. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11911. The filter accepts the following options:
  11912. @table @option
  11913. @item mode
  11914. Available values are:
  11915. @table @samp
  11916. @item auto
  11917. Keep the same field property.
  11918. @item bff
  11919. Mark the frame as bottom-field-first.
  11920. @item tff
  11921. Mark the frame as top-field-first.
  11922. @item prog
  11923. Mark the frame as progressive.
  11924. @end table
  11925. @end table
  11926. @anchor{setparams}
  11927. @section setparams
  11928. Force frame parameter for the output video frame.
  11929. The @code{setparams} filter marks interlace and color range for the
  11930. output frames. It does not change the input frame, but only sets the
  11931. corresponding property, which affects how the frame is treated by
  11932. filters/encoders.
  11933. @table @option
  11934. @item field_mode
  11935. Available values are:
  11936. @table @samp
  11937. @item auto
  11938. Keep the same field property (default).
  11939. @item bff
  11940. Mark the frame as bottom-field-first.
  11941. @item tff
  11942. Mark the frame as top-field-first.
  11943. @item prog
  11944. Mark the frame as progressive.
  11945. @end table
  11946. @item range
  11947. Available values are:
  11948. @table @samp
  11949. @item auto
  11950. Keep the same color range property (default).
  11951. @item unspecified, unknown
  11952. Mark the frame as unspecified color range.
  11953. @item limited, tv, mpeg
  11954. Mark the frame as limited range.
  11955. @item full, pc, jpeg
  11956. Mark the frame as full range.
  11957. @end table
  11958. @item color_primaries
  11959. Set the color primaries.
  11960. Available values are:
  11961. @table @samp
  11962. @item auto
  11963. Keep the same color primaries property (default).
  11964. @item bt709
  11965. @item unknown
  11966. @item bt470m
  11967. @item bt470bg
  11968. @item smpte170m
  11969. @item smpte240m
  11970. @item film
  11971. @item bt2020
  11972. @item smpte428
  11973. @item smpte431
  11974. @item smpte432
  11975. @item jedec-p22
  11976. @end table
  11977. @item color_trc
  11978. Set the color transfer.
  11979. Available values are:
  11980. @table @samp
  11981. @item auto
  11982. Keep the same color trc property (default).
  11983. @item bt709
  11984. @item unknown
  11985. @item bt470m
  11986. @item bt470bg
  11987. @item smpte170m
  11988. @item smpte240m
  11989. @item linear
  11990. @item log100
  11991. @item log316
  11992. @item iec61966-2-4
  11993. @item bt1361e
  11994. @item iec61966-2-1
  11995. @item bt2020-10
  11996. @item bt2020-12
  11997. @item smpte2084
  11998. @item smpte428
  11999. @item arib-std-b67
  12000. @end table
  12001. @item colorspace
  12002. Set the colorspace.
  12003. Available values are:
  12004. @table @samp
  12005. @item auto
  12006. Keep the same colorspace property (default).
  12007. @item gbr
  12008. @item bt709
  12009. @item unknown
  12010. @item fcc
  12011. @item bt470bg
  12012. @item smpte170m
  12013. @item smpte240m
  12014. @item ycgco
  12015. @item bt2020nc
  12016. @item bt2020c
  12017. @item smpte2085
  12018. @item chroma-derived-nc
  12019. @item chroma-derived-c
  12020. @item ictcp
  12021. @end table
  12022. @end table
  12023. @section showinfo
  12024. Show a line containing various information for each input video frame.
  12025. The input video is not modified.
  12026. This filter supports the following options:
  12027. @table @option
  12028. @item checksum
  12029. Calculate checksums of each plane. By default enabled.
  12030. @end table
  12031. The shown line contains a sequence of key/value pairs of the form
  12032. @var{key}:@var{value}.
  12033. The following values are shown in the output:
  12034. @table @option
  12035. @item n
  12036. The (sequential) number of the input frame, starting from 0.
  12037. @item pts
  12038. The Presentation TimeStamp of the input frame, expressed as a number of
  12039. time base units. The time base unit depends on the filter input pad.
  12040. @item pts_time
  12041. The Presentation TimeStamp of the input frame, expressed as a number of
  12042. seconds.
  12043. @item pos
  12044. The position of the frame in the input stream, or -1 if this information is
  12045. unavailable and/or meaningless (for example in case of synthetic video).
  12046. @item fmt
  12047. The pixel format name.
  12048. @item sar
  12049. The sample aspect ratio of the input frame, expressed in the form
  12050. @var{num}/@var{den}.
  12051. @item s
  12052. The size of the input frame. For the syntax of this option, check the
  12053. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12054. @item i
  12055. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12056. for bottom field first).
  12057. @item iskey
  12058. This is 1 if the frame is a key frame, 0 otherwise.
  12059. @item type
  12060. The picture type of the input frame ("I" for an I-frame, "P" for a
  12061. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12062. Also refer to the documentation of the @code{AVPictureType} enum and of
  12063. the @code{av_get_picture_type_char} function defined in
  12064. @file{libavutil/avutil.h}.
  12065. @item checksum
  12066. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12067. @item plane_checksum
  12068. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12069. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12070. @end table
  12071. @section showpalette
  12072. Displays the 256 colors palette of each frame. This filter is only relevant for
  12073. @var{pal8} pixel format frames.
  12074. It accepts the following option:
  12075. @table @option
  12076. @item s
  12077. Set the size of the box used to represent one palette color entry. Default is
  12078. @code{30} (for a @code{30x30} pixel box).
  12079. @end table
  12080. @section shuffleframes
  12081. Reorder and/or duplicate and/or drop video frames.
  12082. It accepts the following parameters:
  12083. @table @option
  12084. @item mapping
  12085. Set the destination indexes of input frames.
  12086. This is space or '|' separated list of indexes that maps input frames to output
  12087. frames. Number of indexes also sets maximal value that each index may have.
  12088. '-1' index have special meaning and that is to drop frame.
  12089. @end table
  12090. The first frame has the index 0. The default is to keep the input unchanged.
  12091. @subsection Examples
  12092. @itemize
  12093. @item
  12094. Swap second and third frame of every three frames of the input:
  12095. @example
  12096. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12097. @end example
  12098. @item
  12099. Swap 10th and 1st frame of every ten frames of the input:
  12100. @example
  12101. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12102. @end example
  12103. @end itemize
  12104. @section shuffleplanes
  12105. Reorder and/or duplicate video planes.
  12106. It accepts the following parameters:
  12107. @table @option
  12108. @item map0
  12109. The index of the input plane to be used as the first output plane.
  12110. @item map1
  12111. The index of the input plane to be used as the second output plane.
  12112. @item map2
  12113. The index of the input plane to be used as the third output plane.
  12114. @item map3
  12115. The index of the input plane to be used as the fourth output plane.
  12116. @end table
  12117. The first plane has the index 0. The default is to keep the input unchanged.
  12118. @subsection Examples
  12119. @itemize
  12120. @item
  12121. Swap the second and third planes of the input:
  12122. @example
  12123. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12124. @end example
  12125. @end itemize
  12126. @anchor{signalstats}
  12127. @section signalstats
  12128. Evaluate various visual metrics that assist in determining issues associated
  12129. with the digitization of analog video media.
  12130. By default the filter will log these metadata values:
  12131. @table @option
  12132. @item YMIN
  12133. Display the minimal Y value contained within the input frame. Expressed in
  12134. range of [0-255].
  12135. @item YLOW
  12136. Display the Y value at the 10% percentile within the input frame. Expressed in
  12137. range of [0-255].
  12138. @item YAVG
  12139. Display the average Y value within the input frame. Expressed in range of
  12140. [0-255].
  12141. @item YHIGH
  12142. Display the Y value at the 90% percentile within the input frame. Expressed in
  12143. range of [0-255].
  12144. @item YMAX
  12145. Display the maximum Y value contained within the input frame. Expressed in
  12146. range of [0-255].
  12147. @item UMIN
  12148. Display the minimal U value contained within the input frame. Expressed in
  12149. range of [0-255].
  12150. @item ULOW
  12151. Display the U value at the 10% percentile within the input frame. Expressed in
  12152. range of [0-255].
  12153. @item UAVG
  12154. Display the average U value within the input frame. Expressed in range of
  12155. [0-255].
  12156. @item UHIGH
  12157. Display the U value at the 90% percentile within the input frame. Expressed in
  12158. range of [0-255].
  12159. @item UMAX
  12160. Display the maximum U value contained within the input frame. Expressed in
  12161. range of [0-255].
  12162. @item VMIN
  12163. Display the minimal V value contained within the input frame. Expressed in
  12164. range of [0-255].
  12165. @item VLOW
  12166. Display the V value at the 10% percentile within the input frame. Expressed in
  12167. range of [0-255].
  12168. @item VAVG
  12169. Display the average V value within the input frame. Expressed in range of
  12170. [0-255].
  12171. @item VHIGH
  12172. Display the V value at the 90% percentile within the input frame. Expressed in
  12173. range of [0-255].
  12174. @item VMAX
  12175. Display the maximum V value contained within the input frame. Expressed in
  12176. range of [0-255].
  12177. @item SATMIN
  12178. Display the minimal saturation value contained within the input frame.
  12179. Expressed in range of [0-~181.02].
  12180. @item SATLOW
  12181. Display the saturation value at the 10% percentile within the input frame.
  12182. Expressed in range of [0-~181.02].
  12183. @item SATAVG
  12184. Display the average saturation value within the input frame. Expressed in range
  12185. of [0-~181.02].
  12186. @item SATHIGH
  12187. Display the saturation value at the 90% percentile within the input frame.
  12188. Expressed in range of [0-~181.02].
  12189. @item SATMAX
  12190. Display the maximum saturation value contained within the input frame.
  12191. Expressed in range of [0-~181.02].
  12192. @item HUEMED
  12193. Display the median value for hue within the input frame. Expressed in range of
  12194. [0-360].
  12195. @item HUEAVG
  12196. Display the average value for hue within the input frame. Expressed in range of
  12197. [0-360].
  12198. @item YDIF
  12199. Display the average of sample value difference between all values of the Y
  12200. plane in the current frame and corresponding values of the previous input frame.
  12201. Expressed in range of [0-255].
  12202. @item UDIF
  12203. Display the average of sample value difference between all values of the U
  12204. plane in the current frame and corresponding values of the previous input frame.
  12205. Expressed in range of [0-255].
  12206. @item VDIF
  12207. Display the average of sample value difference between all values of the V
  12208. plane in the current frame and corresponding values of the previous input frame.
  12209. Expressed in range of [0-255].
  12210. @item YBITDEPTH
  12211. Display bit depth of Y plane in current frame.
  12212. Expressed in range of [0-16].
  12213. @item UBITDEPTH
  12214. Display bit depth of U plane in current frame.
  12215. Expressed in range of [0-16].
  12216. @item VBITDEPTH
  12217. Display bit depth of V plane in current frame.
  12218. Expressed in range of [0-16].
  12219. @end table
  12220. The filter accepts the following options:
  12221. @table @option
  12222. @item stat
  12223. @item out
  12224. @option{stat} specify an additional form of image analysis.
  12225. @option{out} output video with the specified type of pixel highlighted.
  12226. Both options accept the following values:
  12227. @table @samp
  12228. @item tout
  12229. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12230. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12231. include the results of video dropouts, head clogs, or tape tracking issues.
  12232. @item vrep
  12233. Identify @var{vertical line repetition}. Vertical line repetition includes
  12234. similar rows of pixels within a frame. In born-digital video vertical line
  12235. repetition is common, but this pattern is uncommon in video digitized from an
  12236. analog source. When it occurs in video that results from the digitization of an
  12237. analog source it can indicate concealment from a dropout compensator.
  12238. @item brng
  12239. Identify pixels that fall outside of legal broadcast range.
  12240. @end table
  12241. @item color, c
  12242. Set the highlight color for the @option{out} option. The default color is
  12243. yellow.
  12244. @end table
  12245. @subsection Examples
  12246. @itemize
  12247. @item
  12248. Output data of various video metrics:
  12249. @example
  12250. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12251. @end example
  12252. @item
  12253. Output specific data about the minimum and maximum values of the Y plane per frame:
  12254. @example
  12255. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12256. @end example
  12257. @item
  12258. Playback video while highlighting pixels that are outside of broadcast range in red.
  12259. @example
  12260. ffplay example.mov -vf signalstats="out=brng:color=red"
  12261. @end example
  12262. @item
  12263. Playback video with signalstats metadata drawn over the frame.
  12264. @example
  12265. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12266. @end example
  12267. The contents of signalstat_drawtext.txt used in the command are:
  12268. @example
  12269. time %@{pts:hms@}
  12270. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12271. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12272. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12273. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12274. @end example
  12275. @end itemize
  12276. @anchor{signature}
  12277. @section signature
  12278. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12279. input. In this case the matching between the inputs can be calculated additionally.
  12280. The filter always passes through the first input. The signature of each stream can
  12281. be written into a file.
  12282. It accepts the following options:
  12283. @table @option
  12284. @item detectmode
  12285. Enable or disable the matching process.
  12286. Available values are:
  12287. @table @samp
  12288. @item off
  12289. Disable the calculation of a matching (default).
  12290. @item full
  12291. Calculate the matching for the whole video and output whether the whole video
  12292. matches or only parts.
  12293. @item fast
  12294. Calculate only until a matching is found or the video ends. Should be faster in
  12295. some cases.
  12296. @end table
  12297. @item nb_inputs
  12298. Set the number of inputs. The option value must be a non negative integer.
  12299. Default value is 1.
  12300. @item filename
  12301. Set the path to which the output is written. If there is more than one input,
  12302. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12303. integer), that will be replaced with the input number. If no filename is
  12304. specified, no output will be written. This is the default.
  12305. @item format
  12306. Choose the output format.
  12307. Available values are:
  12308. @table @samp
  12309. @item binary
  12310. Use the specified binary representation (default).
  12311. @item xml
  12312. Use the specified xml representation.
  12313. @end table
  12314. @item th_d
  12315. Set threshold to detect one word as similar. The option value must be an integer
  12316. greater than zero. The default value is 9000.
  12317. @item th_dc
  12318. Set threshold to detect all words as similar. The option value must be an integer
  12319. greater than zero. The default value is 60000.
  12320. @item th_xh
  12321. Set threshold to detect frames as similar. The option value must be an integer
  12322. greater than zero. The default value is 116.
  12323. @item th_di
  12324. Set the minimum length of a sequence in frames to recognize it as matching
  12325. sequence. The option value must be a non negative integer value.
  12326. The default value is 0.
  12327. @item th_it
  12328. Set the minimum relation, that matching frames to all frames must have.
  12329. The option value must be a double value between 0 and 1. The default value is 0.5.
  12330. @end table
  12331. @subsection Examples
  12332. @itemize
  12333. @item
  12334. To calculate the signature of an input video and store it in signature.bin:
  12335. @example
  12336. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12337. @end example
  12338. @item
  12339. To detect whether two videos match and store the signatures in XML format in
  12340. signature0.xml and signature1.xml:
  12341. @example
  12342. 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 -
  12343. @end example
  12344. @end itemize
  12345. @anchor{smartblur}
  12346. @section smartblur
  12347. Blur the input video without impacting the outlines.
  12348. It accepts the following options:
  12349. @table @option
  12350. @item luma_radius, lr
  12351. Set the luma radius. The option value must be a float number in
  12352. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12353. used to blur the image (slower if larger). Default value is 1.0.
  12354. @item luma_strength, ls
  12355. Set the luma strength. The option value must be a float number
  12356. in the range [-1.0,1.0] that configures the blurring. A value included
  12357. in [0.0,1.0] will blur the image whereas a value included in
  12358. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12359. @item luma_threshold, lt
  12360. Set the luma threshold used as a coefficient to determine
  12361. whether a pixel should be blurred or not. The option value must be an
  12362. integer in the range [-30,30]. A value of 0 will filter all the image,
  12363. a value included in [0,30] will filter flat areas and a value included
  12364. in [-30,0] will filter edges. Default value is 0.
  12365. @item chroma_radius, cr
  12366. Set the chroma radius. The option value must be a float number in
  12367. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12368. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12369. @item chroma_strength, cs
  12370. Set the chroma strength. The option value must be a float number
  12371. in the range [-1.0,1.0] that configures the blurring. A value included
  12372. in [0.0,1.0] will blur the image whereas a value included in
  12373. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12374. @item chroma_threshold, ct
  12375. Set the chroma threshold used as a coefficient to determine
  12376. whether a pixel should be blurred or not. The option value must be an
  12377. integer in the range [-30,30]. A value of 0 will filter all the image,
  12378. a value included in [0,30] will filter flat areas and a value included
  12379. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12380. @end table
  12381. If a chroma option is not explicitly set, the corresponding luma value
  12382. is set.
  12383. @section ssim
  12384. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12385. This filter takes in input two input videos, the first input is
  12386. considered the "main" source and is passed unchanged to the
  12387. output. The second input is used as a "reference" video for computing
  12388. the SSIM.
  12389. Both video inputs must have the same resolution and pixel format for
  12390. this filter to work correctly. Also it assumes that both inputs
  12391. have the same number of frames, which are compared one by one.
  12392. The filter stores the calculated SSIM of each frame.
  12393. The description of the accepted parameters follows.
  12394. @table @option
  12395. @item stats_file, f
  12396. If specified the filter will use the named file to save the SSIM of
  12397. each individual frame. When filename equals "-" the data is sent to
  12398. standard output.
  12399. @end table
  12400. The file printed if @var{stats_file} is selected, contains a sequence of
  12401. key/value pairs of the form @var{key}:@var{value} for each compared
  12402. couple of frames.
  12403. A description of each shown parameter follows:
  12404. @table @option
  12405. @item n
  12406. sequential number of the input frame, starting from 1
  12407. @item Y, U, V, R, G, B
  12408. SSIM of the compared frames for the component specified by the suffix.
  12409. @item All
  12410. SSIM of the compared frames for the whole frame.
  12411. @item dB
  12412. Same as above but in dB representation.
  12413. @end table
  12414. This filter also supports the @ref{framesync} options.
  12415. For example:
  12416. @example
  12417. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12418. [main][ref] ssim="stats_file=stats.log" [out]
  12419. @end example
  12420. On this example the input file being processed is compared with the
  12421. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12422. is stored in @file{stats.log}.
  12423. Another example with both psnr and ssim at same time:
  12424. @example
  12425. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12426. @end example
  12427. @section stereo3d
  12428. Convert between different stereoscopic image formats.
  12429. The filters accept the following options:
  12430. @table @option
  12431. @item in
  12432. Set stereoscopic image format of input.
  12433. Available values for input image formats are:
  12434. @table @samp
  12435. @item sbsl
  12436. side by side parallel (left eye left, right eye right)
  12437. @item sbsr
  12438. side by side crosseye (right eye left, left eye right)
  12439. @item sbs2l
  12440. side by side parallel with half width resolution
  12441. (left eye left, right eye right)
  12442. @item sbs2r
  12443. side by side crosseye with half width resolution
  12444. (right eye left, left eye right)
  12445. @item abl
  12446. above-below (left eye above, right eye below)
  12447. @item abr
  12448. above-below (right eye above, left eye below)
  12449. @item ab2l
  12450. above-below with half height resolution
  12451. (left eye above, right eye below)
  12452. @item ab2r
  12453. above-below with half height resolution
  12454. (right eye above, left eye below)
  12455. @item al
  12456. alternating frames (left eye first, right eye second)
  12457. @item ar
  12458. alternating frames (right eye first, left eye second)
  12459. @item irl
  12460. interleaved rows (left eye has top row, right eye starts on next row)
  12461. @item irr
  12462. interleaved rows (right eye has top row, left eye starts on next row)
  12463. @item icl
  12464. interleaved columns, left eye first
  12465. @item icr
  12466. interleaved columns, right eye first
  12467. Default value is @samp{sbsl}.
  12468. @end table
  12469. @item out
  12470. Set stereoscopic image format of output.
  12471. @table @samp
  12472. @item sbsl
  12473. side by side parallel (left eye left, right eye right)
  12474. @item sbsr
  12475. side by side crosseye (right eye left, left eye right)
  12476. @item sbs2l
  12477. side by side parallel with half width resolution
  12478. (left eye left, right eye right)
  12479. @item sbs2r
  12480. side by side crosseye with half width resolution
  12481. (right eye left, left eye right)
  12482. @item abl
  12483. above-below (left eye above, right eye below)
  12484. @item abr
  12485. above-below (right eye above, left eye below)
  12486. @item ab2l
  12487. above-below with half height resolution
  12488. (left eye above, right eye below)
  12489. @item ab2r
  12490. above-below with half height resolution
  12491. (right eye above, left eye below)
  12492. @item al
  12493. alternating frames (left eye first, right eye second)
  12494. @item ar
  12495. alternating frames (right eye first, left eye second)
  12496. @item irl
  12497. interleaved rows (left eye has top row, right eye starts on next row)
  12498. @item irr
  12499. interleaved rows (right eye has top row, left eye starts on next row)
  12500. @item arbg
  12501. anaglyph red/blue gray
  12502. (red filter on left eye, blue filter on right eye)
  12503. @item argg
  12504. anaglyph red/green gray
  12505. (red filter on left eye, green filter on right eye)
  12506. @item arcg
  12507. anaglyph red/cyan gray
  12508. (red filter on left eye, cyan filter on right eye)
  12509. @item arch
  12510. anaglyph red/cyan half colored
  12511. (red filter on left eye, cyan filter on right eye)
  12512. @item arcc
  12513. anaglyph red/cyan color
  12514. (red filter on left eye, cyan filter on right eye)
  12515. @item arcd
  12516. anaglyph red/cyan color optimized with the least squares projection of dubois
  12517. (red filter on left eye, cyan filter on right eye)
  12518. @item agmg
  12519. anaglyph green/magenta gray
  12520. (green filter on left eye, magenta filter on right eye)
  12521. @item agmh
  12522. anaglyph green/magenta half colored
  12523. (green filter on left eye, magenta filter on right eye)
  12524. @item agmc
  12525. anaglyph green/magenta colored
  12526. (green filter on left eye, magenta filter on right eye)
  12527. @item agmd
  12528. anaglyph green/magenta color optimized with the least squares projection of dubois
  12529. (green filter on left eye, magenta filter on right eye)
  12530. @item aybg
  12531. anaglyph yellow/blue gray
  12532. (yellow filter on left eye, blue filter on right eye)
  12533. @item aybh
  12534. anaglyph yellow/blue half colored
  12535. (yellow filter on left eye, blue filter on right eye)
  12536. @item aybc
  12537. anaglyph yellow/blue colored
  12538. (yellow filter on left eye, blue filter on right eye)
  12539. @item aybd
  12540. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12541. (yellow filter on left eye, blue filter on right eye)
  12542. @item ml
  12543. mono output (left eye only)
  12544. @item mr
  12545. mono output (right eye only)
  12546. @item chl
  12547. checkerboard, left eye first
  12548. @item chr
  12549. checkerboard, right eye first
  12550. @item icl
  12551. interleaved columns, left eye first
  12552. @item icr
  12553. interleaved columns, right eye first
  12554. @item hdmi
  12555. HDMI frame pack
  12556. @end table
  12557. Default value is @samp{arcd}.
  12558. @end table
  12559. @subsection Examples
  12560. @itemize
  12561. @item
  12562. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12563. @example
  12564. stereo3d=sbsl:aybd
  12565. @end example
  12566. @item
  12567. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12568. @example
  12569. stereo3d=abl:sbsr
  12570. @end example
  12571. @end itemize
  12572. @section streamselect, astreamselect
  12573. Select video or audio streams.
  12574. The filter accepts the following options:
  12575. @table @option
  12576. @item inputs
  12577. Set number of inputs. Default is 2.
  12578. @item map
  12579. Set input indexes to remap to outputs.
  12580. @end table
  12581. @subsection Commands
  12582. The @code{streamselect} and @code{astreamselect} filter supports the following
  12583. commands:
  12584. @table @option
  12585. @item map
  12586. Set input indexes to remap to outputs.
  12587. @end table
  12588. @subsection Examples
  12589. @itemize
  12590. @item
  12591. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12592. @example
  12593. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12594. @end example
  12595. @item
  12596. Same as above, but for audio:
  12597. @example
  12598. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12599. @end example
  12600. @end itemize
  12601. @section sobel
  12602. Apply sobel operator to input video stream.
  12603. The filter accepts the following option:
  12604. @table @option
  12605. @item planes
  12606. Set which planes will be processed, unprocessed planes will be copied.
  12607. By default value 0xf, all planes will be processed.
  12608. @item scale
  12609. Set value which will be multiplied with filtered result.
  12610. @item delta
  12611. Set value which will be added to filtered result.
  12612. @end table
  12613. @anchor{spp}
  12614. @section spp
  12615. Apply a simple postprocessing filter that compresses and decompresses the image
  12616. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12617. and average the results.
  12618. The filter accepts the following options:
  12619. @table @option
  12620. @item quality
  12621. Set quality. This option defines the number of levels for averaging. It accepts
  12622. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12623. effect. A value of @code{6} means the higher quality. For each increment of
  12624. that value the speed drops by a factor of approximately 2. Default value is
  12625. @code{3}.
  12626. @item qp
  12627. Force a constant quantization parameter. If not set, the filter will use the QP
  12628. from the video stream (if available).
  12629. @item mode
  12630. Set thresholding mode. Available modes are:
  12631. @table @samp
  12632. @item hard
  12633. Set hard thresholding (default).
  12634. @item soft
  12635. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12636. @end table
  12637. @item use_bframe_qp
  12638. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12639. option may cause flicker since the B-Frames have often larger QP. Default is
  12640. @code{0} (not enabled).
  12641. @end table
  12642. @section sr
  12643. Scale the input by applying one of the super-resolution methods based on
  12644. convolutional neural networks. Supported models:
  12645. @itemize
  12646. @item
  12647. Super-Resolution Convolutional Neural Network model (SRCNN).
  12648. See @url{https://arxiv.org/abs/1501.00092}.
  12649. @item
  12650. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12651. See @url{https://arxiv.org/abs/1609.05158}.
  12652. @end itemize
  12653. Training scripts as well as scripts for model generation can be found at
  12654. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  12655. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12656. The filter accepts the following options:
  12657. @table @option
  12658. @item dnn_backend
  12659. Specify which DNN backend to use for model loading and execution. This option accepts
  12660. the following values:
  12661. @table @samp
  12662. @item native
  12663. Native implementation of DNN loading and execution.
  12664. @item tensorflow
  12665. TensorFlow backend. To enable this backend you
  12666. need to install the TensorFlow for C library (see
  12667. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12668. @code{--enable-libtensorflow}
  12669. @end table
  12670. Default value is @samp{native}.
  12671. @item model
  12672. Set path to model file specifying network architecture and its parameters.
  12673. Note that different backends use different file formats. TensorFlow backend
  12674. can load files for both formats, while native backend can load files for only
  12675. its format.
  12676. @item scale_factor
  12677. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12678. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12679. input upscaled using bicubic upscaling with proper scale factor.
  12680. @end table
  12681. @anchor{subtitles}
  12682. @section subtitles
  12683. Draw subtitles on top of input video using the libass library.
  12684. To enable compilation of this filter you need to configure FFmpeg with
  12685. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12686. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12687. Alpha) subtitles format.
  12688. The filter accepts the following options:
  12689. @table @option
  12690. @item filename, f
  12691. Set the filename of the subtitle file to read. It must be specified.
  12692. @item original_size
  12693. Specify the size of the original video, the video for which the ASS file
  12694. was composed. For the syntax of this option, check the
  12695. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12696. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12697. correctly scale the fonts if the aspect ratio has been changed.
  12698. @item fontsdir
  12699. Set a directory path containing fonts that can be used by the filter.
  12700. These fonts will be used in addition to whatever the font provider uses.
  12701. @item alpha
  12702. Process alpha channel, by default alpha channel is untouched.
  12703. @item charenc
  12704. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12705. useful if not UTF-8.
  12706. @item stream_index, si
  12707. Set subtitles stream index. @code{subtitles} filter only.
  12708. @item force_style
  12709. Override default style or script info parameters of the subtitles. It accepts a
  12710. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12711. @end table
  12712. If the first key is not specified, it is assumed that the first value
  12713. specifies the @option{filename}.
  12714. For example, to render the file @file{sub.srt} on top of the input
  12715. video, use the command:
  12716. @example
  12717. subtitles=sub.srt
  12718. @end example
  12719. which is equivalent to:
  12720. @example
  12721. subtitles=filename=sub.srt
  12722. @end example
  12723. To render the default subtitles stream from file @file{video.mkv}, use:
  12724. @example
  12725. subtitles=video.mkv
  12726. @end example
  12727. To render the second subtitles stream from that file, use:
  12728. @example
  12729. subtitles=video.mkv:si=1
  12730. @end example
  12731. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12732. @code{DejaVu Serif}, use:
  12733. @example
  12734. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12735. @end example
  12736. @section super2xsai
  12737. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12738. Interpolate) pixel art scaling algorithm.
  12739. Useful for enlarging pixel art images without reducing sharpness.
  12740. @section swaprect
  12741. Swap two rectangular objects in video.
  12742. This filter accepts the following options:
  12743. @table @option
  12744. @item w
  12745. Set object width.
  12746. @item h
  12747. Set object height.
  12748. @item x1
  12749. Set 1st rect x coordinate.
  12750. @item y1
  12751. Set 1st rect y coordinate.
  12752. @item x2
  12753. Set 2nd rect x coordinate.
  12754. @item y2
  12755. Set 2nd rect y coordinate.
  12756. All expressions are evaluated once for each frame.
  12757. @end table
  12758. The all options are expressions containing the following constants:
  12759. @table @option
  12760. @item w
  12761. @item h
  12762. The input width and height.
  12763. @item a
  12764. same as @var{w} / @var{h}
  12765. @item sar
  12766. input sample aspect ratio
  12767. @item dar
  12768. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12769. @item n
  12770. The number of the input frame, starting from 0.
  12771. @item t
  12772. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12773. @item pos
  12774. the position in the file of the input frame, NAN if unknown
  12775. @end table
  12776. @section swapuv
  12777. Swap U & V plane.
  12778. @section telecine
  12779. Apply telecine process to the video.
  12780. This filter accepts the following options:
  12781. @table @option
  12782. @item first_field
  12783. @table @samp
  12784. @item top, t
  12785. top field first
  12786. @item bottom, b
  12787. bottom field first
  12788. The default value is @code{top}.
  12789. @end table
  12790. @item pattern
  12791. A string of numbers representing the pulldown pattern you wish to apply.
  12792. The default value is @code{23}.
  12793. @end table
  12794. @example
  12795. Some typical patterns:
  12796. NTSC output (30i):
  12797. 27.5p: 32222
  12798. 24p: 23 (classic)
  12799. 24p: 2332 (preferred)
  12800. 20p: 33
  12801. 18p: 334
  12802. 16p: 3444
  12803. PAL output (25i):
  12804. 27.5p: 12222
  12805. 24p: 222222222223 ("Euro pulldown")
  12806. 16.67p: 33
  12807. 16p: 33333334
  12808. @end example
  12809. @section threshold
  12810. Apply threshold effect to video stream.
  12811. This filter needs four video streams to perform thresholding.
  12812. First stream is stream we are filtering.
  12813. Second stream is holding threshold values, third stream is holding min values,
  12814. and last, fourth stream is holding max values.
  12815. The filter accepts the following option:
  12816. @table @option
  12817. @item planes
  12818. Set which planes will be processed, unprocessed planes will be copied.
  12819. By default value 0xf, all planes will be processed.
  12820. @end table
  12821. For example if first stream pixel's component value is less then threshold value
  12822. of pixel component from 2nd threshold stream, third stream value will picked,
  12823. otherwise fourth stream pixel component value will be picked.
  12824. Using color source filter one can perform various types of thresholding:
  12825. @subsection Examples
  12826. @itemize
  12827. @item
  12828. Binary threshold, using gray color as threshold:
  12829. @example
  12830. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12831. @end example
  12832. @item
  12833. Inverted binary threshold, using gray color as threshold:
  12834. @example
  12835. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12836. @end example
  12837. @item
  12838. Truncate binary threshold, using gray color as threshold:
  12839. @example
  12840. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12841. @end example
  12842. @item
  12843. Threshold to zero, using gray color as threshold:
  12844. @example
  12845. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12846. @end example
  12847. @item
  12848. Inverted threshold to zero, using gray color as threshold:
  12849. @example
  12850. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12851. @end example
  12852. @end itemize
  12853. @section thumbnail
  12854. Select the most representative frame in a given sequence of consecutive frames.
  12855. The filter accepts the following options:
  12856. @table @option
  12857. @item n
  12858. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12859. will pick one of them, and then handle the next batch of @var{n} frames until
  12860. the end. Default is @code{100}.
  12861. @end table
  12862. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12863. value will result in a higher memory usage, so a high value is not recommended.
  12864. @subsection Examples
  12865. @itemize
  12866. @item
  12867. Extract one picture each 50 frames:
  12868. @example
  12869. thumbnail=50
  12870. @end example
  12871. @item
  12872. Complete example of a thumbnail creation with @command{ffmpeg}:
  12873. @example
  12874. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12875. @end example
  12876. @end itemize
  12877. @section tile
  12878. Tile several successive frames together.
  12879. The filter accepts the following options:
  12880. @table @option
  12881. @item layout
  12882. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12883. this option, check the
  12884. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12885. @item nb_frames
  12886. Set the maximum number of frames to render in the given area. It must be less
  12887. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12888. the area will be used.
  12889. @item margin
  12890. Set the outer border margin in pixels.
  12891. @item padding
  12892. Set the inner border thickness (i.e. the number of pixels between frames). For
  12893. more advanced padding options (such as having different values for the edges),
  12894. refer to the pad video filter.
  12895. @item color
  12896. Specify the color of the unused area. For the syntax of this option, check the
  12897. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12898. The default value of @var{color} is "black".
  12899. @item overlap
  12900. Set the number of frames to overlap when tiling several successive frames together.
  12901. The value must be between @code{0} and @var{nb_frames - 1}.
  12902. @item init_padding
  12903. Set the number of frames to initially be empty before displaying first output frame.
  12904. This controls how soon will one get first output frame.
  12905. The value must be between @code{0} and @var{nb_frames - 1}.
  12906. @end table
  12907. @subsection Examples
  12908. @itemize
  12909. @item
  12910. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12911. @example
  12912. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12913. @end example
  12914. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12915. duplicating each output frame to accommodate the originally detected frame
  12916. rate.
  12917. @item
  12918. Display @code{5} pictures in an area of @code{3x2} frames,
  12919. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12920. mixed flat and named options:
  12921. @example
  12922. tile=3x2:nb_frames=5:padding=7:margin=2
  12923. @end example
  12924. @end itemize
  12925. @section tinterlace
  12926. Perform various types of temporal field interlacing.
  12927. Frames are counted starting from 1, so the first input frame is
  12928. considered odd.
  12929. The filter accepts the following options:
  12930. @table @option
  12931. @item mode
  12932. Specify the mode of the interlacing. This option can also be specified
  12933. as a value alone. See below for a list of values for this option.
  12934. Available values are:
  12935. @table @samp
  12936. @item merge, 0
  12937. Move odd frames into the upper field, even into the lower field,
  12938. generating a double height frame at half frame rate.
  12939. @example
  12940. ------> time
  12941. Input:
  12942. Frame 1 Frame 2 Frame 3 Frame 4
  12943. 11111 22222 33333 44444
  12944. 11111 22222 33333 44444
  12945. 11111 22222 33333 44444
  12946. 11111 22222 33333 44444
  12947. Output:
  12948. 11111 33333
  12949. 22222 44444
  12950. 11111 33333
  12951. 22222 44444
  12952. 11111 33333
  12953. 22222 44444
  12954. 11111 33333
  12955. 22222 44444
  12956. @end example
  12957. @item drop_even, 1
  12958. Only output odd frames, even frames are dropped, generating a frame with
  12959. unchanged height at half frame rate.
  12960. @example
  12961. ------> time
  12962. Input:
  12963. Frame 1 Frame 2 Frame 3 Frame 4
  12964. 11111 22222 33333 44444
  12965. 11111 22222 33333 44444
  12966. 11111 22222 33333 44444
  12967. 11111 22222 33333 44444
  12968. Output:
  12969. 11111 33333
  12970. 11111 33333
  12971. 11111 33333
  12972. 11111 33333
  12973. @end example
  12974. @item drop_odd, 2
  12975. Only output even frames, odd frames are dropped, generating a frame with
  12976. unchanged height at half frame rate.
  12977. @example
  12978. ------> time
  12979. Input:
  12980. Frame 1 Frame 2 Frame 3 Frame 4
  12981. 11111 22222 33333 44444
  12982. 11111 22222 33333 44444
  12983. 11111 22222 33333 44444
  12984. 11111 22222 33333 44444
  12985. Output:
  12986. 22222 44444
  12987. 22222 44444
  12988. 22222 44444
  12989. 22222 44444
  12990. @end example
  12991. @item pad, 3
  12992. Expand each frame to full height, but pad alternate lines with black,
  12993. generating a frame with double height at the same input frame rate.
  12994. @example
  12995. ------> time
  12996. Input:
  12997. Frame 1 Frame 2 Frame 3 Frame 4
  12998. 11111 22222 33333 44444
  12999. 11111 22222 33333 44444
  13000. 11111 22222 33333 44444
  13001. 11111 22222 33333 44444
  13002. Output:
  13003. 11111 ..... 33333 .....
  13004. ..... 22222 ..... 44444
  13005. 11111 ..... 33333 .....
  13006. ..... 22222 ..... 44444
  13007. 11111 ..... 33333 .....
  13008. ..... 22222 ..... 44444
  13009. 11111 ..... 33333 .....
  13010. ..... 22222 ..... 44444
  13011. @end example
  13012. @item interleave_top, 4
  13013. Interleave the upper field from odd frames with the lower field from
  13014. even frames, generating a frame with unchanged height at half frame rate.
  13015. @example
  13016. ------> time
  13017. Input:
  13018. Frame 1 Frame 2 Frame 3 Frame 4
  13019. 11111<- 22222 33333<- 44444
  13020. 11111 22222<- 33333 44444<-
  13021. 11111<- 22222 33333<- 44444
  13022. 11111 22222<- 33333 44444<-
  13023. Output:
  13024. 11111 33333
  13025. 22222 44444
  13026. 11111 33333
  13027. 22222 44444
  13028. @end example
  13029. @item interleave_bottom, 5
  13030. Interleave the lower field from odd frames with the upper field from
  13031. even frames, generating a frame with unchanged height at half frame rate.
  13032. @example
  13033. ------> time
  13034. Input:
  13035. Frame 1 Frame 2 Frame 3 Frame 4
  13036. 11111 22222<- 33333 44444<-
  13037. 11111<- 22222 33333<- 44444
  13038. 11111 22222<- 33333 44444<-
  13039. 11111<- 22222 33333<- 44444
  13040. Output:
  13041. 22222 44444
  13042. 11111 33333
  13043. 22222 44444
  13044. 11111 33333
  13045. @end example
  13046. @item interlacex2, 6
  13047. Double frame rate with unchanged height. Frames are inserted each
  13048. containing the second temporal field from the previous input frame and
  13049. the first temporal field from the next input frame. This mode relies on
  13050. the top_field_first flag. Useful for interlaced video displays with no
  13051. field synchronisation.
  13052. @example
  13053. ------> time
  13054. Input:
  13055. Frame 1 Frame 2 Frame 3 Frame 4
  13056. 11111 22222 33333 44444
  13057. 11111 22222 33333 44444
  13058. 11111 22222 33333 44444
  13059. 11111 22222 33333 44444
  13060. Output:
  13061. 11111 22222 22222 33333 33333 44444 44444
  13062. 11111 11111 22222 22222 33333 33333 44444
  13063. 11111 22222 22222 33333 33333 44444 44444
  13064. 11111 11111 22222 22222 33333 33333 44444
  13065. @end example
  13066. @item mergex2, 7
  13067. Move odd frames into the upper field, even into the lower field,
  13068. generating a double height frame at same frame rate.
  13069. @example
  13070. ------> time
  13071. Input:
  13072. Frame 1 Frame 2 Frame 3 Frame 4
  13073. 11111 22222 33333 44444
  13074. 11111 22222 33333 44444
  13075. 11111 22222 33333 44444
  13076. 11111 22222 33333 44444
  13077. Output:
  13078. 11111 33333 33333 55555
  13079. 22222 22222 44444 44444
  13080. 11111 33333 33333 55555
  13081. 22222 22222 44444 44444
  13082. 11111 33333 33333 55555
  13083. 22222 22222 44444 44444
  13084. 11111 33333 33333 55555
  13085. 22222 22222 44444 44444
  13086. @end example
  13087. @end table
  13088. Numeric values are deprecated but are accepted for backward
  13089. compatibility reasons.
  13090. Default mode is @code{merge}.
  13091. @item flags
  13092. Specify flags influencing the filter process.
  13093. Available value for @var{flags} is:
  13094. @table @option
  13095. @item low_pass_filter, vlpf
  13096. Enable linear vertical low-pass filtering in the filter.
  13097. Vertical low-pass filtering is required when creating an interlaced
  13098. destination from a progressive source which contains high-frequency
  13099. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13100. patterning.
  13101. @item complex_filter, cvlpf
  13102. Enable complex vertical low-pass filtering.
  13103. This will slightly less reduce interlace 'twitter' and Moire
  13104. patterning but better retain detail and subjective sharpness impression.
  13105. @end table
  13106. Vertical low-pass filtering can only be enabled for @option{mode}
  13107. @var{interleave_top} and @var{interleave_bottom}.
  13108. @end table
  13109. @section tmix
  13110. Mix successive video frames.
  13111. A description of the accepted options follows.
  13112. @table @option
  13113. @item frames
  13114. The number of successive frames to mix. If unspecified, it defaults to 3.
  13115. @item weights
  13116. Specify weight of each input video frame.
  13117. Each weight is separated by space. If number of weights is smaller than
  13118. number of @var{frames} last specified weight will be used for all remaining
  13119. unset weights.
  13120. @item scale
  13121. Specify scale, if it is set it will be multiplied with sum
  13122. of each weight multiplied with pixel values to give final destination
  13123. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13124. @end table
  13125. @subsection Examples
  13126. @itemize
  13127. @item
  13128. Average 7 successive frames:
  13129. @example
  13130. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13131. @end example
  13132. @item
  13133. Apply simple temporal convolution:
  13134. @example
  13135. tmix=frames=3:weights="-1 3 -1"
  13136. @end example
  13137. @item
  13138. Similar as above but only showing temporal differences:
  13139. @example
  13140. tmix=frames=3:weights="-1 2 -1":scale=1
  13141. @end example
  13142. @end itemize
  13143. @anchor{tonemap}
  13144. @section tonemap
  13145. Tone map colors from different dynamic ranges.
  13146. This filter expects data in single precision floating point, as it needs to
  13147. operate on (and can output) out-of-range values. Another filter, such as
  13148. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13149. The tonemapping algorithms implemented only work on linear light, so input
  13150. data should be linearized beforehand (and possibly correctly tagged).
  13151. @example
  13152. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13153. @end example
  13154. @subsection Options
  13155. The filter accepts the following options.
  13156. @table @option
  13157. @item tonemap
  13158. Set the tone map algorithm to use.
  13159. Possible values are:
  13160. @table @var
  13161. @item none
  13162. Do not apply any tone map, only desaturate overbright pixels.
  13163. @item clip
  13164. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13165. in-range values, while distorting out-of-range values.
  13166. @item linear
  13167. Stretch the entire reference gamut to a linear multiple of the display.
  13168. @item gamma
  13169. Fit a logarithmic transfer between the tone curves.
  13170. @item reinhard
  13171. Preserve overall image brightness with a simple curve, using nonlinear
  13172. contrast, which results in flattening details and degrading color accuracy.
  13173. @item hable
  13174. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13175. of slightly darkening everything. Use it when detail preservation is more
  13176. important than color and brightness accuracy.
  13177. @item mobius
  13178. Smoothly map out-of-range values, while retaining contrast and colors for
  13179. in-range material as much as possible. Use it when color accuracy is more
  13180. important than detail preservation.
  13181. @end table
  13182. Default is none.
  13183. @item param
  13184. Tune the tone mapping algorithm.
  13185. This affects the following algorithms:
  13186. @table @var
  13187. @item none
  13188. Ignored.
  13189. @item linear
  13190. Specifies the scale factor to use while stretching.
  13191. Default to 1.0.
  13192. @item gamma
  13193. Specifies the exponent of the function.
  13194. Default to 1.8.
  13195. @item clip
  13196. Specify an extra linear coefficient to multiply into the signal before clipping.
  13197. Default to 1.0.
  13198. @item reinhard
  13199. Specify the local contrast coefficient at the display peak.
  13200. Default to 0.5, which means that in-gamut values will be about half as bright
  13201. as when clipping.
  13202. @item hable
  13203. Ignored.
  13204. @item mobius
  13205. Specify the transition point from linear to mobius transform. Every value
  13206. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13207. more accurate the result will be, at the cost of losing bright details.
  13208. Default to 0.3, which due to the steep initial slope still preserves in-range
  13209. colors fairly accurately.
  13210. @end table
  13211. @item desat
  13212. Apply desaturation for highlights that exceed this level of brightness. The
  13213. higher the parameter, the more color information will be preserved. This
  13214. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13215. (smoothly) turning into white instead. This makes images feel more natural,
  13216. at the cost of reducing information about out-of-range colors.
  13217. The default of 2.0 is somewhat conservative and will mostly just apply to
  13218. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13219. This option works only if the input frame has a supported color tag.
  13220. @item peak
  13221. Override signal/nominal/reference peak with this value. Useful when the
  13222. embedded peak information in display metadata is not reliable or when tone
  13223. mapping from a lower range to a higher range.
  13224. @end table
  13225. @section tpad
  13226. Temporarily pad video frames.
  13227. The filter accepts the following options:
  13228. @table @option
  13229. @item start
  13230. Specify number of delay frames before input video stream.
  13231. @item stop
  13232. Specify number of padding frames after input video stream.
  13233. Set to -1 to pad indefinitely.
  13234. @item start_mode
  13235. Set kind of frames added to beginning of stream.
  13236. Can be either @var{add} or @var{clone}.
  13237. With @var{add} frames of solid-color are added.
  13238. With @var{clone} frames are clones of first frame.
  13239. @item stop_mode
  13240. Set kind of frames added to end of stream.
  13241. Can be either @var{add} or @var{clone}.
  13242. With @var{add} frames of solid-color are added.
  13243. With @var{clone} frames are clones of last frame.
  13244. @item start_duration, stop_duration
  13245. Specify the duration of the start/stop delay. See
  13246. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13247. for the accepted syntax.
  13248. These options override @var{start} and @var{stop}.
  13249. @item color
  13250. Specify the color of the padded area. For the syntax of this option,
  13251. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13252. manual,ffmpeg-utils}.
  13253. The default value of @var{color} is "black".
  13254. @end table
  13255. @anchor{transpose}
  13256. @section transpose
  13257. Transpose rows with columns in the input video and optionally flip it.
  13258. It accepts the following parameters:
  13259. @table @option
  13260. @item dir
  13261. Specify the transposition direction.
  13262. Can assume the following values:
  13263. @table @samp
  13264. @item 0, 4, cclock_flip
  13265. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13266. @example
  13267. L.R L.l
  13268. . . -> . .
  13269. l.r R.r
  13270. @end example
  13271. @item 1, 5, clock
  13272. Rotate by 90 degrees clockwise, that is:
  13273. @example
  13274. L.R l.L
  13275. . . -> . .
  13276. l.r r.R
  13277. @end example
  13278. @item 2, 6, cclock
  13279. Rotate by 90 degrees counterclockwise, that is:
  13280. @example
  13281. L.R R.r
  13282. . . -> . .
  13283. l.r L.l
  13284. @end example
  13285. @item 3, 7, clock_flip
  13286. Rotate by 90 degrees clockwise and vertically flip, that is:
  13287. @example
  13288. L.R r.R
  13289. . . -> . .
  13290. l.r l.L
  13291. @end example
  13292. @end table
  13293. For values between 4-7, the transposition is only done if the input
  13294. video geometry is portrait and not landscape. These values are
  13295. deprecated, the @code{passthrough} option should be used instead.
  13296. Numerical values are deprecated, and should be dropped in favor of
  13297. symbolic constants.
  13298. @item passthrough
  13299. Do not apply the transposition if the input geometry matches the one
  13300. specified by the specified value. It accepts the following values:
  13301. @table @samp
  13302. @item none
  13303. Always apply transposition.
  13304. @item portrait
  13305. Preserve portrait geometry (when @var{height} >= @var{width}).
  13306. @item landscape
  13307. Preserve landscape geometry (when @var{width} >= @var{height}).
  13308. @end table
  13309. Default value is @code{none}.
  13310. @end table
  13311. For example to rotate by 90 degrees clockwise and preserve portrait
  13312. layout:
  13313. @example
  13314. transpose=dir=1:passthrough=portrait
  13315. @end example
  13316. The command above can also be specified as:
  13317. @example
  13318. transpose=1:portrait
  13319. @end example
  13320. @section transpose_npp
  13321. Transpose rows with columns in the input video and optionally flip it.
  13322. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13323. It accepts the following parameters:
  13324. @table @option
  13325. @item dir
  13326. Specify the transposition direction.
  13327. Can assume the following values:
  13328. @table @samp
  13329. @item cclock_flip
  13330. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13331. @item clock
  13332. Rotate by 90 degrees clockwise.
  13333. @item cclock
  13334. Rotate by 90 degrees counterclockwise.
  13335. @item clock_flip
  13336. Rotate by 90 degrees clockwise and vertically flip.
  13337. @end table
  13338. @item passthrough
  13339. Do not apply the transposition if the input geometry matches the one
  13340. specified by the specified value. It accepts the following values:
  13341. @table @samp
  13342. @item none
  13343. Always apply transposition. (default)
  13344. @item portrait
  13345. Preserve portrait geometry (when @var{height} >= @var{width}).
  13346. @item landscape
  13347. Preserve landscape geometry (when @var{width} >= @var{height}).
  13348. @end table
  13349. @end table
  13350. @section trim
  13351. Trim the input so that the output contains one continuous subpart of the input.
  13352. It accepts the following parameters:
  13353. @table @option
  13354. @item start
  13355. Specify the time of the start of the kept section, i.e. the frame with the
  13356. timestamp @var{start} will be the first frame in the output.
  13357. @item end
  13358. Specify the time of the first frame that will be dropped, i.e. the frame
  13359. immediately preceding the one with the timestamp @var{end} will be the last
  13360. frame in the output.
  13361. @item start_pts
  13362. This is the same as @var{start}, except this option sets the start timestamp
  13363. in timebase units instead of seconds.
  13364. @item end_pts
  13365. This is the same as @var{end}, except this option sets the end timestamp
  13366. in timebase units instead of seconds.
  13367. @item duration
  13368. The maximum duration of the output in seconds.
  13369. @item start_frame
  13370. The number of the first frame that should be passed to the output.
  13371. @item end_frame
  13372. The number of the first frame that should be dropped.
  13373. @end table
  13374. @option{start}, @option{end}, and @option{duration} are expressed as time
  13375. duration specifications; see
  13376. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13377. for the accepted syntax.
  13378. Note that the first two sets of the start/end options and the @option{duration}
  13379. option look at the frame timestamp, while the _frame variants simply count the
  13380. frames that pass through the filter. Also note that this filter does not modify
  13381. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13382. setpts filter after the trim filter.
  13383. If multiple start or end options are set, this filter tries to be greedy and
  13384. keep all the frames that match at least one of the specified constraints. To keep
  13385. only the part that matches all the constraints at once, chain multiple trim
  13386. filters.
  13387. The defaults are such that all the input is kept. So it is possible to set e.g.
  13388. just the end values to keep everything before the specified time.
  13389. Examples:
  13390. @itemize
  13391. @item
  13392. Drop everything except the second minute of input:
  13393. @example
  13394. ffmpeg -i INPUT -vf trim=60:120
  13395. @end example
  13396. @item
  13397. Keep only the first second:
  13398. @example
  13399. ffmpeg -i INPUT -vf trim=duration=1
  13400. @end example
  13401. @end itemize
  13402. @section unpremultiply
  13403. Apply alpha unpremultiply effect to input video stream using first plane
  13404. of second stream as alpha.
  13405. Both streams must have same dimensions and same pixel format.
  13406. The filter accepts the following option:
  13407. @table @option
  13408. @item planes
  13409. Set which planes will be processed, unprocessed planes will be copied.
  13410. By default value 0xf, all planes will be processed.
  13411. If the format has 1 or 2 components, then luma is bit 0.
  13412. If the format has 3 or 4 components:
  13413. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13414. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13415. If present, the alpha channel is always the last bit.
  13416. @item inplace
  13417. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13418. @end table
  13419. @anchor{unsharp}
  13420. @section unsharp
  13421. Sharpen or blur the input video.
  13422. It accepts the following parameters:
  13423. @table @option
  13424. @item luma_msize_x, lx
  13425. Set the luma matrix horizontal size. It must be an odd integer between
  13426. 3 and 23. The default value is 5.
  13427. @item luma_msize_y, ly
  13428. Set the luma matrix vertical size. It must be an odd integer between 3
  13429. and 23. The default value is 5.
  13430. @item luma_amount, la
  13431. Set the luma effect strength. It must be a floating point number, reasonable
  13432. values lay between -1.5 and 1.5.
  13433. Negative values will blur the input video, while positive values will
  13434. sharpen it, a value of zero will disable the effect.
  13435. Default value is 1.0.
  13436. @item chroma_msize_x, cx
  13437. Set the chroma matrix horizontal size. It must be an odd integer
  13438. between 3 and 23. The default value is 5.
  13439. @item chroma_msize_y, cy
  13440. Set the chroma matrix vertical size. It must be an odd integer
  13441. between 3 and 23. The default value is 5.
  13442. @item chroma_amount, ca
  13443. Set the chroma effect strength. It must be a floating point number, reasonable
  13444. values lay between -1.5 and 1.5.
  13445. Negative values will blur the input video, while positive values will
  13446. sharpen it, a value of zero will disable the effect.
  13447. Default value is 0.0.
  13448. @end table
  13449. All parameters are optional and default to the equivalent of the
  13450. string '5:5:1.0:5:5:0.0'.
  13451. @subsection Examples
  13452. @itemize
  13453. @item
  13454. Apply strong luma sharpen effect:
  13455. @example
  13456. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13457. @end example
  13458. @item
  13459. Apply a strong blur of both luma and chroma parameters:
  13460. @example
  13461. unsharp=7:7:-2:7:7:-2
  13462. @end example
  13463. @end itemize
  13464. @section uspp
  13465. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13466. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13467. shifts and average the results.
  13468. The way this differs from the behavior of spp is that uspp actually encodes &
  13469. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13470. DCT similar to MJPEG.
  13471. The filter accepts the following options:
  13472. @table @option
  13473. @item quality
  13474. Set quality. This option defines the number of levels for averaging. It accepts
  13475. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13476. effect. A value of @code{8} means the higher quality. For each increment of
  13477. that value the speed drops by a factor of approximately 2. Default value is
  13478. @code{3}.
  13479. @item qp
  13480. Force a constant quantization parameter. If not set, the filter will use the QP
  13481. from the video stream (if available).
  13482. @end table
  13483. @section vaguedenoiser
  13484. Apply a wavelet based denoiser.
  13485. It transforms each frame from the video input into the wavelet domain,
  13486. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13487. the obtained coefficients. It does an inverse wavelet transform after.
  13488. Due to wavelet properties, it should give a nice smoothed result, and
  13489. reduced noise, without blurring picture features.
  13490. This filter accepts the following options:
  13491. @table @option
  13492. @item threshold
  13493. The filtering strength. The higher, the more filtered the video will be.
  13494. Hard thresholding can use a higher threshold than soft thresholding
  13495. before the video looks overfiltered. Default value is 2.
  13496. @item method
  13497. The filtering method the filter will use.
  13498. It accepts the following values:
  13499. @table @samp
  13500. @item hard
  13501. All values under the threshold will be zeroed.
  13502. @item soft
  13503. All values under the threshold will be zeroed. All values above will be
  13504. reduced by the threshold.
  13505. @item garrote
  13506. Scales or nullifies coefficients - intermediary between (more) soft and
  13507. (less) hard thresholding.
  13508. @end table
  13509. Default is garrote.
  13510. @item nsteps
  13511. Number of times, the wavelet will decompose the picture. Picture can't
  13512. be decomposed beyond a particular point (typically, 8 for a 640x480
  13513. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13514. @item percent
  13515. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13516. @item planes
  13517. A list of the planes to process. By default all planes are processed.
  13518. @end table
  13519. @section vectorscope
  13520. Display 2 color component values in the two dimensional graph (which is called
  13521. a vectorscope).
  13522. This filter accepts the following options:
  13523. @table @option
  13524. @item mode, m
  13525. Set vectorscope mode.
  13526. It accepts the following values:
  13527. @table @samp
  13528. @item gray
  13529. Gray values are displayed on graph, higher brightness means more pixels have
  13530. same component color value on location in graph. This is the default mode.
  13531. @item color
  13532. Gray values are displayed on graph. Surrounding pixels values which are not
  13533. present in video frame are drawn in gradient of 2 color components which are
  13534. set by option @code{x} and @code{y}. The 3rd color component is static.
  13535. @item color2
  13536. Actual color components values present in video frame are displayed on graph.
  13537. @item color3
  13538. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13539. on graph increases value of another color component, which is luminance by
  13540. default values of @code{x} and @code{y}.
  13541. @item color4
  13542. Actual colors present in video frame are displayed on graph. If two different
  13543. colors map to same position on graph then color with higher value of component
  13544. not present in graph is picked.
  13545. @item color5
  13546. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13547. component picked from radial gradient.
  13548. @end table
  13549. @item x
  13550. Set which color component will be represented on X-axis. Default is @code{1}.
  13551. @item y
  13552. Set which color component will be represented on Y-axis. Default is @code{2}.
  13553. @item intensity, i
  13554. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13555. of color component which represents frequency of (X, Y) location in graph.
  13556. @item envelope, e
  13557. @table @samp
  13558. @item none
  13559. No envelope, this is default.
  13560. @item instant
  13561. Instant envelope, even darkest single pixel will be clearly highlighted.
  13562. @item peak
  13563. Hold maximum and minimum values presented in graph over time. This way you
  13564. can still spot out of range values without constantly looking at vectorscope.
  13565. @item peak+instant
  13566. Peak and instant envelope combined together.
  13567. @end table
  13568. @item graticule, g
  13569. Set what kind of graticule to draw.
  13570. @table @samp
  13571. @item none
  13572. @item green
  13573. @item color
  13574. @end table
  13575. @item opacity, o
  13576. Set graticule opacity.
  13577. @item flags, f
  13578. Set graticule flags.
  13579. @table @samp
  13580. @item white
  13581. Draw graticule for white point.
  13582. @item black
  13583. Draw graticule for black point.
  13584. @item name
  13585. Draw color points short names.
  13586. @end table
  13587. @item bgopacity, b
  13588. Set background opacity.
  13589. @item lthreshold, l
  13590. Set low threshold for color component not represented on X or Y axis.
  13591. Values lower than this value will be ignored. Default is 0.
  13592. Note this value is multiplied with actual max possible value one pixel component
  13593. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13594. is 0.1 * 255 = 25.
  13595. @item hthreshold, h
  13596. Set high threshold for color component not represented on X or Y axis.
  13597. Values higher than this value will be ignored. Default is 1.
  13598. Note this value is multiplied with actual max possible value one pixel component
  13599. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13600. is 0.9 * 255 = 230.
  13601. @item colorspace, c
  13602. Set what kind of colorspace to use when drawing graticule.
  13603. @table @samp
  13604. @item auto
  13605. @item 601
  13606. @item 709
  13607. @end table
  13608. Default is auto.
  13609. @end table
  13610. @anchor{vidstabdetect}
  13611. @section vidstabdetect
  13612. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13613. @ref{vidstabtransform} for pass 2.
  13614. This filter generates a file with relative translation and rotation
  13615. transform information about subsequent frames, which is then used by
  13616. the @ref{vidstabtransform} filter.
  13617. To enable compilation of this filter you need to configure FFmpeg with
  13618. @code{--enable-libvidstab}.
  13619. This filter accepts the following options:
  13620. @table @option
  13621. @item result
  13622. Set the path to the file used to write the transforms information.
  13623. Default value is @file{transforms.trf}.
  13624. @item shakiness
  13625. Set how shaky the video is and how quick the camera is. It accepts an
  13626. integer in the range 1-10, a value of 1 means little shakiness, a
  13627. value of 10 means strong shakiness. Default value is 5.
  13628. @item accuracy
  13629. Set the accuracy of the detection process. It must be a value in the
  13630. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13631. accuracy. Default value is 15.
  13632. @item stepsize
  13633. Set stepsize of the search process. The region around minimum is
  13634. scanned with 1 pixel resolution. Default value is 6.
  13635. @item mincontrast
  13636. Set minimum contrast. Below this value a local measurement field is
  13637. discarded. Must be a floating point value in the range 0-1. Default
  13638. value is 0.3.
  13639. @item tripod
  13640. Set reference frame number for tripod mode.
  13641. If enabled, the motion of the frames is compared to a reference frame
  13642. in the filtered stream, identified by the specified number. The idea
  13643. is to compensate all movements in a more-or-less static scene and keep
  13644. the camera view absolutely still.
  13645. If set to 0, it is disabled. The frames are counted starting from 1.
  13646. @item show
  13647. Show fields and transforms in the resulting frames. It accepts an
  13648. integer in the range 0-2. Default value is 0, which disables any
  13649. visualization.
  13650. @end table
  13651. @subsection Examples
  13652. @itemize
  13653. @item
  13654. Use default values:
  13655. @example
  13656. vidstabdetect
  13657. @end example
  13658. @item
  13659. Analyze strongly shaky movie and put the results in file
  13660. @file{mytransforms.trf}:
  13661. @example
  13662. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13663. @end example
  13664. @item
  13665. Visualize the result of internal transformations in the resulting
  13666. video:
  13667. @example
  13668. vidstabdetect=show=1
  13669. @end example
  13670. @item
  13671. Analyze a video with medium shakiness using @command{ffmpeg}:
  13672. @example
  13673. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13674. @end example
  13675. @end itemize
  13676. @anchor{vidstabtransform}
  13677. @section vidstabtransform
  13678. Video stabilization/deshaking: pass 2 of 2,
  13679. see @ref{vidstabdetect} for pass 1.
  13680. Read a file with transform information for each frame and
  13681. apply/compensate them. Together with the @ref{vidstabdetect}
  13682. filter this can be used to deshake videos. See also
  13683. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13684. the @ref{unsharp} filter, see below.
  13685. To enable compilation of this filter you need to configure FFmpeg with
  13686. @code{--enable-libvidstab}.
  13687. @subsection Options
  13688. @table @option
  13689. @item input
  13690. Set path to the file used to read the transforms. Default value is
  13691. @file{transforms.trf}.
  13692. @item smoothing
  13693. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13694. camera movements. Default value is 10.
  13695. For example a number of 10 means that 21 frames are used (10 in the
  13696. past and 10 in the future) to smoothen the motion in the video. A
  13697. larger value leads to a smoother video, but limits the acceleration of
  13698. the camera (pan/tilt movements). 0 is a special case where a static
  13699. camera is simulated.
  13700. @item optalgo
  13701. Set the camera path optimization algorithm.
  13702. Accepted values are:
  13703. @table @samp
  13704. @item gauss
  13705. gaussian kernel low-pass filter on camera motion (default)
  13706. @item avg
  13707. averaging on transformations
  13708. @end table
  13709. @item maxshift
  13710. Set maximal number of pixels to translate frames. Default value is -1,
  13711. meaning no limit.
  13712. @item maxangle
  13713. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13714. value is -1, meaning no limit.
  13715. @item crop
  13716. Specify how to deal with borders that may be visible due to movement
  13717. compensation.
  13718. Available values are:
  13719. @table @samp
  13720. @item keep
  13721. keep image information from previous frame (default)
  13722. @item black
  13723. fill the border black
  13724. @end table
  13725. @item invert
  13726. Invert transforms if set to 1. Default value is 0.
  13727. @item relative
  13728. Consider transforms as relative to previous frame if set to 1,
  13729. absolute if set to 0. Default value is 0.
  13730. @item zoom
  13731. Set percentage to zoom. A positive value will result in a zoom-in
  13732. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13733. zoom).
  13734. @item optzoom
  13735. Set optimal zooming to avoid borders.
  13736. Accepted values are:
  13737. @table @samp
  13738. @item 0
  13739. disabled
  13740. @item 1
  13741. optimal static zoom value is determined (only very strong movements
  13742. will lead to visible borders) (default)
  13743. @item 2
  13744. optimal adaptive zoom value is determined (no borders will be
  13745. visible), see @option{zoomspeed}
  13746. @end table
  13747. Note that the value given at zoom is added to the one calculated here.
  13748. @item zoomspeed
  13749. Set percent to zoom maximally each frame (enabled when
  13750. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13751. 0.25.
  13752. @item interpol
  13753. Specify type of interpolation.
  13754. Available values are:
  13755. @table @samp
  13756. @item no
  13757. no interpolation
  13758. @item linear
  13759. linear only horizontal
  13760. @item bilinear
  13761. linear in both directions (default)
  13762. @item bicubic
  13763. cubic in both directions (slow)
  13764. @end table
  13765. @item tripod
  13766. Enable virtual tripod mode if set to 1, which is equivalent to
  13767. @code{relative=0:smoothing=0}. Default value is 0.
  13768. Use also @code{tripod} option of @ref{vidstabdetect}.
  13769. @item debug
  13770. Increase log verbosity if set to 1. Also the detected global motions
  13771. are written to the temporary file @file{global_motions.trf}. Default
  13772. value is 0.
  13773. @end table
  13774. @subsection Examples
  13775. @itemize
  13776. @item
  13777. Use @command{ffmpeg} for a typical stabilization with default values:
  13778. @example
  13779. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13780. @end example
  13781. Note the use of the @ref{unsharp} filter which is always recommended.
  13782. @item
  13783. Zoom in a bit more and load transform data from a given file:
  13784. @example
  13785. vidstabtransform=zoom=5:input="mytransforms.trf"
  13786. @end example
  13787. @item
  13788. Smoothen the video even more:
  13789. @example
  13790. vidstabtransform=smoothing=30
  13791. @end example
  13792. @end itemize
  13793. @section vflip
  13794. Flip the input video vertically.
  13795. For example, to vertically flip a video with @command{ffmpeg}:
  13796. @example
  13797. ffmpeg -i in.avi -vf "vflip" out.avi
  13798. @end example
  13799. @section vfrdet
  13800. Detect variable frame rate video.
  13801. This filter tries to detect if the input is variable or constant frame rate.
  13802. At end it will output number of frames detected as having variable delta pts,
  13803. and ones with constant delta pts.
  13804. If there was frames with variable delta, than it will also show min and max delta
  13805. encountered.
  13806. @section vibrance
  13807. Boost or alter saturation.
  13808. The filter accepts the following options:
  13809. @table @option
  13810. @item intensity
  13811. Set strength of boost if positive value or strength of alter if negative value.
  13812. Default is 0. Allowed range is from -2 to 2.
  13813. @item rbal
  13814. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  13815. @item gbal
  13816. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  13817. @item bbal
  13818. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  13819. @item rlum
  13820. Set the red luma coefficient.
  13821. @item glum
  13822. Set the green luma coefficient.
  13823. @item blum
  13824. Set the blue luma coefficient.
  13825. @item alternate
  13826. If @code{intensity} is negative and this is set to 1, colors will change,
  13827. otherwise colors will be less saturated, more towards gray.
  13828. @end table
  13829. @anchor{vignette}
  13830. @section vignette
  13831. Make or reverse a natural vignetting effect.
  13832. The filter accepts the following options:
  13833. @table @option
  13834. @item angle, a
  13835. Set lens angle expression as a number of radians.
  13836. The value is clipped in the @code{[0,PI/2]} range.
  13837. Default value: @code{"PI/5"}
  13838. @item x0
  13839. @item y0
  13840. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13841. by default.
  13842. @item mode
  13843. Set forward/backward mode.
  13844. Available modes are:
  13845. @table @samp
  13846. @item forward
  13847. The larger the distance from the central point, the darker the image becomes.
  13848. @item backward
  13849. The larger the distance from the central point, the brighter the image becomes.
  13850. This can be used to reverse a vignette effect, though there is no automatic
  13851. detection to extract the lens @option{angle} and other settings (yet). It can
  13852. also be used to create a burning effect.
  13853. @end table
  13854. Default value is @samp{forward}.
  13855. @item eval
  13856. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13857. It accepts the following values:
  13858. @table @samp
  13859. @item init
  13860. Evaluate expressions only once during the filter initialization.
  13861. @item frame
  13862. Evaluate expressions for each incoming frame. This is way slower than the
  13863. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13864. allows advanced dynamic expressions.
  13865. @end table
  13866. Default value is @samp{init}.
  13867. @item dither
  13868. Set dithering to reduce the circular banding effects. Default is @code{1}
  13869. (enabled).
  13870. @item aspect
  13871. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13872. Setting this value to the SAR of the input will make a rectangular vignetting
  13873. following the dimensions of the video.
  13874. Default is @code{1/1}.
  13875. @end table
  13876. @subsection Expressions
  13877. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13878. following parameters.
  13879. @table @option
  13880. @item w
  13881. @item h
  13882. input width and height
  13883. @item n
  13884. the number of input frame, starting from 0
  13885. @item pts
  13886. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13887. @var{TB} units, NAN if undefined
  13888. @item r
  13889. frame rate of the input video, NAN if the input frame rate is unknown
  13890. @item t
  13891. the PTS (Presentation TimeStamp) of the filtered video frame,
  13892. expressed in seconds, NAN if undefined
  13893. @item tb
  13894. time base of the input video
  13895. @end table
  13896. @subsection Examples
  13897. @itemize
  13898. @item
  13899. Apply simple strong vignetting effect:
  13900. @example
  13901. vignette=PI/4
  13902. @end example
  13903. @item
  13904. Make a flickering vignetting:
  13905. @example
  13906. vignette='PI/4+random(1)*PI/50':eval=frame
  13907. @end example
  13908. @end itemize
  13909. @section vmafmotion
  13910. Obtain the average vmaf motion score of a video.
  13911. It is one of the component filters of VMAF.
  13912. The obtained average motion score is printed through the logging system.
  13913. In the below example the input file @file{ref.mpg} is being processed and score
  13914. is computed.
  13915. @example
  13916. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13917. @end example
  13918. @section vstack
  13919. Stack input videos vertically.
  13920. All streams must be of same pixel format and of same width.
  13921. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13922. to create same output.
  13923. The filter accept the following option:
  13924. @table @option
  13925. @item inputs
  13926. Set number of input streams. Default is 2.
  13927. @item shortest
  13928. If set to 1, force the output to terminate when the shortest input
  13929. terminates. Default value is 0.
  13930. @end table
  13931. @section w3fdif
  13932. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13933. Deinterlacing Filter").
  13934. Based on the process described by Martin Weston for BBC R&D, and
  13935. implemented based on the de-interlace algorithm written by Jim
  13936. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13937. uses filter coefficients calculated by BBC R&D.
  13938. This filter use field-dominance information in frame to decide which
  13939. of each pair of fields to place first in the output.
  13940. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  13941. There are two sets of filter coefficients, so called "simple":
  13942. and "complex". Which set of filter coefficients is used can
  13943. be set by passing an optional parameter:
  13944. @table @option
  13945. @item filter
  13946. Set the interlacing filter coefficients. Accepts one of the following values:
  13947. @table @samp
  13948. @item simple
  13949. Simple filter coefficient set.
  13950. @item complex
  13951. More-complex filter coefficient set.
  13952. @end table
  13953. Default value is @samp{complex}.
  13954. @item deint
  13955. Specify which frames to deinterlace. Accept one of the following values:
  13956. @table @samp
  13957. @item all
  13958. Deinterlace all frames,
  13959. @item interlaced
  13960. Only deinterlace frames marked as interlaced.
  13961. @end table
  13962. Default value is @samp{all}.
  13963. @end table
  13964. @section waveform
  13965. Video waveform monitor.
  13966. The waveform monitor plots color component intensity. By default luminance
  13967. only. Each column of the waveform corresponds to a column of pixels in the
  13968. source video.
  13969. It accepts the following options:
  13970. @table @option
  13971. @item mode, m
  13972. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13973. In row mode, the graph on the left side represents color component value 0 and
  13974. the right side represents value = 255. In column mode, the top side represents
  13975. color component value = 0 and bottom side represents value = 255.
  13976. @item intensity, i
  13977. Set intensity. Smaller values are useful to find out how many values of the same
  13978. luminance are distributed across input rows/columns.
  13979. Default value is @code{0.04}. Allowed range is [0, 1].
  13980. @item mirror, r
  13981. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13982. In mirrored mode, higher values will be represented on the left
  13983. side for @code{row} mode and at the top for @code{column} mode. Default is
  13984. @code{1} (mirrored).
  13985. @item display, d
  13986. Set display mode.
  13987. It accepts the following values:
  13988. @table @samp
  13989. @item overlay
  13990. Presents information identical to that in the @code{parade}, except
  13991. that the graphs representing color components are superimposed directly
  13992. over one another.
  13993. This display mode makes it easier to spot relative differences or similarities
  13994. in overlapping areas of the color components that are supposed to be identical,
  13995. such as neutral whites, grays, or blacks.
  13996. @item stack
  13997. Display separate graph for the color components side by side in
  13998. @code{row} mode or one below the other in @code{column} mode.
  13999. @item parade
  14000. Display separate graph for the color components side by side in
  14001. @code{column} mode or one below the other in @code{row} mode.
  14002. Using this display mode makes it easy to spot color casts in the highlights
  14003. and shadows of an image, by comparing the contours of the top and the bottom
  14004. graphs of each waveform. Since whites, grays, and blacks are characterized
  14005. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  14006. should display three waveforms of roughly equal width/height. If not, the
  14007. correction is easy to perform by making level adjustments the three waveforms.
  14008. @end table
  14009. Default is @code{stack}.
  14010. @item components, c
  14011. Set which color components to display. Default is 1, which means only luminance
  14012. or red color component if input is in RGB colorspace. If is set for example to
  14013. 7 it will display all 3 (if) available color components.
  14014. @item envelope, e
  14015. @table @samp
  14016. @item none
  14017. No envelope, this is default.
  14018. @item instant
  14019. Instant envelope, minimum and maximum values presented in graph will be easily
  14020. visible even with small @code{step} value.
  14021. @item peak
  14022. Hold minimum and maximum values presented in graph across time. This way you
  14023. can still spot out of range values without constantly looking at waveforms.
  14024. @item peak+instant
  14025. Peak and instant envelope combined together.
  14026. @end table
  14027. @item filter, f
  14028. @table @samp
  14029. @item lowpass
  14030. No filtering, this is default.
  14031. @item flat
  14032. Luma and chroma combined together.
  14033. @item aflat
  14034. Similar as above, but shows difference between blue and red chroma.
  14035. @item xflat
  14036. Similar as above, but use different colors.
  14037. @item chroma
  14038. Displays only chroma.
  14039. @item color
  14040. Displays actual color value on waveform.
  14041. @item acolor
  14042. Similar as above, but with luma showing frequency of chroma values.
  14043. @end table
  14044. @item graticule, g
  14045. Set which graticule to display.
  14046. @table @samp
  14047. @item none
  14048. Do not display graticule.
  14049. @item green
  14050. Display green graticule showing legal broadcast ranges.
  14051. @item orange
  14052. Display orange graticule showing legal broadcast ranges.
  14053. @end table
  14054. @item opacity, o
  14055. Set graticule opacity.
  14056. @item flags, fl
  14057. Set graticule flags.
  14058. @table @samp
  14059. @item numbers
  14060. Draw numbers above lines. By default enabled.
  14061. @item dots
  14062. Draw dots instead of lines.
  14063. @end table
  14064. @item scale, s
  14065. Set scale used for displaying graticule.
  14066. @table @samp
  14067. @item digital
  14068. @item millivolts
  14069. @item ire
  14070. @end table
  14071. Default is digital.
  14072. @item bgopacity, b
  14073. Set background opacity.
  14074. @end table
  14075. @section weave, doubleweave
  14076. The @code{weave} takes a field-based video input and join
  14077. each two sequential fields into single frame, producing a new double
  14078. height clip with half the frame rate and half the frame count.
  14079. The @code{doubleweave} works same as @code{weave} but without
  14080. halving frame rate and frame count.
  14081. It accepts the following option:
  14082. @table @option
  14083. @item first_field
  14084. Set first field. Available values are:
  14085. @table @samp
  14086. @item top, t
  14087. Set the frame as top-field-first.
  14088. @item bottom, b
  14089. Set the frame as bottom-field-first.
  14090. @end table
  14091. @end table
  14092. @subsection Examples
  14093. @itemize
  14094. @item
  14095. Interlace video using @ref{select} and @ref{separatefields} filter:
  14096. @example
  14097. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  14098. @end example
  14099. @end itemize
  14100. @section xbr
  14101. Apply the xBR high-quality magnification filter which is designed for pixel
  14102. art. It follows a set of edge-detection rules, see
  14103. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  14104. It accepts the following option:
  14105. @table @option
  14106. @item n
  14107. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  14108. @code{3xBR} and @code{4} for @code{4xBR}.
  14109. Default is @code{3}.
  14110. @end table
  14111. @section xmedian
  14112. Pick median pixels from several input videos.
  14113. The filter accept the following options:
  14114. @table @option
  14115. @item inputs
  14116. Set number of inputs.
  14117. Default is 3. Allowed range is from 3 to 255.
  14118. If number of inputs is even number, than result will be mean value between two median values.
  14119. @item planes
  14120. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14121. @end table
  14122. @section xstack
  14123. Stack video inputs into custom layout.
  14124. All streams must be of same pixel format.
  14125. The filter accept the following option:
  14126. @table @option
  14127. @item inputs
  14128. Set number of input streams. Default is 2.
  14129. @item layout
  14130. Specify layout of inputs.
  14131. This option requires the desired layout configuration to be explicitly set by the user.
  14132. This sets position of each video input in output. Each input
  14133. is separated by '|'.
  14134. The first number represents the column, and the second number represents the row.
  14135. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  14136. where X is video input from which to take width or height.
  14137. Multiple values can be used when separated by '+'. In such
  14138. case values are summed together.
  14139. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  14140. a layout must be set by the user.
  14141. @item shortest
  14142. If set to 1, force the output to terminate when the shortest input
  14143. terminates. Default value is 0.
  14144. @end table
  14145. @subsection Examples
  14146. @itemize
  14147. @item
  14148. Display 4 inputs into 2x2 grid,
  14149. note that if inputs are of different sizes unused gaps might appear,
  14150. as not all of output video is used.
  14151. @example
  14152. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  14153. @end example
  14154. @item
  14155. Display 4 inputs into 1x4 grid,
  14156. note that if inputs are of different sizes unused gaps might appear,
  14157. as not all of output video is used.
  14158. @example
  14159. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  14160. @end example
  14161. @item
  14162. Display 9 inputs into 3x3 grid,
  14163. note that if inputs are of different sizes unused gaps might appear,
  14164. as not all of output video is used.
  14165. @example
  14166. 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
  14167. @end example
  14168. @end itemize
  14169. @anchor{yadif}
  14170. @section yadif
  14171. Deinterlace the input video ("yadif" means "yet another deinterlacing
  14172. filter").
  14173. It accepts the following parameters:
  14174. @table @option
  14175. @item mode
  14176. The interlacing mode to adopt. It accepts one of the following values:
  14177. @table @option
  14178. @item 0, send_frame
  14179. Output one frame for each frame.
  14180. @item 1, send_field
  14181. Output one frame for each field.
  14182. @item 2, send_frame_nospatial
  14183. Like @code{send_frame}, but it skips the spatial interlacing check.
  14184. @item 3, send_field_nospatial
  14185. Like @code{send_field}, but it skips the spatial interlacing check.
  14186. @end table
  14187. The default value is @code{send_frame}.
  14188. @item parity
  14189. The picture field parity assumed for the input interlaced video. It accepts one
  14190. of the following values:
  14191. @table @option
  14192. @item 0, tff
  14193. Assume the top field is first.
  14194. @item 1, bff
  14195. Assume the bottom field is first.
  14196. @item -1, auto
  14197. Enable automatic detection of field parity.
  14198. @end table
  14199. The default value is @code{auto}.
  14200. If the interlacing is unknown or the decoder does not export this information,
  14201. top field first will be assumed.
  14202. @item deint
  14203. Specify which frames to deinterlace. Accept one of the following
  14204. values:
  14205. @table @option
  14206. @item 0, all
  14207. Deinterlace all frames.
  14208. @item 1, interlaced
  14209. Only deinterlace frames marked as interlaced.
  14210. @end table
  14211. The default value is @code{all}.
  14212. @end table
  14213. @section yadif_cuda
  14214. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14215. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14216. and/or nvenc.
  14217. It accepts the following parameters:
  14218. @table @option
  14219. @item mode
  14220. The interlacing mode to adopt. It accepts one of the following values:
  14221. @table @option
  14222. @item 0, send_frame
  14223. Output one frame for each frame.
  14224. @item 1, send_field
  14225. Output one frame for each field.
  14226. @item 2, send_frame_nospatial
  14227. Like @code{send_frame}, but it skips the spatial interlacing check.
  14228. @item 3, send_field_nospatial
  14229. Like @code{send_field}, but it skips the spatial interlacing check.
  14230. @end table
  14231. The default value is @code{send_frame}.
  14232. @item parity
  14233. The picture field parity assumed for the input interlaced video. It accepts one
  14234. of the following values:
  14235. @table @option
  14236. @item 0, tff
  14237. Assume the top field is first.
  14238. @item 1, bff
  14239. Assume the bottom field is first.
  14240. @item -1, auto
  14241. Enable automatic detection of field parity.
  14242. @end table
  14243. The default value is @code{auto}.
  14244. If the interlacing is unknown or the decoder does not export this information,
  14245. top field first will be assumed.
  14246. @item deint
  14247. Specify which frames to deinterlace. Accept one of the following
  14248. values:
  14249. @table @option
  14250. @item 0, all
  14251. Deinterlace all frames.
  14252. @item 1, interlaced
  14253. Only deinterlace frames marked as interlaced.
  14254. @end table
  14255. The default value is @code{all}.
  14256. @end table
  14257. @section zoompan
  14258. Apply Zoom & Pan effect.
  14259. This filter accepts the following options:
  14260. @table @option
  14261. @item zoom, z
  14262. Set the zoom expression. Range is 1-10. Default is 1.
  14263. @item x
  14264. @item y
  14265. Set the x and y expression. Default is 0.
  14266. @item d
  14267. Set the duration expression in number of frames.
  14268. This sets for how many number of frames effect will last for
  14269. single input image.
  14270. @item s
  14271. Set the output image size, default is 'hd720'.
  14272. @item fps
  14273. Set the output frame rate, default is '25'.
  14274. @end table
  14275. Each expression can contain the following constants:
  14276. @table @option
  14277. @item in_w, iw
  14278. Input width.
  14279. @item in_h, ih
  14280. Input height.
  14281. @item out_w, ow
  14282. Output width.
  14283. @item out_h, oh
  14284. Output height.
  14285. @item in
  14286. Input frame count.
  14287. @item on
  14288. Output frame count.
  14289. @item x
  14290. @item y
  14291. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14292. for current input frame.
  14293. @item px
  14294. @item py
  14295. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14296. not yet such frame (first input frame).
  14297. @item zoom
  14298. Last calculated zoom from 'z' expression for current input frame.
  14299. @item pzoom
  14300. Last calculated zoom of last output frame of previous input frame.
  14301. @item duration
  14302. Number of output frames for current input frame. Calculated from 'd' expression
  14303. for each input frame.
  14304. @item pduration
  14305. number of output frames created for previous input frame
  14306. @item a
  14307. Rational number: input width / input height
  14308. @item sar
  14309. sample aspect ratio
  14310. @item dar
  14311. display aspect ratio
  14312. @end table
  14313. @subsection Examples
  14314. @itemize
  14315. @item
  14316. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14317. @example
  14318. 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
  14319. @end example
  14320. @item
  14321. Zoom-in up to 1.5 and pan always at center of picture:
  14322. @example
  14323. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14324. @end example
  14325. @item
  14326. Same as above but without pausing:
  14327. @example
  14328. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14329. @end example
  14330. @end itemize
  14331. @anchor{zscale}
  14332. @section zscale
  14333. Scale (resize) the input video, using the z.lib library:
  14334. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14335. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14336. The zscale filter forces the output display aspect ratio to be the same
  14337. as the input, by changing the output sample aspect ratio.
  14338. If the input image format is different from the format requested by
  14339. the next filter, the zscale filter will convert the input to the
  14340. requested format.
  14341. @subsection Options
  14342. The filter accepts the following options.
  14343. @table @option
  14344. @item width, w
  14345. @item height, h
  14346. Set the output video dimension expression. Default value is the input
  14347. dimension.
  14348. If the @var{width} or @var{w} value is 0, the input width is used for
  14349. the output. If the @var{height} or @var{h} value is 0, the input height
  14350. is used for the output.
  14351. If one and only one of the values is -n with n >= 1, the zscale filter
  14352. will use a value that maintains the aspect ratio of the input image,
  14353. calculated from the other specified dimension. After that it will,
  14354. however, make sure that the calculated dimension is divisible by n and
  14355. adjust the value if necessary.
  14356. If both values are -n with n >= 1, the behavior will be identical to
  14357. both values being set to 0 as previously detailed.
  14358. See below for the list of accepted constants for use in the dimension
  14359. expression.
  14360. @item size, s
  14361. Set the video size. For the syntax of this option, check the
  14362. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14363. @item dither, d
  14364. Set the dither type.
  14365. Possible values are:
  14366. @table @var
  14367. @item none
  14368. @item ordered
  14369. @item random
  14370. @item error_diffusion
  14371. @end table
  14372. Default is none.
  14373. @item filter, f
  14374. Set the resize filter type.
  14375. Possible values are:
  14376. @table @var
  14377. @item point
  14378. @item bilinear
  14379. @item bicubic
  14380. @item spline16
  14381. @item spline36
  14382. @item lanczos
  14383. @end table
  14384. Default is bilinear.
  14385. @item range, r
  14386. Set the color range.
  14387. Possible values are:
  14388. @table @var
  14389. @item input
  14390. @item limited
  14391. @item full
  14392. @end table
  14393. Default is same as input.
  14394. @item primaries, p
  14395. Set the color primaries.
  14396. Possible values are:
  14397. @table @var
  14398. @item input
  14399. @item 709
  14400. @item unspecified
  14401. @item 170m
  14402. @item 240m
  14403. @item 2020
  14404. @end table
  14405. Default is same as input.
  14406. @item transfer, t
  14407. Set the transfer characteristics.
  14408. Possible values are:
  14409. @table @var
  14410. @item input
  14411. @item 709
  14412. @item unspecified
  14413. @item 601
  14414. @item linear
  14415. @item 2020_10
  14416. @item 2020_12
  14417. @item smpte2084
  14418. @item iec61966-2-1
  14419. @item arib-std-b67
  14420. @end table
  14421. Default is same as input.
  14422. @item matrix, m
  14423. Set the colorspace matrix.
  14424. Possible value are:
  14425. @table @var
  14426. @item input
  14427. @item 709
  14428. @item unspecified
  14429. @item 470bg
  14430. @item 170m
  14431. @item 2020_ncl
  14432. @item 2020_cl
  14433. @end table
  14434. Default is same as input.
  14435. @item rangein, rin
  14436. Set the input color range.
  14437. Possible values are:
  14438. @table @var
  14439. @item input
  14440. @item limited
  14441. @item full
  14442. @end table
  14443. Default is same as input.
  14444. @item primariesin, pin
  14445. Set the input color primaries.
  14446. Possible values are:
  14447. @table @var
  14448. @item input
  14449. @item 709
  14450. @item unspecified
  14451. @item 170m
  14452. @item 240m
  14453. @item 2020
  14454. @end table
  14455. Default is same as input.
  14456. @item transferin, tin
  14457. Set the input transfer characteristics.
  14458. Possible values are:
  14459. @table @var
  14460. @item input
  14461. @item 709
  14462. @item unspecified
  14463. @item 601
  14464. @item linear
  14465. @item 2020_10
  14466. @item 2020_12
  14467. @end table
  14468. Default is same as input.
  14469. @item matrixin, min
  14470. Set the input colorspace matrix.
  14471. Possible value are:
  14472. @table @var
  14473. @item input
  14474. @item 709
  14475. @item unspecified
  14476. @item 470bg
  14477. @item 170m
  14478. @item 2020_ncl
  14479. @item 2020_cl
  14480. @end table
  14481. @item chromal, c
  14482. Set the output chroma location.
  14483. Possible values are:
  14484. @table @var
  14485. @item input
  14486. @item left
  14487. @item center
  14488. @item topleft
  14489. @item top
  14490. @item bottomleft
  14491. @item bottom
  14492. @end table
  14493. @item chromalin, cin
  14494. Set the input chroma location.
  14495. Possible values are:
  14496. @table @var
  14497. @item input
  14498. @item left
  14499. @item center
  14500. @item topleft
  14501. @item top
  14502. @item bottomleft
  14503. @item bottom
  14504. @end table
  14505. @item npl
  14506. Set the nominal peak luminance.
  14507. @end table
  14508. The values of the @option{w} and @option{h} options are expressions
  14509. containing the following constants:
  14510. @table @var
  14511. @item in_w
  14512. @item in_h
  14513. The input width and height
  14514. @item iw
  14515. @item ih
  14516. These are the same as @var{in_w} and @var{in_h}.
  14517. @item out_w
  14518. @item out_h
  14519. The output (scaled) width and height
  14520. @item ow
  14521. @item oh
  14522. These are the same as @var{out_w} and @var{out_h}
  14523. @item a
  14524. The same as @var{iw} / @var{ih}
  14525. @item sar
  14526. input sample aspect ratio
  14527. @item dar
  14528. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14529. @item hsub
  14530. @item vsub
  14531. horizontal and vertical input chroma subsample values. For example for the
  14532. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14533. @item ohsub
  14534. @item ovsub
  14535. horizontal and vertical output chroma subsample values. For example for the
  14536. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14537. @end table
  14538. @table @option
  14539. @end table
  14540. @c man end VIDEO FILTERS
  14541. @chapter OpenCL Video Filters
  14542. @c man begin OPENCL VIDEO FILTERS
  14543. Below is a description of the currently available OpenCL video filters.
  14544. To enable compilation of these filters you need to configure FFmpeg with
  14545. @code{--enable-opencl}.
  14546. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14547. @table @option
  14548. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14549. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14550. given device parameters.
  14551. @item -filter_hw_device @var{name}
  14552. Pass the hardware device called @var{name} to all filters in any filter graph.
  14553. @end table
  14554. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14555. @itemize
  14556. @item
  14557. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14558. @example
  14559. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14560. @end example
  14561. @end itemize
  14562. 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.
  14563. @section avgblur_opencl
  14564. Apply average blur filter.
  14565. The filter accepts the following options:
  14566. @table @option
  14567. @item sizeX
  14568. Set horizontal radius size.
  14569. Range is @code{[1, 1024]} and default value is @code{1}.
  14570. @item planes
  14571. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14572. @item sizeY
  14573. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14574. @end table
  14575. @subsection Example
  14576. @itemize
  14577. @item
  14578. 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.
  14579. @example
  14580. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14581. @end example
  14582. @end itemize
  14583. @section boxblur_opencl
  14584. Apply a boxblur algorithm to the input video.
  14585. It accepts the following parameters:
  14586. @table @option
  14587. @item luma_radius, lr
  14588. @item luma_power, lp
  14589. @item chroma_radius, cr
  14590. @item chroma_power, cp
  14591. @item alpha_radius, ar
  14592. @item alpha_power, ap
  14593. @end table
  14594. A description of the accepted options follows.
  14595. @table @option
  14596. @item luma_radius, lr
  14597. @item chroma_radius, cr
  14598. @item alpha_radius, ar
  14599. Set an expression for the box radius in pixels used for blurring the
  14600. corresponding input plane.
  14601. The radius value must be a non-negative number, and must not be
  14602. greater than the value of the expression @code{min(w,h)/2} for the
  14603. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14604. planes.
  14605. Default value for @option{luma_radius} is "2". If not specified,
  14606. @option{chroma_radius} and @option{alpha_radius} default to the
  14607. corresponding value set for @option{luma_radius}.
  14608. The expressions can contain the following constants:
  14609. @table @option
  14610. @item w
  14611. @item h
  14612. The input width and height in pixels.
  14613. @item cw
  14614. @item ch
  14615. The input chroma image width and height in pixels.
  14616. @item hsub
  14617. @item vsub
  14618. The horizontal and vertical chroma subsample values. For example, for the
  14619. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14620. @end table
  14621. @item luma_power, lp
  14622. @item chroma_power, cp
  14623. @item alpha_power, ap
  14624. Specify how many times the boxblur filter is applied to the
  14625. corresponding plane.
  14626. Default value for @option{luma_power} is 2. If not specified,
  14627. @option{chroma_power} and @option{alpha_power} default to the
  14628. corresponding value set for @option{luma_power}.
  14629. A value of 0 will disable the effect.
  14630. @end table
  14631. @subsection Examples
  14632. 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.
  14633. @itemize
  14634. @item
  14635. Apply a boxblur filter with the luma, chroma, and alpha radius
  14636. 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.
  14637. @example
  14638. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14639. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14640. @end example
  14641. @item
  14642. 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.
  14643. For the luma plane, a 2x2 box radius will be run once.
  14644. For the chroma plane, a 4x4 box radius will be run 5 times.
  14645. For the alpha plane, a 3x3 box radius will be run 7 times.
  14646. @example
  14647. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14648. @end example
  14649. @end itemize
  14650. @section convolution_opencl
  14651. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14652. The filter accepts the following options:
  14653. @table @option
  14654. @item 0m
  14655. @item 1m
  14656. @item 2m
  14657. @item 3m
  14658. Set matrix for each plane.
  14659. Matrix is sequence of 9, 25 or 49 signed numbers.
  14660. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14661. @item 0rdiv
  14662. @item 1rdiv
  14663. @item 2rdiv
  14664. @item 3rdiv
  14665. Set multiplier for calculated value for each plane.
  14666. If unset or 0, it will be sum of all matrix elements.
  14667. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14668. @item 0bias
  14669. @item 1bias
  14670. @item 2bias
  14671. @item 3bias
  14672. Set bias for each plane. This value is added to the result of the multiplication.
  14673. Useful for making the overall image brighter or darker.
  14674. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  14675. @end table
  14676. @subsection Examples
  14677. @itemize
  14678. @item
  14679. Apply sharpen:
  14680. @example
  14681. -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
  14682. @end example
  14683. @item
  14684. Apply blur:
  14685. @example
  14686. -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
  14687. @end example
  14688. @item
  14689. Apply edge enhance:
  14690. @example
  14691. -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
  14692. @end example
  14693. @item
  14694. Apply edge detect:
  14695. @example
  14696. -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
  14697. @end example
  14698. @item
  14699. Apply laplacian edge detector which includes diagonals:
  14700. @example
  14701. -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
  14702. @end example
  14703. @item
  14704. Apply emboss:
  14705. @example
  14706. -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
  14707. @end example
  14708. @end itemize
  14709. @section dilation_opencl
  14710. Apply dilation effect to the video.
  14711. This filter replaces the pixel by the local(3x3) maximum.
  14712. It accepts the following options:
  14713. @table @option
  14714. @item threshold0
  14715. @item threshold1
  14716. @item threshold2
  14717. @item threshold3
  14718. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14719. If @code{0}, plane will remain unchanged.
  14720. @item coordinates
  14721. Flag which specifies the pixel to refer to.
  14722. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14723. Flags to local 3x3 coordinates region centered on @code{x}:
  14724. 1 2 3
  14725. 4 x 5
  14726. 6 7 8
  14727. @end table
  14728. @subsection Example
  14729. @itemize
  14730. @item
  14731. 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.
  14732. @example
  14733. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14734. @end example
  14735. @end itemize
  14736. @section erosion_opencl
  14737. Apply erosion effect to the video.
  14738. This filter replaces the pixel by the local(3x3) minimum.
  14739. It accepts the following options:
  14740. @table @option
  14741. @item threshold0
  14742. @item threshold1
  14743. @item threshold2
  14744. @item threshold3
  14745. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14746. If @code{0}, plane will remain unchanged.
  14747. @item coordinates
  14748. Flag which specifies the pixel to refer to.
  14749. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14750. Flags to local 3x3 coordinates region centered on @code{x}:
  14751. 1 2 3
  14752. 4 x 5
  14753. 6 7 8
  14754. @end table
  14755. @subsection Example
  14756. @itemize
  14757. @item
  14758. 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.
  14759. @example
  14760. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14761. @end example
  14762. @end itemize
  14763. @section colorkey_opencl
  14764. RGB colorspace color keying.
  14765. The filter accepts the following options:
  14766. @table @option
  14767. @item color
  14768. The color which will be replaced with transparency.
  14769. @item similarity
  14770. Similarity percentage with the key color.
  14771. 0.01 matches only the exact key color, while 1.0 matches everything.
  14772. @item blend
  14773. Blend percentage.
  14774. 0.0 makes pixels either fully transparent, or not transparent at all.
  14775. Higher values result in semi-transparent pixels, with a higher transparency
  14776. the more similar the pixels color is to the key color.
  14777. @end table
  14778. @subsection Examples
  14779. @itemize
  14780. @item
  14781. Make every semi-green pixel in the input transparent with some slight blending:
  14782. @example
  14783. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  14784. @end example
  14785. @end itemize
  14786. @section nlmeans_opencl
  14787. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  14788. @section overlay_opencl
  14789. Overlay one video on top of another.
  14790. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  14791. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  14792. The filter accepts the following options:
  14793. @table @option
  14794. @item x
  14795. Set the x coordinate of the overlaid video on the main video.
  14796. Default value is @code{0}.
  14797. @item y
  14798. Set the x coordinate of the overlaid video on the main video.
  14799. Default value is @code{0}.
  14800. @end table
  14801. @subsection Examples
  14802. @itemize
  14803. @item
  14804. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  14805. @example
  14806. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14807. @end example
  14808. @item
  14809. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  14810. @example
  14811. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14812. @end example
  14813. @end itemize
  14814. @section prewitt_opencl
  14815. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  14816. The filter accepts the following option:
  14817. @table @option
  14818. @item planes
  14819. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14820. @item scale
  14821. Set value which will be multiplied with filtered result.
  14822. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14823. @item delta
  14824. Set value which will be added to filtered result.
  14825. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14826. @end table
  14827. @subsection Example
  14828. @itemize
  14829. @item
  14830. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  14831. @example
  14832. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14833. @end example
  14834. @end itemize
  14835. @section roberts_opencl
  14836. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  14837. The filter accepts the following option:
  14838. @table @option
  14839. @item planes
  14840. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14841. @item scale
  14842. Set value which will be multiplied with filtered result.
  14843. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14844. @item delta
  14845. Set value which will be added to filtered result.
  14846. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14847. @end table
  14848. @subsection Example
  14849. @itemize
  14850. @item
  14851. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  14852. @example
  14853. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14854. @end example
  14855. @end itemize
  14856. @section sobel_opencl
  14857. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  14858. The filter accepts the following option:
  14859. @table @option
  14860. @item planes
  14861. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14862. @item scale
  14863. Set value which will be multiplied with filtered result.
  14864. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14865. @item delta
  14866. Set value which will be added to filtered result.
  14867. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14868. @end table
  14869. @subsection Example
  14870. @itemize
  14871. @item
  14872. Apply sobel operator with scale set to 2 and delta set to 10
  14873. @example
  14874. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14875. @end example
  14876. @end itemize
  14877. @section tonemap_opencl
  14878. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  14879. It accepts the following parameters:
  14880. @table @option
  14881. @item tonemap
  14882. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  14883. @item param
  14884. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  14885. @item desat
  14886. Apply desaturation for highlights that exceed this level of brightness. The
  14887. higher the parameter, the more color information will be preserved. This
  14888. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14889. (smoothly) turning into white instead. This makes images feel more natural,
  14890. at the cost of reducing information about out-of-range colors.
  14891. The default value is 0.5, and the algorithm here is a little different from
  14892. the cpu version tonemap currently. A setting of 0.0 disables this option.
  14893. @item threshold
  14894. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  14895. is used to detect whether the scene has changed or not. If the distance between
  14896. the current frame average brightness and the current running average exceeds
  14897. a threshold value, we would re-calculate scene average and peak brightness.
  14898. The default value is 0.2.
  14899. @item format
  14900. Specify the output pixel format.
  14901. Currently supported formats are:
  14902. @table @var
  14903. @item p010
  14904. @item nv12
  14905. @end table
  14906. @item range, r
  14907. Set the output color range.
  14908. Possible values are:
  14909. @table @var
  14910. @item tv/mpeg
  14911. @item pc/jpeg
  14912. @end table
  14913. Default is same as input.
  14914. @item primaries, p
  14915. Set the output color primaries.
  14916. Possible values are:
  14917. @table @var
  14918. @item bt709
  14919. @item bt2020
  14920. @end table
  14921. Default is same as input.
  14922. @item transfer, t
  14923. Set the output transfer characteristics.
  14924. Possible values are:
  14925. @table @var
  14926. @item bt709
  14927. @item bt2020
  14928. @end table
  14929. Default is bt709.
  14930. @item matrix, m
  14931. Set the output colorspace matrix.
  14932. Possible value are:
  14933. @table @var
  14934. @item bt709
  14935. @item bt2020
  14936. @end table
  14937. Default is same as input.
  14938. @end table
  14939. @subsection Example
  14940. @itemize
  14941. @item
  14942. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  14943. @example
  14944. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  14945. @end example
  14946. @end itemize
  14947. @section unsharp_opencl
  14948. Sharpen or blur the input video.
  14949. It accepts the following parameters:
  14950. @table @option
  14951. @item luma_msize_x, lx
  14952. Set the luma matrix horizontal size.
  14953. Range is @code{[1, 23]} and default value is @code{5}.
  14954. @item luma_msize_y, ly
  14955. Set the luma matrix vertical size.
  14956. Range is @code{[1, 23]} and default value is @code{5}.
  14957. @item luma_amount, la
  14958. Set the luma effect strength.
  14959. Range is @code{[-10, 10]} and default value is @code{1.0}.
  14960. Negative values will blur the input video, while positive values will
  14961. sharpen it, a value of zero will disable the effect.
  14962. @item chroma_msize_x, cx
  14963. Set the chroma matrix horizontal size.
  14964. Range is @code{[1, 23]} and default value is @code{5}.
  14965. @item chroma_msize_y, cy
  14966. Set the chroma matrix vertical size.
  14967. Range is @code{[1, 23]} and default value is @code{5}.
  14968. @item chroma_amount, ca
  14969. Set the chroma effect strength.
  14970. Range is @code{[-10, 10]} and default value is @code{0.0}.
  14971. Negative values will blur the input video, while positive values will
  14972. sharpen it, a value of zero will disable the effect.
  14973. @end table
  14974. All parameters are optional and default to the equivalent of the
  14975. string '5:5:1.0:5:5:0.0'.
  14976. @subsection Examples
  14977. @itemize
  14978. @item
  14979. Apply strong luma sharpen effect:
  14980. @example
  14981. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  14982. @end example
  14983. @item
  14984. Apply a strong blur of both luma and chroma parameters:
  14985. @example
  14986. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  14987. @end example
  14988. @end itemize
  14989. @c man end OPENCL VIDEO FILTERS
  14990. @chapter Video Sources
  14991. @c man begin VIDEO SOURCES
  14992. Below is a description of the currently available video sources.
  14993. @section buffer
  14994. Buffer video frames, and make them available to the filter chain.
  14995. This source is mainly intended for a programmatic use, in particular
  14996. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  14997. It accepts the following parameters:
  14998. @table @option
  14999. @item video_size
  15000. Specify the size (width and height) of the buffered video frames. For the
  15001. syntax of this option, check the
  15002. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15003. @item width
  15004. The input video width.
  15005. @item height
  15006. The input video height.
  15007. @item pix_fmt
  15008. A string representing the pixel format of the buffered video frames.
  15009. It may be a number corresponding to a pixel format, or a pixel format
  15010. name.
  15011. @item time_base
  15012. Specify the timebase assumed by the timestamps of the buffered frames.
  15013. @item frame_rate
  15014. Specify the frame rate expected for the video stream.
  15015. @item pixel_aspect, sar
  15016. The sample (pixel) aspect ratio of the input video.
  15017. @item sws_param
  15018. Specify the optional parameters to be used for the scale filter which
  15019. is automatically inserted when an input change is detected in the
  15020. input size or format.
  15021. @item hw_frames_ctx
  15022. When using a hardware pixel format, this should be a reference to an
  15023. AVHWFramesContext describing input frames.
  15024. @end table
  15025. For example:
  15026. @example
  15027. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  15028. @end example
  15029. will instruct the source to accept video frames with size 320x240 and
  15030. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  15031. square pixels (1:1 sample aspect ratio).
  15032. Since the pixel format with name "yuv410p" corresponds to the number 6
  15033. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  15034. this example corresponds to:
  15035. @example
  15036. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  15037. @end example
  15038. Alternatively, the options can be specified as a flat string, but this
  15039. syntax is deprecated:
  15040. @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}]
  15041. @section cellauto
  15042. Create a pattern generated by an elementary cellular automaton.
  15043. The initial state of the cellular automaton can be defined through the
  15044. @option{filename} and @option{pattern} options. If such options are
  15045. not specified an initial state is created randomly.
  15046. At each new frame a new row in the video is filled with the result of
  15047. the cellular automaton next generation. The behavior when the whole
  15048. frame is filled is defined by the @option{scroll} option.
  15049. This source accepts the following options:
  15050. @table @option
  15051. @item filename, f
  15052. Read the initial cellular automaton state, i.e. the starting row, from
  15053. the specified file.
  15054. In the file, each non-whitespace character is considered an alive
  15055. cell, a newline will terminate the row, and further characters in the
  15056. file will be ignored.
  15057. @item pattern, p
  15058. Read the initial cellular automaton state, i.e. the starting row, from
  15059. the specified string.
  15060. Each non-whitespace character in the string is considered an alive
  15061. cell, a newline will terminate the row, and further characters in the
  15062. string will be ignored.
  15063. @item rate, r
  15064. Set the video rate, that is the number of frames generated per second.
  15065. Default is 25.
  15066. @item random_fill_ratio, ratio
  15067. Set the random fill ratio for the initial cellular automaton row. It
  15068. is a floating point number value ranging from 0 to 1, defaults to
  15069. 1/PHI.
  15070. This option is ignored when a file or a pattern is specified.
  15071. @item random_seed, seed
  15072. Set the seed for filling randomly the initial row, must be an integer
  15073. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15074. set to -1, the filter will try to use a good random seed on a best
  15075. effort basis.
  15076. @item rule
  15077. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  15078. Default value is 110.
  15079. @item size, s
  15080. Set the size of the output video. For the syntax of this option, check the
  15081. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15082. If @option{filename} or @option{pattern} is specified, the size is set
  15083. by default to the width of the specified initial state row, and the
  15084. height is set to @var{width} * PHI.
  15085. If @option{size} is set, it must contain the width of the specified
  15086. pattern string, and the specified pattern will be centered in the
  15087. larger row.
  15088. If a filename or a pattern string is not specified, the size value
  15089. defaults to "320x518" (used for a randomly generated initial state).
  15090. @item scroll
  15091. If set to 1, scroll the output upward when all the rows in the output
  15092. have been already filled. If set to 0, the new generated row will be
  15093. written over the top row just after the bottom row is filled.
  15094. Defaults to 1.
  15095. @item start_full, full
  15096. If set to 1, completely fill the output with generated rows before
  15097. outputting the first frame.
  15098. This is the default behavior, for disabling set the value to 0.
  15099. @item stitch
  15100. If set to 1, stitch the left and right row edges together.
  15101. This is the default behavior, for disabling set the value to 0.
  15102. @end table
  15103. @subsection Examples
  15104. @itemize
  15105. @item
  15106. Read the initial state from @file{pattern}, and specify an output of
  15107. size 200x400.
  15108. @example
  15109. cellauto=f=pattern:s=200x400
  15110. @end example
  15111. @item
  15112. Generate a random initial row with a width of 200 cells, with a fill
  15113. ratio of 2/3:
  15114. @example
  15115. cellauto=ratio=2/3:s=200x200
  15116. @end example
  15117. @item
  15118. Create a pattern generated by rule 18 starting by a single alive cell
  15119. centered on an initial row with width 100:
  15120. @example
  15121. cellauto=p=@@:s=100x400:full=0:rule=18
  15122. @end example
  15123. @item
  15124. Specify a more elaborated initial pattern:
  15125. @example
  15126. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  15127. @end example
  15128. @end itemize
  15129. @anchor{coreimagesrc}
  15130. @section coreimagesrc
  15131. Video source generated on GPU using Apple's CoreImage API on OSX.
  15132. This video source is a specialized version of the @ref{coreimage} video filter.
  15133. Use a core image generator at the beginning of the applied filterchain to
  15134. generate the content.
  15135. The coreimagesrc video source accepts the following options:
  15136. @table @option
  15137. @item list_generators
  15138. List all available generators along with all their respective options as well as
  15139. possible minimum and maximum values along with the default values.
  15140. @example
  15141. list_generators=true
  15142. @end example
  15143. @item size, s
  15144. Specify the size of the sourced video. For the syntax of this option, check the
  15145. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15146. The default value is @code{320x240}.
  15147. @item rate, r
  15148. Specify the frame rate of the sourced video, as the number of frames
  15149. generated per second. It has to be a string in the format
  15150. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15151. number or a valid video frame rate abbreviation. The default value is
  15152. "25".
  15153. @item sar
  15154. Set the sample aspect ratio of the sourced video.
  15155. @item duration, d
  15156. Set the duration of the sourced video. See
  15157. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15158. for the accepted syntax.
  15159. If not specified, or the expressed duration is negative, the video is
  15160. supposed to be generated forever.
  15161. @end table
  15162. Additionally, all options of the @ref{coreimage} video filter are accepted.
  15163. A complete filterchain can be used for further processing of the
  15164. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  15165. and examples for details.
  15166. @subsection Examples
  15167. @itemize
  15168. @item
  15169. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  15170. given as complete and escaped command-line for Apple's standard bash shell:
  15171. @example
  15172. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  15173. @end example
  15174. This example is equivalent to the QRCode example of @ref{coreimage} without the
  15175. need for a nullsrc video source.
  15176. @end itemize
  15177. @section mandelbrot
  15178. Generate a Mandelbrot set fractal, and progressively zoom towards the
  15179. point specified with @var{start_x} and @var{start_y}.
  15180. This source accepts the following options:
  15181. @table @option
  15182. @item end_pts
  15183. Set the terminal pts value. Default value is 400.
  15184. @item end_scale
  15185. Set the terminal scale value.
  15186. Must be a floating point value. Default value is 0.3.
  15187. @item inner
  15188. Set the inner coloring mode, that is the algorithm used to draw the
  15189. Mandelbrot fractal internal region.
  15190. It shall assume one of the following values:
  15191. @table @option
  15192. @item black
  15193. Set black mode.
  15194. @item convergence
  15195. Show time until convergence.
  15196. @item mincol
  15197. Set color based on point closest to the origin of the iterations.
  15198. @item period
  15199. Set period mode.
  15200. @end table
  15201. Default value is @var{mincol}.
  15202. @item bailout
  15203. Set the bailout value. Default value is 10.0.
  15204. @item maxiter
  15205. Set the maximum of iterations performed by the rendering
  15206. algorithm. Default value is 7189.
  15207. @item outer
  15208. Set outer coloring mode.
  15209. It shall assume one of following values:
  15210. @table @option
  15211. @item iteration_count
  15212. Set iteration count mode.
  15213. @item normalized_iteration_count
  15214. set normalized iteration count mode.
  15215. @end table
  15216. Default value is @var{normalized_iteration_count}.
  15217. @item rate, r
  15218. Set frame rate, expressed as number of frames per second. Default
  15219. value is "25".
  15220. @item size, s
  15221. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15222. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15223. @item start_scale
  15224. Set the initial scale value. Default value is 3.0.
  15225. @item start_x
  15226. Set the initial x position. Must be a floating point value between
  15227. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15228. @item start_y
  15229. Set the initial y position. Must be a floating point value between
  15230. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15231. @end table
  15232. @section mptestsrc
  15233. Generate various test patterns, as generated by the MPlayer test filter.
  15234. The size of the generated video is fixed, and is 256x256.
  15235. This source is useful in particular for testing encoding features.
  15236. This source accepts the following options:
  15237. @table @option
  15238. @item rate, r
  15239. Specify the frame rate of the sourced video, as the number of frames
  15240. generated per second. It has to be a string in the format
  15241. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15242. number or a valid video frame rate abbreviation. The default value is
  15243. "25".
  15244. @item duration, d
  15245. Set the duration of the sourced video. See
  15246. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15247. for the accepted syntax.
  15248. If not specified, or the expressed duration is negative, the video is
  15249. supposed to be generated forever.
  15250. @item test, t
  15251. Set the number or the name of the test to perform. Supported tests are:
  15252. @table @option
  15253. @item dc_luma
  15254. @item dc_chroma
  15255. @item freq_luma
  15256. @item freq_chroma
  15257. @item amp_luma
  15258. @item amp_chroma
  15259. @item cbp
  15260. @item mv
  15261. @item ring1
  15262. @item ring2
  15263. @item all
  15264. @end table
  15265. Default value is "all", which will cycle through the list of all tests.
  15266. @end table
  15267. Some examples:
  15268. @example
  15269. mptestsrc=t=dc_luma
  15270. @end example
  15271. will generate a "dc_luma" test pattern.
  15272. @section frei0r_src
  15273. Provide a frei0r source.
  15274. To enable compilation of this filter you need to install the frei0r
  15275. header and configure FFmpeg with @code{--enable-frei0r}.
  15276. This source accepts the following parameters:
  15277. @table @option
  15278. @item size
  15279. The size of the video to generate. For the syntax of this option, check the
  15280. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15281. @item framerate
  15282. The framerate of the generated video. It may be a string of the form
  15283. @var{num}/@var{den} or a frame rate abbreviation.
  15284. @item filter_name
  15285. The name to the frei0r source to load. For more information regarding frei0r and
  15286. how to set the parameters, read the @ref{frei0r} section in the video filters
  15287. documentation.
  15288. @item filter_params
  15289. A '|'-separated list of parameters to pass to the frei0r source.
  15290. @end table
  15291. For example, to generate a frei0r partik0l source with size 200x200
  15292. and frame rate 10 which is overlaid on the overlay filter main input:
  15293. @example
  15294. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15295. @end example
  15296. @section life
  15297. Generate a life pattern.
  15298. This source is based on a generalization of John Conway's life game.
  15299. The sourced input represents a life grid, each pixel represents a cell
  15300. which can be in one of two possible states, alive or dead. Every cell
  15301. interacts with its eight neighbours, which are the cells that are
  15302. horizontally, vertically, or diagonally adjacent.
  15303. At each interaction the grid evolves according to the adopted rule,
  15304. which specifies the number of neighbor alive cells which will make a
  15305. cell stay alive or born. The @option{rule} option allows one to specify
  15306. the rule to adopt.
  15307. This source accepts the following options:
  15308. @table @option
  15309. @item filename, f
  15310. Set the file from which to read the initial grid state. In the file,
  15311. each non-whitespace character is considered an alive cell, and newline
  15312. is used to delimit the end of each row.
  15313. If this option is not specified, the initial grid is generated
  15314. randomly.
  15315. @item rate, r
  15316. Set the video rate, that is the number of frames generated per second.
  15317. Default is 25.
  15318. @item random_fill_ratio, ratio
  15319. Set the random fill ratio for the initial random grid. It is a
  15320. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15321. It is ignored when a file is specified.
  15322. @item random_seed, seed
  15323. Set the seed for filling the initial random grid, must be an integer
  15324. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15325. set to -1, the filter will try to use a good random seed on a best
  15326. effort basis.
  15327. @item rule
  15328. Set the life rule.
  15329. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15330. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15331. @var{NS} specifies the number of alive neighbor cells which make a
  15332. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15333. which make a dead cell to become alive (i.e. to "born").
  15334. "s" and "b" can be used in place of "S" and "B", respectively.
  15335. Alternatively a rule can be specified by an 18-bits integer. The 9
  15336. high order bits are used to encode the next cell state if it is alive
  15337. for each number of neighbor alive cells, the low order bits specify
  15338. the rule for "borning" new cells. Higher order bits encode for an
  15339. higher number of neighbor cells.
  15340. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15341. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15342. Default value is "S23/B3", which is the original Conway's game of life
  15343. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15344. cells, and will born a new cell if there are three alive cells around
  15345. a dead cell.
  15346. @item size, s
  15347. Set the size of the output video. For the syntax of this option, check the
  15348. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15349. If @option{filename} is specified, the size is set by default to the
  15350. same size of the input file. If @option{size} is set, it must contain
  15351. the size specified in the input file, and the initial grid defined in
  15352. that file is centered in the larger resulting area.
  15353. If a filename is not specified, the size value defaults to "320x240"
  15354. (used for a randomly generated initial grid).
  15355. @item stitch
  15356. If set to 1, stitch the left and right grid edges together, and the
  15357. top and bottom edges also. Defaults to 1.
  15358. @item mold
  15359. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15360. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15361. value from 0 to 255.
  15362. @item life_color
  15363. Set the color of living (or new born) cells.
  15364. @item death_color
  15365. Set the color of dead cells. If @option{mold} is set, this is the first color
  15366. used to represent a dead cell.
  15367. @item mold_color
  15368. Set mold color, for definitely dead and moldy cells.
  15369. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15370. ffmpeg-utils manual,ffmpeg-utils}.
  15371. @end table
  15372. @subsection Examples
  15373. @itemize
  15374. @item
  15375. Read a grid from @file{pattern}, and center it on a grid of size
  15376. 300x300 pixels:
  15377. @example
  15378. life=f=pattern:s=300x300
  15379. @end example
  15380. @item
  15381. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15382. @example
  15383. life=ratio=2/3:s=200x200
  15384. @end example
  15385. @item
  15386. Specify a custom rule for evolving a randomly generated grid:
  15387. @example
  15388. life=rule=S14/B34
  15389. @end example
  15390. @item
  15391. Full example with slow death effect (mold) using @command{ffplay}:
  15392. @example
  15393. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15394. @end example
  15395. @end itemize
  15396. @anchor{allrgb}
  15397. @anchor{allyuv}
  15398. @anchor{color}
  15399. @anchor{haldclutsrc}
  15400. @anchor{nullsrc}
  15401. @anchor{pal75bars}
  15402. @anchor{pal100bars}
  15403. @anchor{rgbtestsrc}
  15404. @anchor{smptebars}
  15405. @anchor{smptehdbars}
  15406. @anchor{testsrc}
  15407. @anchor{testsrc2}
  15408. @anchor{yuvtestsrc}
  15409. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15410. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15411. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15412. The @code{color} source provides an uniformly colored input.
  15413. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15414. @ref{haldclut} filter.
  15415. The @code{nullsrc} source returns unprocessed video frames. It is
  15416. mainly useful to be employed in analysis / debugging tools, or as the
  15417. source for filters which ignore the input data.
  15418. The @code{pal75bars} source generates a color bars pattern, based on
  15419. EBU PAL recommendations with 75% color levels.
  15420. The @code{pal100bars} source generates a color bars pattern, based on
  15421. EBU PAL recommendations with 100% color levels.
  15422. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15423. detecting RGB vs BGR issues. You should see a red, green and blue
  15424. stripe from top to bottom.
  15425. The @code{smptebars} source generates a color bars pattern, based on
  15426. the SMPTE Engineering Guideline EG 1-1990.
  15427. The @code{smptehdbars} source generates a color bars pattern, based on
  15428. the SMPTE RP 219-2002.
  15429. The @code{testsrc} source generates a test video pattern, showing a
  15430. color pattern, a scrolling gradient and a timestamp. This is mainly
  15431. intended for testing purposes.
  15432. The @code{testsrc2} source is similar to testsrc, but supports more
  15433. pixel formats instead of just @code{rgb24}. This allows using it as an
  15434. input for other tests without requiring a format conversion.
  15435. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15436. see a y, cb and cr stripe from top to bottom.
  15437. The sources accept the following parameters:
  15438. @table @option
  15439. @item level
  15440. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15441. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15442. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15443. coded on a @code{1/(N*N)} scale.
  15444. @item color, c
  15445. Specify the color of the source, only available in the @code{color}
  15446. source. For the syntax of this option, check the
  15447. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15448. @item size, s
  15449. Specify the size of the sourced video. For the syntax of this option, check the
  15450. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15451. The default value is @code{320x240}.
  15452. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15453. @code{haldclutsrc} filters.
  15454. @item rate, r
  15455. Specify the frame rate of the sourced video, as the number of frames
  15456. generated per second. It has to be a string in the format
  15457. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15458. number or a valid video frame rate abbreviation. The default value is
  15459. "25".
  15460. @item duration, d
  15461. Set the duration of the sourced video. See
  15462. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15463. for the accepted syntax.
  15464. If not specified, or the expressed duration is negative, the video is
  15465. supposed to be generated forever.
  15466. @item sar
  15467. Set the sample aspect ratio of the sourced video.
  15468. @item alpha
  15469. Specify the alpha (opacity) of the background, only available in the
  15470. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15471. 255 (fully opaque, the default).
  15472. @item decimals, n
  15473. Set the number of decimals to show in the timestamp, only available in the
  15474. @code{testsrc} source.
  15475. The displayed timestamp value will correspond to the original
  15476. timestamp value multiplied by the power of 10 of the specified
  15477. value. Default value is 0.
  15478. @end table
  15479. @subsection Examples
  15480. @itemize
  15481. @item
  15482. Generate a video with a duration of 5.3 seconds, with size
  15483. 176x144 and a frame rate of 10 frames per second:
  15484. @example
  15485. testsrc=duration=5.3:size=qcif:rate=10
  15486. @end example
  15487. @item
  15488. The following graph description will generate a red source
  15489. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15490. frames per second:
  15491. @example
  15492. color=c=red@@0.2:s=qcif:r=10
  15493. @end example
  15494. @item
  15495. If the input content is to be ignored, @code{nullsrc} can be used. The
  15496. following command generates noise in the luminance plane by employing
  15497. the @code{geq} filter:
  15498. @example
  15499. nullsrc=s=256x256, geq=random(1)*255:128:128
  15500. @end example
  15501. @end itemize
  15502. @subsection Commands
  15503. The @code{color} source supports the following commands:
  15504. @table @option
  15505. @item c, color
  15506. Set the color of the created image. Accepts the same syntax of the
  15507. corresponding @option{color} option.
  15508. @end table
  15509. @section openclsrc
  15510. Generate video using an OpenCL program.
  15511. @table @option
  15512. @item source
  15513. OpenCL program source file.
  15514. @item kernel
  15515. Kernel name in program.
  15516. @item size, s
  15517. Size of frames to generate. This must be set.
  15518. @item format
  15519. Pixel format to use for the generated frames. This must be set.
  15520. @item rate, r
  15521. Number of frames generated every second. Default value is '25'.
  15522. @end table
  15523. For details of how the program loading works, see the @ref{program_opencl}
  15524. filter.
  15525. Example programs:
  15526. @itemize
  15527. @item
  15528. Generate a colour ramp by setting pixel values from the position of the pixel
  15529. in the output image. (Note that this will work with all pixel formats, but
  15530. the generated output will not be the same.)
  15531. @verbatim
  15532. __kernel void ramp(__write_only image2d_t dst,
  15533. unsigned int index)
  15534. {
  15535. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15536. float4 val;
  15537. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15538. write_imagef(dst, loc, val);
  15539. }
  15540. @end verbatim
  15541. @item
  15542. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15543. @verbatim
  15544. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15545. unsigned int index)
  15546. {
  15547. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15548. float4 value = 0.0f;
  15549. int x = loc.x + index;
  15550. int y = loc.y + index;
  15551. while (x > 0 || y > 0) {
  15552. if (x % 3 == 1 && y % 3 == 1) {
  15553. value = 1.0f;
  15554. break;
  15555. }
  15556. x /= 3;
  15557. y /= 3;
  15558. }
  15559. write_imagef(dst, loc, value);
  15560. }
  15561. @end verbatim
  15562. @end itemize
  15563. @c man end VIDEO SOURCES
  15564. @chapter Video Sinks
  15565. @c man begin VIDEO SINKS
  15566. Below is a description of the currently available video sinks.
  15567. @section buffersink
  15568. Buffer video frames, and make them available to the end of the filter
  15569. graph.
  15570. This sink is mainly intended for programmatic use, in particular
  15571. through the interface defined in @file{libavfilter/buffersink.h}
  15572. or the options system.
  15573. It accepts a pointer to an AVBufferSinkContext structure, which
  15574. defines the incoming buffers' formats, to be passed as the opaque
  15575. parameter to @code{avfilter_init_filter} for initialization.
  15576. @section nullsink
  15577. Null video sink: do absolutely nothing with the input video. It is
  15578. mainly useful as a template and for use in analysis / debugging
  15579. tools.
  15580. @c man end VIDEO SINKS
  15581. @chapter Multimedia Filters
  15582. @c man begin MULTIMEDIA FILTERS
  15583. Below is a description of the currently available multimedia filters.
  15584. @section abitscope
  15585. Convert input audio to a video output, displaying the audio bit scope.
  15586. The filter accepts the following options:
  15587. @table @option
  15588. @item rate, r
  15589. Set frame rate, expressed as number of frames per second. Default
  15590. value is "25".
  15591. @item size, s
  15592. Specify the video size for the output. For the syntax of this option, check the
  15593. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15594. Default value is @code{1024x256}.
  15595. @item colors
  15596. Specify list of colors separated by space or by '|' which will be used to
  15597. draw channels. Unrecognized or missing colors will be replaced
  15598. by white color.
  15599. @end table
  15600. @section ahistogram
  15601. Convert input audio to a video output, displaying the volume histogram.
  15602. The filter accepts the following options:
  15603. @table @option
  15604. @item dmode
  15605. Specify how histogram is calculated.
  15606. It accepts the following values:
  15607. @table @samp
  15608. @item single
  15609. Use single histogram for all channels.
  15610. @item separate
  15611. Use separate histogram for each channel.
  15612. @end table
  15613. Default is @code{single}.
  15614. @item rate, r
  15615. Set frame rate, expressed as number of frames per second. Default
  15616. value is "25".
  15617. @item size, s
  15618. Specify the video size for the output. For the syntax of this option, check the
  15619. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15620. Default value is @code{hd720}.
  15621. @item scale
  15622. Set display scale.
  15623. It accepts the following values:
  15624. @table @samp
  15625. @item log
  15626. logarithmic
  15627. @item sqrt
  15628. square root
  15629. @item cbrt
  15630. cubic root
  15631. @item lin
  15632. linear
  15633. @item rlog
  15634. reverse logarithmic
  15635. @end table
  15636. Default is @code{log}.
  15637. @item ascale
  15638. Set amplitude scale.
  15639. It accepts the following values:
  15640. @table @samp
  15641. @item log
  15642. logarithmic
  15643. @item lin
  15644. linear
  15645. @end table
  15646. Default is @code{log}.
  15647. @item acount
  15648. Set how much frames to accumulate in histogram.
  15649. Default is 1. Setting this to -1 accumulates all frames.
  15650. @item rheight
  15651. Set histogram ratio of window height.
  15652. @item slide
  15653. Set sonogram sliding.
  15654. It accepts the following values:
  15655. @table @samp
  15656. @item replace
  15657. replace old rows with new ones.
  15658. @item scroll
  15659. scroll from top to bottom.
  15660. @end table
  15661. Default is @code{replace}.
  15662. @end table
  15663. @section aphasemeter
  15664. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  15665. representing mean phase of current audio frame. A video output can also be produced and is
  15666. enabled by default. The audio is passed through as first output.
  15667. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  15668. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  15669. and @code{1} means channels are in phase.
  15670. The filter accepts the following options, all related to its video output:
  15671. @table @option
  15672. @item rate, r
  15673. Set the output frame rate. Default value is @code{25}.
  15674. @item size, s
  15675. Set the video size for the output. For the syntax of this option, check the
  15676. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15677. Default value is @code{800x400}.
  15678. @item rc
  15679. @item gc
  15680. @item bc
  15681. Specify the red, green, blue contrast. Default values are @code{2},
  15682. @code{7} and @code{1}.
  15683. Allowed range is @code{[0, 255]}.
  15684. @item mpc
  15685. Set color which will be used for drawing median phase. If color is
  15686. @code{none} which is default, no median phase value will be drawn.
  15687. @item video
  15688. Enable video output. Default is enabled.
  15689. @end table
  15690. @section avectorscope
  15691. Convert input audio to a video output, representing the audio vector
  15692. scope.
  15693. The filter is used to measure the difference between channels of stereo
  15694. audio stream. A monoaural signal, consisting of identical left and right
  15695. signal, results in straight vertical line. Any stereo separation is visible
  15696. as a deviation from this line, creating a Lissajous figure.
  15697. If the straight (or deviation from it) but horizontal line appears this
  15698. indicates that the left and right channels are out of phase.
  15699. The filter accepts the following options:
  15700. @table @option
  15701. @item mode, m
  15702. Set the vectorscope mode.
  15703. Available values are:
  15704. @table @samp
  15705. @item lissajous
  15706. Lissajous rotated by 45 degrees.
  15707. @item lissajous_xy
  15708. Same as above but not rotated.
  15709. @item polar
  15710. Shape resembling half of circle.
  15711. @end table
  15712. Default value is @samp{lissajous}.
  15713. @item size, s
  15714. Set the video size for the output. For the syntax of this option, check the
  15715. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15716. Default value is @code{400x400}.
  15717. @item rate, r
  15718. Set the output frame rate. Default value is @code{25}.
  15719. @item rc
  15720. @item gc
  15721. @item bc
  15722. @item ac
  15723. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  15724. @code{160}, @code{80} and @code{255}.
  15725. Allowed range is @code{[0, 255]}.
  15726. @item rf
  15727. @item gf
  15728. @item bf
  15729. @item af
  15730. Specify the red, green, blue and alpha fade. Default values are @code{15},
  15731. @code{10}, @code{5} and @code{5}.
  15732. Allowed range is @code{[0, 255]}.
  15733. @item zoom
  15734. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  15735. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  15736. @item draw
  15737. Set the vectorscope drawing mode.
  15738. Available values are:
  15739. @table @samp
  15740. @item dot
  15741. Draw dot for each sample.
  15742. @item line
  15743. Draw line between previous and current sample.
  15744. @end table
  15745. Default value is @samp{dot}.
  15746. @item scale
  15747. Specify amplitude scale of audio samples.
  15748. Available values are:
  15749. @table @samp
  15750. @item lin
  15751. Linear.
  15752. @item sqrt
  15753. Square root.
  15754. @item cbrt
  15755. Cubic root.
  15756. @item log
  15757. Logarithmic.
  15758. @end table
  15759. @item swap
  15760. Swap left channel axis with right channel axis.
  15761. @item mirror
  15762. Mirror axis.
  15763. @table @samp
  15764. @item none
  15765. No mirror.
  15766. @item x
  15767. Mirror only x axis.
  15768. @item y
  15769. Mirror only y axis.
  15770. @item xy
  15771. Mirror both axis.
  15772. @end table
  15773. @end table
  15774. @subsection Examples
  15775. @itemize
  15776. @item
  15777. Complete example using @command{ffplay}:
  15778. @example
  15779. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15780. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  15781. @end example
  15782. @end itemize
  15783. @section bench, abench
  15784. Benchmark part of a filtergraph.
  15785. The filter accepts the following options:
  15786. @table @option
  15787. @item action
  15788. Start or stop a timer.
  15789. Available values are:
  15790. @table @samp
  15791. @item start
  15792. Get the current time, set it as frame metadata (using the key
  15793. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  15794. @item stop
  15795. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  15796. the input frame metadata to get the time difference. Time difference, average,
  15797. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  15798. @code{min}) are then printed. The timestamps are expressed in seconds.
  15799. @end table
  15800. @end table
  15801. @subsection Examples
  15802. @itemize
  15803. @item
  15804. Benchmark @ref{selectivecolor} filter:
  15805. @example
  15806. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  15807. @end example
  15808. @end itemize
  15809. @section concat
  15810. Concatenate audio and video streams, joining them together one after the
  15811. other.
  15812. The filter works on segments of synchronized video and audio streams. All
  15813. segments must have the same number of streams of each type, and that will
  15814. also be the number of streams at output.
  15815. The filter accepts the following options:
  15816. @table @option
  15817. @item n
  15818. Set the number of segments. Default is 2.
  15819. @item v
  15820. Set the number of output video streams, that is also the number of video
  15821. streams in each segment. Default is 1.
  15822. @item a
  15823. Set the number of output audio streams, that is also the number of audio
  15824. streams in each segment. Default is 0.
  15825. @item unsafe
  15826. Activate unsafe mode: do not fail if segments have a different format.
  15827. @end table
  15828. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  15829. @var{a} audio outputs.
  15830. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  15831. segment, in the same order as the outputs, then the inputs for the second
  15832. segment, etc.
  15833. Related streams do not always have exactly the same duration, for various
  15834. reasons including codec frame size or sloppy authoring. For that reason,
  15835. related synchronized streams (e.g. a video and its audio track) should be
  15836. concatenated at once. The concat filter will use the duration of the longest
  15837. stream in each segment (except the last one), and if necessary pad shorter
  15838. audio streams with silence.
  15839. For this filter to work correctly, all segments must start at timestamp 0.
  15840. All corresponding streams must have the same parameters in all segments; the
  15841. filtering system will automatically select a common pixel format for video
  15842. streams, and a common sample format, sample rate and channel layout for
  15843. audio streams, but other settings, such as resolution, must be converted
  15844. explicitly by the user.
  15845. Different frame rates are acceptable but will result in variable frame rate
  15846. at output; be sure to configure the output file to handle it.
  15847. @subsection Examples
  15848. @itemize
  15849. @item
  15850. Concatenate an opening, an episode and an ending, all in bilingual version
  15851. (video in stream 0, audio in streams 1 and 2):
  15852. @example
  15853. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  15854. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  15855. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  15856. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  15857. @end example
  15858. @item
  15859. Concatenate two parts, handling audio and video separately, using the
  15860. (a)movie sources, and adjusting the resolution:
  15861. @example
  15862. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  15863. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  15864. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  15865. @end example
  15866. Note that a desync will happen at the stitch if the audio and video streams
  15867. do not have exactly the same duration in the first file.
  15868. @end itemize
  15869. @subsection Commands
  15870. This filter supports the following commands:
  15871. @table @option
  15872. @item next
  15873. Close the current segment and step to the next one
  15874. @end table
  15875. @section drawgraph, adrawgraph
  15876. Draw a graph using input video or audio metadata.
  15877. It accepts the following parameters:
  15878. @table @option
  15879. @item m1
  15880. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  15881. @item fg1
  15882. Set 1st foreground color expression.
  15883. @item m2
  15884. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  15885. @item fg2
  15886. Set 2nd foreground color expression.
  15887. @item m3
  15888. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  15889. @item fg3
  15890. Set 3rd foreground color expression.
  15891. @item m4
  15892. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  15893. @item fg4
  15894. Set 4th foreground color expression.
  15895. @item min
  15896. Set minimal value of metadata value.
  15897. @item max
  15898. Set maximal value of metadata value.
  15899. @item bg
  15900. Set graph background color. Default is white.
  15901. @item mode
  15902. Set graph mode.
  15903. Available values for mode is:
  15904. @table @samp
  15905. @item bar
  15906. @item dot
  15907. @item line
  15908. @end table
  15909. Default is @code{line}.
  15910. @item slide
  15911. Set slide mode.
  15912. Available values for slide is:
  15913. @table @samp
  15914. @item frame
  15915. Draw new frame when right border is reached.
  15916. @item replace
  15917. Replace old columns with new ones.
  15918. @item scroll
  15919. Scroll from right to left.
  15920. @item rscroll
  15921. Scroll from left to right.
  15922. @item picture
  15923. Draw single picture.
  15924. @end table
  15925. Default is @code{frame}.
  15926. @item size
  15927. Set size of graph video. For the syntax of this option, check the
  15928. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15929. The default value is @code{900x256}.
  15930. The foreground color expressions can use the following variables:
  15931. @table @option
  15932. @item MIN
  15933. Minimal value of metadata value.
  15934. @item MAX
  15935. Maximal value of metadata value.
  15936. @item VAL
  15937. Current metadata key value.
  15938. @end table
  15939. The color is defined as 0xAABBGGRR.
  15940. @end table
  15941. Example using metadata from @ref{signalstats} filter:
  15942. @example
  15943. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  15944. @end example
  15945. Example using metadata from @ref{ebur128} filter:
  15946. @example
  15947. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  15948. @end example
  15949. @anchor{ebur128}
  15950. @section ebur128
  15951. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  15952. level. By default, it logs a message at a frequency of 10Hz with the
  15953. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  15954. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  15955. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  15956. sample format is double-precision floating point. The input stream will be converted to
  15957. this specification, if needed. Users may need to insert aformat and/or aresample filters
  15958. after this filter to obtain the original parameters.
  15959. The filter also has a video output (see the @var{video} option) with a real
  15960. time graph to observe the loudness evolution. The graphic contains the logged
  15961. message mentioned above, so it is not printed anymore when this option is set,
  15962. unless the verbose logging is set. The main graphing area contains the
  15963. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  15964. the momentary loudness (400 milliseconds), but can optionally be configured
  15965. to instead display short-term loudness (see @var{gauge}).
  15966. The green area marks a +/- 1LU target range around the target loudness
  15967. (-23LUFS by default, unless modified through @var{target}).
  15968. More information about the Loudness Recommendation EBU R128 on
  15969. @url{http://tech.ebu.ch/loudness}.
  15970. The filter accepts the following options:
  15971. @table @option
  15972. @item video
  15973. Activate the video output. The audio stream is passed unchanged whether this
  15974. option is set or no. The video stream will be the first output stream if
  15975. activated. Default is @code{0}.
  15976. @item size
  15977. Set the video size. This option is for video only. For the syntax of this
  15978. option, check the
  15979. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15980. Default and minimum resolution is @code{640x480}.
  15981. @item meter
  15982. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  15983. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  15984. other integer value between this range is allowed.
  15985. @item metadata
  15986. Set metadata injection. If set to @code{1}, the audio input will be segmented
  15987. into 100ms output frames, each of them containing various loudness information
  15988. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  15989. Default is @code{0}.
  15990. @item framelog
  15991. Force the frame logging level.
  15992. Available values are:
  15993. @table @samp
  15994. @item info
  15995. information logging level
  15996. @item verbose
  15997. verbose logging level
  15998. @end table
  15999. By default, the logging level is set to @var{info}. If the @option{video} or
  16000. the @option{metadata} options are set, it switches to @var{verbose}.
  16001. @item peak
  16002. Set peak mode(s).
  16003. Available modes can be cumulated (the option is a @code{flag} type). Possible
  16004. values are:
  16005. @table @samp
  16006. @item none
  16007. Disable any peak mode (default).
  16008. @item sample
  16009. Enable sample-peak mode.
  16010. Simple peak mode looking for the higher sample value. It logs a message
  16011. for sample-peak (identified by @code{SPK}).
  16012. @item true
  16013. Enable true-peak mode.
  16014. If enabled, the peak lookup is done on an over-sampled version of the input
  16015. stream for better peak accuracy. It logs a message for true-peak.
  16016. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  16017. This mode requires a build with @code{libswresample}.
  16018. @end table
  16019. @item dualmono
  16020. Treat mono input files as "dual mono". If a mono file is intended for playback
  16021. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  16022. If set to @code{true}, this option will compensate for this effect.
  16023. Multi-channel input files are not affected by this option.
  16024. @item panlaw
  16025. Set a specific pan law to be used for the measurement of dual mono files.
  16026. This parameter is optional, and has a default value of -3.01dB.
  16027. @item target
  16028. Set a specific target level (in LUFS) used as relative zero in the visualization.
  16029. This parameter is optional and has a default value of -23LUFS as specified
  16030. by EBU R128. However, material published online may prefer a level of -16LUFS
  16031. (e.g. for use with podcasts or video platforms).
  16032. @item gauge
  16033. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  16034. @code{shortterm}. By default the momentary value will be used, but in certain
  16035. scenarios it may be more useful to observe the short term value instead (e.g.
  16036. live mixing).
  16037. @item scale
  16038. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  16039. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  16040. video output, not the summary or continuous log output.
  16041. @end table
  16042. @subsection Examples
  16043. @itemize
  16044. @item
  16045. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  16046. @example
  16047. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  16048. @end example
  16049. @item
  16050. Run an analysis with @command{ffmpeg}:
  16051. @example
  16052. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  16053. @end example
  16054. @end itemize
  16055. @section interleave, ainterleave
  16056. Temporally interleave frames from several inputs.
  16057. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  16058. These filters read frames from several inputs and send the oldest
  16059. queued frame to the output.
  16060. Input streams must have well defined, monotonically increasing frame
  16061. timestamp values.
  16062. In order to submit one frame to output, these filters need to enqueue
  16063. at least one frame for each input, so they cannot work in case one
  16064. input is not yet terminated and will not receive incoming frames.
  16065. For example consider the case when one input is a @code{select} filter
  16066. which always drops input frames. The @code{interleave} filter will keep
  16067. reading from that input, but it will never be able to send new frames
  16068. to output until the input sends an end-of-stream signal.
  16069. Also, depending on inputs synchronization, the filters will drop
  16070. frames in case one input receives more frames than the other ones, and
  16071. the queue is already filled.
  16072. These filters accept the following options:
  16073. @table @option
  16074. @item nb_inputs, n
  16075. Set the number of different inputs, it is 2 by default.
  16076. @end table
  16077. @subsection Examples
  16078. @itemize
  16079. @item
  16080. Interleave frames belonging to different streams using @command{ffmpeg}:
  16081. @example
  16082. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  16083. @end example
  16084. @item
  16085. Add flickering blur effect:
  16086. @example
  16087. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  16088. @end example
  16089. @end itemize
  16090. @section metadata, ametadata
  16091. Manipulate frame metadata.
  16092. This filter accepts the following options:
  16093. @table @option
  16094. @item mode
  16095. Set mode of operation of the filter.
  16096. Can be one of the following:
  16097. @table @samp
  16098. @item select
  16099. If both @code{value} and @code{key} is set, select frames
  16100. which have such metadata. If only @code{key} is set, select
  16101. every frame that has such key in metadata.
  16102. @item add
  16103. Add new metadata @code{key} and @code{value}. If key is already available
  16104. do nothing.
  16105. @item modify
  16106. Modify value of already present key.
  16107. @item delete
  16108. If @code{value} is set, delete only keys that have such value.
  16109. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  16110. the frame.
  16111. @item print
  16112. Print key and its value if metadata was found. If @code{key} is not set print all
  16113. metadata values available in frame.
  16114. @end table
  16115. @item key
  16116. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  16117. @item value
  16118. Set metadata value which will be used. This option is mandatory for
  16119. @code{modify} and @code{add} mode.
  16120. @item function
  16121. Which function to use when comparing metadata value and @code{value}.
  16122. Can be one of following:
  16123. @table @samp
  16124. @item same_str
  16125. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  16126. @item starts_with
  16127. Values are interpreted as strings, returns true if metadata value starts with
  16128. the @code{value} option string.
  16129. @item less
  16130. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  16131. @item equal
  16132. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  16133. @item greater
  16134. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  16135. @item expr
  16136. Values are interpreted as floats, returns true if expression from option @code{expr}
  16137. evaluates to true.
  16138. @end table
  16139. @item expr
  16140. Set expression which is used when @code{function} is set to @code{expr}.
  16141. The expression is evaluated through the eval API and can contain the following
  16142. constants:
  16143. @table @option
  16144. @item VALUE1
  16145. Float representation of @code{value} from metadata key.
  16146. @item VALUE2
  16147. Float representation of @code{value} as supplied by user in @code{value} option.
  16148. @end table
  16149. @item file
  16150. If specified in @code{print} mode, output is written to the named file. Instead of
  16151. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  16152. for standard output. If @code{file} option is not set, output is written to the log
  16153. with AV_LOG_INFO loglevel.
  16154. @end table
  16155. @subsection Examples
  16156. @itemize
  16157. @item
  16158. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  16159. between 0 and 1.
  16160. @example
  16161. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  16162. @end example
  16163. @item
  16164. Print silencedetect output to file @file{metadata.txt}.
  16165. @example
  16166. silencedetect,ametadata=mode=print:file=metadata.txt
  16167. @end example
  16168. @item
  16169. Direct all metadata to a pipe with file descriptor 4.
  16170. @example
  16171. metadata=mode=print:file='pipe\:4'
  16172. @end example
  16173. @end itemize
  16174. @section perms, aperms
  16175. Set read/write permissions for the output frames.
  16176. These filters are mainly aimed at developers to test direct path in the
  16177. following filter in the filtergraph.
  16178. The filters accept the following options:
  16179. @table @option
  16180. @item mode
  16181. Select the permissions mode.
  16182. It accepts the following values:
  16183. @table @samp
  16184. @item none
  16185. Do nothing. This is the default.
  16186. @item ro
  16187. Set all the output frames read-only.
  16188. @item rw
  16189. Set all the output frames directly writable.
  16190. @item toggle
  16191. Make the frame read-only if writable, and writable if read-only.
  16192. @item random
  16193. Set each output frame read-only or writable randomly.
  16194. @end table
  16195. @item seed
  16196. Set the seed for the @var{random} mode, must be an integer included between
  16197. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16198. @code{-1}, the filter will try to use a good random seed on a best effort
  16199. basis.
  16200. @end table
  16201. Note: in case of auto-inserted filter between the permission filter and the
  16202. following one, the permission might not be received as expected in that
  16203. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16204. perms/aperms filter can avoid this problem.
  16205. @section realtime, arealtime
  16206. Slow down filtering to match real time approximately.
  16207. These filters will pause the filtering for a variable amount of time to
  16208. match the output rate with the input timestamps.
  16209. They are similar to the @option{re} option to @code{ffmpeg}.
  16210. They accept the following options:
  16211. @table @option
  16212. @item limit
  16213. Time limit for the pauses. Any pause longer than that will be considered
  16214. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16215. @item speed
  16216. Speed factor for processing. The value must be a float larger than zero.
  16217. Values larger than 1.0 will result in faster than realtime processing,
  16218. smaller will slow processing down. The @var{limit} is automatically adapted
  16219. accordingly. Default is 1.0.
  16220. A processing speed faster than what is possible without these filters cannot
  16221. be achieved.
  16222. @end table
  16223. @anchor{select}
  16224. @section select, aselect
  16225. Select frames to pass in output.
  16226. This filter accepts the following options:
  16227. @table @option
  16228. @item expr, e
  16229. Set expression, which is evaluated for each input frame.
  16230. If the expression is evaluated to zero, the frame is discarded.
  16231. If the evaluation result is negative or NaN, the frame is sent to the
  16232. first output; otherwise it is sent to the output with index
  16233. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16234. For example a value of @code{1.2} corresponds to the output with index
  16235. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16236. @item outputs, n
  16237. Set the number of outputs. The output to which to send the selected
  16238. frame is based on the result of the evaluation. Default value is 1.
  16239. @end table
  16240. The expression can contain the following constants:
  16241. @table @option
  16242. @item n
  16243. The (sequential) number of the filtered frame, starting from 0.
  16244. @item selected_n
  16245. The (sequential) number of the selected frame, starting from 0.
  16246. @item prev_selected_n
  16247. The sequential number of the last selected frame. It's NAN if undefined.
  16248. @item TB
  16249. The timebase of the input timestamps.
  16250. @item pts
  16251. The PTS (Presentation TimeStamp) of the filtered video frame,
  16252. expressed in @var{TB} units. It's NAN if undefined.
  16253. @item t
  16254. The PTS of the filtered video frame,
  16255. expressed in seconds. It's NAN if undefined.
  16256. @item prev_pts
  16257. The PTS of the previously filtered video frame. It's NAN if undefined.
  16258. @item prev_selected_pts
  16259. The PTS of the last previously filtered video frame. It's NAN if undefined.
  16260. @item prev_selected_t
  16261. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  16262. @item start_pts
  16263. The PTS of the first video frame in the video. It's NAN if undefined.
  16264. @item start_t
  16265. The time of the first video frame in the video. It's NAN if undefined.
  16266. @item pict_type @emph{(video only)}
  16267. The type of the filtered frame. It can assume one of the following
  16268. values:
  16269. @table @option
  16270. @item I
  16271. @item P
  16272. @item B
  16273. @item S
  16274. @item SI
  16275. @item SP
  16276. @item BI
  16277. @end table
  16278. @item interlace_type @emph{(video only)}
  16279. The frame interlace type. It can assume one of the following values:
  16280. @table @option
  16281. @item PROGRESSIVE
  16282. The frame is progressive (not interlaced).
  16283. @item TOPFIRST
  16284. The frame is top-field-first.
  16285. @item BOTTOMFIRST
  16286. The frame is bottom-field-first.
  16287. @end table
  16288. @item consumed_sample_n @emph{(audio only)}
  16289. the number of selected samples before the current frame
  16290. @item samples_n @emph{(audio only)}
  16291. the number of samples in the current frame
  16292. @item sample_rate @emph{(audio only)}
  16293. the input sample rate
  16294. @item key
  16295. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16296. @item pos
  16297. the position in the file of the filtered frame, -1 if the information
  16298. is not available (e.g. for synthetic video)
  16299. @item scene @emph{(video only)}
  16300. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16301. probability for the current frame to introduce a new scene, while a higher
  16302. value means the current frame is more likely to be one (see the example below)
  16303. @item concatdec_select
  16304. The concat demuxer can select only part of a concat input file by setting an
  16305. inpoint and an outpoint, but the output packets may not be entirely contained
  16306. in the selected interval. By using this variable, it is possible to skip frames
  16307. generated by the concat demuxer which are not exactly contained in the selected
  16308. interval.
  16309. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16310. and the @var{lavf.concat.duration} packet metadata values which are also
  16311. present in the decoded frames.
  16312. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16313. start_time and either the duration metadata is missing or the frame pts is less
  16314. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16315. missing.
  16316. That basically means that an input frame is selected if its pts is within the
  16317. interval set by the concat demuxer.
  16318. @end table
  16319. The default value of the select expression is "1".
  16320. @subsection Examples
  16321. @itemize
  16322. @item
  16323. Select all frames in input:
  16324. @example
  16325. select
  16326. @end example
  16327. The example above is the same as:
  16328. @example
  16329. select=1
  16330. @end example
  16331. @item
  16332. Skip all frames:
  16333. @example
  16334. select=0
  16335. @end example
  16336. @item
  16337. Select only I-frames:
  16338. @example
  16339. select='eq(pict_type\,I)'
  16340. @end example
  16341. @item
  16342. Select one frame every 100:
  16343. @example
  16344. select='not(mod(n\,100))'
  16345. @end example
  16346. @item
  16347. Select only frames contained in the 10-20 time interval:
  16348. @example
  16349. select=between(t\,10\,20)
  16350. @end example
  16351. @item
  16352. Select only I-frames contained in the 10-20 time interval:
  16353. @example
  16354. select=between(t\,10\,20)*eq(pict_type\,I)
  16355. @end example
  16356. @item
  16357. Select frames with a minimum distance of 10 seconds:
  16358. @example
  16359. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16360. @end example
  16361. @item
  16362. Use aselect to select only audio frames with samples number > 100:
  16363. @example
  16364. aselect='gt(samples_n\,100)'
  16365. @end example
  16366. @item
  16367. Create a mosaic of the first scenes:
  16368. @example
  16369. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16370. @end example
  16371. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16372. choice.
  16373. @item
  16374. Send even and odd frames to separate outputs, and compose them:
  16375. @example
  16376. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16377. @end example
  16378. @item
  16379. Select useful frames from an ffconcat file which is using inpoints and
  16380. outpoints but where the source files are not intra frame only.
  16381. @example
  16382. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16383. @end example
  16384. @end itemize
  16385. @section sendcmd, asendcmd
  16386. Send commands to filters in the filtergraph.
  16387. These filters read commands to be sent to other filters in the
  16388. filtergraph.
  16389. @code{sendcmd} must be inserted between two video filters,
  16390. @code{asendcmd} must be inserted between two audio filters, but apart
  16391. from that they act the same way.
  16392. The specification of commands can be provided in the filter arguments
  16393. with the @var{commands} option, or in a file specified by the
  16394. @var{filename} option.
  16395. These filters accept the following options:
  16396. @table @option
  16397. @item commands, c
  16398. Set the commands to be read and sent to the other filters.
  16399. @item filename, f
  16400. Set the filename of the commands to be read and sent to the other
  16401. filters.
  16402. @end table
  16403. @subsection Commands syntax
  16404. A commands description consists of a sequence of interval
  16405. specifications, comprising a list of commands to be executed when a
  16406. particular event related to that interval occurs. The occurring event
  16407. is typically the current frame time entering or leaving a given time
  16408. interval.
  16409. An interval is specified by the following syntax:
  16410. @example
  16411. @var{START}[-@var{END}] @var{COMMANDS};
  16412. @end example
  16413. The time interval is specified by the @var{START} and @var{END} times.
  16414. @var{END} is optional and defaults to the maximum time.
  16415. The current frame time is considered within the specified interval if
  16416. it is included in the interval [@var{START}, @var{END}), that is when
  16417. the time is greater or equal to @var{START} and is lesser than
  16418. @var{END}.
  16419. @var{COMMANDS} consists of a sequence of one or more command
  16420. specifications, separated by ",", relating to that interval. The
  16421. syntax of a command specification is given by:
  16422. @example
  16423. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16424. @end example
  16425. @var{FLAGS} is optional and specifies the type of events relating to
  16426. the time interval which enable sending the specified command, and must
  16427. be a non-null sequence of identifier flags separated by "+" or "|" and
  16428. enclosed between "[" and "]".
  16429. The following flags are recognized:
  16430. @table @option
  16431. @item enter
  16432. The command is sent when the current frame timestamp enters the
  16433. specified interval. In other words, the command is sent when the
  16434. previous frame timestamp was not in the given interval, and the
  16435. current is.
  16436. @item leave
  16437. The command is sent when the current frame timestamp leaves the
  16438. specified interval. In other words, the command is sent when the
  16439. previous frame timestamp was in the given interval, and the
  16440. current is not.
  16441. @end table
  16442. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16443. assumed.
  16444. @var{TARGET} specifies the target of the command, usually the name of
  16445. the filter class or a specific filter instance name.
  16446. @var{COMMAND} specifies the name of the command for the target filter.
  16447. @var{ARG} is optional and specifies the optional list of argument for
  16448. the given @var{COMMAND}.
  16449. Between one interval specification and another, whitespaces, or
  16450. sequences of characters starting with @code{#} until the end of line,
  16451. are ignored and can be used to annotate comments.
  16452. A simplified BNF description of the commands specification syntax
  16453. follows:
  16454. @example
  16455. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16456. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16457. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16458. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16459. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16460. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16461. @end example
  16462. @subsection Examples
  16463. @itemize
  16464. @item
  16465. Specify audio tempo change at second 4:
  16466. @example
  16467. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16468. @end example
  16469. @item
  16470. Target a specific filter instance:
  16471. @example
  16472. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  16473. @end example
  16474. @item
  16475. Specify a list of drawtext and hue commands in a file.
  16476. @example
  16477. # show text in the interval 5-10
  16478. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  16479. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  16480. # desaturate the image in the interval 15-20
  16481. 15.0-20.0 [enter] hue s 0,
  16482. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16483. [leave] hue s 1,
  16484. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16485. # apply an exponential saturation fade-out effect, starting from time 25
  16486. 25 [enter] hue s exp(25-t)
  16487. @end example
  16488. A filtergraph allowing to read and process the above command list
  16489. stored in a file @file{test.cmd}, can be specified with:
  16490. @example
  16491. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16492. @end example
  16493. @end itemize
  16494. @anchor{setpts}
  16495. @section setpts, asetpts
  16496. Change the PTS (presentation timestamp) of the input frames.
  16497. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16498. This filter accepts the following options:
  16499. @table @option
  16500. @item expr
  16501. The expression which is evaluated for each frame to construct its timestamp.
  16502. @end table
  16503. The expression is evaluated through the eval API and can contain the following
  16504. constants:
  16505. @table @option
  16506. @item FRAME_RATE, FR
  16507. frame rate, only defined for constant frame-rate video
  16508. @item PTS
  16509. The presentation timestamp in input
  16510. @item N
  16511. The count of the input frame for video or the number of consumed samples,
  16512. not including the current frame for audio, starting from 0.
  16513. @item NB_CONSUMED_SAMPLES
  16514. The number of consumed samples, not including the current frame (only
  16515. audio)
  16516. @item NB_SAMPLES, S
  16517. The number of samples in the current frame (only audio)
  16518. @item SAMPLE_RATE, SR
  16519. The audio sample rate.
  16520. @item STARTPTS
  16521. The PTS of the first frame.
  16522. @item STARTT
  16523. the time in seconds of the first frame
  16524. @item INTERLACED
  16525. State whether the current frame is interlaced.
  16526. @item T
  16527. the time in seconds of the current frame
  16528. @item POS
  16529. original position in the file of the frame, or undefined if undefined
  16530. for the current frame
  16531. @item PREV_INPTS
  16532. The previous input PTS.
  16533. @item PREV_INT
  16534. previous input time in seconds
  16535. @item PREV_OUTPTS
  16536. The previous output PTS.
  16537. @item PREV_OUTT
  16538. previous output time in seconds
  16539. @item RTCTIME
  16540. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16541. instead.
  16542. @item RTCSTART
  16543. The wallclock (RTC) time at the start of the movie in microseconds.
  16544. @item TB
  16545. The timebase of the input timestamps.
  16546. @end table
  16547. @subsection Examples
  16548. @itemize
  16549. @item
  16550. Start counting PTS from zero
  16551. @example
  16552. setpts=PTS-STARTPTS
  16553. @end example
  16554. @item
  16555. Apply fast motion effect:
  16556. @example
  16557. setpts=0.5*PTS
  16558. @end example
  16559. @item
  16560. Apply slow motion effect:
  16561. @example
  16562. setpts=2.0*PTS
  16563. @end example
  16564. @item
  16565. Set fixed rate of 25 frames per second:
  16566. @example
  16567. setpts=N/(25*TB)
  16568. @end example
  16569. @item
  16570. Set fixed rate 25 fps with some jitter:
  16571. @example
  16572. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16573. @end example
  16574. @item
  16575. Apply an offset of 10 seconds to the input PTS:
  16576. @example
  16577. setpts=PTS+10/TB
  16578. @end example
  16579. @item
  16580. Generate timestamps from a "live source" and rebase onto the current timebase:
  16581. @example
  16582. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16583. @end example
  16584. @item
  16585. Generate timestamps by counting samples:
  16586. @example
  16587. asetpts=N/SR/TB
  16588. @end example
  16589. @end itemize
  16590. @section setrange
  16591. Force color range for the output video frame.
  16592. The @code{setrange} filter marks the color range property for the
  16593. output frames. It does not change the input frame, but only sets the
  16594. corresponding property, which affects how the frame is treated by
  16595. following filters.
  16596. The filter accepts the following options:
  16597. @table @option
  16598. @item range
  16599. Available values are:
  16600. @table @samp
  16601. @item auto
  16602. Keep the same color range property.
  16603. @item unspecified, unknown
  16604. Set the color range as unspecified.
  16605. @item limited, tv, mpeg
  16606. Set the color range as limited.
  16607. @item full, pc, jpeg
  16608. Set the color range as full.
  16609. @end table
  16610. @end table
  16611. @section settb, asettb
  16612. Set the timebase to use for the output frames timestamps.
  16613. It is mainly useful for testing timebase configuration.
  16614. It accepts the following parameters:
  16615. @table @option
  16616. @item expr, tb
  16617. The expression which is evaluated into the output timebase.
  16618. @end table
  16619. The value for @option{tb} is an arithmetic expression representing a
  16620. rational. The expression can contain the constants "AVTB" (the default
  16621. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16622. audio only). Default value is "intb".
  16623. @subsection Examples
  16624. @itemize
  16625. @item
  16626. Set the timebase to 1/25:
  16627. @example
  16628. settb=expr=1/25
  16629. @end example
  16630. @item
  16631. Set the timebase to 1/10:
  16632. @example
  16633. settb=expr=0.1
  16634. @end example
  16635. @item
  16636. Set the timebase to 1001/1000:
  16637. @example
  16638. settb=1+0.001
  16639. @end example
  16640. @item
  16641. Set the timebase to 2*intb:
  16642. @example
  16643. settb=2*intb
  16644. @end example
  16645. @item
  16646. Set the default timebase value:
  16647. @example
  16648. settb=AVTB
  16649. @end example
  16650. @end itemize
  16651. @section showcqt
  16652. Convert input audio to a video output representing frequency spectrum
  16653. logarithmically using Brown-Puckette constant Q transform algorithm with
  16654. direct frequency domain coefficient calculation (but the transform itself
  16655. is not really constant Q, instead the Q factor is actually variable/clamped),
  16656. with musical tone scale, from E0 to D#10.
  16657. The filter accepts the following options:
  16658. @table @option
  16659. @item size, s
  16660. Specify the video size for the output. It must be even. For the syntax of this option,
  16661. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16662. Default value is @code{1920x1080}.
  16663. @item fps, rate, r
  16664. Set the output frame rate. Default value is @code{25}.
  16665. @item bar_h
  16666. Set the bargraph height. It must be even. Default value is @code{-1} which
  16667. computes the bargraph height automatically.
  16668. @item axis_h
  16669. Set the axis height. It must be even. Default value is @code{-1} which computes
  16670. the axis height automatically.
  16671. @item sono_h
  16672. Set the sonogram height. It must be even. Default value is @code{-1} which
  16673. computes the sonogram height automatically.
  16674. @item fullhd
  16675. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  16676. instead. Default value is @code{1}.
  16677. @item sono_v, volume
  16678. Specify the sonogram volume expression. It can contain variables:
  16679. @table @option
  16680. @item bar_v
  16681. the @var{bar_v} evaluated expression
  16682. @item frequency, freq, f
  16683. the frequency where it is evaluated
  16684. @item timeclamp, tc
  16685. the value of @var{timeclamp} option
  16686. @end table
  16687. and functions:
  16688. @table @option
  16689. @item a_weighting(f)
  16690. A-weighting of equal loudness
  16691. @item b_weighting(f)
  16692. B-weighting of equal loudness
  16693. @item c_weighting(f)
  16694. C-weighting of equal loudness.
  16695. @end table
  16696. Default value is @code{16}.
  16697. @item bar_v, volume2
  16698. Specify the bargraph volume expression. It can contain variables:
  16699. @table @option
  16700. @item sono_v
  16701. the @var{sono_v} evaluated expression
  16702. @item frequency, freq, f
  16703. the frequency where it is evaluated
  16704. @item timeclamp, tc
  16705. the value of @var{timeclamp} option
  16706. @end table
  16707. and functions:
  16708. @table @option
  16709. @item a_weighting(f)
  16710. A-weighting of equal loudness
  16711. @item b_weighting(f)
  16712. B-weighting of equal loudness
  16713. @item c_weighting(f)
  16714. C-weighting of equal loudness.
  16715. @end table
  16716. Default value is @code{sono_v}.
  16717. @item sono_g, gamma
  16718. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  16719. higher gamma makes the spectrum having more range. Default value is @code{3}.
  16720. Acceptable range is @code{[1, 7]}.
  16721. @item bar_g, gamma2
  16722. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  16723. @code{[1, 7]}.
  16724. @item bar_t
  16725. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  16726. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  16727. @item timeclamp, tc
  16728. Specify the transform timeclamp. At low frequency, there is trade-off between
  16729. accuracy in time domain and frequency domain. If timeclamp is lower,
  16730. event in time domain is represented more accurately (such as fast bass drum),
  16731. otherwise event in frequency domain is represented more accurately
  16732. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  16733. @item attack
  16734. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  16735. limits future samples by applying asymmetric windowing in time domain, useful
  16736. when low latency is required. Accepted range is @code{[0, 1]}.
  16737. @item basefreq
  16738. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  16739. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  16740. @item endfreq
  16741. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  16742. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  16743. @item coeffclamp
  16744. This option is deprecated and ignored.
  16745. @item tlength
  16746. Specify the transform length in time domain. Use this option to control accuracy
  16747. trade-off between time domain and frequency domain at every frequency sample.
  16748. It can contain variables:
  16749. @table @option
  16750. @item frequency, freq, f
  16751. the frequency where it is evaluated
  16752. @item timeclamp, tc
  16753. the value of @var{timeclamp} option.
  16754. @end table
  16755. Default value is @code{384*tc/(384+tc*f)}.
  16756. @item count
  16757. Specify the transform count for every video frame. Default value is @code{6}.
  16758. Acceptable range is @code{[1, 30]}.
  16759. @item fcount
  16760. Specify the transform count for every single pixel. Default value is @code{0},
  16761. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  16762. @item fontfile
  16763. Specify font file for use with freetype to draw the axis. If not specified,
  16764. use embedded font. Note that drawing with font file or embedded font is not
  16765. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  16766. option instead.
  16767. @item font
  16768. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  16769. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  16770. @item fontcolor
  16771. Specify font color expression. This is arithmetic expression that should return
  16772. integer value 0xRRGGBB. It can contain variables:
  16773. @table @option
  16774. @item frequency, freq, f
  16775. the frequency where it is evaluated
  16776. @item timeclamp, tc
  16777. the value of @var{timeclamp} option
  16778. @end table
  16779. and functions:
  16780. @table @option
  16781. @item midi(f)
  16782. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  16783. @item r(x), g(x), b(x)
  16784. red, green, and blue value of intensity x.
  16785. @end table
  16786. Default value is @code{st(0, (midi(f)-59.5)/12);
  16787. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  16788. r(1-ld(1)) + b(ld(1))}.
  16789. @item axisfile
  16790. Specify image file to draw the axis. This option override @var{fontfile} and
  16791. @var{fontcolor} option.
  16792. @item axis, text
  16793. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  16794. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  16795. Default value is @code{1}.
  16796. @item csp
  16797. Set colorspace. The accepted values are:
  16798. @table @samp
  16799. @item unspecified
  16800. Unspecified (default)
  16801. @item bt709
  16802. BT.709
  16803. @item fcc
  16804. FCC
  16805. @item bt470bg
  16806. BT.470BG or BT.601-6 625
  16807. @item smpte170m
  16808. SMPTE-170M or BT.601-6 525
  16809. @item smpte240m
  16810. SMPTE-240M
  16811. @item bt2020ncl
  16812. BT.2020 with non-constant luminance
  16813. @end table
  16814. @item cscheme
  16815. Set spectrogram color scheme. This is list of floating point values with format
  16816. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  16817. The default is @code{1|0.5|0|0|0.5|1}.
  16818. @end table
  16819. @subsection Examples
  16820. @itemize
  16821. @item
  16822. Playing audio while showing the spectrum:
  16823. @example
  16824. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  16825. @end example
  16826. @item
  16827. Same as above, but with frame rate 30 fps:
  16828. @example
  16829. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  16830. @end example
  16831. @item
  16832. Playing at 1280x720:
  16833. @example
  16834. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  16835. @end example
  16836. @item
  16837. Disable sonogram display:
  16838. @example
  16839. sono_h=0
  16840. @end example
  16841. @item
  16842. A1 and its harmonics: A1, A2, (near)E3, A3:
  16843. @example
  16844. 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),
  16845. asplit[a][out1]; [a] showcqt [out0]'
  16846. @end example
  16847. @item
  16848. Same as above, but with more accuracy in frequency domain:
  16849. @example
  16850. 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),
  16851. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  16852. @end example
  16853. @item
  16854. Custom volume:
  16855. @example
  16856. bar_v=10:sono_v=bar_v*a_weighting(f)
  16857. @end example
  16858. @item
  16859. Custom gamma, now spectrum is linear to the amplitude.
  16860. @example
  16861. bar_g=2:sono_g=2
  16862. @end example
  16863. @item
  16864. Custom tlength equation:
  16865. @example
  16866. 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)))'
  16867. @end example
  16868. @item
  16869. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  16870. @example
  16871. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  16872. @end example
  16873. @item
  16874. Custom font using fontconfig:
  16875. @example
  16876. font='Courier New,Monospace,mono|bold'
  16877. @end example
  16878. @item
  16879. Custom frequency range with custom axis using image file:
  16880. @example
  16881. axisfile=myaxis.png:basefreq=40:endfreq=10000
  16882. @end example
  16883. @end itemize
  16884. @section showfreqs
  16885. Convert input audio to video output representing the audio power spectrum.
  16886. Audio amplitude is on Y-axis while frequency is on X-axis.
  16887. The filter accepts the following options:
  16888. @table @option
  16889. @item size, s
  16890. Specify size of video. For the syntax of this option, check the
  16891. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16892. Default is @code{1024x512}.
  16893. @item mode
  16894. Set display mode.
  16895. This set how each frequency bin will be represented.
  16896. It accepts the following values:
  16897. @table @samp
  16898. @item line
  16899. @item bar
  16900. @item dot
  16901. @end table
  16902. Default is @code{bar}.
  16903. @item ascale
  16904. Set amplitude scale.
  16905. It accepts the following values:
  16906. @table @samp
  16907. @item lin
  16908. Linear scale.
  16909. @item sqrt
  16910. Square root scale.
  16911. @item cbrt
  16912. Cubic root scale.
  16913. @item log
  16914. Logarithmic scale.
  16915. @end table
  16916. Default is @code{log}.
  16917. @item fscale
  16918. Set frequency scale.
  16919. It accepts the following values:
  16920. @table @samp
  16921. @item lin
  16922. Linear scale.
  16923. @item log
  16924. Logarithmic scale.
  16925. @item rlog
  16926. Reverse logarithmic scale.
  16927. @end table
  16928. Default is @code{lin}.
  16929. @item win_size
  16930. Set window size.
  16931. It accepts the following values:
  16932. @table @samp
  16933. @item w16
  16934. @item w32
  16935. @item w64
  16936. @item w128
  16937. @item w256
  16938. @item w512
  16939. @item w1024
  16940. @item w2048
  16941. @item w4096
  16942. @item w8192
  16943. @item w16384
  16944. @item w32768
  16945. @item w65536
  16946. @end table
  16947. Default is @code{w2048}
  16948. @item win_func
  16949. Set windowing function.
  16950. It accepts the following values:
  16951. @table @samp
  16952. @item rect
  16953. @item bartlett
  16954. @item hanning
  16955. @item hamming
  16956. @item blackman
  16957. @item welch
  16958. @item flattop
  16959. @item bharris
  16960. @item bnuttall
  16961. @item bhann
  16962. @item sine
  16963. @item nuttall
  16964. @item lanczos
  16965. @item gauss
  16966. @item tukey
  16967. @item dolph
  16968. @item cauchy
  16969. @item parzen
  16970. @item poisson
  16971. @item bohman
  16972. @end table
  16973. Default is @code{hanning}.
  16974. @item overlap
  16975. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16976. which means optimal overlap for selected window function will be picked.
  16977. @item averaging
  16978. Set time averaging. Setting this to 0 will display current maximal peaks.
  16979. Default is @code{1}, which means time averaging is disabled.
  16980. @item colors
  16981. Specify list of colors separated by space or by '|' which will be used to
  16982. draw channel frequencies. Unrecognized or missing colors will be replaced
  16983. by white color.
  16984. @item cmode
  16985. Set channel display mode.
  16986. It accepts the following values:
  16987. @table @samp
  16988. @item combined
  16989. @item separate
  16990. @end table
  16991. Default is @code{combined}.
  16992. @item minamp
  16993. Set minimum amplitude used in @code{log} amplitude scaler.
  16994. @end table
  16995. @section showspatial
  16996. Convert stereo input audio to a video output, representing the spatial relationship
  16997. between two channels.
  16998. The filter accepts the following options:
  16999. @table @option
  17000. @item size, s
  17001. Specify the video size for the output. For the syntax of this option, check the
  17002. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17003. Default value is @code{512x512}.
  17004. @item win_size
  17005. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  17006. @item win_func
  17007. Set window function.
  17008. It accepts the following values:
  17009. @table @samp
  17010. @item rect
  17011. @item bartlett
  17012. @item hann
  17013. @item hanning
  17014. @item hamming
  17015. @item blackman
  17016. @item welch
  17017. @item flattop
  17018. @item bharris
  17019. @item bnuttall
  17020. @item bhann
  17021. @item sine
  17022. @item nuttall
  17023. @item lanczos
  17024. @item gauss
  17025. @item tukey
  17026. @item dolph
  17027. @item cauchy
  17028. @item parzen
  17029. @item poisson
  17030. @item bohman
  17031. @end table
  17032. Default value is @code{hann}.
  17033. @item overlap
  17034. Set ratio of overlap window. Default value is @code{0.5}.
  17035. When value is @code{1} overlap is set to recommended size for specific
  17036. window function currently used.
  17037. @end table
  17038. @anchor{showspectrum}
  17039. @section showspectrum
  17040. Convert input audio to a video output, representing the audio frequency
  17041. spectrum.
  17042. The filter accepts the following options:
  17043. @table @option
  17044. @item size, s
  17045. Specify the video size for the output. For the syntax of this option, check the
  17046. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17047. Default value is @code{640x512}.
  17048. @item slide
  17049. Specify how the spectrum should slide along the window.
  17050. It accepts the following values:
  17051. @table @samp
  17052. @item replace
  17053. the samples start again on the left when they reach the right
  17054. @item scroll
  17055. the samples scroll from right to left
  17056. @item fullframe
  17057. frames are only produced when the samples reach the right
  17058. @item rscroll
  17059. the samples scroll from left to right
  17060. @end table
  17061. Default value is @code{replace}.
  17062. @item mode
  17063. Specify display mode.
  17064. It accepts the following values:
  17065. @table @samp
  17066. @item combined
  17067. all channels are displayed in the same row
  17068. @item separate
  17069. all channels are displayed in separate rows
  17070. @end table
  17071. Default value is @samp{combined}.
  17072. @item color
  17073. Specify display color mode.
  17074. It accepts the following values:
  17075. @table @samp
  17076. @item channel
  17077. each channel is displayed in a separate color
  17078. @item intensity
  17079. each channel is displayed using the same color scheme
  17080. @item rainbow
  17081. each channel is displayed using the rainbow color scheme
  17082. @item moreland
  17083. each channel is displayed using the moreland color scheme
  17084. @item nebulae
  17085. each channel is displayed using the nebulae color scheme
  17086. @item fire
  17087. each channel is displayed using the fire color scheme
  17088. @item fiery
  17089. each channel is displayed using the fiery color scheme
  17090. @item fruit
  17091. each channel is displayed using the fruit color scheme
  17092. @item cool
  17093. each channel is displayed using the cool color scheme
  17094. @item magma
  17095. each channel is displayed using the magma color scheme
  17096. @item green
  17097. each channel is displayed using the green color scheme
  17098. @item viridis
  17099. each channel is displayed using the viridis color scheme
  17100. @item plasma
  17101. each channel is displayed using the plasma color scheme
  17102. @item cividis
  17103. each channel is displayed using the cividis color scheme
  17104. @item terrain
  17105. each channel is displayed using the terrain color scheme
  17106. @end table
  17107. Default value is @samp{channel}.
  17108. @item scale
  17109. Specify scale used for calculating intensity color values.
  17110. It accepts the following values:
  17111. @table @samp
  17112. @item lin
  17113. linear
  17114. @item sqrt
  17115. square root, default
  17116. @item cbrt
  17117. cubic root
  17118. @item log
  17119. logarithmic
  17120. @item 4thrt
  17121. 4th root
  17122. @item 5thrt
  17123. 5th root
  17124. @end table
  17125. Default value is @samp{sqrt}.
  17126. @item fscale
  17127. Specify frequency scale.
  17128. It accepts the following values:
  17129. @table @samp
  17130. @item lin
  17131. linear
  17132. @item log
  17133. logarithmic
  17134. @end table
  17135. Default value is @samp{lin}.
  17136. @item saturation
  17137. Set saturation modifier for displayed colors. Negative values provide
  17138. alternative color scheme. @code{0} is no saturation at all.
  17139. Saturation must be in [-10.0, 10.0] range.
  17140. Default value is @code{1}.
  17141. @item win_func
  17142. Set window function.
  17143. It accepts the following values:
  17144. @table @samp
  17145. @item rect
  17146. @item bartlett
  17147. @item hann
  17148. @item hanning
  17149. @item hamming
  17150. @item blackman
  17151. @item welch
  17152. @item flattop
  17153. @item bharris
  17154. @item bnuttall
  17155. @item bhann
  17156. @item sine
  17157. @item nuttall
  17158. @item lanczos
  17159. @item gauss
  17160. @item tukey
  17161. @item dolph
  17162. @item cauchy
  17163. @item parzen
  17164. @item poisson
  17165. @item bohman
  17166. @end table
  17167. Default value is @code{hann}.
  17168. @item orientation
  17169. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17170. @code{horizontal}. Default is @code{vertical}.
  17171. @item overlap
  17172. Set ratio of overlap window. Default value is @code{0}.
  17173. When value is @code{1} overlap is set to recommended size for specific
  17174. window function currently used.
  17175. @item gain
  17176. Set scale gain for calculating intensity color values.
  17177. Default value is @code{1}.
  17178. @item data
  17179. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  17180. @item rotation
  17181. Set color rotation, must be in [-1.0, 1.0] range.
  17182. Default value is @code{0}.
  17183. @item start
  17184. Set start frequency from which to display spectrogram. Default is @code{0}.
  17185. @item stop
  17186. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17187. @item fps
  17188. Set upper frame rate limit. Default is @code{auto}, unlimited.
  17189. @item legend
  17190. Draw time and frequency axes and legends. Default is disabled.
  17191. @end table
  17192. The usage is very similar to the showwaves filter; see the examples in that
  17193. section.
  17194. @subsection Examples
  17195. @itemize
  17196. @item
  17197. Large window with logarithmic color scaling:
  17198. @example
  17199. showspectrum=s=1280x480:scale=log
  17200. @end example
  17201. @item
  17202. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  17203. @example
  17204. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17205. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  17206. @end example
  17207. @end itemize
  17208. @section showspectrumpic
  17209. Convert input audio to a single video frame, representing the audio frequency
  17210. spectrum.
  17211. The filter accepts the following options:
  17212. @table @option
  17213. @item size, s
  17214. Specify the video size for the output. For the syntax of this option, check the
  17215. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17216. Default value is @code{4096x2048}.
  17217. @item mode
  17218. Specify display mode.
  17219. It accepts the following values:
  17220. @table @samp
  17221. @item combined
  17222. all channels are displayed in the same row
  17223. @item separate
  17224. all channels are displayed in separate rows
  17225. @end table
  17226. Default value is @samp{combined}.
  17227. @item color
  17228. Specify display color mode.
  17229. It accepts the following values:
  17230. @table @samp
  17231. @item channel
  17232. each channel is displayed in a separate color
  17233. @item intensity
  17234. each channel is displayed using the same color scheme
  17235. @item rainbow
  17236. each channel is displayed using the rainbow color scheme
  17237. @item moreland
  17238. each channel is displayed using the moreland color scheme
  17239. @item nebulae
  17240. each channel is displayed using the nebulae color scheme
  17241. @item fire
  17242. each channel is displayed using the fire color scheme
  17243. @item fiery
  17244. each channel is displayed using the fiery color scheme
  17245. @item fruit
  17246. each channel is displayed using the fruit color scheme
  17247. @item cool
  17248. each channel is displayed using the cool color scheme
  17249. @item magma
  17250. each channel is displayed using the magma color scheme
  17251. @item green
  17252. each channel is displayed using the green color scheme
  17253. @item viridis
  17254. each channel is displayed using the viridis color scheme
  17255. @item plasma
  17256. each channel is displayed using the plasma color scheme
  17257. @item cividis
  17258. each channel is displayed using the cividis color scheme
  17259. @item terrain
  17260. each channel is displayed using the terrain color scheme
  17261. @end table
  17262. Default value is @samp{intensity}.
  17263. @item scale
  17264. Specify scale used for calculating intensity color values.
  17265. It accepts the following values:
  17266. @table @samp
  17267. @item lin
  17268. linear
  17269. @item sqrt
  17270. square root, default
  17271. @item cbrt
  17272. cubic root
  17273. @item log
  17274. logarithmic
  17275. @item 4thrt
  17276. 4th root
  17277. @item 5thrt
  17278. 5th root
  17279. @end table
  17280. Default value is @samp{log}.
  17281. @item fscale
  17282. Specify frequency scale.
  17283. It accepts the following values:
  17284. @table @samp
  17285. @item lin
  17286. linear
  17287. @item log
  17288. logarithmic
  17289. @end table
  17290. Default value is @samp{lin}.
  17291. @item saturation
  17292. Set saturation modifier for displayed colors. Negative values provide
  17293. alternative color scheme. @code{0} is no saturation at all.
  17294. Saturation must be in [-10.0, 10.0] range.
  17295. Default value is @code{1}.
  17296. @item win_func
  17297. Set window function.
  17298. It accepts the following values:
  17299. @table @samp
  17300. @item rect
  17301. @item bartlett
  17302. @item hann
  17303. @item hanning
  17304. @item hamming
  17305. @item blackman
  17306. @item welch
  17307. @item flattop
  17308. @item bharris
  17309. @item bnuttall
  17310. @item bhann
  17311. @item sine
  17312. @item nuttall
  17313. @item lanczos
  17314. @item gauss
  17315. @item tukey
  17316. @item dolph
  17317. @item cauchy
  17318. @item parzen
  17319. @item poisson
  17320. @item bohman
  17321. @end table
  17322. Default value is @code{hann}.
  17323. @item orientation
  17324. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17325. @code{horizontal}. Default is @code{vertical}.
  17326. @item gain
  17327. Set scale gain for calculating intensity color values.
  17328. Default value is @code{1}.
  17329. @item legend
  17330. Draw time and frequency axes and legends. Default is enabled.
  17331. @item rotation
  17332. Set color rotation, must be in [-1.0, 1.0] range.
  17333. Default value is @code{0}.
  17334. @item start
  17335. Set start frequency from which to display spectrogram. Default is @code{0}.
  17336. @item stop
  17337. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17338. @end table
  17339. @subsection Examples
  17340. @itemize
  17341. @item
  17342. Extract an audio spectrogram of a whole audio track
  17343. in a 1024x1024 picture using @command{ffmpeg}:
  17344. @example
  17345. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  17346. @end example
  17347. @end itemize
  17348. @section showvolume
  17349. Convert input audio volume to a video output.
  17350. The filter accepts the following options:
  17351. @table @option
  17352. @item rate, r
  17353. Set video rate.
  17354. @item b
  17355. Set border width, allowed range is [0, 5]. Default is 1.
  17356. @item w
  17357. Set channel width, allowed range is [80, 8192]. Default is 400.
  17358. @item h
  17359. Set channel height, allowed range is [1, 900]. Default is 20.
  17360. @item f
  17361. Set fade, allowed range is [0, 1]. Default is 0.95.
  17362. @item c
  17363. Set volume color expression.
  17364. The expression can use the following variables:
  17365. @table @option
  17366. @item VOLUME
  17367. Current max volume of channel in dB.
  17368. @item PEAK
  17369. Current peak.
  17370. @item CHANNEL
  17371. Current channel number, starting from 0.
  17372. @end table
  17373. @item t
  17374. If set, displays channel names. Default is enabled.
  17375. @item v
  17376. If set, displays volume values. Default is enabled.
  17377. @item o
  17378. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  17379. default is @code{h}.
  17380. @item s
  17381. Set step size, allowed range is [0, 5]. Default is 0, which means
  17382. step is disabled.
  17383. @item p
  17384. Set background opacity, allowed range is [0, 1]. Default is 0.
  17385. @item m
  17386. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17387. default is @code{p}.
  17388. @item ds
  17389. Set display scale, can be linear: @code{lin} or log: @code{log},
  17390. default is @code{lin}.
  17391. @item dm
  17392. In second.
  17393. If set to > 0., display a line for the max level
  17394. in the previous seconds.
  17395. default is disabled: @code{0.}
  17396. @item dmc
  17397. The color of the max line. Use when @code{dm} option is set to > 0.
  17398. default is: @code{orange}
  17399. @end table
  17400. @section showwaves
  17401. Convert input audio to a video output, representing the samples waves.
  17402. The filter accepts the following options:
  17403. @table @option
  17404. @item size, s
  17405. Specify the video size for the output. For the syntax of this option, check the
  17406. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17407. Default value is @code{600x240}.
  17408. @item mode
  17409. Set display mode.
  17410. Available values are:
  17411. @table @samp
  17412. @item point
  17413. Draw a point for each sample.
  17414. @item line
  17415. Draw a vertical line for each sample.
  17416. @item p2p
  17417. Draw a point for each sample and a line between them.
  17418. @item cline
  17419. Draw a centered vertical line for each sample.
  17420. @end table
  17421. Default value is @code{point}.
  17422. @item n
  17423. Set the number of samples which are printed on the same column. A
  17424. larger value will decrease the frame rate. Must be a positive
  17425. integer. This option can be set only if the value for @var{rate}
  17426. is not explicitly specified.
  17427. @item rate, r
  17428. Set the (approximate) output frame rate. This is done by setting the
  17429. option @var{n}. Default value is "25".
  17430. @item split_channels
  17431. Set if channels should be drawn separately or overlap. Default value is 0.
  17432. @item colors
  17433. Set colors separated by '|' which are going to be used for drawing of each channel.
  17434. @item scale
  17435. Set amplitude scale.
  17436. Available values are:
  17437. @table @samp
  17438. @item lin
  17439. Linear.
  17440. @item log
  17441. Logarithmic.
  17442. @item sqrt
  17443. Square root.
  17444. @item cbrt
  17445. Cubic root.
  17446. @end table
  17447. Default is linear.
  17448. @item draw
  17449. Set the draw mode. This is mostly useful to set for high @var{n}.
  17450. Available values are:
  17451. @table @samp
  17452. @item scale
  17453. Scale pixel values for each drawn sample.
  17454. @item full
  17455. Draw every sample directly.
  17456. @end table
  17457. Default value is @code{scale}.
  17458. @end table
  17459. @subsection Examples
  17460. @itemize
  17461. @item
  17462. Output the input file audio and the corresponding video representation
  17463. at the same time:
  17464. @example
  17465. amovie=a.mp3,asplit[out0],showwaves[out1]
  17466. @end example
  17467. @item
  17468. Create a synthetic signal and show it with showwaves, forcing a
  17469. frame rate of 30 frames per second:
  17470. @example
  17471. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17472. @end example
  17473. @end itemize
  17474. @section showwavespic
  17475. Convert input audio to a single video frame, representing the samples waves.
  17476. The filter accepts the following options:
  17477. @table @option
  17478. @item size, s
  17479. Specify the video size for the output. For the syntax of this option, check the
  17480. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17481. Default value is @code{600x240}.
  17482. @item split_channels
  17483. Set if channels should be drawn separately or overlap. Default value is 0.
  17484. @item colors
  17485. Set colors separated by '|' which are going to be used for drawing of each channel.
  17486. @item scale
  17487. Set amplitude scale.
  17488. Available values are:
  17489. @table @samp
  17490. @item lin
  17491. Linear.
  17492. @item log
  17493. Logarithmic.
  17494. @item sqrt
  17495. Square root.
  17496. @item cbrt
  17497. Cubic root.
  17498. @end table
  17499. Default is linear.
  17500. @item draw
  17501. Set the draw mode.
  17502. Available values are:
  17503. @table @samp
  17504. @item scale
  17505. Scale pixel values for each drawn sample.
  17506. @item full
  17507. Draw every sample directly.
  17508. @end table
  17509. Default value is @code{scale}.
  17510. @end table
  17511. @subsection Examples
  17512. @itemize
  17513. @item
  17514. Extract a channel split representation of the wave form of a whole audio track
  17515. in a 1024x800 picture using @command{ffmpeg}:
  17516. @example
  17517. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  17518. @end example
  17519. @end itemize
  17520. @section sidedata, asidedata
  17521. Delete frame side data, or select frames based on it.
  17522. This filter accepts the following options:
  17523. @table @option
  17524. @item mode
  17525. Set mode of operation of the filter.
  17526. Can be one of the following:
  17527. @table @samp
  17528. @item select
  17529. Select every frame with side data of @code{type}.
  17530. @item delete
  17531. Delete side data of @code{type}. If @code{type} is not set, delete all side
  17532. data in the frame.
  17533. @end table
  17534. @item type
  17535. Set side data type used with all modes. Must be set for @code{select} mode. For
  17536. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  17537. in @file{libavutil/frame.h}. For example, to choose
  17538. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  17539. @end table
  17540. @section spectrumsynth
  17541. Sythesize audio from 2 input video spectrums, first input stream represents
  17542. magnitude across time and second represents phase across time.
  17543. The filter will transform from frequency domain as displayed in videos back
  17544. to time domain as presented in audio output.
  17545. This filter is primarily created for reversing processed @ref{showspectrum}
  17546. filter outputs, but can synthesize sound from other spectrograms too.
  17547. But in such case results are going to be poor if the phase data is not
  17548. available, because in such cases phase data need to be recreated, usually
  17549. it's just recreated from random noise.
  17550. For best results use gray only output (@code{channel} color mode in
  17551. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  17552. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  17553. @code{data} option. Inputs videos should generally use @code{fullframe}
  17554. slide mode as that saves resources needed for decoding video.
  17555. The filter accepts the following options:
  17556. @table @option
  17557. @item sample_rate
  17558. Specify sample rate of output audio, the sample rate of audio from which
  17559. spectrum was generated may differ.
  17560. @item channels
  17561. Set number of channels represented in input video spectrums.
  17562. @item scale
  17563. Set scale which was used when generating magnitude input spectrum.
  17564. Can be @code{lin} or @code{log}. Default is @code{log}.
  17565. @item slide
  17566. Set slide which was used when generating inputs spectrums.
  17567. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17568. Default is @code{fullframe}.
  17569. @item win_func
  17570. Set window function used for resynthesis.
  17571. @item overlap
  17572. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17573. which means optimal overlap for selected window function will be picked.
  17574. @item orientation
  17575. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17576. Default is @code{vertical}.
  17577. @end table
  17578. @subsection Examples
  17579. @itemize
  17580. @item
  17581. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17582. then resynthesize videos back to audio with spectrumsynth:
  17583. @example
  17584. 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
  17585. 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
  17586. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17587. @end example
  17588. @end itemize
  17589. @section split, asplit
  17590. Split input into several identical outputs.
  17591. @code{asplit} works with audio input, @code{split} with video.
  17592. The filter accepts a single parameter which specifies the number of outputs. If
  17593. unspecified, it defaults to 2.
  17594. @subsection Examples
  17595. @itemize
  17596. @item
  17597. Create two separate outputs from the same input:
  17598. @example
  17599. [in] split [out0][out1]
  17600. @end example
  17601. @item
  17602. To create 3 or more outputs, you need to specify the number of
  17603. outputs, like in:
  17604. @example
  17605. [in] asplit=3 [out0][out1][out2]
  17606. @end example
  17607. @item
  17608. Create two separate outputs from the same input, one cropped and
  17609. one padded:
  17610. @example
  17611. [in] split [splitout1][splitout2];
  17612. [splitout1] crop=100:100:0:0 [cropout];
  17613. [splitout2] pad=200:200:100:100 [padout];
  17614. @end example
  17615. @item
  17616. Create 5 copies of the input audio with @command{ffmpeg}:
  17617. @example
  17618. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17619. @end example
  17620. @end itemize
  17621. @section zmq, azmq
  17622. Receive commands sent through a libzmq client, and forward them to
  17623. filters in the filtergraph.
  17624. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17625. must be inserted between two video filters, @code{azmq} between two
  17626. audio filters. Both are capable to send messages to any filter type.
  17627. To enable these filters you need to install the libzmq library and
  17628. headers and configure FFmpeg with @code{--enable-libzmq}.
  17629. For more information about libzmq see:
  17630. @url{http://www.zeromq.org/}
  17631. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17632. receives messages sent through a network interface defined by the
  17633. @option{bind_address} (or the abbreviation "@option{b}") option.
  17634. Default value of this option is @file{tcp://localhost:5555}. You may
  17635. want to alter this value to your needs, but do not forget to escape any
  17636. ':' signs (see @ref{filtergraph escaping}).
  17637. The received message must be in the form:
  17638. @example
  17639. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17640. @end example
  17641. @var{TARGET} specifies the target of the command, usually the name of
  17642. the filter class or a specific filter instance name. The default
  17643. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17644. but you can override this by using the @samp{filter_name@@id} syntax
  17645. (see @ref{Filtergraph syntax}).
  17646. @var{COMMAND} specifies the name of the command for the target filter.
  17647. @var{ARG} is optional and specifies the optional argument list for the
  17648. given @var{COMMAND}.
  17649. Upon reception, the message is processed and the corresponding command
  17650. is injected into the filtergraph. Depending on the result, the filter
  17651. will send a reply to the client, adopting the format:
  17652. @example
  17653. @var{ERROR_CODE} @var{ERROR_REASON}
  17654. @var{MESSAGE}
  17655. @end example
  17656. @var{MESSAGE} is optional.
  17657. @subsection Examples
  17658. Look at @file{tools/zmqsend} for an example of a zmq client which can
  17659. be used to send commands processed by these filters.
  17660. Consider the following filtergraph generated by @command{ffplay}.
  17661. In this example the last overlay filter has an instance name. All other
  17662. filters will have default instance names.
  17663. @example
  17664. ffplay -dumpgraph 1 -f lavfi "
  17665. color=s=100x100:c=red [l];
  17666. color=s=100x100:c=blue [r];
  17667. nullsrc=s=200x100, zmq [bg];
  17668. [bg][l] overlay [bg+l];
  17669. [bg+l][r] overlay@@my=x=100 "
  17670. @end example
  17671. To change the color of the left side of the video, the following
  17672. command can be used:
  17673. @example
  17674. echo Parsed_color_0 c yellow | tools/zmqsend
  17675. @end example
  17676. To change the right side:
  17677. @example
  17678. echo Parsed_color_1 c pink | tools/zmqsend
  17679. @end example
  17680. To change the position of the right side:
  17681. @example
  17682. echo overlay@@my x 150 | tools/zmqsend
  17683. @end example
  17684. @c man end MULTIMEDIA FILTERS
  17685. @chapter Multimedia Sources
  17686. @c man begin MULTIMEDIA SOURCES
  17687. Below is a description of the currently available multimedia sources.
  17688. @section amovie
  17689. This is the same as @ref{movie} source, except it selects an audio
  17690. stream by default.
  17691. @anchor{movie}
  17692. @section movie
  17693. Read audio and/or video stream(s) from a movie container.
  17694. It accepts the following parameters:
  17695. @table @option
  17696. @item filename
  17697. The name of the resource to read (not necessarily a file; it can also be a
  17698. device or a stream accessed through some protocol).
  17699. @item format_name, f
  17700. Specifies the format assumed for the movie to read, and can be either
  17701. the name of a container or an input device. If not specified, the
  17702. format is guessed from @var{movie_name} or by probing.
  17703. @item seek_point, sp
  17704. Specifies the seek point in seconds. The frames will be output
  17705. starting from this seek point. The parameter is evaluated with
  17706. @code{av_strtod}, so the numerical value may be suffixed by an IS
  17707. postfix. The default value is "0".
  17708. @item streams, s
  17709. Specifies the streams to read. Several streams can be specified,
  17710. separated by "+". The source will then have as many outputs, in the
  17711. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  17712. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  17713. respectively the default (best suited) video and audio stream. Default
  17714. is "dv", or "da" if the filter is called as "amovie".
  17715. @item stream_index, si
  17716. Specifies the index of the video stream to read. If the value is -1,
  17717. the most suitable video stream will be automatically selected. The default
  17718. value is "-1". Deprecated. If the filter is called "amovie", it will select
  17719. audio instead of video.
  17720. @item loop
  17721. Specifies how many times to read the stream in sequence.
  17722. If the value is 0, the stream will be looped infinitely.
  17723. Default value is "1".
  17724. Note that when the movie is looped the source timestamps are not
  17725. changed, so it will generate non monotonically increasing timestamps.
  17726. @item discontinuity
  17727. Specifies the time difference between frames above which the point is
  17728. considered a timestamp discontinuity which is removed by adjusting the later
  17729. timestamps.
  17730. @end table
  17731. It allows overlaying a second video on top of the main input of
  17732. a filtergraph, as shown in this graph:
  17733. @example
  17734. input -----------> deltapts0 --> overlay --> output
  17735. ^
  17736. |
  17737. movie --> scale--> deltapts1 -------+
  17738. @end example
  17739. @subsection Examples
  17740. @itemize
  17741. @item
  17742. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  17743. on top of the input labelled "in":
  17744. @example
  17745. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17746. [in] setpts=PTS-STARTPTS [main];
  17747. [main][over] overlay=16:16 [out]
  17748. @end example
  17749. @item
  17750. Read from a video4linux2 device, and overlay it on top of the input
  17751. labelled "in":
  17752. @example
  17753. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17754. [in] setpts=PTS-STARTPTS [main];
  17755. [main][over] overlay=16:16 [out]
  17756. @end example
  17757. @item
  17758. Read the first video stream and the audio stream with id 0x81 from
  17759. dvd.vob; the video is connected to the pad named "video" and the audio is
  17760. connected to the pad named "audio":
  17761. @example
  17762. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  17763. @end example
  17764. @end itemize
  17765. @subsection Commands
  17766. Both movie and amovie support the following commands:
  17767. @table @option
  17768. @item seek
  17769. Perform seek using "av_seek_frame".
  17770. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  17771. @itemize
  17772. @item
  17773. @var{stream_index}: If stream_index is -1, a default
  17774. stream is selected, and @var{timestamp} is automatically converted
  17775. from AV_TIME_BASE units to the stream specific time_base.
  17776. @item
  17777. @var{timestamp}: Timestamp in AVStream.time_base units
  17778. or, if no stream is specified, in AV_TIME_BASE units.
  17779. @item
  17780. @var{flags}: Flags which select direction and seeking mode.
  17781. @end itemize
  17782. @item get_duration
  17783. Get movie duration in AV_TIME_BASE units.
  17784. @end table
  17785. @c man end MULTIMEDIA SOURCES