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.

23442 lines
623KB

  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 mix
  1094. How much to use filtered signal in output. Default is 1.
  1095. Range is between 0 and 1.
  1096. @item response
  1097. Show IR frequency response, magnitude and phase in additional video stream.
  1098. By default it is disabled.
  1099. @item channel
  1100. Set for which IR channel to display frequency response. By default is first channel
  1101. displayed. This option is used only when @var{response} is enabled.
  1102. @item size
  1103. Set video stream size. This option is used only when @var{response} is enabled.
  1104. @end table
  1105. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1106. order.
  1107. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1108. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1109. imaginary unit.
  1110. Different coefficients and gains can be provided for every channel, in such case
  1111. use '|' to separate coefficients or gains. Last provided coefficients will be
  1112. used for all remaining channels.
  1113. @subsection Examples
  1114. @itemize
  1115. @item
  1116. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1117. @example
  1118. 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
  1119. @end example
  1120. @item
  1121. Same as above but in @code{zp} format:
  1122. @example
  1123. 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
  1124. @end example
  1125. @end itemize
  1126. @section alimiter
  1127. The limiter prevents an input signal from rising over a desired threshold.
  1128. This limiter uses lookahead technology to prevent your signal from distorting.
  1129. It means that there is a small delay after the signal is processed. Keep in mind
  1130. that the delay it produces is the attack time you set.
  1131. The filter accepts the following options:
  1132. @table @option
  1133. @item level_in
  1134. Set input gain. Default is 1.
  1135. @item level_out
  1136. Set output gain. Default is 1.
  1137. @item limit
  1138. Don't let signals above this level pass the limiter. Default is 1.
  1139. @item attack
  1140. The limiter will reach its attenuation level in this amount of time in
  1141. milliseconds. Default is 5 milliseconds.
  1142. @item release
  1143. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1144. Default is 50 milliseconds.
  1145. @item asc
  1146. When gain reduction is always needed ASC takes care of releasing to an
  1147. average reduction level rather than reaching a reduction of 0 in the release
  1148. time.
  1149. @item asc_level
  1150. Select how much the release time is affected by ASC, 0 means nearly no changes
  1151. in release time while 1 produces higher release times.
  1152. @item level
  1153. Auto level output signal. Default is enabled.
  1154. This normalizes audio back to 0dB if enabled.
  1155. @end table
  1156. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1157. with @ref{aresample} before applying this filter.
  1158. @section allpass
  1159. Apply a two-pole all-pass filter with central frequency (in Hz)
  1160. @var{frequency}, and filter-width @var{width}.
  1161. An all-pass filter changes the audio's frequency to phase relationship
  1162. without changing its frequency to amplitude relationship.
  1163. The filter accepts the following options:
  1164. @table @option
  1165. @item frequency, f
  1166. Set frequency in Hz.
  1167. @item width_type, t
  1168. Set method to specify band-width of filter.
  1169. @table @option
  1170. @item h
  1171. Hz
  1172. @item q
  1173. Q-Factor
  1174. @item o
  1175. octave
  1176. @item s
  1177. slope
  1178. @item k
  1179. kHz
  1180. @end table
  1181. @item width, w
  1182. Specify the band-width of a filter in width_type units.
  1183. @item mix, m
  1184. How much to use filtered signal in output. Default is 1.
  1185. Range is between 0 and 1.
  1186. @item channels, c
  1187. Specify which channels to filter, by default all available are filtered.
  1188. @end table
  1189. @subsection Commands
  1190. This filter supports the following commands:
  1191. @table @option
  1192. @item frequency, f
  1193. Change allpass frequency.
  1194. Syntax for the command is : "@var{frequency}"
  1195. @item width_type, t
  1196. Change allpass width_type.
  1197. Syntax for the command is : "@var{width_type}"
  1198. @item width, w
  1199. Change allpass width.
  1200. Syntax for the command is : "@var{width}"
  1201. @item mix, m
  1202. Change allpass mix.
  1203. Syntax for the command is : "@var{mix}"
  1204. @end table
  1205. @section aloop
  1206. Loop audio samples.
  1207. The filter accepts the following options:
  1208. @table @option
  1209. @item loop
  1210. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1211. Default is 0.
  1212. @item size
  1213. Set maximal number of samples. Default is 0.
  1214. @item start
  1215. Set first sample of loop. Default is 0.
  1216. @end table
  1217. @anchor{amerge}
  1218. @section amerge
  1219. Merge two or more audio streams into a single multi-channel stream.
  1220. The filter accepts the following options:
  1221. @table @option
  1222. @item inputs
  1223. Set the number of inputs. Default is 2.
  1224. @end table
  1225. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1226. the channel layout of the output will be set accordingly and the channels
  1227. will be reordered as necessary. If the channel layouts of the inputs are not
  1228. disjoint, the output will have all the channels of the first input then all
  1229. the channels of the second input, in that order, and the channel layout of
  1230. the output will be the default value corresponding to the total number of
  1231. channels.
  1232. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1233. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1234. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1235. first input, b1 is the first channel of the second input).
  1236. On the other hand, if both input are in stereo, the output channels will be
  1237. in the default order: a1, a2, b1, b2, and the channel layout will be
  1238. arbitrarily set to 4.0, which may or may not be the expected value.
  1239. All inputs must have the same sample rate, and format.
  1240. If inputs do not have the same duration, the output will stop with the
  1241. shortest.
  1242. @subsection Examples
  1243. @itemize
  1244. @item
  1245. Merge two mono files into a stereo stream:
  1246. @example
  1247. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1248. @end example
  1249. @item
  1250. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1251. @example
  1252. 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
  1253. @end example
  1254. @end itemize
  1255. @section amix
  1256. Mixes multiple audio inputs into a single output.
  1257. Note that this filter only supports float samples (the @var{amerge}
  1258. and @var{pan} audio filters support many formats). If the @var{amix}
  1259. input has integer samples then @ref{aresample} will be automatically
  1260. inserted to perform the conversion to float samples.
  1261. For example
  1262. @example
  1263. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1264. @end example
  1265. will mix 3 input audio streams to a single output with the same duration as the
  1266. first input and a dropout transition time of 3 seconds.
  1267. It accepts the following parameters:
  1268. @table @option
  1269. @item inputs
  1270. The number of inputs. If unspecified, it defaults to 2.
  1271. @item duration
  1272. How to determine the end-of-stream.
  1273. @table @option
  1274. @item longest
  1275. The duration of the longest input. (default)
  1276. @item shortest
  1277. The duration of the shortest input.
  1278. @item first
  1279. The duration of the first input.
  1280. @end table
  1281. @item dropout_transition
  1282. The transition time, in seconds, for volume renormalization when an input
  1283. stream ends. The default value is 2 seconds.
  1284. @item weights
  1285. Specify weight of each input audio stream as sequence.
  1286. Each weight is separated by space. By default all inputs have same weight.
  1287. @end table
  1288. @section amultiply
  1289. Multiply first audio stream with second audio stream and store result
  1290. in output audio stream. Multiplication is done by multiplying each
  1291. sample from first stream with sample at same position from second stream.
  1292. With this element-wise multiplication one can create amplitude fades and
  1293. amplitude modulations.
  1294. @section anequalizer
  1295. High-order parametric multiband equalizer for each channel.
  1296. It accepts the following parameters:
  1297. @table @option
  1298. @item params
  1299. This option string is in format:
  1300. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1301. Each equalizer band is separated by '|'.
  1302. @table @option
  1303. @item chn
  1304. Set channel number to which equalization will be applied.
  1305. If input doesn't have that channel the entry is ignored.
  1306. @item f
  1307. Set central frequency for band.
  1308. If input doesn't have that frequency the entry is ignored.
  1309. @item w
  1310. Set band width in hertz.
  1311. @item g
  1312. Set band gain in dB.
  1313. @item t
  1314. Set filter type for band, optional, can be:
  1315. @table @samp
  1316. @item 0
  1317. Butterworth, this is default.
  1318. @item 1
  1319. Chebyshev type 1.
  1320. @item 2
  1321. Chebyshev type 2.
  1322. @end table
  1323. @end table
  1324. @item curves
  1325. With this option activated frequency response of anequalizer is displayed
  1326. in video stream.
  1327. @item size
  1328. Set video stream size. Only useful if curves option is activated.
  1329. @item mgain
  1330. Set max gain that will be displayed. Only useful if curves option is activated.
  1331. Setting this to a reasonable value makes it possible to display gain which is derived from
  1332. neighbour bands which are too close to each other and thus produce higher gain
  1333. when both are activated.
  1334. @item fscale
  1335. Set frequency scale used to draw frequency response in video output.
  1336. Can be linear or logarithmic. Default is logarithmic.
  1337. @item colors
  1338. Set color for each channel curve which is going to be displayed in video stream.
  1339. This is list of color names separated by space or by '|'.
  1340. Unrecognised or missing colors will be replaced by white color.
  1341. @end table
  1342. @subsection Examples
  1343. @itemize
  1344. @item
  1345. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1346. for first 2 channels using Chebyshev type 1 filter:
  1347. @example
  1348. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1349. @end example
  1350. @end itemize
  1351. @subsection Commands
  1352. This filter supports the following commands:
  1353. @table @option
  1354. @item change
  1355. Alter existing filter parameters.
  1356. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1357. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1358. error is returned.
  1359. @var{freq} set new frequency parameter.
  1360. @var{width} set new width parameter in herz.
  1361. @var{gain} set new gain parameter in dB.
  1362. Full filter invocation with asendcmd may look like this:
  1363. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1364. @end table
  1365. @section anlmdn
  1366. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1367. Each sample is adjusted by looking for other samples with similar contexts. This
  1368. context similarity is defined by comparing their surrounding patches of size
  1369. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1370. The filter accepts the following options.
  1371. @table @option
  1372. @item s
  1373. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1374. @item p
  1375. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1376. Default value is 2 milliseconds.
  1377. @item r
  1378. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1379. Default value is 6 milliseconds.
  1380. @item o
  1381. Set the output mode.
  1382. It accepts the following values:
  1383. @table @option
  1384. @item i
  1385. Pass input unchanged.
  1386. @item o
  1387. Pass noise filtered out.
  1388. @item n
  1389. Pass only noise.
  1390. Default value is @var{o}.
  1391. @end table
  1392. @item m
  1393. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1394. @end table
  1395. @subsection Commands
  1396. This filter supports the following commands:
  1397. @table @option
  1398. @item s
  1399. Change denoise strength. Argument is single float number.
  1400. Syntax for the command is : "@var{s}"
  1401. @item o
  1402. Change output mode.
  1403. Syntax for the command is : "i", "o" or "n" string.
  1404. @end table
  1405. @section anull
  1406. Pass the audio source unchanged to the output.
  1407. @section apad
  1408. Pad the end of an audio stream with silence.
  1409. This can be used together with @command{ffmpeg} @option{-shortest} to
  1410. extend audio streams to the same length as the video stream.
  1411. A description of the accepted options follows.
  1412. @table @option
  1413. @item packet_size
  1414. Set silence packet size. Default value is 4096.
  1415. @item pad_len
  1416. Set the number of samples of silence to add to the end. After the
  1417. value is reached, the stream is terminated. This option is mutually
  1418. exclusive with @option{whole_len}.
  1419. @item whole_len
  1420. Set the minimum total number of samples in the output audio stream. If
  1421. the value is longer than the input audio length, silence is added to
  1422. the end, until the value is reached. This option is mutually exclusive
  1423. with @option{pad_len}.
  1424. @item pad_dur
  1425. Specify the duration of samples of silence to add. See
  1426. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1427. for the accepted syntax. Used only if set to non-zero value.
  1428. @item whole_dur
  1429. Specify the minimum total duration in the output audio stream. See
  1430. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1431. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1432. the input audio length, silence is added to the end, until the value is reached.
  1433. This option is mutually exclusive with @option{pad_dur}
  1434. @end table
  1435. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1436. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1437. the input stream indefinitely.
  1438. @subsection Examples
  1439. @itemize
  1440. @item
  1441. Add 1024 samples of silence to the end of the input:
  1442. @example
  1443. apad=pad_len=1024
  1444. @end example
  1445. @item
  1446. Make sure the audio output will contain at least 10000 samples, pad
  1447. the input with silence if required:
  1448. @example
  1449. apad=whole_len=10000
  1450. @end example
  1451. @item
  1452. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1453. video stream will always result the shortest and will be converted
  1454. until the end in the output file when using the @option{shortest}
  1455. option:
  1456. @example
  1457. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1458. @end example
  1459. @end itemize
  1460. @section aphaser
  1461. Add a phasing effect to the input audio.
  1462. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1463. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1464. A description of the accepted parameters follows.
  1465. @table @option
  1466. @item in_gain
  1467. Set input gain. Default is 0.4.
  1468. @item out_gain
  1469. Set output gain. Default is 0.74
  1470. @item delay
  1471. Set delay in milliseconds. Default is 3.0.
  1472. @item decay
  1473. Set decay. Default is 0.4.
  1474. @item speed
  1475. Set modulation speed in Hz. Default is 0.5.
  1476. @item type
  1477. Set modulation type. Default is triangular.
  1478. It accepts the following values:
  1479. @table @samp
  1480. @item triangular, t
  1481. @item sinusoidal, s
  1482. @end table
  1483. @end table
  1484. @section apulsator
  1485. Audio pulsator is something between an autopanner and a tremolo.
  1486. But it can produce funny stereo effects as well. Pulsator changes the volume
  1487. of the left and right channel based on a LFO (low frequency oscillator) with
  1488. different waveforms and shifted phases.
  1489. This filter have the ability to define an offset between left and right
  1490. channel. An offset of 0 means that both LFO shapes match each other.
  1491. The left and right channel are altered equally - a conventional tremolo.
  1492. An offset of 50% means that the shape of the right channel is exactly shifted
  1493. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1494. an autopanner. At 1 both curves match again. Every setting in between moves the
  1495. phase shift gapless between all stages and produces some "bypassing" sounds with
  1496. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1497. the 0.5) the faster the signal passes from the left to the right speaker.
  1498. The filter accepts the following options:
  1499. @table @option
  1500. @item level_in
  1501. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1502. @item level_out
  1503. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1504. @item mode
  1505. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1506. sawup or sawdown. Default is sine.
  1507. @item amount
  1508. Set modulation. Define how much of original signal is affected by the LFO.
  1509. @item offset_l
  1510. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1511. @item offset_r
  1512. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1513. @item width
  1514. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1515. @item timing
  1516. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1517. @item bpm
  1518. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1519. is set to bpm.
  1520. @item ms
  1521. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1522. is set to ms.
  1523. @item hz
  1524. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1525. if timing is set to hz.
  1526. @end table
  1527. @anchor{aresample}
  1528. @section aresample
  1529. Resample the input audio to the specified parameters, using the
  1530. libswresample library. If none are specified then the filter will
  1531. automatically convert between its input and output.
  1532. This filter is also able to stretch/squeeze the audio data to make it match
  1533. the timestamps or to inject silence / cut out audio to make it match the
  1534. timestamps, do a combination of both or do neither.
  1535. The filter accepts the syntax
  1536. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1537. expresses a sample rate and @var{resampler_options} is a list of
  1538. @var{key}=@var{value} pairs, separated by ":". See the
  1539. @ref{Resampler Options,,"Resampler Options" section in the
  1540. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1541. for the complete list of supported options.
  1542. @subsection Examples
  1543. @itemize
  1544. @item
  1545. Resample the input audio to 44100Hz:
  1546. @example
  1547. aresample=44100
  1548. @end example
  1549. @item
  1550. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1551. samples per second compensation:
  1552. @example
  1553. aresample=async=1000
  1554. @end example
  1555. @end itemize
  1556. @section areverse
  1557. Reverse an audio clip.
  1558. Warning: This filter requires memory to buffer the entire clip, so trimming
  1559. is suggested.
  1560. @subsection Examples
  1561. @itemize
  1562. @item
  1563. Take the first 5 seconds of a clip, and reverse it.
  1564. @example
  1565. atrim=end=5,areverse
  1566. @end example
  1567. @end itemize
  1568. @section asetnsamples
  1569. Set the number of samples per each output audio frame.
  1570. The last output packet may contain a different number of samples, as
  1571. the filter will flush all the remaining samples when the input audio
  1572. signals its end.
  1573. The filter accepts the following options:
  1574. @table @option
  1575. @item nb_out_samples, n
  1576. Set the number of frames per each output audio frame. The number is
  1577. intended as the number of samples @emph{per each channel}.
  1578. Default value is 1024.
  1579. @item pad, p
  1580. If set to 1, the filter will pad the last audio frame with zeroes, so
  1581. that the last frame will contain the same number of samples as the
  1582. previous ones. Default value is 1.
  1583. @end table
  1584. For example, to set the number of per-frame samples to 1234 and
  1585. disable padding for the last frame, use:
  1586. @example
  1587. asetnsamples=n=1234:p=0
  1588. @end example
  1589. @section asetrate
  1590. Set the sample rate without altering the PCM data.
  1591. This will result in a change of speed and pitch.
  1592. The filter accepts the following options:
  1593. @table @option
  1594. @item sample_rate, r
  1595. Set the output sample rate. Default is 44100 Hz.
  1596. @end table
  1597. @section ashowinfo
  1598. Show a line containing various information for each input audio frame.
  1599. The input audio is not modified.
  1600. The shown line contains a sequence of key/value pairs of the form
  1601. @var{key}:@var{value}.
  1602. The following values are shown in the output:
  1603. @table @option
  1604. @item n
  1605. The (sequential) number of the input frame, starting from 0.
  1606. @item pts
  1607. The presentation timestamp of the input frame, in time base units; the time base
  1608. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1609. @item pts_time
  1610. The presentation timestamp of the input frame in seconds.
  1611. @item pos
  1612. position of the frame in the input stream, -1 if this information in
  1613. unavailable and/or meaningless (for example in case of synthetic audio)
  1614. @item fmt
  1615. The sample format.
  1616. @item chlayout
  1617. The channel layout.
  1618. @item rate
  1619. The sample rate for the audio frame.
  1620. @item nb_samples
  1621. The number of samples (per channel) in the frame.
  1622. @item checksum
  1623. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1624. audio, the data is treated as if all the planes were concatenated.
  1625. @item plane_checksums
  1626. A list of Adler-32 checksums for each data plane.
  1627. @end table
  1628. @section asoftclip
  1629. Apply audio soft clipping.
  1630. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1631. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1632. This filter accepts the following options:
  1633. @table @option
  1634. @item type
  1635. Set type of soft-clipping.
  1636. It accepts the following values:
  1637. @table @option
  1638. @item tanh
  1639. @item atan
  1640. @item cubic
  1641. @item exp
  1642. @item alg
  1643. @item quintic
  1644. @item sin
  1645. @end table
  1646. @item param
  1647. Set additional parameter which controls sigmoid function.
  1648. @end table
  1649. @section asr
  1650. Automatic Speech Recognition
  1651. This filter uses PocketSphinx for speech recognition. To enable
  1652. compilation of this filter, you need to configure FFmpeg with
  1653. @code{--enable-pocketsphinx}.
  1654. It accepts the following options:
  1655. @table @option
  1656. @item rate
  1657. Set sampling rate of input audio. Defaults is @code{16000}.
  1658. This need to match speech models, otherwise one will get poor results.
  1659. @item hmm
  1660. Set dictionary containing acoustic model files.
  1661. @item dict
  1662. Set pronunciation dictionary.
  1663. @item lm
  1664. Set language model file.
  1665. @item lmctl
  1666. Set language model set.
  1667. @item lmname
  1668. Set which language model to use.
  1669. @item logfn
  1670. Set output for log messages.
  1671. @end table
  1672. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1673. @anchor{astats}
  1674. @section astats
  1675. Display time domain statistical information about the audio channels.
  1676. Statistics are calculated and displayed for each audio channel and,
  1677. where applicable, an overall figure is also given.
  1678. It accepts the following option:
  1679. @table @option
  1680. @item length
  1681. Short window length in seconds, used for peak and trough RMS measurement.
  1682. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1683. @item metadata
  1684. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1685. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1686. disabled.
  1687. Available keys for each channel are:
  1688. DC_offset
  1689. Min_level
  1690. Max_level
  1691. Min_difference
  1692. Max_difference
  1693. Mean_difference
  1694. RMS_difference
  1695. Peak_level
  1696. RMS_peak
  1697. RMS_trough
  1698. Crest_factor
  1699. Flat_factor
  1700. Peak_count
  1701. Bit_depth
  1702. Dynamic_range
  1703. Zero_crossings
  1704. Zero_crossings_rate
  1705. Number_of_NaNs
  1706. Number_of_Infs
  1707. Number_of_denormals
  1708. and for Overall:
  1709. DC_offset
  1710. Min_level
  1711. Max_level
  1712. Min_difference
  1713. Max_difference
  1714. Mean_difference
  1715. RMS_difference
  1716. Peak_level
  1717. RMS_level
  1718. RMS_peak
  1719. RMS_trough
  1720. Flat_factor
  1721. Peak_count
  1722. Bit_depth
  1723. Number_of_samples
  1724. Number_of_NaNs
  1725. Number_of_Infs
  1726. Number_of_denormals
  1727. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1728. this @code{lavfi.astats.Overall.Peak_count}.
  1729. For description what each key means read below.
  1730. @item reset
  1731. Set number of frame after which stats are going to be recalculated.
  1732. Default is disabled.
  1733. @item measure_perchannel
  1734. Select the entries which need to be measured per channel. The metadata keys can
  1735. be used as flags, default is @option{all} which measures everything.
  1736. @option{none} disables all per channel measurement.
  1737. @item measure_overall
  1738. Select the entries which need to be measured overall. The metadata keys can
  1739. be used as flags, default is @option{all} which measures everything.
  1740. @option{none} disables all overall measurement.
  1741. @end table
  1742. A description of each shown parameter follows:
  1743. @table @option
  1744. @item DC offset
  1745. Mean amplitude displacement from zero.
  1746. @item Min level
  1747. Minimal sample level.
  1748. @item Max level
  1749. Maximal sample level.
  1750. @item Min difference
  1751. Minimal difference between two consecutive samples.
  1752. @item Max difference
  1753. Maximal difference between two consecutive samples.
  1754. @item Mean difference
  1755. Mean difference between two consecutive samples.
  1756. The average of each difference between two consecutive samples.
  1757. @item RMS difference
  1758. Root Mean Square difference between two consecutive samples.
  1759. @item Peak level dB
  1760. @item RMS level dB
  1761. Standard peak and RMS level measured in dBFS.
  1762. @item RMS peak dB
  1763. @item RMS trough dB
  1764. Peak and trough values for RMS level measured over a short window.
  1765. @item Crest factor
  1766. Standard ratio of peak to RMS level (note: not in dB).
  1767. @item Flat factor
  1768. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1769. (i.e. either @var{Min level} or @var{Max level}).
  1770. @item Peak count
  1771. Number of occasions (not the number of samples) that the signal attained either
  1772. @var{Min level} or @var{Max level}.
  1773. @item Bit depth
  1774. Overall bit depth of audio. Number of bits used for each sample.
  1775. @item Dynamic range
  1776. Measured dynamic range of audio in dB.
  1777. @item Zero crossings
  1778. Number of points where the waveform crosses the zero level axis.
  1779. @item Zero crossings rate
  1780. Rate of Zero crossings and number of audio samples.
  1781. @end table
  1782. @section atempo
  1783. Adjust audio tempo.
  1784. The filter accepts exactly one parameter, the audio tempo. If not
  1785. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1786. be in the [0.5, 100.0] range.
  1787. Note that tempo greater than 2 will skip some samples rather than
  1788. blend them in. If for any reason this is a concern it is always
  1789. possible to daisy-chain several instances of atempo to achieve the
  1790. desired product tempo.
  1791. @subsection Examples
  1792. @itemize
  1793. @item
  1794. Slow down audio to 80% tempo:
  1795. @example
  1796. atempo=0.8
  1797. @end example
  1798. @item
  1799. To speed up audio to 300% tempo:
  1800. @example
  1801. atempo=3
  1802. @end example
  1803. @item
  1804. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1805. @example
  1806. atempo=sqrt(3),atempo=sqrt(3)
  1807. @end example
  1808. @end itemize
  1809. @section atrim
  1810. Trim the input so that the output contains one continuous subpart of the input.
  1811. It accepts the following parameters:
  1812. @table @option
  1813. @item start
  1814. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1815. sample with the timestamp @var{start} will be the first sample in the output.
  1816. @item end
  1817. Specify time of the first audio sample that will be dropped, i.e. the
  1818. audio sample immediately preceding the one with the timestamp @var{end} will be
  1819. the last sample in the output.
  1820. @item start_pts
  1821. Same as @var{start}, except this option sets the start timestamp in samples
  1822. instead of seconds.
  1823. @item end_pts
  1824. Same as @var{end}, except this option sets the end timestamp in samples instead
  1825. of seconds.
  1826. @item duration
  1827. The maximum duration of the output in seconds.
  1828. @item start_sample
  1829. The number of the first sample that should be output.
  1830. @item end_sample
  1831. The number of the first sample that should be dropped.
  1832. @end table
  1833. @option{start}, @option{end}, and @option{duration} are expressed as time
  1834. duration specifications; see
  1835. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1836. Note that the first two sets of the start/end options and the @option{duration}
  1837. option look at the frame timestamp, while the _sample options simply count the
  1838. samples that pass through the filter. So start/end_pts and start/end_sample will
  1839. give different results when the timestamps are wrong, inexact or do not start at
  1840. zero. Also note that this filter does not modify the timestamps. If you wish
  1841. to have the output timestamps start at zero, insert the asetpts filter after the
  1842. atrim filter.
  1843. If multiple start or end options are set, this filter tries to be greedy and
  1844. keep all samples that match at least one of the specified constraints. To keep
  1845. only the part that matches all the constraints at once, chain multiple atrim
  1846. filters.
  1847. The defaults are such that all the input is kept. So it is possible to set e.g.
  1848. just the end values to keep everything before the specified time.
  1849. Examples:
  1850. @itemize
  1851. @item
  1852. Drop everything except the second minute of input:
  1853. @example
  1854. ffmpeg -i INPUT -af atrim=60:120
  1855. @end example
  1856. @item
  1857. Keep only the first 1000 samples:
  1858. @example
  1859. ffmpeg -i INPUT -af atrim=end_sample=1000
  1860. @end example
  1861. @end itemize
  1862. @section bandpass
  1863. Apply a two-pole Butterworth band-pass filter with central
  1864. frequency @var{frequency}, and (3dB-point) band-width width.
  1865. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1866. instead of the default: constant 0dB peak gain.
  1867. The filter roll off at 6dB per octave (20dB per decade).
  1868. The filter accepts the following options:
  1869. @table @option
  1870. @item frequency, f
  1871. Set the filter's central frequency. Default is @code{3000}.
  1872. @item csg
  1873. Constant skirt gain if set to 1. Defaults to 0.
  1874. @item width_type, t
  1875. Set method to specify band-width of filter.
  1876. @table @option
  1877. @item h
  1878. Hz
  1879. @item q
  1880. Q-Factor
  1881. @item o
  1882. octave
  1883. @item s
  1884. slope
  1885. @item k
  1886. kHz
  1887. @end table
  1888. @item width, w
  1889. Specify the band-width of a filter in width_type units.
  1890. @item mix, m
  1891. How much to use filtered signal in output. Default is 1.
  1892. Range is between 0 and 1.
  1893. @item channels, c
  1894. Specify which channels to filter, by default all available are filtered.
  1895. @end table
  1896. @subsection Commands
  1897. This filter supports the following commands:
  1898. @table @option
  1899. @item frequency, f
  1900. Change bandpass frequency.
  1901. Syntax for the command is : "@var{frequency}"
  1902. @item width_type, t
  1903. Change bandpass width_type.
  1904. Syntax for the command is : "@var{width_type}"
  1905. @item width, w
  1906. Change bandpass width.
  1907. Syntax for the command is : "@var{width}"
  1908. @item mix, m
  1909. Change bandpass mix.
  1910. Syntax for the command is : "@var{mix}"
  1911. @end table
  1912. @section bandreject
  1913. Apply a two-pole Butterworth band-reject filter with central
  1914. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1915. The filter roll off at 6dB per octave (20dB per decade).
  1916. The filter accepts the following options:
  1917. @table @option
  1918. @item frequency, f
  1919. Set the filter's central frequency. Default is @code{3000}.
  1920. @item width_type, t
  1921. Set method to specify band-width of filter.
  1922. @table @option
  1923. @item h
  1924. Hz
  1925. @item q
  1926. Q-Factor
  1927. @item o
  1928. octave
  1929. @item s
  1930. slope
  1931. @item k
  1932. kHz
  1933. @end table
  1934. @item width, w
  1935. Specify the band-width of a filter in width_type units.
  1936. @item mix, m
  1937. How much to use filtered signal in output. Default is 1.
  1938. Range is between 0 and 1.
  1939. @item channels, c
  1940. Specify which channels to filter, by default all available are filtered.
  1941. @end table
  1942. @subsection Commands
  1943. This filter supports the following commands:
  1944. @table @option
  1945. @item frequency, f
  1946. Change bandreject frequency.
  1947. Syntax for the command is : "@var{frequency}"
  1948. @item width_type, t
  1949. Change bandreject width_type.
  1950. Syntax for the command is : "@var{width_type}"
  1951. @item width, w
  1952. Change bandreject width.
  1953. Syntax for the command is : "@var{width}"
  1954. @item mix, m
  1955. Change bandreject mix.
  1956. Syntax for the command is : "@var{mix}"
  1957. @end table
  1958. @section bass, lowshelf
  1959. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1960. shelving filter with a response similar to that of a standard
  1961. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1962. The filter accepts the following options:
  1963. @table @option
  1964. @item gain, g
  1965. Give the gain at 0 Hz. Its useful range is about -20
  1966. (for a large cut) to +20 (for a large boost).
  1967. Beware of clipping when using a positive gain.
  1968. @item frequency, f
  1969. Set the filter's central frequency and so can be used
  1970. to extend or reduce the frequency range to be boosted or cut.
  1971. The default value is @code{100} Hz.
  1972. @item width_type, t
  1973. Set method to specify band-width of filter.
  1974. @table @option
  1975. @item h
  1976. Hz
  1977. @item q
  1978. Q-Factor
  1979. @item o
  1980. octave
  1981. @item s
  1982. slope
  1983. @item k
  1984. kHz
  1985. @end table
  1986. @item width, w
  1987. Determine how steep is the filter's shelf transition.
  1988. @item mix, m
  1989. How much to use filtered signal in output. Default is 1.
  1990. Range is between 0 and 1.
  1991. @item channels, c
  1992. Specify which channels to filter, by default all available are filtered.
  1993. @end table
  1994. @subsection Commands
  1995. This filter supports the following commands:
  1996. @table @option
  1997. @item frequency, f
  1998. Change bass frequency.
  1999. Syntax for the command is : "@var{frequency}"
  2000. @item width_type, t
  2001. Change bass width_type.
  2002. Syntax for the command is : "@var{width_type}"
  2003. @item width, w
  2004. Change bass width.
  2005. Syntax for the command is : "@var{width}"
  2006. @item gain, g
  2007. Change bass gain.
  2008. Syntax for the command is : "@var{gain}"
  2009. @item mix, m
  2010. Change bass mix.
  2011. Syntax for the command is : "@var{mix}"
  2012. @end table
  2013. @section biquad
  2014. Apply a biquad IIR filter with the given coefficients.
  2015. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2016. are the numerator and denominator coefficients respectively.
  2017. and @var{channels}, @var{c} specify which channels to filter, by default all
  2018. available are filtered.
  2019. @subsection Commands
  2020. This filter supports the following commands:
  2021. @table @option
  2022. @item a0
  2023. @item a1
  2024. @item a2
  2025. @item b0
  2026. @item b1
  2027. @item b2
  2028. Change biquad parameter.
  2029. Syntax for the command is : "@var{value}"
  2030. @item mix, m
  2031. How much to use filtered signal in output. Default is 1.
  2032. Range is between 0 and 1.
  2033. @end table
  2034. @section bs2b
  2035. Bauer stereo to binaural transformation, which improves headphone listening of
  2036. stereo audio records.
  2037. To enable compilation of this filter you need to configure FFmpeg with
  2038. @code{--enable-libbs2b}.
  2039. It accepts the following parameters:
  2040. @table @option
  2041. @item profile
  2042. Pre-defined crossfeed level.
  2043. @table @option
  2044. @item default
  2045. Default level (fcut=700, feed=50).
  2046. @item cmoy
  2047. Chu Moy circuit (fcut=700, feed=60).
  2048. @item jmeier
  2049. Jan Meier circuit (fcut=650, feed=95).
  2050. @end table
  2051. @item fcut
  2052. Cut frequency (in Hz).
  2053. @item feed
  2054. Feed level (in Hz).
  2055. @end table
  2056. @section channelmap
  2057. Remap input channels to new locations.
  2058. It accepts the following parameters:
  2059. @table @option
  2060. @item map
  2061. Map channels from input to output. The argument is a '|'-separated list of
  2062. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2063. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2064. channel (e.g. FL for front left) or its index in the input channel layout.
  2065. @var{out_channel} is the name of the output channel or its index in the output
  2066. channel layout. If @var{out_channel} is not given then it is implicitly an
  2067. index, starting with zero and increasing by one for each mapping.
  2068. @item channel_layout
  2069. The channel layout of the output stream.
  2070. @end table
  2071. If no mapping is present, the filter will implicitly map input channels to
  2072. output channels, preserving indices.
  2073. @subsection Examples
  2074. @itemize
  2075. @item
  2076. For example, assuming a 5.1+downmix input MOV file,
  2077. @example
  2078. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2079. @end example
  2080. will create an output WAV file tagged as stereo from the downmix channels of
  2081. the input.
  2082. @item
  2083. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2084. @example
  2085. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2086. @end example
  2087. @end itemize
  2088. @section channelsplit
  2089. Split each channel from an input audio stream into a separate output stream.
  2090. It accepts the following parameters:
  2091. @table @option
  2092. @item channel_layout
  2093. The channel layout of the input stream. The default is "stereo".
  2094. @item channels
  2095. A channel layout describing the channels to be extracted as separate output streams
  2096. or "all" to extract each input channel as a separate stream. The default is "all".
  2097. Choosing channels not present in channel layout in the input will result in an error.
  2098. @end table
  2099. @subsection Examples
  2100. @itemize
  2101. @item
  2102. For example, assuming a stereo input MP3 file,
  2103. @example
  2104. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2105. @end example
  2106. will create an output Matroska file with two audio streams, one containing only
  2107. the left channel and the other the right channel.
  2108. @item
  2109. Split a 5.1 WAV file into per-channel files:
  2110. @example
  2111. ffmpeg -i in.wav -filter_complex
  2112. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2113. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2114. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2115. side_right.wav
  2116. @end example
  2117. @item
  2118. Extract only LFE from a 5.1 WAV file:
  2119. @example
  2120. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2121. -map '[LFE]' lfe.wav
  2122. @end example
  2123. @end itemize
  2124. @section chorus
  2125. Add a chorus effect to the audio.
  2126. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2127. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2128. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2129. The modulation depth defines the range the modulated delay is played before or after
  2130. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2131. sound tuned around the original one, like in a chorus where some vocals are slightly
  2132. off key.
  2133. It accepts the following parameters:
  2134. @table @option
  2135. @item in_gain
  2136. Set input gain. Default is 0.4.
  2137. @item out_gain
  2138. Set output gain. Default is 0.4.
  2139. @item delays
  2140. Set delays. A typical delay is around 40ms to 60ms.
  2141. @item decays
  2142. Set decays.
  2143. @item speeds
  2144. Set speeds.
  2145. @item depths
  2146. Set depths.
  2147. @end table
  2148. @subsection Examples
  2149. @itemize
  2150. @item
  2151. A single delay:
  2152. @example
  2153. chorus=0.7:0.9:55:0.4:0.25:2
  2154. @end example
  2155. @item
  2156. Two delays:
  2157. @example
  2158. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2159. @end example
  2160. @item
  2161. Fuller sounding chorus with three delays:
  2162. @example
  2163. 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
  2164. @end example
  2165. @end itemize
  2166. @section compand
  2167. Compress or expand the audio's dynamic range.
  2168. It accepts the following parameters:
  2169. @table @option
  2170. @item attacks
  2171. @item decays
  2172. A list of times in seconds for each channel over which the instantaneous level
  2173. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2174. increase of volume and @var{decays} refers to decrease of volume. For most
  2175. situations, the attack time (response to the audio getting louder) should be
  2176. shorter than the decay time, because the human ear is more sensitive to sudden
  2177. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2178. a typical value for decay is 0.8 seconds.
  2179. If specified number of attacks & decays is lower than number of channels, the last
  2180. set attack/decay will be used for all remaining channels.
  2181. @item points
  2182. A list of points for the transfer function, specified in dB relative to the
  2183. maximum possible signal amplitude. Each key points list must be defined using
  2184. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2185. @code{x0/y0 x1/y1 x2/y2 ....}
  2186. The input values must be in strictly increasing order but the transfer function
  2187. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2188. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2189. function are @code{-70/-70|-60/-20|1/0}.
  2190. @item soft-knee
  2191. Set the curve radius in dB for all joints. It defaults to 0.01.
  2192. @item gain
  2193. Set the additional gain in dB to be applied at all points on the transfer
  2194. function. This allows for easy adjustment of the overall gain.
  2195. It defaults to 0.
  2196. @item volume
  2197. Set an initial volume, in dB, to be assumed for each channel when filtering
  2198. starts. This permits the user to supply a nominal level initially, so that, for
  2199. example, a very large gain is not applied to initial signal levels before the
  2200. companding has begun to operate. A typical value for audio which is initially
  2201. quiet is -90 dB. It defaults to 0.
  2202. @item delay
  2203. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2204. delayed before being fed to the volume adjuster. Specifying a delay
  2205. approximately equal to the attack/decay times allows the filter to effectively
  2206. operate in predictive rather than reactive mode. It defaults to 0.
  2207. @end table
  2208. @subsection Examples
  2209. @itemize
  2210. @item
  2211. Make music with both quiet and loud passages suitable for listening to in a
  2212. noisy environment:
  2213. @example
  2214. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2215. @end example
  2216. Another example for audio with whisper and explosion parts:
  2217. @example
  2218. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2219. @end example
  2220. @item
  2221. A noise gate for when the noise is at a lower level than the signal:
  2222. @example
  2223. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2224. @end example
  2225. @item
  2226. Here is another noise gate, this time for when the noise is at a higher level
  2227. than the signal (making it, in some ways, similar to squelch):
  2228. @example
  2229. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2230. @end example
  2231. @item
  2232. 2:1 compression starting at -6dB:
  2233. @example
  2234. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2235. @end example
  2236. @item
  2237. 2:1 compression starting at -9dB:
  2238. @example
  2239. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2240. @end example
  2241. @item
  2242. 2:1 compression starting at -12dB:
  2243. @example
  2244. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2245. @end example
  2246. @item
  2247. 2:1 compression starting at -18dB:
  2248. @example
  2249. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2250. @end example
  2251. @item
  2252. 3:1 compression starting at -15dB:
  2253. @example
  2254. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2255. @end example
  2256. @item
  2257. Compressor/Gate:
  2258. @example
  2259. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2260. @end example
  2261. @item
  2262. Expander:
  2263. @example
  2264. 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
  2265. @end example
  2266. @item
  2267. Hard limiter at -6dB:
  2268. @example
  2269. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2270. @end example
  2271. @item
  2272. Hard limiter at -12dB:
  2273. @example
  2274. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2275. @end example
  2276. @item
  2277. Hard noise gate at -35 dB:
  2278. @example
  2279. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2280. @end example
  2281. @item
  2282. Soft limiter:
  2283. @example
  2284. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2285. @end example
  2286. @end itemize
  2287. @section compensationdelay
  2288. Compensation Delay Line is a metric based delay to compensate differing
  2289. positions of microphones or speakers.
  2290. For example, you have recorded guitar with two microphones placed in
  2291. different location. Because the front of sound wave has fixed speed in
  2292. normal conditions, the phasing of microphones can vary and depends on
  2293. their location and interposition. The best sound mix can be achieved when
  2294. these microphones are in phase (synchronized). Note that distance of
  2295. ~30 cm between microphones makes one microphone to capture signal in
  2296. antiphase to another microphone. That makes the final mix sounding moody.
  2297. This filter helps to solve phasing problems by adding different delays
  2298. to each microphone track and make them synchronized.
  2299. The best result can be reached when you take one track as base and
  2300. synchronize other tracks one by one with it.
  2301. Remember that synchronization/delay tolerance depends on sample rate, too.
  2302. Higher sample rates will give more tolerance.
  2303. It accepts the following parameters:
  2304. @table @option
  2305. @item mm
  2306. Set millimeters distance. This is compensation distance for fine tuning.
  2307. Default is 0.
  2308. @item cm
  2309. Set cm distance. This is compensation distance for tightening distance setup.
  2310. Default is 0.
  2311. @item m
  2312. Set meters distance. This is compensation distance for hard distance setup.
  2313. Default is 0.
  2314. @item dry
  2315. Set dry amount. Amount of unprocessed (dry) signal.
  2316. Default is 0.
  2317. @item wet
  2318. Set wet amount. Amount of processed (wet) signal.
  2319. Default is 1.
  2320. @item temp
  2321. Set temperature degree in Celsius. This is the temperature of the environment.
  2322. Default is 20.
  2323. @end table
  2324. @section crossfeed
  2325. Apply headphone crossfeed filter.
  2326. Crossfeed is the process of blending the left and right channels of stereo
  2327. audio recording.
  2328. It is mainly used to reduce extreme stereo separation of low frequencies.
  2329. The intent is to produce more speaker like sound to the listener.
  2330. The filter accepts the following options:
  2331. @table @option
  2332. @item strength
  2333. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2334. This sets gain of low shelf filter for side part of stereo image.
  2335. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2336. @item range
  2337. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2338. This sets cut off frequency of low shelf filter. Default is cut off near
  2339. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2340. @item level_in
  2341. Set input gain. Default is 0.9.
  2342. @item level_out
  2343. Set output gain. Default is 1.
  2344. @end table
  2345. @section crystalizer
  2346. Simple algorithm to expand audio dynamic range.
  2347. The filter accepts the following options:
  2348. @table @option
  2349. @item i
  2350. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2351. (unchanged sound) to 10.0 (maximum effect).
  2352. @item c
  2353. Enable clipping. By default is enabled.
  2354. @end table
  2355. @section dcshift
  2356. Apply a DC shift to the audio.
  2357. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2358. in the recording chain) from the audio. The effect of a DC offset is reduced
  2359. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2360. a signal has a DC offset.
  2361. @table @option
  2362. @item shift
  2363. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2364. the audio.
  2365. @item limitergain
  2366. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2367. used to prevent clipping.
  2368. @end table
  2369. @section deesser
  2370. Apply de-essing to the audio samples.
  2371. @table @option
  2372. @item i
  2373. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2374. Default is 0.
  2375. @item m
  2376. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2377. Default is 0.5.
  2378. @item f
  2379. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2380. Default is 0.5.
  2381. @item s
  2382. Set the output mode.
  2383. It accepts the following values:
  2384. @table @option
  2385. @item i
  2386. Pass input unchanged.
  2387. @item o
  2388. Pass ess filtered out.
  2389. @item e
  2390. Pass only ess.
  2391. Default value is @var{o}.
  2392. @end table
  2393. @end table
  2394. @section drmeter
  2395. Measure audio dynamic range.
  2396. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2397. is found in transition material. And anything less that 8 have very poor dynamics
  2398. and is very compressed.
  2399. The filter accepts the following options:
  2400. @table @option
  2401. @item length
  2402. Set window length in seconds used to split audio into segments of equal length.
  2403. Default is 3 seconds.
  2404. @end table
  2405. @section dynaudnorm
  2406. Dynamic Audio Normalizer.
  2407. This filter applies a certain amount of gain to the input audio in order
  2408. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2409. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2410. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2411. This allows for applying extra gain to the "quiet" sections of the audio
  2412. while avoiding distortions or clipping the "loud" sections. In other words:
  2413. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2414. sections, in the sense that the volume of each section is brought to the
  2415. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2416. this goal *without* applying "dynamic range compressing". It will retain 100%
  2417. of the dynamic range *within* each section of the audio file.
  2418. @table @option
  2419. @item f
  2420. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2421. Default is 500 milliseconds.
  2422. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2423. referred to as frames. This is required, because a peak magnitude has no
  2424. meaning for just a single sample value. Instead, we need to determine the
  2425. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2426. normalizer would simply use the peak magnitude of the complete file, the
  2427. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2428. frame. The length of a frame is specified in milliseconds. By default, the
  2429. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2430. been found to give good results with most files.
  2431. Note that the exact frame length, in number of samples, will be determined
  2432. automatically, based on the sampling rate of the individual input audio file.
  2433. @item g
  2434. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2435. number. Default is 31.
  2436. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2437. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2438. is specified in frames, centered around the current frame. For the sake of
  2439. simplicity, this must be an odd number. Consequently, the default value of 31
  2440. takes into account the current frame, as well as the 15 preceding frames and
  2441. the 15 subsequent frames. Using a larger window results in a stronger
  2442. smoothing effect and thus in less gain variation, i.e. slower gain
  2443. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2444. effect and thus in more gain variation, i.e. faster gain adaptation.
  2445. In other words, the more you increase this value, the more the Dynamic Audio
  2446. Normalizer will behave like a "traditional" normalization filter. On the
  2447. contrary, the more you decrease this value, the more the Dynamic Audio
  2448. Normalizer will behave like a dynamic range compressor.
  2449. @item p
  2450. Set the target peak value. This specifies the highest permissible magnitude
  2451. level for the normalized audio input. This filter will try to approach the
  2452. target peak magnitude as closely as possible, but at the same time it also
  2453. makes sure that the normalized signal will never exceed the peak magnitude.
  2454. A frame's maximum local gain factor is imposed directly by the target peak
  2455. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2456. It is not recommended to go above this value.
  2457. @item m
  2458. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2459. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2460. factor for each input frame, i.e. the maximum gain factor that does not
  2461. result in clipping or distortion. The maximum gain factor is determined by
  2462. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2463. additionally bounds the frame's maximum gain factor by a predetermined
  2464. (global) maximum gain factor. This is done in order to avoid excessive gain
  2465. factors in "silent" or almost silent frames. By default, the maximum gain
  2466. factor is 10.0, For most inputs the default value should be sufficient and
  2467. it usually is not recommended to increase this value. Though, for input
  2468. with an extremely low overall volume level, it may be necessary to allow even
  2469. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2470. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2471. Instead, a "sigmoid" threshold function will be applied. This way, the
  2472. gain factors will smoothly approach the threshold value, but never exceed that
  2473. value.
  2474. @item r
  2475. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2476. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2477. This means that the maximum local gain factor for each frame is defined
  2478. (only) by the frame's highest magnitude sample. This way, the samples can
  2479. be amplified as much as possible without exceeding the maximum signal
  2480. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2481. Normalizer can also take into account the frame's root mean square,
  2482. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2483. determine the power of a time-varying signal. It is therefore considered
  2484. that the RMS is a better approximation of the "perceived loudness" than
  2485. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2486. frames to a constant RMS value, a uniform "perceived loudness" can be
  2487. established. If a target RMS value has been specified, a frame's local gain
  2488. factor is defined as the factor that would result in exactly that RMS value.
  2489. Note, however, that the maximum local gain factor is still restricted by the
  2490. frame's highest magnitude sample, in order to prevent clipping.
  2491. @item n
  2492. Enable channels coupling. By default is enabled.
  2493. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2494. amount. This means the same gain factor will be applied to all channels, i.e.
  2495. the maximum possible gain factor is determined by the "loudest" channel.
  2496. However, in some recordings, it may happen that the volume of the different
  2497. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2498. In this case, this option can be used to disable the channel coupling. This way,
  2499. the gain factor will be determined independently for each channel, depending
  2500. only on the individual channel's highest magnitude sample. This allows for
  2501. harmonizing the volume of the different channels.
  2502. @item c
  2503. Enable DC bias correction. By default is disabled.
  2504. An audio signal (in the time domain) is a sequence of sample values.
  2505. In the Dynamic Audio Normalizer these sample values are represented in the
  2506. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2507. audio signal, or "waveform", should be centered around the zero point.
  2508. That means if we calculate the mean value of all samples in a file, or in a
  2509. single frame, then the result should be 0.0 or at least very close to that
  2510. value. If, however, there is a significant deviation of the mean value from
  2511. 0.0, in either positive or negative direction, this is referred to as a
  2512. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2513. Audio Normalizer provides optional DC bias correction.
  2514. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2515. the mean value, or "DC correction" offset, of each input frame and subtract
  2516. that value from all of the frame's sample values which ensures those samples
  2517. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2518. boundaries, the DC correction offset values will be interpolated smoothly
  2519. between neighbouring frames.
  2520. @item b
  2521. Enable alternative boundary mode. By default is disabled.
  2522. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2523. around each frame. This includes the preceding frames as well as the
  2524. subsequent frames. However, for the "boundary" frames, located at the very
  2525. beginning and at the very end of the audio file, not all neighbouring
  2526. frames are available. In particular, for the first few frames in the audio
  2527. file, the preceding frames are not known. And, similarly, for the last few
  2528. frames in the audio file, the subsequent frames are not known. Thus, the
  2529. question arises which gain factors should be assumed for the missing frames
  2530. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2531. to deal with this situation. The default boundary mode assumes a gain factor
  2532. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2533. "fade out" at the beginning and at the end of the input, respectively.
  2534. @item s
  2535. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2536. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2537. compression. This means that signal peaks will not be pruned and thus the
  2538. full dynamic range will be retained within each local neighbourhood. However,
  2539. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2540. normalization algorithm with a more "traditional" compression.
  2541. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2542. (thresholding) function. If (and only if) the compression feature is enabled,
  2543. all input frames will be processed by a soft knee thresholding function prior
  2544. to the actual normalization process. Put simply, the thresholding function is
  2545. going to prune all samples whose magnitude exceeds a certain threshold value.
  2546. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2547. value. Instead, the threshold value will be adjusted for each individual
  2548. frame.
  2549. In general, smaller parameters result in stronger compression, and vice versa.
  2550. Values below 3.0 are not recommended, because audible distortion may appear.
  2551. @end table
  2552. @section earwax
  2553. Make audio easier to listen to on headphones.
  2554. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2555. so that when listened to on headphones the stereo image is moved from
  2556. inside your head (standard for headphones) to outside and in front of
  2557. the listener (standard for speakers).
  2558. Ported from SoX.
  2559. @section equalizer
  2560. Apply a two-pole peaking equalisation (EQ) filter. With this
  2561. filter, the signal-level at and around a selected frequency can
  2562. be increased or decreased, whilst (unlike bandpass and bandreject
  2563. filters) that at all other frequencies is unchanged.
  2564. In order to produce complex equalisation curves, this filter can
  2565. be given several times, each with a different central frequency.
  2566. The filter accepts the following options:
  2567. @table @option
  2568. @item frequency, f
  2569. Set the filter's central frequency in Hz.
  2570. @item width_type, t
  2571. Set method to specify band-width of filter.
  2572. @table @option
  2573. @item h
  2574. Hz
  2575. @item q
  2576. Q-Factor
  2577. @item o
  2578. octave
  2579. @item s
  2580. slope
  2581. @item k
  2582. kHz
  2583. @end table
  2584. @item width, w
  2585. Specify the band-width of a filter in width_type units.
  2586. @item gain, g
  2587. Set the required gain or attenuation in dB.
  2588. Beware of clipping when using a positive gain.
  2589. @item mix, m
  2590. How much to use filtered signal in output. Default is 1.
  2591. Range is between 0 and 1.
  2592. @item channels, c
  2593. Specify which channels to filter, by default all available are filtered.
  2594. @end table
  2595. @subsection Examples
  2596. @itemize
  2597. @item
  2598. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2599. @example
  2600. equalizer=f=1000:t=h:width=200:g=-10
  2601. @end example
  2602. @item
  2603. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2604. @example
  2605. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2606. @end example
  2607. @end itemize
  2608. @subsection Commands
  2609. This filter supports the following commands:
  2610. @table @option
  2611. @item frequency, f
  2612. Change equalizer frequency.
  2613. Syntax for the command is : "@var{frequency}"
  2614. @item width_type, t
  2615. Change equalizer width_type.
  2616. Syntax for the command is : "@var{width_type}"
  2617. @item width, w
  2618. Change equalizer width.
  2619. Syntax for the command is : "@var{width}"
  2620. @item gain, g
  2621. Change equalizer gain.
  2622. Syntax for the command is : "@var{gain}"
  2623. @item mix, m
  2624. Change equalizer mix.
  2625. Syntax for the command is : "@var{mix}"
  2626. @end table
  2627. @section extrastereo
  2628. Linearly increases the difference between left and right channels which
  2629. adds some sort of "live" effect to playback.
  2630. The filter accepts the following options:
  2631. @table @option
  2632. @item m
  2633. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2634. (average of both channels), with 1.0 sound will be unchanged, with
  2635. -1.0 left and right channels will be swapped.
  2636. @item c
  2637. Enable clipping. By default is enabled.
  2638. @end table
  2639. @section firequalizer
  2640. Apply FIR Equalization using arbitrary frequency response.
  2641. The filter accepts the following option:
  2642. @table @option
  2643. @item gain
  2644. Set gain curve equation (in dB). The expression can contain variables:
  2645. @table @option
  2646. @item f
  2647. the evaluated frequency
  2648. @item sr
  2649. sample rate
  2650. @item ch
  2651. channel number, set to 0 when multichannels evaluation is disabled
  2652. @item chid
  2653. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2654. multichannels evaluation is disabled
  2655. @item chs
  2656. number of channels
  2657. @item chlayout
  2658. channel_layout, see libavutil/channel_layout.h
  2659. @end table
  2660. and functions:
  2661. @table @option
  2662. @item gain_interpolate(f)
  2663. interpolate gain on frequency f based on gain_entry
  2664. @item cubic_interpolate(f)
  2665. same as gain_interpolate, but smoother
  2666. @end table
  2667. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2668. @item gain_entry
  2669. Set gain entry for gain_interpolate function. The expression can
  2670. contain functions:
  2671. @table @option
  2672. @item entry(f, g)
  2673. store gain entry at frequency f with value g
  2674. @end table
  2675. This option is also available as command.
  2676. @item delay
  2677. Set filter delay in seconds. Higher value means more accurate.
  2678. Default is @code{0.01}.
  2679. @item accuracy
  2680. Set filter accuracy in Hz. Lower value means more accurate.
  2681. Default is @code{5}.
  2682. @item wfunc
  2683. Set window function. Acceptable values are:
  2684. @table @option
  2685. @item rectangular
  2686. rectangular window, useful when gain curve is already smooth
  2687. @item hann
  2688. hann window (default)
  2689. @item hamming
  2690. hamming window
  2691. @item blackman
  2692. blackman window
  2693. @item nuttall3
  2694. 3-terms continuous 1st derivative nuttall window
  2695. @item mnuttall3
  2696. minimum 3-terms discontinuous nuttall window
  2697. @item nuttall
  2698. 4-terms continuous 1st derivative nuttall window
  2699. @item bnuttall
  2700. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2701. @item bharris
  2702. blackman-harris window
  2703. @item tukey
  2704. tukey window
  2705. @end table
  2706. @item fixed
  2707. If enabled, use fixed number of audio samples. This improves speed when
  2708. filtering with large delay. Default is disabled.
  2709. @item multi
  2710. Enable multichannels evaluation on gain. Default is disabled.
  2711. @item zero_phase
  2712. Enable zero phase mode by subtracting timestamp to compensate delay.
  2713. Default is disabled.
  2714. @item scale
  2715. Set scale used by gain. Acceptable values are:
  2716. @table @option
  2717. @item linlin
  2718. linear frequency, linear gain
  2719. @item linlog
  2720. linear frequency, logarithmic (in dB) gain (default)
  2721. @item loglin
  2722. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2723. @item loglog
  2724. logarithmic frequency, logarithmic gain
  2725. @end table
  2726. @item dumpfile
  2727. Set file for dumping, suitable for gnuplot.
  2728. @item dumpscale
  2729. Set scale for dumpfile. Acceptable values are same with scale option.
  2730. Default is linlog.
  2731. @item fft2
  2732. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2733. Default is disabled.
  2734. @item min_phase
  2735. Enable minimum phase impulse response. Default is disabled.
  2736. @end table
  2737. @subsection Examples
  2738. @itemize
  2739. @item
  2740. lowpass at 1000 Hz:
  2741. @example
  2742. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2743. @end example
  2744. @item
  2745. lowpass at 1000 Hz with gain_entry:
  2746. @example
  2747. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2748. @end example
  2749. @item
  2750. custom equalization:
  2751. @example
  2752. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2753. @end example
  2754. @item
  2755. higher delay with zero phase to compensate delay:
  2756. @example
  2757. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2758. @end example
  2759. @item
  2760. lowpass on left channel, highpass on right channel:
  2761. @example
  2762. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2763. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2764. @end example
  2765. @end itemize
  2766. @section flanger
  2767. Apply a flanging effect to the audio.
  2768. The filter accepts the following options:
  2769. @table @option
  2770. @item delay
  2771. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2772. @item depth
  2773. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2774. @item regen
  2775. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2776. Default value is 0.
  2777. @item width
  2778. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2779. Default value is 71.
  2780. @item speed
  2781. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2782. @item shape
  2783. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2784. Default value is @var{sinusoidal}.
  2785. @item phase
  2786. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2787. Default value is 25.
  2788. @item interp
  2789. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2790. Default is @var{linear}.
  2791. @end table
  2792. @section haas
  2793. Apply Haas effect to audio.
  2794. Note that this makes most sense to apply on mono signals.
  2795. With this filter applied to mono signals it give some directionality and
  2796. stretches its stereo image.
  2797. The filter accepts the following options:
  2798. @table @option
  2799. @item level_in
  2800. Set input level. By default is @var{1}, or 0dB
  2801. @item level_out
  2802. Set output level. By default is @var{1}, or 0dB.
  2803. @item side_gain
  2804. Set gain applied to side part of signal. By default is @var{1}.
  2805. @item middle_source
  2806. Set kind of middle source. Can be one of the following:
  2807. @table @samp
  2808. @item left
  2809. Pick left channel.
  2810. @item right
  2811. Pick right channel.
  2812. @item mid
  2813. Pick middle part signal of stereo image.
  2814. @item side
  2815. Pick side part signal of stereo image.
  2816. @end table
  2817. @item middle_phase
  2818. Change middle phase. By default is disabled.
  2819. @item left_delay
  2820. Set left channel delay. By default is @var{2.05} milliseconds.
  2821. @item left_balance
  2822. Set left channel balance. By default is @var{-1}.
  2823. @item left_gain
  2824. Set left channel gain. By default is @var{1}.
  2825. @item left_phase
  2826. Change left phase. By default is disabled.
  2827. @item right_delay
  2828. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2829. @item right_balance
  2830. Set right channel balance. By default is @var{1}.
  2831. @item right_gain
  2832. Set right channel gain. By default is @var{1}.
  2833. @item right_phase
  2834. Change right phase. By default is enabled.
  2835. @end table
  2836. @section hdcd
  2837. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2838. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2839. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2840. of HDCD, and detects the Transient Filter flag.
  2841. @example
  2842. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2843. @end example
  2844. When using the filter with wav, note the default encoding for wav is 16-bit,
  2845. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2846. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2847. @example
  2848. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2849. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2850. @end example
  2851. The filter accepts the following options:
  2852. @table @option
  2853. @item disable_autoconvert
  2854. Disable any automatic format conversion or resampling in the filter graph.
  2855. @item process_stereo
  2856. Process the stereo channels together. If target_gain does not match between
  2857. channels, consider it invalid and use the last valid target_gain.
  2858. @item cdt_ms
  2859. Set the code detect timer period in ms.
  2860. @item force_pe
  2861. Always extend peaks above -3dBFS even if PE isn't signaled.
  2862. @item analyze_mode
  2863. Replace audio with a solid tone and adjust the amplitude to signal some
  2864. specific aspect of the decoding process. The output file can be loaded in
  2865. an audio editor alongside the original to aid analysis.
  2866. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2867. Modes are:
  2868. @table @samp
  2869. @item 0, off
  2870. Disabled
  2871. @item 1, lle
  2872. Gain adjustment level at each sample
  2873. @item 2, pe
  2874. Samples where peak extend occurs
  2875. @item 3, cdt
  2876. Samples where the code detect timer is active
  2877. @item 4, tgm
  2878. Samples where the target gain does not match between channels
  2879. @end table
  2880. @end table
  2881. @section headphone
  2882. Apply head-related transfer functions (HRTFs) to create virtual
  2883. loudspeakers around the user for binaural listening via headphones.
  2884. The HRIRs are provided via additional streams, for each channel
  2885. one stereo input stream is needed.
  2886. The filter accepts the following options:
  2887. @table @option
  2888. @item map
  2889. Set mapping of input streams for convolution.
  2890. The argument is a '|'-separated list of channel names in order as they
  2891. are given as additional stream inputs for filter.
  2892. This also specify number of input streams. Number of input streams
  2893. must be not less than number of channels in first stream plus one.
  2894. @item gain
  2895. Set gain applied to audio. Value is in dB. Default is 0.
  2896. @item type
  2897. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2898. processing audio in time domain which is slow.
  2899. @var{freq} is processing audio in frequency domain which is fast.
  2900. Default is @var{freq}.
  2901. @item lfe
  2902. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2903. @item size
  2904. Set size of frame in number of samples which will be processed at once.
  2905. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2906. @item hrir
  2907. Set format of hrir stream.
  2908. Default value is @var{stereo}. Alternative value is @var{multich}.
  2909. If value is set to @var{stereo}, number of additional streams should
  2910. be greater or equal to number of input channels in first input stream.
  2911. Also each additional stream should have stereo number of channels.
  2912. If value is set to @var{multich}, number of additional streams should
  2913. be exactly one. Also number of input channels of additional stream
  2914. should be equal or greater than twice number of channels of first input
  2915. stream.
  2916. @end table
  2917. @subsection Examples
  2918. @itemize
  2919. @item
  2920. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2921. each amovie filter use stereo file with IR coefficients as input.
  2922. The files give coefficients for each position of virtual loudspeaker:
  2923. @example
  2924. ffmpeg -i input.wav
  2925. -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"
  2926. output.wav
  2927. @end example
  2928. @item
  2929. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2930. but now in @var{multich} @var{hrir} format.
  2931. @example
  2932. 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"
  2933. output.wav
  2934. @end example
  2935. @end itemize
  2936. @section highpass
  2937. Apply a high-pass filter with 3dB point frequency.
  2938. The filter can be either single-pole, or double-pole (the default).
  2939. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2940. The filter accepts the following options:
  2941. @table @option
  2942. @item frequency, f
  2943. Set frequency in Hz. Default is 3000.
  2944. @item poles, p
  2945. Set number of poles. Default is 2.
  2946. @item width_type, t
  2947. Set method to specify band-width of filter.
  2948. @table @option
  2949. @item h
  2950. Hz
  2951. @item q
  2952. Q-Factor
  2953. @item o
  2954. octave
  2955. @item s
  2956. slope
  2957. @item k
  2958. kHz
  2959. @end table
  2960. @item width, w
  2961. Specify the band-width of a filter in width_type units.
  2962. Applies only to double-pole filter.
  2963. The default is 0.707q and gives a Butterworth response.
  2964. @item mix, m
  2965. How much to use filtered signal in output. Default is 1.
  2966. Range is between 0 and 1.
  2967. @item channels, c
  2968. Specify which channels to filter, by default all available are filtered.
  2969. @end table
  2970. @subsection Commands
  2971. This filter supports the following commands:
  2972. @table @option
  2973. @item frequency, f
  2974. Change highpass frequency.
  2975. Syntax for the command is : "@var{frequency}"
  2976. @item width_type, t
  2977. Change highpass width_type.
  2978. Syntax for the command is : "@var{width_type}"
  2979. @item width, w
  2980. Change highpass width.
  2981. Syntax for the command is : "@var{width}"
  2982. @item mix, m
  2983. Change highpass mix.
  2984. Syntax for the command is : "@var{mix}"
  2985. @end table
  2986. @section join
  2987. Join multiple input streams into one multi-channel stream.
  2988. It accepts the following parameters:
  2989. @table @option
  2990. @item inputs
  2991. The number of input streams. It defaults to 2.
  2992. @item channel_layout
  2993. The desired output channel layout. It defaults to stereo.
  2994. @item map
  2995. Map channels from inputs to output. The argument is a '|'-separated list of
  2996. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2997. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2998. can be either the name of the input channel (e.g. FL for front left) or its
  2999. index in the specified input stream. @var{out_channel} is the name of the output
  3000. channel.
  3001. @end table
  3002. The filter will attempt to guess the mappings when they are not specified
  3003. explicitly. It does so by first trying to find an unused matching input channel
  3004. and if that fails it picks the first unused input channel.
  3005. Join 3 inputs (with properly set channel layouts):
  3006. @example
  3007. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3008. @end example
  3009. Build a 5.1 output from 6 single-channel streams:
  3010. @example
  3011. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3012. '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'
  3013. out
  3014. @end example
  3015. @section ladspa
  3016. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3017. To enable compilation of this filter you need to configure FFmpeg with
  3018. @code{--enable-ladspa}.
  3019. @table @option
  3020. @item file, f
  3021. Specifies the name of LADSPA plugin library to load. If the environment
  3022. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3023. each one of the directories specified by the colon separated list in
  3024. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3025. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3026. @file{/usr/lib/ladspa/}.
  3027. @item plugin, p
  3028. Specifies the plugin within the library. Some libraries contain only
  3029. one plugin, but others contain many of them. If this is not set filter
  3030. will list all available plugins within the specified library.
  3031. @item controls, c
  3032. Set the '|' separated list of controls which are zero or more floating point
  3033. values that determine the behavior of the loaded plugin (for example delay,
  3034. threshold or gain).
  3035. Controls need to be defined using the following syntax:
  3036. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3037. @var{valuei} is the value set on the @var{i}-th control.
  3038. Alternatively they can be also defined using the following syntax:
  3039. @var{value0}|@var{value1}|@var{value2}|..., where
  3040. @var{valuei} is the value set on the @var{i}-th control.
  3041. If @option{controls} is set to @code{help}, all available controls and
  3042. their valid ranges are printed.
  3043. @item sample_rate, s
  3044. Specify the sample rate, default to 44100. Only used if plugin have
  3045. zero inputs.
  3046. @item nb_samples, n
  3047. Set the number of samples per channel per each output frame, default
  3048. is 1024. Only used if plugin have zero inputs.
  3049. @item duration, d
  3050. Set the minimum duration of the sourced audio. See
  3051. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3052. for the accepted syntax.
  3053. Note that the resulting duration may be greater than the specified duration,
  3054. as the generated audio is always cut at the end of a complete frame.
  3055. If not specified, or the expressed duration is negative, the audio is
  3056. supposed to be generated forever.
  3057. Only used if plugin have zero inputs.
  3058. @end table
  3059. @subsection Examples
  3060. @itemize
  3061. @item
  3062. List all available plugins within amp (LADSPA example plugin) library:
  3063. @example
  3064. ladspa=file=amp
  3065. @end example
  3066. @item
  3067. List all available controls and their valid ranges for @code{vcf_notch}
  3068. plugin from @code{VCF} library:
  3069. @example
  3070. ladspa=f=vcf:p=vcf_notch:c=help
  3071. @end example
  3072. @item
  3073. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3074. plugin library:
  3075. @example
  3076. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3077. @end example
  3078. @item
  3079. Add reverberation to the audio using TAP-plugins
  3080. (Tom's Audio Processing plugins):
  3081. @example
  3082. ladspa=file=tap_reverb:tap_reverb
  3083. @end example
  3084. @item
  3085. Generate white noise, with 0.2 amplitude:
  3086. @example
  3087. ladspa=file=cmt:noise_source_white:c=c0=.2
  3088. @end example
  3089. @item
  3090. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3091. @code{C* Audio Plugin Suite} (CAPS) library:
  3092. @example
  3093. ladspa=file=caps:Click:c=c1=20'
  3094. @end example
  3095. @item
  3096. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3097. @example
  3098. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3099. @end example
  3100. @item
  3101. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3102. @code{SWH Plugins} collection:
  3103. @example
  3104. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3105. @end example
  3106. @item
  3107. Attenuate low frequencies using Multiband EQ from Steve Harris
  3108. @code{SWH Plugins} collection:
  3109. @example
  3110. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3111. @end example
  3112. @item
  3113. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3114. (CAPS) library:
  3115. @example
  3116. ladspa=caps:Narrower
  3117. @end example
  3118. @item
  3119. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3120. @example
  3121. ladspa=caps:White:.2
  3122. @end example
  3123. @item
  3124. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3125. @example
  3126. ladspa=caps:Fractal:c=c1=1
  3127. @end example
  3128. @item
  3129. Dynamic volume normalization using @code{VLevel} plugin:
  3130. @example
  3131. ladspa=vlevel-ladspa:vlevel_mono
  3132. @end example
  3133. @end itemize
  3134. @subsection Commands
  3135. This filter supports the following commands:
  3136. @table @option
  3137. @item cN
  3138. Modify the @var{N}-th control value.
  3139. If the specified value is not valid, it is ignored and prior one is kept.
  3140. @end table
  3141. @section loudnorm
  3142. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3143. Support for both single pass (livestreams, files) and double pass (files) modes.
  3144. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3145. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3146. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3147. The filter accepts the following options:
  3148. @table @option
  3149. @item I, i
  3150. Set integrated loudness target.
  3151. Range is -70.0 - -5.0. Default value is -24.0.
  3152. @item LRA, lra
  3153. Set loudness range target.
  3154. Range is 1.0 - 20.0. Default value is 7.0.
  3155. @item TP, tp
  3156. Set maximum true peak.
  3157. Range is -9.0 - +0.0. Default value is -2.0.
  3158. @item measured_I, measured_i
  3159. Measured IL of input file.
  3160. Range is -99.0 - +0.0.
  3161. @item measured_LRA, measured_lra
  3162. Measured LRA of input file.
  3163. Range is 0.0 - 99.0.
  3164. @item measured_TP, measured_tp
  3165. Measured true peak of input file.
  3166. Range is -99.0 - +99.0.
  3167. @item measured_thresh
  3168. Measured threshold of input file.
  3169. Range is -99.0 - +0.0.
  3170. @item offset
  3171. Set offset gain. Gain is applied before the true-peak limiter.
  3172. Range is -99.0 - +99.0. Default is +0.0.
  3173. @item linear
  3174. Normalize linearly if possible.
  3175. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3176. to be specified in order to use this mode.
  3177. Options are true or false. Default is true.
  3178. @item dual_mono
  3179. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3180. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3181. If set to @code{true}, this option will compensate for this effect.
  3182. Multi-channel input files are not affected by this option.
  3183. Options are true or false. Default is false.
  3184. @item print_format
  3185. Set print format for stats. Options are summary, json, or none.
  3186. Default value is none.
  3187. @end table
  3188. @section lowpass
  3189. Apply a low-pass filter with 3dB point frequency.
  3190. The filter can be either single-pole or double-pole (the default).
  3191. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3192. The filter accepts the following options:
  3193. @table @option
  3194. @item frequency, f
  3195. Set frequency in Hz. Default is 500.
  3196. @item poles, p
  3197. Set number of poles. Default is 2.
  3198. @item width_type, t
  3199. Set method to specify band-width of filter.
  3200. @table @option
  3201. @item h
  3202. Hz
  3203. @item q
  3204. Q-Factor
  3205. @item o
  3206. octave
  3207. @item s
  3208. slope
  3209. @item k
  3210. kHz
  3211. @end table
  3212. @item width, w
  3213. Specify the band-width of a filter in width_type units.
  3214. Applies only to double-pole filter.
  3215. The default is 0.707q and gives a Butterworth response.
  3216. @item mix, m
  3217. How much to use filtered signal in output. Default is 1.
  3218. Range is between 0 and 1.
  3219. @item channels, c
  3220. Specify which channels to filter, by default all available are filtered.
  3221. @end table
  3222. @subsection Examples
  3223. @itemize
  3224. @item
  3225. Lowpass only LFE channel, it LFE is not present it does nothing:
  3226. @example
  3227. lowpass=c=LFE
  3228. @end example
  3229. @end itemize
  3230. @subsection Commands
  3231. This filter supports the following commands:
  3232. @table @option
  3233. @item frequency, f
  3234. Change lowpass frequency.
  3235. Syntax for the command is : "@var{frequency}"
  3236. @item width_type, t
  3237. Change lowpass width_type.
  3238. Syntax for the command is : "@var{width_type}"
  3239. @item width, w
  3240. Change lowpass width.
  3241. Syntax for the command is : "@var{width}"
  3242. @item mix, m
  3243. Change lowpass mix.
  3244. Syntax for the command is : "@var{mix}"
  3245. @end table
  3246. @section lv2
  3247. Load a LV2 (LADSPA Version 2) plugin.
  3248. To enable compilation of this filter you need to configure FFmpeg with
  3249. @code{--enable-lv2}.
  3250. @table @option
  3251. @item plugin, p
  3252. Specifies the plugin URI. You may need to escape ':'.
  3253. @item controls, c
  3254. Set the '|' separated list of controls which are zero or more floating point
  3255. values that determine the behavior of the loaded plugin (for example delay,
  3256. threshold or gain).
  3257. If @option{controls} is set to @code{help}, all available controls and
  3258. their valid ranges are printed.
  3259. @item sample_rate, s
  3260. Specify the sample rate, default to 44100. Only used if plugin have
  3261. zero inputs.
  3262. @item nb_samples, n
  3263. Set the number of samples per channel per each output frame, default
  3264. is 1024. Only used if plugin have zero inputs.
  3265. @item duration, d
  3266. Set the minimum duration of the sourced audio. See
  3267. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3268. for the accepted syntax.
  3269. Note that the resulting duration may be greater than the specified duration,
  3270. as the generated audio is always cut at the end of a complete frame.
  3271. If not specified, or the expressed duration is negative, the audio is
  3272. supposed to be generated forever.
  3273. Only used if plugin have zero inputs.
  3274. @end table
  3275. @subsection Examples
  3276. @itemize
  3277. @item
  3278. Apply bass enhancer plugin from Calf:
  3279. @example
  3280. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3281. @end example
  3282. @item
  3283. Apply vinyl plugin from Calf:
  3284. @example
  3285. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3286. @end example
  3287. @item
  3288. Apply bit crusher plugin from ArtyFX:
  3289. @example
  3290. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3291. @end example
  3292. @end itemize
  3293. @section mcompand
  3294. Multiband Compress or expand the audio's dynamic range.
  3295. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3296. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3297. response when absent compander action.
  3298. It accepts the following parameters:
  3299. @table @option
  3300. @item args
  3301. This option syntax is:
  3302. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3303. For explanation of each item refer to compand filter documentation.
  3304. @end table
  3305. @anchor{pan}
  3306. @section pan
  3307. Mix channels with specific gain levels. The filter accepts the output
  3308. channel layout followed by a set of channels definitions.
  3309. This filter is also designed to efficiently remap the channels of an audio
  3310. stream.
  3311. The filter accepts parameters of the form:
  3312. "@var{l}|@var{outdef}|@var{outdef}|..."
  3313. @table @option
  3314. @item l
  3315. output channel layout or number of channels
  3316. @item outdef
  3317. output channel specification, of the form:
  3318. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3319. @item out_name
  3320. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3321. number (c0, c1, etc.)
  3322. @item gain
  3323. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3324. @item in_name
  3325. input channel to use, see out_name for details; it is not possible to mix
  3326. named and numbered input channels
  3327. @end table
  3328. If the `=' in a channel specification is replaced by `<', then the gains for
  3329. that specification will be renormalized so that the total is 1, thus
  3330. avoiding clipping noise.
  3331. @subsection Mixing examples
  3332. For example, if you want to down-mix from stereo to mono, but with a bigger
  3333. factor for the left channel:
  3334. @example
  3335. pan=1c|c0=0.9*c0+0.1*c1
  3336. @end example
  3337. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3338. 7-channels surround:
  3339. @example
  3340. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3341. @end example
  3342. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3343. that should be preferred (see "-ac" option) unless you have very specific
  3344. needs.
  3345. @subsection Remapping examples
  3346. The channel remapping will be effective if, and only if:
  3347. @itemize
  3348. @item gain coefficients are zeroes or ones,
  3349. @item only one input per channel output,
  3350. @end itemize
  3351. If all these conditions are satisfied, the filter will notify the user ("Pure
  3352. channel mapping detected"), and use an optimized and lossless method to do the
  3353. remapping.
  3354. For example, if you have a 5.1 source and want a stereo audio stream by
  3355. dropping the extra channels:
  3356. @example
  3357. pan="stereo| c0=FL | c1=FR"
  3358. @end example
  3359. Given the same source, you can also switch front left and front right channels
  3360. and keep the input channel layout:
  3361. @example
  3362. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3363. @end example
  3364. If the input is a stereo audio stream, you can mute the front left channel (and
  3365. still keep the stereo channel layout) with:
  3366. @example
  3367. pan="stereo|c1=c1"
  3368. @end example
  3369. Still with a stereo audio stream input, you can copy the right channel in both
  3370. front left and right:
  3371. @example
  3372. pan="stereo| c0=FR | c1=FR"
  3373. @end example
  3374. @section replaygain
  3375. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3376. outputs it unchanged.
  3377. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3378. @section resample
  3379. Convert the audio sample format, sample rate and channel layout. It is
  3380. not meant to be used directly.
  3381. @section rubberband
  3382. Apply time-stretching and pitch-shifting with librubberband.
  3383. To enable compilation of this filter, you need to configure FFmpeg with
  3384. @code{--enable-librubberband}.
  3385. The filter accepts the following options:
  3386. @table @option
  3387. @item tempo
  3388. Set tempo scale factor.
  3389. @item pitch
  3390. Set pitch scale factor.
  3391. @item transients
  3392. Set transients detector.
  3393. Possible values are:
  3394. @table @var
  3395. @item crisp
  3396. @item mixed
  3397. @item smooth
  3398. @end table
  3399. @item detector
  3400. Set detector.
  3401. Possible values are:
  3402. @table @var
  3403. @item compound
  3404. @item percussive
  3405. @item soft
  3406. @end table
  3407. @item phase
  3408. Set phase.
  3409. Possible values are:
  3410. @table @var
  3411. @item laminar
  3412. @item independent
  3413. @end table
  3414. @item window
  3415. Set processing window size.
  3416. Possible values are:
  3417. @table @var
  3418. @item standard
  3419. @item short
  3420. @item long
  3421. @end table
  3422. @item smoothing
  3423. Set smoothing.
  3424. Possible values are:
  3425. @table @var
  3426. @item off
  3427. @item on
  3428. @end table
  3429. @item formant
  3430. Enable formant preservation when shift pitching.
  3431. Possible values are:
  3432. @table @var
  3433. @item shifted
  3434. @item preserved
  3435. @end table
  3436. @item pitchq
  3437. Set pitch quality.
  3438. Possible values are:
  3439. @table @var
  3440. @item quality
  3441. @item speed
  3442. @item consistency
  3443. @end table
  3444. @item channels
  3445. Set channels.
  3446. Possible values are:
  3447. @table @var
  3448. @item apart
  3449. @item together
  3450. @end table
  3451. @end table
  3452. @section sidechaincompress
  3453. This filter acts like normal compressor but has the ability to compress
  3454. detected signal using second input signal.
  3455. It needs two input streams and returns one output stream.
  3456. First input stream will be processed depending on second stream signal.
  3457. The filtered signal then can be filtered with other filters in later stages of
  3458. processing. See @ref{pan} and @ref{amerge} filter.
  3459. The filter accepts the following options:
  3460. @table @option
  3461. @item level_in
  3462. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3463. @item mode
  3464. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3465. Default is @code{downward}.
  3466. @item threshold
  3467. If a signal of second stream raises above this level it will affect the gain
  3468. reduction of first stream.
  3469. By default is 0.125. Range is between 0.00097563 and 1.
  3470. @item ratio
  3471. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3472. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3473. Default is 2. Range is between 1 and 20.
  3474. @item attack
  3475. Amount of milliseconds the signal has to rise above the threshold before gain
  3476. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3477. @item release
  3478. Amount of milliseconds the signal has to fall below the threshold before
  3479. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3480. @item makeup
  3481. Set the amount by how much signal will be amplified after processing.
  3482. Default is 1. Range is from 1 to 64.
  3483. @item knee
  3484. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3485. Default is 2.82843. Range is between 1 and 8.
  3486. @item link
  3487. Choose if the @code{average} level between all channels of side-chain stream
  3488. or the louder(@code{maximum}) channel of side-chain stream affects the
  3489. reduction. Default is @code{average}.
  3490. @item detection
  3491. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3492. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3493. @item level_sc
  3494. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3495. @item mix
  3496. How much to use compressed signal in output. Default is 1.
  3497. Range is between 0 and 1.
  3498. @end table
  3499. @subsection Examples
  3500. @itemize
  3501. @item
  3502. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3503. depending on the signal of 2nd input and later compressed signal to be
  3504. merged with 2nd input:
  3505. @example
  3506. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3507. @end example
  3508. @end itemize
  3509. @section sidechaingate
  3510. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3511. filter the detected signal before sending it to the gain reduction stage.
  3512. Normally a gate uses the full range signal to detect a level above the
  3513. threshold.
  3514. For example: If you cut all lower frequencies from your sidechain signal
  3515. the gate will decrease the volume of your track only if not enough highs
  3516. appear. With this technique you are able to reduce the resonation of a
  3517. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3518. guitar.
  3519. It needs two input streams and returns one output stream.
  3520. First input stream will be processed depending on second stream signal.
  3521. The filter accepts the following options:
  3522. @table @option
  3523. @item level_in
  3524. Set input level before filtering.
  3525. Default is 1. Allowed range is from 0.015625 to 64.
  3526. @item mode
  3527. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3528. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3529. will be amplified, expanding dynamic range in upward direction.
  3530. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3531. @item range
  3532. Set the level of gain reduction when the signal is below the threshold.
  3533. Default is 0.06125. Allowed range is from 0 to 1.
  3534. Setting this to 0 disables reduction and then filter behaves like expander.
  3535. @item threshold
  3536. If a signal rises above this level the gain reduction is released.
  3537. Default is 0.125. Allowed range is from 0 to 1.
  3538. @item ratio
  3539. Set a ratio about which the signal is reduced.
  3540. Default is 2. Allowed range is from 1 to 9000.
  3541. @item attack
  3542. Amount of milliseconds the signal has to rise above the threshold before gain
  3543. reduction stops.
  3544. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3545. @item release
  3546. Amount of milliseconds the signal has to fall below the threshold before the
  3547. reduction is increased again. Default is 250 milliseconds.
  3548. Allowed range is from 0.01 to 9000.
  3549. @item makeup
  3550. Set amount of amplification of signal after processing.
  3551. Default is 1. Allowed range is from 1 to 64.
  3552. @item knee
  3553. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3554. Default is 2.828427125. Allowed range is from 1 to 8.
  3555. @item detection
  3556. Choose if exact signal should be taken for detection or an RMS like one.
  3557. Default is rms. Can be peak or rms.
  3558. @item link
  3559. Choose if the average level between all channels or the louder channel affects
  3560. the reduction.
  3561. Default is average. Can be average or maximum.
  3562. @item level_sc
  3563. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3564. @end table
  3565. @section silencedetect
  3566. Detect silence in an audio stream.
  3567. This filter logs a message when it detects that the input audio volume is less
  3568. or equal to a noise tolerance value for a duration greater or equal to the
  3569. minimum detected noise duration.
  3570. The printed times and duration are expressed in seconds.
  3571. The filter accepts the following options:
  3572. @table @option
  3573. @item noise, n
  3574. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3575. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3576. @item duration, d
  3577. Set silence duration until notification (default is 2 seconds).
  3578. @item mono, m
  3579. Process each channel separately, instead of combined. By default is disabled.
  3580. @end table
  3581. @subsection Examples
  3582. @itemize
  3583. @item
  3584. Detect 5 seconds of silence with -50dB noise tolerance:
  3585. @example
  3586. silencedetect=n=-50dB:d=5
  3587. @end example
  3588. @item
  3589. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3590. tolerance in @file{silence.mp3}:
  3591. @example
  3592. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3593. @end example
  3594. @end itemize
  3595. @section silenceremove
  3596. Remove silence from the beginning, middle or end of the audio.
  3597. The filter accepts the following options:
  3598. @table @option
  3599. @item start_periods
  3600. This value is used to indicate if audio should be trimmed at beginning of
  3601. the audio. A value of zero indicates no silence should be trimmed from the
  3602. beginning. When specifying a non-zero value, it trims audio up until it
  3603. finds non-silence. Normally, when trimming silence from beginning of audio
  3604. the @var{start_periods} will be @code{1} but it can be increased to higher
  3605. values to trim all audio up to specific count of non-silence periods.
  3606. Default value is @code{0}.
  3607. @item start_duration
  3608. Specify the amount of time that non-silence must be detected before it stops
  3609. trimming audio. By increasing the duration, bursts of noises can be treated
  3610. as silence and trimmed off. Default value is @code{0}.
  3611. @item start_threshold
  3612. This indicates what sample value should be treated as silence. For digital
  3613. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3614. you may wish to increase the value to account for background noise.
  3615. Can be specified in dB (in case "dB" is appended to the specified value)
  3616. or amplitude ratio. Default value is @code{0}.
  3617. @item start_silence
  3618. Specify max duration of silence at beginning that will be kept after
  3619. trimming. Default is 0, which is equal to trimming all samples detected
  3620. as silence.
  3621. @item start_mode
  3622. Specify mode of detection of silence end in start of multi-channel audio.
  3623. Can be @var{any} or @var{all}. Default is @var{any}.
  3624. With @var{any}, any sample that is detected as non-silence will cause
  3625. stopped trimming of silence.
  3626. With @var{all}, only if all channels are detected as non-silence will cause
  3627. stopped trimming of silence.
  3628. @item stop_periods
  3629. Set the count for trimming silence from the end of audio.
  3630. To remove silence from the middle of a file, specify a @var{stop_periods}
  3631. that is negative. This value is then treated as a positive value and is
  3632. used to indicate the effect should restart processing as specified by
  3633. @var{start_periods}, making it suitable for removing periods of silence
  3634. in the middle of the audio.
  3635. Default value is @code{0}.
  3636. @item stop_duration
  3637. Specify a duration of silence that must exist before audio is not copied any
  3638. more. By specifying a higher duration, silence that is wanted can be left in
  3639. the audio.
  3640. Default value is @code{0}.
  3641. @item stop_threshold
  3642. This is the same as @option{start_threshold} but for trimming silence from
  3643. the end of audio.
  3644. Can be specified in dB (in case "dB" is appended to the specified value)
  3645. or amplitude ratio. Default value is @code{0}.
  3646. @item stop_silence
  3647. Specify max duration of silence at end that will be kept after
  3648. trimming. Default is 0, which is equal to trimming all samples detected
  3649. as silence.
  3650. @item stop_mode
  3651. Specify mode of detection of silence start in end of multi-channel audio.
  3652. Can be @var{any} or @var{all}. Default is @var{any}.
  3653. With @var{any}, any sample that is detected as non-silence will cause
  3654. stopped trimming of silence.
  3655. With @var{all}, only if all channels are detected as non-silence will cause
  3656. stopped trimming of silence.
  3657. @item detection
  3658. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3659. and works better with digital silence which is exactly 0.
  3660. Default value is @code{rms}.
  3661. @item window
  3662. Set duration in number of seconds used to calculate size of window in number
  3663. of samples for detecting silence.
  3664. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3665. @end table
  3666. @subsection Examples
  3667. @itemize
  3668. @item
  3669. The following example shows how this filter can be used to start a recording
  3670. that does not contain the delay at the start which usually occurs between
  3671. pressing the record button and the start of the performance:
  3672. @example
  3673. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3674. @end example
  3675. @item
  3676. Trim all silence encountered from beginning to end where there is more than 1
  3677. second of silence in audio:
  3678. @example
  3679. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3680. @end example
  3681. @end itemize
  3682. @section sofalizer
  3683. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3684. loudspeakers around the user for binaural listening via headphones (audio
  3685. formats up to 9 channels supported).
  3686. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3687. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3688. Austrian Academy of Sciences.
  3689. To enable compilation of this filter you need to configure FFmpeg with
  3690. @code{--enable-libmysofa}.
  3691. The filter accepts the following options:
  3692. @table @option
  3693. @item sofa
  3694. Set the SOFA file used for rendering.
  3695. @item gain
  3696. Set gain applied to audio. Value is in dB. Default is 0.
  3697. @item rotation
  3698. Set rotation of virtual loudspeakers in deg. Default is 0.
  3699. @item elevation
  3700. Set elevation of virtual speakers in deg. Default is 0.
  3701. @item radius
  3702. Set distance in meters between loudspeakers and the listener with near-field
  3703. HRTFs. Default is 1.
  3704. @item type
  3705. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3706. processing audio in time domain which is slow.
  3707. @var{freq} is processing audio in frequency domain which is fast.
  3708. Default is @var{freq}.
  3709. @item speakers
  3710. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3711. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3712. Each virtual loudspeaker is described with short channel name following with
  3713. azimuth and elevation in degrees.
  3714. Each virtual loudspeaker description is separated by '|'.
  3715. For example to override front left and front right channel positions use:
  3716. 'speakers=FL 45 15|FR 345 15'.
  3717. Descriptions with unrecognised channel names are ignored.
  3718. @item lfegain
  3719. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3720. @item framesize
  3721. Set custom frame size in number of samples. Default is 1024.
  3722. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3723. is set to @var{freq}.
  3724. @item normalize
  3725. Should all IRs be normalized upon importing SOFA file.
  3726. By default is enabled.
  3727. @item interpolate
  3728. Should nearest IRs be interpolated with neighbor IRs if exact position
  3729. does not match. By default is disabled.
  3730. @item minphase
  3731. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3732. @item anglestep
  3733. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3734. @item radstep
  3735. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3736. @end table
  3737. @subsection Examples
  3738. @itemize
  3739. @item
  3740. Using ClubFritz6 sofa file:
  3741. @example
  3742. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3743. @end example
  3744. @item
  3745. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3746. @example
  3747. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3748. @end example
  3749. @item
  3750. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3751. and also with custom gain:
  3752. @example
  3753. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3754. @end example
  3755. @end itemize
  3756. @section stereotools
  3757. This filter has some handy utilities to manage stereo signals, for converting
  3758. M/S stereo recordings to L/R signal while having control over the parameters
  3759. or spreading the stereo image of master track.
  3760. The filter accepts the following options:
  3761. @table @option
  3762. @item level_in
  3763. Set input level before filtering for both channels. Defaults is 1.
  3764. Allowed range is from 0.015625 to 64.
  3765. @item level_out
  3766. Set output level after filtering for both channels. Defaults is 1.
  3767. Allowed range is from 0.015625 to 64.
  3768. @item balance_in
  3769. Set input balance between both channels. Default is 0.
  3770. Allowed range is from -1 to 1.
  3771. @item balance_out
  3772. Set output balance between both channels. Default is 0.
  3773. Allowed range is from -1 to 1.
  3774. @item softclip
  3775. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3776. clipping. Disabled by default.
  3777. @item mutel
  3778. Mute the left channel. Disabled by default.
  3779. @item muter
  3780. Mute the right channel. Disabled by default.
  3781. @item phasel
  3782. Change the phase of the left channel. Disabled by default.
  3783. @item phaser
  3784. Change the phase of the right channel. Disabled by default.
  3785. @item mode
  3786. Set stereo mode. Available values are:
  3787. @table @samp
  3788. @item lr>lr
  3789. Left/Right to Left/Right, this is default.
  3790. @item lr>ms
  3791. Left/Right to Mid/Side.
  3792. @item ms>lr
  3793. Mid/Side to Left/Right.
  3794. @item lr>ll
  3795. Left/Right to Left/Left.
  3796. @item lr>rr
  3797. Left/Right to Right/Right.
  3798. @item lr>l+r
  3799. Left/Right to Left + Right.
  3800. @item lr>rl
  3801. Left/Right to Right/Left.
  3802. @item ms>ll
  3803. Mid/Side to Left/Left.
  3804. @item ms>rr
  3805. Mid/Side to Right/Right.
  3806. @end table
  3807. @item slev
  3808. Set level of side signal. Default is 1.
  3809. Allowed range is from 0.015625 to 64.
  3810. @item sbal
  3811. Set balance of side signal. Default is 0.
  3812. Allowed range is from -1 to 1.
  3813. @item mlev
  3814. Set level of the middle signal. Default is 1.
  3815. Allowed range is from 0.015625 to 64.
  3816. @item mpan
  3817. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3818. @item base
  3819. Set stereo base between mono and inversed channels. Default is 0.
  3820. Allowed range is from -1 to 1.
  3821. @item delay
  3822. Set delay in milliseconds how much to delay left from right channel and
  3823. vice versa. Default is 0. Allowed range is from -20 to 20.
  3824. @item sclevel
  3825. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3826. @item phase
  3827. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3828. @item bmode_in, bmode_out
  3829. Set balance mode for balance_in/balance_out option.
  3830. Can be one of the following:
  3831. @table @samp
  3832. @item balance
  3833. Classic balance mode. Attenuate one channel at time.
  3834. Gain is raised up to 1.
  3835. @item amplitude
  3836. Similar as classic mode above but gain is raised up to 2.
  3837. @item power
  3838. Equal power distribution, from -6dB to +6dB range.
  3839. @end table
  3840. @end table
  3841. @subsection Examples
  3842. @itemize
  3843. @item
  3844. Apply karaoke like effect:
  3845. @example
  3846. stereotools=mlev=0.015625
  3847. @end example
  3848. @item
  3849. Convert M/S signal to L/R:
  3850. @example
  3851. "stereotools=mode=ms>lr"
  3852. @end example
  3853. @end itemize
  3854. @section stereowiden
  3855. This filter enhance the stereo effect by suppressing signal common to both
  3856. channels and by delaying the signal of left into right and vice versa,
  3857. thereby widening the stereo effect.
  3858. The filter accepts the following options:
  3859. @table @option
  3860. @item delay
  3861. Time in milliseconds of the delay of left signal into right and vice versa.
  3862. Default is 20 milliseconds.
  3863. @item feedback
  3864. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3865. effect of left signal in right output and vice versa which gives widening
  3866. effect. Default is 0.3.
  3867. @item crossfeed
  3868. Cross feed of left into right with inverted phase. This helps in suppressing
  3869. the mono. If the value is 1 it will cancel all the signal common to both
  3870. channels. Default is 0.3.
  3871. @item drymix
  3872. Set level of input signal of original channel. Default is 0.8.
  3873. @end table
  3874. @section superequalizer
  3875. Apply 18 band equalizer.
  3876. The filter accepts the following options:
  3877. @table @option
  3878. @item 1b
  3879. Set 65Hz band gain.
  3880. @item 2b
  3881. Set 92Hz band gain.
  3882. @item 3b
  3883. Set 131Hz band gain.
  3884. @item 4b
  3885. Set 185Hz band gain.
  3886. @item 5b
  3887. Set 262Hz band gain.
  3888. @item 6b
  3889. Set 370Hz band gain.
  3890. @item 7b
  3891. Set 523Hz band gain.
  3892. @item 8b
  3893. Set 740Hz band gain.
  3894. @item 9b
  3895. Set 1047Hz band gain.
  3896. @item 10b
  3897. Set 1480Hz band gain.
  3898. @item 11b
  3899. Set 2093Hz band gain.
  3900. @item 12b
  3901. Set 2960Hz band gain.
  3902. @item 13b
  3903. Set 4186Hz band gain.
  3904. @item 14b
  3905. Set 5920Hz band gain.
  3906. @item 15b
  3907. Set 8372Hz band gain.
  3908. @item 16b
  3909. Set 11840Hz band gain.
  3910. @item 17b
  3911. Set 16744Hz band gain.
  3912. @item 18b
  3913. Set 20000Hz band gain.
  3914. @end table
  3915. @section surround
  3916. Apply audio surround upmix filter.
  3917. This filter allows to produce multichannel output from audio stream.
  3918. The filter accepts the following options:
  3919. @table @option
  3920. @item chl_out
  3921. Set output channel layout. By default, this is @var{5.1}.
  3922. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3923. for the required syntax.
  3924. @item chl_in
  3925. Set input channel layout. By default, this is @var{stereo}.
  3926. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3927. for the required syntax.
  3928. @item level_in
  3929. Set input volume level. By default, this is @var{1}.
  3930. @item level_out
  3931. Set output volume level. By default, this is @var{1}.
  3932. @item lfe
  3933. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3934. @item lfe_low
  3935. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3936. @item lfe_high
  3937. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3938. @item lfe_mode
  3939. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  3940. In @var{add} mode, LFE channel is created from input audio and added to output.
  3941. In @var{sub} mode, LFE channel is created from input audio and added to output but
  3942. also all non-LFE output channels are subtracted with output LFE channel.
  3943. @item angle
  3944. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  3945. Default is @var{90}.
  3946. @item fc_in
  3947. Set front center input volume. By default, this is @var{1}.
  3948. @item fc_out
  3949. Set front center output volume. By default, this is @var{1}.
  3950. @item fl_in
  3951. Set front left input volume. By default, this is @var{1}.
  3952. @item fl_out
  3953. Set front left output volume. By default, this is @var{1}.
  3954. @item fr_in
  3955. Set front right input volume. By default, this is @var{1}.
  3956. @item fr_out
  3957. Set front right output volume. By default, this is @var{1}.
  3958. @item sl_in
  3959. Set side left input volume. By default, this is @var{1}.
  3960. @item sl_out
  3961. Set side left output volume. By default, this is @var{1}.
  3962. @item sr_in
  3963. Set side right input volume. By default, this is @var{1}.
  3964. @item sr_out
  3965. Set side right output volume. By default, this is @var{1}.
  3966. @item bl_in
  3967. Set back left input volume. By default, this is @var{1}.
  3968. @item bl_out
  3969. Set back left output volume. By default, this is @var{1}.
  3970. @item br_in
  3971. Set back right input volume. By default, this is @var{1}.
  3972. @item br_out
  3973. Set back right output volume. By default, this is @var{1}.
  3974. @item bc_in
  3975. Set back center input volume. By default, this is @var{1}.
  3976. @item bc_out
  3977. Set back center output volume. By default, this is @var{1}.
  3978. @item lfe_in
  3979. Set LFE input volume. By default, this is @var{1}.
  3980. @item lfe_out
  3981. Set LFE output volume. By default, this is @var{1}.
  3982. @item allx
  3983. Set spread usage of stereo image across X axis for all channels.
  3984. @item ally
  3985. Set spread usage of stereo image across Y axis for all channels.
  3986. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  3987. Set spread usage of stereo image across X axis for each channel.
  3988. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  3989. Set spread usage of stereo image across Y axis for each channel.
  3990. @item win_size
  3991. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  3992. @item win_func
  3993. Set window function.
  3994. It accepts the following values:
  3995. @table @samp
  3996. @item rect
  3997. @item bartlett
  3998. @item hann, hanning
  3999. @item hamming
  4000. @item blackman
  4001. @item welch
  4002. @item flattop
  4003. @item bharris
  4004. @item bnuttall
  4005. @item bhann
  4006. @item sine
  4007. @item nuttall
  4008. @item lanczos
  4009. @item gauss
  4010. @item tukey
  4011. @item dolph
  4012. @item cauchy
  4013. @item parzen
  4014. @item poisson
  4015. @item bohman
  4016. @end table
  4017. Default is @code{hann}.
  4018. @item overlap
  4019. Set window overlap. If set to 1, the recommended overlap for selected
  4020. window function will be picked. Default is @code{0.5}.
  4021. @end table
  4022. @section treble, highshelf
  4023. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4024. shelving filter with a response similar to that of a standard
  4025. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4026. The filter accepts the following options:
  4027. @table @option
  4028. @item gain, g
  4029. Give the gain at whichever is the lower of ~22 kHz and the
  4030. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4031. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4032. @item frequency, f
  4033. Set the filter's central frequency and so can be used
  4034. to extend or reduce the frequency range to be boosted or cut.
  4035. The default value is @code{3000} Hz.
  4036. @item width_type, t
  4037. Set method to specify band-width of filter.
  4038. @table @option
  4039. @item h
  4040. Hz
  4041. @item q
  4042. Q-Factor
  4043. @item o
  4044. octave
  4045. @item s
  4046. slope
  4047. @item k
  4048. kHz
  4049. @end table
  4050. @item width, w
  4051. Determine how steep is the filter's shelf transition.
  4052. @item mix, m
  4053. How much to use filtered signal in output. Default is 1.
  4054. Range is between 0 and 1.
  4055. @item channels, c
  4056. Specify which channels to filter, by default all available are filtered.
  4057. @end table
  4058. @subsection Commands
  4059. This filter supports the following commands:
  4060. @table @option
  4061. @item frequency, f
  4062. Change treble frequency.
  4063. Syntax for the command is : "@var{frequency}"
  4064. @item width_type, t
  4065. Change treble width_type.
  4066. Syntax for the command is : "@var{width_type}"
  4067. @item width, w
  4068. Change treble width.
  4069. Syntax for the command is : "@var{width}"
  4070. @item gain, g
  4071. Change treble gain.
  4072. Syntax for the command is : "@var{gain}"
  4073. @item mix, m
  4074. Change treble mix.
  4075. Syntax for the command is : "@var{mix}"
  4076. @end table
  4077. @section tremolo
  4078. Sinusoidal amplitude modulation.
  4079. The filter accepts the following options:
  4080. @table @option
  4081. @item f
  4082. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4083. (20 Hz or lower) will result in a tremolo effect.
  4084. This filter may also be used as a ring modulator by specifying
  4085. a modulation frequency higher than 20 Hz.
  4086. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4087. @item d
  4088. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4089. Default value is 0.5.
  4090. @end table
  4091. @section vibrato
  4092. Sinusoidal phase modulation.
  4093. The filter accepts the following options:
  4094. @table @option
  4095. @item f
  4096. Modulation frequency in Hertz.
  4097. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4098. @item d
  4099. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4100. Default value is 0.5.
  4101. @end table
  4102. @section volume
  4103. Adjust the input audio volume.
  4104. It accepts the following parameters:
  4105. @table @option
  4106. @item volume
  4107. Set audio volume expression.
  4108. Output values are clipped to the maximum value.
  4109. The output audio volume is given by the relation:
  4110. @example
  4111. @var{output_volume} = @var{volume} * @var{input_volume}
  4112. @end example
  4113. The default value for @var{volume} is "1.0".
  4114. @item precision
  4115. This parameter represents the mathematical precision.
  4116. It determines which input sample formats will be allowed, which affects the
  4117. precision of the volume scaling.
  4118. @table @option
  4119. @item fixed
  4120. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4121. @item float
  4122. 32-bit floating-point; this limits input sample format to FLT. (default)
  4123. @item double
  4124. 64-bit floating-point; this limits input sample format to DBL.
  4125. @end table
  4126. @item replaygain
  4127. Choose the behaviour on encountering ReplayGain side data in input frames.
  4128. @table @option
  4129. @item drop
  4130. Remove ReplayGain side data, ignoring its contents (the default).
  4131. @item ignore
  4132. Ignore ReplayGain side data, but leave it in the frame.
  4133. @item track
  4134. Prefer the track gain, if present.
  4135. @item album
  4136. Prefer the album gain, if present.
  4137. @end table
  4138. @item replaygain_preamp
  4139. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4140. Default value for @var{replaygain_preamp} is 0.0.
  4141. @item eval
  4142. Set when the volume expression is evaluated.
  4143. It accepts the following values:
  4144. @table @samp
  4145. @item once
  4146. only evaluate expression once during the filter initialization, or
  4147. when the @samp{volume} command is sent
  4148. @item frame
  4149. evaluate expression for each incoming frame
  4150. @end table
  4151. Default value is @samp{once}.
  4152. @end table
  4153. The volume expression can contain the following parameters.
  4154. @table @option
  4155. @item n
  4156. frame number (starting at zero)
  4157. @item nb_channels
  4158. number of channels
  4159. @item nb_consumed_samples
  4160. number of samples consumed by the filter
  4161. @item nb_samples
  4162. number of samples in the current frame
  4163. @item pos
  4164. original frame position in the file
  4165. @item pts
  4166. frame PTS
  4167. @item sample_rate
  4168. sample rate
  4169. @item startpts
  4170. PTS at start of stream
  4171. @item startt
  4172. time at start of stream
  4173. @item t
  4174. frame time
  4175. @item tb
  4176. timestamp timebase
  4177. @item volume
  4178. last set volume value
  4179. @end table
  4180. Note that when @option{eval} is set to @samp{once} only the
  4181. @var{sample_rate} and @var{tb} variables are available, all other
  4182. variables will evaluate to NAN.
  4183. @subsection Commands
  4184. This filter supports the following commands:
  4185. @table @option
  4186. @item volume
  4187. Modify the volume expression.
  4188. The command accepts the same syntax of the corresponding option.
  4189. If the specified expression is not valid, it is kept at its current
  4190. value.
  4191. @item replaygain_noclip
  4192. Prevent clipping by limiting the gain applied.
  4193. Default value for @var{replaygain_noclip} is 1.
  4194. @end table
  4195. @subsection Examples
  4196. @itemize
  4197. @item
  4198. Halve the input audio volume:
  4199. @example
  4200. volume=volume=0.5
  4201. volume=volume=1/2
  4202. volume=volume=-6.0206dB
  4203. @end example
  4204. In all the above example the named key for @option{volume} can be
  4205. omitted, for example like in:
  4206. @example
  4207. volume=0.5
  4208. @end example
  4209. @item
  4210. Increase input audio power by 6 decibels using fixed-point precision:
  4211. @example
  4212. volume=volume=6dB:precision=fixed
  4213. @end example
  4214. @item
  4215. Fade volume after time 10 with an annihilation period of 5 seconds:
  4216. @example
  4217. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4218. @end example
  4219. @end itemize
  4220. @section volumedetect
  4221. Detect the volume of the input video.
  4222. The filter has no parameters. The input is not modified. Statistics about
  4223. the volume will be printed in the log when the input stream end is reached.
  4224. In particular it will show the mean volume (root mean square), maximum
  4225. volume (on a per-sample basis), and the beginning of a histogram of the
  4226. registered volume values (from the maximum value to a cumulated 1/1000 of
  4227. the samples).
  4228. All volumes are in decibels relative to the maximum PCM value.
  4229. @subsection Examples
  4230. Here is an excerpt of the output:
  4231. @example
  4232. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4233. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4234. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4235. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4236. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4237. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4238. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4239. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4240. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4241. @end example
  4242. It means that:
  4243. @itemize
  4244. @item
  4245. The mean square energy is approximately -27 dB, or 10^-2.7.
  4246. @item
  4247. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4248. @item
  4249. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4250. @end itemize
  4251. In other words, raising the volume by +4 dB does not cause any clipping,
  4252. raising it by +5 dB causes clipping for 6 samples, etc.
  4253. @c man end AUDIO FILTERS
  4254. @chapter Audio Sources
  4255. @c man begin AUDIO SOURCES
  4256. Below is a description of the currently available audio sources.
  4257. @section abuffer
  4258. Buffer audio frames, and make them available to the filter chain.
  4259. This source is mainly intended for a programmatic use, in particular
  4260. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4261. It accepts the following parameters:
  4262. @table @option
  4263. @item time_base
  4264. The timebase which will be used for timestamps of submitted frames. It must be
  4265. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4266. @item sample_rate
  4267. The sample rate of the incoming audio buffers.
  4268. @item sample_fmt
  4269. The sample format of the incoming audio buffers.
  4270. Either a sample format name or its corresponding integer representation from
  4271. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4272. @item channel_layout
  4273. The channel layout of the incoming audio buffers.
  4274. Either a channel layout name from channel_layout_map in
  4275. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4276. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4277. @item channels
  4278. The number of channels of the incoming audio buffers.
  4279. If both @var{channels} and @var{channel_layout} are specified, then they
  4280. must be consistent.
  4281. @end table
  4282. @subsection Examples
  4283. @example
  4284. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4285. @end example
  4286. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4287. Since the sample format with name "s16p" corresponds to the number
  4288. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4289. equivalent to:
  4290. @example
  4291. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4292. @end example
  4293. @section aevalsrc
  4294. Generate an audio signal specified by an expression.
  4295. This source accepts in input one or more expressions (one for each
  4296. channel), which are evaluated and used to generate a corresponding
  4297. audio signal.
  4298. This source accepts the following options:
  4299. @table @option
  4300. @item exprs
  4301. Set the '|'-separated expressions list for each separate channel. In case the
  4302. @option{channel_layout} option is not specified, the selected channel layout
  4303. depends on the number of provided expressions. Otherwise the last
  4304. specified expression is applied to the remaining output channels.
  4305. @item channel_layout, c
  4306. Set the channel layout. The number of channels in the specified layout
  4307. must be equal to the number of specified expressions.
  4308. @item duration, d
  4309. Set the minimum duration of the sourced audio. See
  4310. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4311. for the accepted syntax.
  4312. Note that the resulting duration may be greater than the specified
  4313. duration, as the generated audio is always cut at the end of a
  4314. complete frame.
  4315. If not specified, or the expressed duration is negative, the audio is
  4316. supposed to be generated forever.
  4317. @item nb_samples, n
  4318. Set the number of samples per channel per each output frame,
  4319. default to 1024.
  4320. @item sample_rate, s
  4321. Specify the sample rate, default to 44100.
  4322. @end table
  4323. Each expression in @var{exprs} can contain the following constants:
  4324. @table @option
  4325. @item n
  4326. number of the evaluated sample, starting from 0
  4327. @item t
  4328. time of the evaluated sample expressed in seconds, starting from 0
  4329. @item s
  4330. sample rate
  4331. @end table
  4332. @subsection Examples
  4333. @itemize
  4334. @item
  4335. Generate silence:
  4336. @example
  4337. aevalsrc=0
  4338. @end example
  4339. @item
  4340. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4341. 8000 Hz:
  4342. @example
  4343. aevalsrc="sin(440*2*PI*t):s=8000"
  4344. @end example
  4345. @item
  4346. Generate a two channels signal, specify the channel layout (Front
  4347. Center + Back Center) explicitly:
  4348. @example
  4349. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4350. @end example
  4351. @item
  4352. Generate white noise:
  4353. @example
  4354. aevalsrc="-2+random(0)"
  4355. @end example
  4356. @item
  4357. Generate an amplitude modulated signal:
  4358. @example
  4359. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4360. @end example
  4361. @item
  4362. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4363. @example
  4364. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4365. @end example
  4366. @end itemize
  4367. @section anullsrc
  4368. The null audio source, return unprocessed audio frames. It is mainly useful
  4369. as a template and to be employed in analysis / debugging tools, or as
  4370. the source for filters which ignore the input data (for example the sox
  4371. synth filter).
  4372. This source accepts the following options:
  4373. @table @option
  4374. @item channel_layout, cl
  4375. Specifies the channel layout, and can be either an integer or a string
  4376. representing a channel layout. The default value of @var{channel_layout}
  4377. is "stereo".
  4378. Check the channel_layout_map definition in
  4379. @file{libavutil/channel_layout.c} for the mapping between strings and
  4380. channel layout values.
  4381. @item sample_rate, r
  4382. Specifies the sample rate, and defaults to 44100.
  4383. @item nb_samples, n
  4384. Set the number of samples per requested frames.
  4385. @end table
  4386. @subsection Examples
  4387. @itemize
  4388. @item
  4389. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4390. @example
  4391. anullsrc=r=48000:cl=4
  4392. @end example
  4393. @item
  4394. Do the same operation with a more obvious syntax:
  4395. @example
  4396. anullsrc=r=48000:cl=mono
  4397. @end example
  4398. @end itemize
  4399. All the parameters need to be explicitly defined.
  4400. @section flite
  4401. Synthesize a voice utterance using the libflite library.
  4402. To enable compilation of this filter you need to configure FFmpeg with
  4403. @code{--enable-libflite}.
  4404. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4405. The filter accepts the following options:
  4406. @table @option
  4407. @item list_voices
  4408. If set to 1, list the names of the available voices and exit
  4409. immediately. Default value is 0.
  4410. @item nb_samples, n
  4411. Set the maximum number of samples per frame. Default value is 512.
  4412. @item textfile
  4413. Set the filename containing the text to speak.
  4414. @item text
  4415. Set the text to speak.
  4416. @item voice, v
  4417. Set the voice to use for the speech synthesis. Default value is
  4418. @code{kal}. See also the @var{list_voices} option.
  4419. @end table
  4420. @subsection Examples
  4421. @itemize
  4422. @item
  4423. Read from file @file{speech.txt}, and synthesize the text using the
  4424. standard flite voice:
  4425. @example
  4426. flite=textfile=speech.txt
  4427. @end example
  4428. @item
  4429. Read the specified text selecting the @code{slt} voice:
  4430. @example
  4431. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4432. @end example
  4433. @item
  4434. Input text to ffmpeg:
  4435. @example
  4436. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4437. @end example
  4438. @item
  4439. Make @file{ffplay} speak the specified text, using @code{flite} and
  4440. the @code{lavfi} device:
  4441. @example
  4442. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4443. @end example
  4444. @end itemize
  4445. For more information about libflite, check:
  4446. @url{http://www.festvox.org/flite/}
  4447. @section anoisesrc
  4448. Generate a noise audio signal.
  4449. The filter accepts the following options:
  4450. @table @option
  4451. @item sample_rate, r
  4452. Specify the sample rate. Default value is 48000 Hz.
  4453. @item amplitude, a
  4454. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4455. is 1.0.
  4456. @item duration, d
  4457. Specify the duration of the generated audio stream. Not specifying this option
  4458. results in noise with an infinite length.
  4459. @item color, colour, c
  4460. Specify the color of noise. Available noise colors are white, pink, brown,
  4461. blue and violet. Default color is white.
  4462. @item seed, s
  4463. Specify a value used to seed the PRNG.
  4464. @item nb_samples, n
  4465. Set the number of samples per each output frame, default is 1024.
  4466. @end table
  4467. @subsection Examples
  4468. @itemize
  4469. @item
  4470. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4471. @example
  4472. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4473. @end example
  4474. @end itemize
  4475. @section hilbert
  4476. Generate odd-tap Hilbert transform FIR coefficients.
  4477. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4478. the signal by 90 degrees.
  4479. This is used in many matrix coding schemes and for analytic signal generation.
  4480. The process is often written as a multiplication by i (or j), the imaginary unit.
  4481. The filter accepts the following options:
  4482. @table @option
  4483. @item sample_rate, s
  4484. Set sample rate, default is 44100.
  4485. @item taps, t
  4486. Set length of FIR filter, default is 22051.
  4487. @item nb_samples, n
  4488. Set number of samples per each frame.
  4489. @item win_func, w
  4490. Set window function to be used when generating FIR coefficients.
  4491. @end table
  4492. @section sinc
  4493. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4494. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4495. The filter accepts the following options:
  4496. @table @option
  4497. @item sample_rate, r
  4498. Set sample rate, default is 44100.
  4499. @item nb_samples, n
  4500. Set number of samples per each frame. Default is 1024.
  4501. @item hp
  4502. Set high-pass frequency. Default is 0.
  4503. @item lp
  4504. Set low-pass frequency. Default is 0.
  4505. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4506. is higher than 0 then filter will create band-pass filter coefficients,
  4507. otherwise band-reject filter coefficients.
  4508. @item phase
  4509. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4510. @item beta
  4511. Set Kaiser window beta.
  4512. @item att
  4513. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4514. @item round
  4515. Enable rounding, by default is disabled.
  4516. @item hptaps
  4517. Set number of taps for high-pass filter.
  4518. @item lptaps
  4519. Set number of taps for low-pass filter.
  4520. @end table
  4521. @section sine
  4522. Generate an audio signal made of a sine wave with amplitude 1/8.
  4523. The audio signal is bit-exact.
  4524. The filter accepts the following options:
  4525. @table @option
  4526. @item frequency, f
  4527. Set the carrier frequency. Default is 440 Hz.
  4528. @item beep_factor, b
  4529. Enable a periodic beep every second with frequency @var{beep_factor} times
  4530. the carrier frequency. Default is 0, meaning the beep is disabled.
  4531. @item sample_rate, r
  4532. Specify the sample rate, default is 44100.
  4533. @item duration, d
  4534. Specify the duration of the generated audio stream.
  4535. @item samples_per_frame
  4536. Set the number of samples per output frame.
  4537. The expression can contain the following constants:
  4538. @table @option
  4539. @item n
  4540. The (sequential) number of the output audio frame, starting from 0.
  4541. @item pts
  4542. The PTS (Presentation TimeStamp) of the output audio frame,
  4543. expressed in @var{TB} units.
  4544. @item t
  4545. The PTS of the output audio frame, expressed in seconds.
  4546. @item TB
  4547. The timebase of the output audio frames.
  4548. @end table
  4549. Default is @code{1024}.
  4550. @end table
  4551. @subsection Examples
  4552. @itemize
  4553. @item
  4554. Generate a simple 440 Hz sine wave:
  4555. @example
  4556. sine
  4557. @end example
  4558. @item
  4559. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4560. @example
  4561. sine=220:4:d=5
  4562. sine=f=220:b=4:d=5
  4563. sine=frequency=220:beep_factor=4:duration=5
  4564. @end example
  4565. @item
  4566. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4567. pattern:
  4568. @example
  4569. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4570. @end example
  4571. @end itemize
  4572. @c man end AUDIO SOURCES
  4573. @chapter Audio Sinks
  4574. @c man begin AUDIO SINKS
  4575. Below is a description of the currently available audio sinks.
  4576. @section abuffersink
  4577. Buffer audio frames, and make them available to the end of filter chain.
  4578. This sink is mainly intended for programmatic use, in particular
  4579. through the interface defined in @file{libavfilter/buffersink.h}
  4580. or the options system.
  4581. It accepts a pointer to an AVABufferSinkContext structure, which
  4582. defines the incoming buffers' formats, to be passed as the opaque
  4583. parameter to @code{avfilter_init_filter} for initialization.
  4584. @section anullsink
  4585. Null audio sink; do absolutely nothing with the input audio. It is
  4586. mainly useful as a template and for use in analysis / debugging
  4587. tools.
  4588. @c man end AUDIO SINKS
  4589. @chapter Video Filters
  4590. @c man begin VIDEO FILTERS
  4591. When you configure your FFmpeg build, you can disable any of the
  4592. existing filters using @code{--disable-filters}.
  4593. The configure output will show the video filters included in your
  4594. build.
  4595. Below is a description of the currently available video filters.
  4596. @section alphaextract
  4597. Extract the alpha component from the input as a grayscale video. This
  4598. is especially useful with the @var{alphamerge} filter.
  4599. @section alphamerge
  4600. Add or replace the alpha component of the primary input with the
  4601. grayscale value of a second input. This is intended for use with
  4602. @var{alphaextract} to allow the transmission or storage of frame
  4603. sequences that have alpha in a format that doesn't support an alpha
  4604. channel.
  4605. For example, to reconstruct full frames from a normal YUV-encoded video
  4606. and a separate video created with @var{alphaextract}, you might use:
  4607. @example
  4608. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4609. @end example
  4610. Since this filter is designed for reconstruction, it operates on frame
  4611. sequences without considering timestamps, and terminates when either
  4612. input reaches end of stream. This will cause problems if your encoding
  4613. pipeline drops frames. If you're trying to apply an image as an
  4614. overlay to a video stream, consider the @var{overlay} filter instead.
  4615. @section amplify
  4616. Amplify differences between current pixel and pixels of adjacent frames in
  4617. same pixel location.
  4618. This filter accepts the following options:
  4619. @table @option
  4620. @item radius
  4621. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4622. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4623. @item factor
  4624. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4625. @item threshold
  4626. Set threshold for difference amplification. Any difference greater or equal to
  4627. this value will not alter source pixel. Default is 10.
  4628. Allowed range is from 0 to 65535.
  4629. @item tolerance
  4630. Set tolerance for difference amplification. Any difference lower to
  4631. this value will not alter source pixel. Default is 0.
  4632. Allowed range is from 0 to 65535.
  4633. @item low
  4634. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4635. This option controls maximum possible value that will decrease source pixel value.
  4636. @item high
  4637. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4638. This option controls maximum possible value that will increase source pixel value.
  4639. @item planes
  4640. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4641. @end table
  4642. @section ass
  4643. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4644. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4645. Substation Alpha) subtitles files.
  4646. This filter accepts the following option in addition to the common options from
  4647. the @ref{subtitles} filter:
  4648. @table @option
  4649. @item shaping
  4650. Set the shaping engine
  4651. Available values are:
  4652. @table @samp
  4653. @item auto
  4654. The default libass shaping engine, which is the best available.
  4655. @item simple
  4656. Fast, font-agnostic shaper that can do only substitutions
  4657. @item complex
  4658. Slower shaper using OpenType for substitutions and positioning
  4659. @end table
  4660. The default is @code{auto}.
  4661. @end table
  4662. @section atadenoise
  4663. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4664. The filter accepts the following options:
  4665. @table @option
  4666. @item 0a
  4667. Set threshold A for 1st plane. Default is 0.02.
  4668. Valid range is 0 to 0.3.
  4669. @item 0b
  4670. Set threshold B for 1st plane. Default is 0.04.
  4671. Valid range is 0 to 5.
  4672. @item 1a
  4673. Set threshold A for 2nd plane. Default is 0.02.
  4674. Valid range is 0 to 0.3.
  4675. @item 1b
  4676. Set threshold B for 2nd plane. Default is 0.04.
  4677. Valid range is 0 to 5.
  4678. @item 2a
  4679. Set threshold A for 3rd plane. Default is 0.02.
  4680. Valid range is 0 to 0.3.
  4681. @item 2b
  4682. Set threshold B for 3rd plane. Default is 0.04.
  4683. Valid range is 0 to 5.
  4684. Threshold A is designed to react on abrupt changes in the input signal and
  4685. threshold B is designed to react on continuous changes in the input signal.
  4686. @item s
  4687. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4688. number in range [5, 129].
  4689. @item p
  4690. Set what planes of frame filter will use for averaging. Default is all.
  4691. @end table
  4692. @section avgblur
  4693. Apply average blur filter.
  4694. The filter accepts the following options:
  4695. @table @option
  4696. @item sizeX
  4697. Set horizontal radius size.
  4698. @item planes
  4699. Set which planes to filter. By default all planes are filtered.
  4700. @item sizeY
  4701. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4702. Default is @code{0}.
  4703. @end table
  4704. @section bbox
  4705. Compute the bounding box for the non-black pixels in the input frame
  4706. luminance plane.
  4707. This filter computes the bounding box containing all the pixels with a
  4708. luminance value greater than the minimum allowed value.
  4709. The parameters describing the bounding box are printed on the filter
  4710. log.
  4711. The filter accepts the following option:
  4712. @table @option
  4713. @item min_val
  4714. Set the minimal luminance value. Default is @code{16}.
  4715. @end table
  4716. @section bitplanenoise
  4717. Show and measure bit plane noise.
  4718. The filter accepts the following options:
  4719. @table @option
  4720. @item bitplane
  4721. Set which plane to analyze. Default is @code{1}.
  4722. @item filter
  4723. Filter out noisy pixels from @code{bitplane} set above.
  4724. Default is disabled.
  4725. @end table
  4726. @section blackdetect
  4727. Detect video intervals that are (almost) completely black. Can be
  4728. useful to detect chapter transitions, commercials, or invalid
  4729. recordings. Output lines contains the time for the start, end and
  4730. duration of the detected black interval expressed in seconds.
  4731. In order to display the output lines, you need to set the loglevel at
  4732. least to the AV_LOG_INFO value.
  4733. The filter accepts the following options:
  4734. @table @option
  4735. @item black_min_duration, d
  4736. Set the minimum detected black duration expressed in seconds. It must
  4737. be a non-negative floating point number.
  4738. Default value is 2.0.
  4739. @item picture_black_ratio_th, pic_th
  4740. Set the threshold for considering a picture "black".
  4741. Express the minimum value for the ratio:
  4742. @example
  4743. @var{nb_black_pixels} / @var{nb_pixels}
  4744. @end example
  4745. for which a picture is considered black.
  4746. Default value is 0.98.
  4747. @item pixel_black_th, pix_th
  4748. Set the threshold for considering a pixel "black".
  4749. The threshold expresses the maximum pixel luminance value for which a
  4750. pixel is considered "black". The provided value is scaled according to
  4751. the following equation:
  4752. @example
  4753. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4754. @end example
  4755. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4756. the input video format, the range is [0-255] for YUV full-range
  4757. formats and [16-235] for YUV non full-range formats.
  4758. Default value is 0.10.
  4759. @end table
  4760. The following example sets the maximum pixel threshold to the minimum
  4761. value, and detects only black intervals of 2 or more seconds:
  4762. @example
  4763. blackdetect=d=2:pix_th=0.00
  4764. @end example
  4765. @section blackframe
  4766. Detect frames that are (almost) completely black. Can be useful to
  4767. detect chapter transitions or commercials. Output lines consist of
  4768. the frame number of the detected frame, the percentage of blackness,
  4769. the position in the file if known or -1 and the timestamp in seconds.
  4770. In order to display the output lines, you need to set the loglevel at
  4771. least to the AV_LOG_INFO value.
  4772. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4773. The value represents the percentage of pixels in the picture that
  4774. are below the threshold value.
  4775. It accepts the following parameters:
  4776. @table @option
  4777. @item amount
  4778. The percentage of the pixels that have to be below the threshold; it defaults to
  4779. @code{98}.
  4780. @item threshold, thresh
  4781. The threshold below which a pixel value is considered black; it defaults to
  4782. @code{32}.
  4783. @end table
  4784. @section blend, tblend
  4785. Blend two video frames into each other.
  4786. The @code{blend} filter takes two input streams and outputs one
  4787. stream, the first input is the "top" layer and second input is
  4788. "bottom" layer. By default, the output terminates when the longest input terminates.
  4789. The @code{tblend} (time blend) filter takes two consecutive frames
  4790. from one single stream, and outputs the result obtained by blending
  4791. the new frame on top of the old frame.
  4792. A description of the accepted options follows.
  4793. @table @option
  4794. @item c0_mode
  4795. @item c1_mode
  4796. @item c2_mode
  4797. @item c3_mode
  4798. @item all_mode
  4799. Set blend mode for specific pixel component or all pixel components in case
  4800. of @var{all_mode}. Default value is @code{normal}.
  4801. Available values for component modes are:
  4802. @table @samp
  4803. @item addition
  4804. @item grainmerge
  4805. @item and
  4806. @item average
  4807. @item burn
  4808. @item darken
  4809. @item difference
  4810. @item grainextract
  4811. @item divide
  4812. @item dodge
  4813. @item freeze
  4814. @item exclusion
  4815. @item extremity
  4816. @item glow
  4817. @item hardlight
  4818. @item hardmix
  4819. @item heat
  4820. @item lighten
  4821. @item linearlight
  4822. @item multiply
  4823. @item multiply128
  4824. @item negation
  4825. @item normal
  4826. @item or
  4827. @item overlay
  4828. @item phoenix
  4829. @item pinlight
  4830. @item reflect
  4831. @item screen
  4832. @item softlight
  4833. @item subtract
  4834. @item vividlight
  4835. @item xor
  4836. @end table
  4837. @item c0_opacity
  4838. @item c1_opacity
  4839. @item c2_opacity
  4840. @item c3_opacity
  4841. @item all_opacity
  4842. Set blend opacity for specific pixel component or all pixel components in case
  4843. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4844. @item c0_expr
  4845. @item c1_expr
  4846. @item c2_expr
  4847. @item c3_expr
  4848. @item all_expr
  4849. Set blend expression for specific pixel component or all pixel components in case
  4850. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4851. The expressions can use the following variables:
  4852. @table @option
  4853. @item N
  4854. The sequential number of the filtered frame, starting from @code{0}.
  4855. @item X
  4856. @item Y
  4857. the coordinates of the current sample
  4858. @item W
  4859. @item H
  4860. the width and height of currently filtered plane
  4861. @item SW
  4862. @item SH
  4863. Width and height scale for the plane being filtered. It is the
  4864. ratio between the dimensions of the current plane to the luma plane,
  4865. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4866. the luma plane and @code{0.5,0.5} for the chroma planes.
  4867. @item T
  4868. Time of the current frame, expressed in seconds.
  4869. @item TOP, A
  4870. Value of pixel component at current location for first video frame (top layer).
  4871. @item BOTTOM, B
  4872. Value of pixel component at current location for second video frame (bottom layer).
  4873. @end table
  4874. @end table
  4875. The @code{blend} filter also supports the @ref{framesync} options.
  4876. @subsection Examples
  4877. @itemize
  4878. @item
  4879. Apply transition from bottom layer to top layer in first 10 seconds:
  4880. @example
  4881. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4882. @end example
  4883. @item
  4884. Apply linear horizontal transition from top layer to bottom layer:
  4885. @example
  4886. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4887. @end example
  4888. @item
  4889. Apply 1x1 checkerboard effect:
  4890. @example
  4891. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4892. @end example
  4893. @item
  4894. Apply uncover left effect:
  4895. @example
  4896. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4897. @end example
  4898. @item
  4899. Apply uncover down effect:
  4900. @example
  4901. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4902. @end example
  4903. @item
  4904. Apply uncover up-left effect:
  4905. @example
  4906. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4907. @end example
  4908. @item
  4909. Split diagonally video and shows top and bottom layer on each side:
  4910. @example
  4911. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4912. @end example
  4913. @item
  4914. Display differences between the current and the previous frame:
  4915. @example
  4916. tblend=all_mode=grainextract
  4917. @end example
  4918. @end itemize
  4919. @section bm3d
  4920. Denoise frames using Block-Matching 3D algorithm.
  4921. The filter accepts the following options.
  4922. @table @option
  4923. @item sigma
  4924. Set denoising strength. Default value is 1.
  4925. Allowed range is from 0 to 999.9.
  4926. The denoising algorithm is very sensitive to sigma, so adjust it
  4927. according to the source.
  4928. @item block
  4929. Set local patch size. This sets dimensions in 2D.
  4930. @item bstep
  4931. Set sliding step for processing blocks. Default value is 4.
  4932. Allowed range is from 1 to 64.
  4933. Smaller values allows processing more reference blocks and is slower.
  4934. @item group
  4935. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4936. When set to 1, no block matching is done. Larger values allows more blocks
  4937. in single group.
  4938. Allowed range is from 1 to 256.
  4939. @item range
  4940. Set radius for search block matching. Default is 9.
  4941. Allowed range is from 1 to INT32_MAX.
  4942. @item mstep
  4943. Set step between two search locations for block matching. Default is 1.
  4944. Allowed range is from 1 to 64. Smaller is slower.
  4945. @item thmse
  4946. Set threshold of mean square error for block matching. Valid range is 0 to
  4947. INT32_MAX.
  4948. @item hdthr
  4949. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4950. Larger values results in stronger hard-thresholding filtering in frequency
  4951. domain.
  4952. @item estim
  4953. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4954. Default is @code{basic}.
  4955. @item ref
  4956. If enabled, filter will use 2nd stream for block matching.
  4957. Default is disabled for @code{basic} value of @var{estim} option,
  4958. and always enabled if value of @var{estim} is @code{final}.
  4959. @item planes
  4960. Set planes to filter. Default is all available except alpha.
  4961. @end table
  4962. @subsection Examples
  4963. @itemize
  4964. @item
  4965. Basic filtering with bm3d:
  4966. @example
  4967. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4968. @end example
  4969. @item
  4970. Same as above, but filtering only luma:
  4971. @example
  4972. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4973. @end example
  4974. @item
  4975. Same as above, but with both estimation modes:
  4976. @example
  4977. 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
  4978. @end example
  4979. @item
  4980. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4981. @example
  4982. 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
  4983. @end example
  4984. @end itemize
  4985. @section boxblur
  4986. Apply a boxblur algorithm to the input video.
  4987. It accepts the following parameters:
  4988. @table @option
  4989. @item luma_radius, lr
  4990. @item luma_power, lp
  4991. @item chroma_radius, cr
  4992. @item chroma_power, cp
  4993. @item alpha_radius, ar
  4994. @item alpha_power, ap
  4995. @end table
  4996. A description of the accepted options follows.
  4997. @table @option
  4998. @item luma_radius, lr
  4999. @item chroma_radius, cr
  5000. @item alpha_radius, ar
  5001. Set an expression for the box radius in pixels used for blurring the
  5002. corresponding input plane.
  5003. The radius value must be a non-negative number, and must not be
  5004. greater than the value of the expression @code{min(w,h)/2} for the
  5005. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5006. planes.
  5007. Default value for @option{luma_radius} is "2". If not specified,
  5008. @option{chroma_radius} and @option{alpha_radius} default to the
  5009. corresponding value set for @option{luma_radius}.
  5010. The expressions can contain the following constants:
  5011. @table @option
  5012. @item w
  5013. @item h
  5014. The input width and height in pixels.
  5015. @item cw
  5016. @item ch
  5017. The input chroma image width and height in pixels.
  5018. @item hsub
  5019. @item vsub
  5020. The horizontal and vertical chroma subsample values. For example, for the
  5021. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5022. @end table
  5023. @item luma_power, lp
  5024. @item chroma_power, cp
  5025. @item alpha_power, ap
  5026. Specify how many times the boxblur filter is applied to the
  5027. corresponding plane.
  5028. Default value for @option{luma_power} is 2. If not specified,
  5029. @option{chroma_power} and @option{alpha_power} default to the
  5030. corresponding value set for @option{luma_power}.
  5031. A value of 0 will disable the effect.
  5032. @end table
  5033. @subsection Examples
  5034. @itemize
  5035. @item
  5036. Apply a boxblur filter with the luma, chroma, and alpha radii
  5037. set to 2:
  5038. @example
  5039. boxblur=luma_radius=2:luma_power=1
  5040. boxblur=2:1
  5041. @end example
  5042. @item
  5043. Set the luma radius to 2, and alpha and chroma radius to 0:
  5044. @example
  5045. boxblur=2:1:cr=0:ar=0
  5046. @end example
  5047. @item
  5048. Set the luma and chroma radii to a fraction of the video dimension:
  5049. @example
  5050. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5051. @end example
  5052. @end itemize
  5053. @section bwdif
  5054. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5055. Deinterlacing Filter").
  5056. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5057. interpolation algorithms.
  5058. It accepts the following parameters:
  5059. @table @option
  5060. @item mode
  5061. The interlacing mode to adopt. It accepts one of the following values:
  5062. @table @option
  5063. @item 0, send_frame
  5064. Output one frame for each frame.
  5065. @item 1, send_field
  5066. Output one frame for each field.
  5067. @end table
  5068. The default value is @code{send_field}.
  5069. @item parity
  5070. The picture field parity assumed for the input interlaced video. It accepts one
  5071. of the following values:
  5072. @table @option
  5073. @item 0, tff
  5074. Assume the top field is first.
  5075. @item 1, bff
  5076. Assume the bottom field is first.
  5077. @item -1, auto
  5078. Enable automatic detection of field parity.
  5079. @end table
  5080. The default value is @code{auto}.
  5081. If the interlacing is unknown or the decoder does not export this information,
  5082. top field first will be assumed.
  5083. @item deint
  5084. Specify which frames to deinterlace. Accept one of the following
  5085. values:
  5086. @table @option
  5087. @item 0, all
  5088. Deinterlace all frames.
  5089. @item 1, interlaced
  5090. Only deinterlace frames marked as interlaced.
  5091. @end table
  5092. The default value is @code{all}.
  5093. @end table
  5094. @section chromahold
  5095. Remove all color information for all colors except for certain one.
  5096. The filter accepts the following options:
  5097. @table @option
  5098. @item color
  5099. The color which will not be replaced with neutral chroma.
  5100. @item similarity
  5101. Similarity percentage with the above color.
  5102. 0.01 matches only the exact key color, while 1.0 matches everything.
  5103. @item blend
  5104. Blend percentage.
  5105. 0.0 makes pixels either fully gray, or not gray at all.
  5106. Higher values result in more preserved color.
  5107. @item yuv
  5108. Signals that the color passed is already in YUV instead of RGB.
  5109. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5110. This can be used to pass exact YUV values as hexadecimal numbers.
  5111. @end table
  5112. @section chromakey
  5113. YUV colorspace color/chroma keying.
  5114. The filter accepts the following options:
  5115. @table @option
  5116. @item color
  5117. The color which will be replaced with transparency.
  5118. @item similarity
  5119. Similarity percentage with the key color.
  5120. 0.01 matches only the exact key color, while 1.0 matches everything.
  5121. @item blend
  5122. Blend percentage.
  5123. 0.0 makes pixels either fully transparent, or not transparent at all.
  5124. Higher values result in semi-transparent pixels, with a higher transparency
  5125. the more similar the pixels color is to the key color.
  5126. @item yuv
  5127. Signals that the color passed is already in YUV instead of RGB.
  5128. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5129. This can be used to pass exact YUV values as hexadecimal numbers.
  5130. @end table
  5131. @subsection Examples
  5132. @itemize
  5133. @item
  5134. Make every green pixel in the input image transparent:
  5135. @example
  5136. ffmpeg -i input.png -vf chromakey=green out.png
  5137. @end example
  5138. @item
  5139. Overlay a greenscreen-video on top of a static black background.
  5140. @example
  5141. 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
  5142. @end example
  5143. @end itemize
  5144. @section chromashift
  5145. Shift chroma pixels horizontally and/or vertically.
  5146. The filter accepts the following options:
  5147. @table @option
  5148. @item cbh
  5149. Set amount to shift chroma-blue horizontally.
  5150. @item cbv
  5151. Set amount to shift chroma-blue vertically.
  5152. @item crh
  5153. Set amount to shift chroma-red horizontally.
  5154. @item crv
  5155. Set amount to shift chroma-red vertically.
  5156. @item edge
  5157. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5158. @end table
  5159. @section ciescope
  5160. Display CIE color diagram with pixels overlaid onto it.
  5161. The filter accepts the following options:
  5162. @table @option
  5163. @item system
  5164. Set color system.
  5165. @table @samp
  5166. @item ntsc, 470m
  5167. @item ebu, 470bg
  5168. @item smpte
  5169. @item 240m
  5170. @item apple
  5171. @item widergb
  5172. @item cie1931
  5173. @item rec709, hdtv
  5174. @item uhdtv, rec2020
  5175. @end table
  5176. @item cie
  5177. Set CIE system.
  5178. @table @samp
  5179. @item xyy
  5180. @item ucs
  5181. @item luv
  5182. @end table
  5183. @item gamuts
  5184. Set what gamuts to draw.
  5185. See @code{system} option for available values.
  5186. @item size, s
  5187. Set ciescope size, by default set to 512.
  5188. @item intensity, i
  5189. Set intensity used to map input pixel values to CIE diagram.
  5190. @item contrast
  5191. Set contrast used to draw tongue colors that are out of active color system gamut.
  5192. @item corrgamma
  5193. Correct gamma displayed on scope, by default enabled.
  5194. @item showwhite
  5195. Show white point on CIE diagram, by default disabled.
  5196. @item gamma
  5197. Set input gamma. Used only with XYZ input color space.
  5198. @end table
  5199. @section codecview
  5200. Visualize information exported by some codecs.
  5201. Some codecs can export information through frames using side-data or other
  5202. means. For example, some MPEG based codecs export motion vectors through the
  5203. @var{export_mvs} flag in the codec @option{flags2} option.
  5204. The filter accepts the following option:
  5205. @table @option
  5206. @item mv
  5207. Set motion vectors to visualize.
  5208. Available flags for @var{mv} are:
  5209. @table @samp
  5210. @item pf
  5211. forward predicted MVs of P-frames
  5212. @item bf
  5213. forward predicted MVs of B-frames
  5214. @item bb
  5215. backward predicted MVs of B-frames
  5216. @end table
  5217. @item qp
  5218. Display quantization parameters using the chroma planes.
  5219. @item mv_type, mvt
  5220. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5221. Available flags for @var{mv_type} are:
  5222. @table @samp
  5223. @item fp
  5224. forward predicted MVs
  5225. @item bp
  5226. backward predicted MVs
  5227. @end table
  5228. @item frame_type, ft
  5229. Set frame type to visualize motion vectors of.
  5230. Available flags for @var{frame_type} are:
  5231. @table @samp
  5232. @item if
  5233. intra-coded frames (I-frames)
  5234. @item pf
  5235. predicted frames (P-frames)
  5236. @item bf
  5237. bi-directionally predicted frames (B-frames)
  5238. @end table
  5239. @end table
  5240. @subsection Examples
  5241. @itemize
  5242. @item
  5243. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5244. @example
  5245. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5246. @end example
  5247. @item
  5248. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5249. @example
  5250. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5251. @end example
  5252. @end itemize
  5253. @section colorbalance
  5254. Modify intensity of primary colors (red, green and blue) of input frames.
  5255. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5256. regions for the red-cyan, green-magenta or blue-yellow balance.
  5257. A positive adjustment value shifts the balance towards the primary color, a negative
  5258. value towards the complementary color.
  5259. The filter accepts the following options:
  5260. @table @option
  5261. @item rs
  5262. @item gs
  5263. @item bs
  5264. Adjust red, green and blue shadows (darkest pixels).
  5265. @item rm
  5266. @item gm
  5267. @item bm
  5268. Adjust red, green and blue midtones (medium pixels).
  5269. @item rh
  5270. @item gh
  5271. @item bh
  5272. Adjust red, green and blue highlights (brightest pixels).
  5273. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5274. @end table
  5275. @subsection Examples
  5276. @itemize
  5277. @item
  5278. Add red color cast to shadows:
  5279. @example
  5280. colorbalance=rs=.3
  5281. @end example
  5282. @end itemize
  5283. @section colorkey
  5284. RGB colorspace color keying.
  5285. The filter accepts the following options:
  5286. @table @option
  5287. @item color
  5288. The color which will be replaced with transparency.
  5289. @item similarity
  5290. Similarity percentage with the key color.
  5291. 0.01 matches only the exact key color, while 1.0 matches everything.
  5292. @item blend
  5293. Blend percentage.
  5294. 0.0 makes pixels either fully transparent, or not transparent at all.
  5295. Higher values result in semi-transparent pixels, with a higher transparency
  5296. the more similar the pixels color is to the key color.
  5297. @end table
  5298. @subsection Examples
  5299. @itemize
  5300. @item
  5301. Make every green pixel in the input image transparent:
  5302. @example
  5303. ffmpeg -i input.png -vf colorkey=green out.png
  5304. @end example
  5305. @item
  5306. Overlay a greenscreen-video on top of a static background image.
  5307. @example
  5308. 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
  5309. @end example
  5310. @end itemize
  5311. @section colorhold
  5312. Remove all color information for all RGB colors except for certain one.
  5313. The filter accepts the following options:
  5314. @table @option
  5315. @item color
  5316. The color which will not be replaced with neutral gray.
  5317. @item similarity
  5318. Similarity percentage with the above color.
  5319. 0.01 matches only the exact key color, while 1.0 matches everything.
  5320. @item blend
  5321. Blend percentage. 0.0 makes pixels fully gray.
  5322. Higher values result in more preserved color.
  5323. @end table
  5324. @section colorlevels
  5325. Adjust video input frames using levels.
  5326. The filter accepts the following options:
  5327. @table @option
  5328. @item rimin
  5329. @item gimin
  5330. @item bimin
  5331. @item aimin
  5332. Adjust red, green, blue and alpha input black point.
  5333. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5334. @item rimax
  5335. @item gimax
  5336. @item bimax
  5337. @item aimax
  5338. Adjust red, green, blue and alpha input white point.
  5339. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5340. Input levels are used to lighten highlights (bright tones), darken shadows
  5341. (dark tones), change the balance of bright and dark tones.
  5342. @item romin
  5343. @item gomin
  5344. @item bomin
  5345. @item aomin
  5346. Adjust red, green, blue and alpha output black point.
  5347. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5348. @item romax
  5349. @item gomax
  5350. @item bomax
  5351. @item aomax
  5352. Adjust red, green, blue and alpha output white point.
  5353. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5354. Output levels allows manual selection of a constrained output level range.
  5355. @end table
  5356. @subsection Examples
  5357. @itemize
  5358. @item
  5359. Make video output darker:
  5360. @example
  5361. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5362. @end example
  5363. @item
  5364. Increase contrast:
  5365. @example
  5366. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5367. @end example
  5368. @item
  5369. Make video output lighter:
  5370. @example
  5371. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5372. @end example
  5373. @item
  5374. Increase brightness:
  5375. @example
  5376. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5377. @end example
  5378. @end itemize
  5379. @section colorchannelmixer
  5380. Adjust video input frames by re-mixing color channels.
  5381. This filter modifies a color channel by adding the values associated to
  5382. the other channels of the same pixels. For example if the value to
  5383. modify is red, the output value will be:
  5384. @example
  5385. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5386. @end example
  5387. The filter accepts the following options:
  5388. @table @option
  5389. @item rr
  5390. @item rg
  5391. @item rb
  5392. @item ra
  5393. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5394. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5395. @item gr
  5396. @item gg
  5397. @item gb
  5398. @item ga
  5399. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5400. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5401. @item br
  5402. @item bg
  5403. @item bb
  5404. @item ba
  5405. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5406. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5407. @item ar
  5408. @item ag
  5409. @item ab
  5410. @item aa
  5411. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5412. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5413. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5414. @end table
  5415. @subsection Examples
  5416. @itemize
  5417. @item
  5418. Convert source to grayscale:
  5419. @example
  5420. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5421. @end example
  5422. @item
  5423. Simulate sepia tones:
  5424. @example
  5425. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5426. @end example
  5427. @end itemize
  5428. @section colormatrix
  5429. Convert color matrix.
  5430. The filter accepts the following options:
  5431. @table @option
  5432. @item src
  5433. @item dst
  5434. Specify the source and destination color matrix. Both values must be
  5435. specified.
  5436. The accepted values are:
  5437. @table @samp
  5438. @item bt709
  5439. BT.709
  5440. @item fcc
  5441. FCC
  5442. @item bt601
  5443. BT.601
  5444. @item bt470
  5445. BT.470
  5446. @item bt470bg
  5447. BT.470BG
  5448. @item smpte170m
  5449. SMPTE-170M
  5450. @item smpte240m
  5451. SMPTE-240M
  5452. @item bt2020
  5453. BT.2020
  5454. @end table
  5455. @end table
  5456. For example to convert from BT.601 to SMPTE-240M, use the command:
  5457. @example
  5458. colormatrix=bt601:smpte240m
  5459. @end example
  5460. @section colorspace
  5461. Convert colorspace, transfer characteristics or color primaries.
  5462. Input video needs to have an even size.
  5463. The filter accepts the following options:
  5464. @table @option
  5465. @anchor{all}
  5466. @item all
  5467. Specify all color properties at once.
  5468. The accepted values are:
  5469. @table @samp
  5470. @item bt470m
  5471. BT.470M
  5472. @item bt470bg
  5473. BT.470BG
  5474. @item bt601-6-525
  5475. BT.601-6 525
  5476. @item bt601-6-625
  5477. BT.601-6 625
  5478. @item bt709
  5479. BT.709
  5480. @item smpte170m
  5481. SMPTE-170M
  5482. @item smpte240m
  5483. SMPTE-240M
  5484. @item bt2020
  5485. BT.2020
  5486. @end table
  5487. @anchor{space}
  5488. @item space
  5489. Specify output colorspace.
  5490. The accepted values are:
  5491. @table @samp
  5492. @item bt709
  5493. BT.709
  5494. @item fcc
  5495. FCC
  5496. @item bt470bg
  5497. BT.470BG or BT.601-6 625
  5498. @item smpte170m
  5499. SMPTE-170M or BT.601-6 525
  5500. @item smpte240m
  5501. SMPTE-240M
  5502. @item ycgco
  5503. YCgCo
  5504. @item bt2020ncl
  5505. BT.2020 with non-constant luminance
  5506. @end table
  5507. @anchor{trc}
  5508. @item trc
  5509. Specify output transfer characteristics.
  5510. The accepted values are:
  5511. @table @samp
  5512. @item bt709
  5513. BT.709
  5514. @item bt470m
  5515. BT.470M
  5516. @item bt470bg
  5517. BT.470BG
  5518. @item gamma22
  5519. Constant gamma of 2.2
  5520. @item gamma28
  5521. Constant gamma of 2.8
  5522. @item smpte170m
  5523. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5524. @item smpte240m
  5525. SMPTE-240M
  5526. @item srgb
  5527. SRGB
  5528. @item iec61966-2-1
  5529. iec61966-2-1
  5530. @item iec61966-2-4
  5531. iec61966-2-4
  5532. @item xvycc
  5533. xvycc
  5534. @item bt2020-10
  5535. BT.2020 for 10-bits content
  5536. @item bt2020-12
  5537. BT.2020 for 12-bits content
  5538. @end table
  5539. @anchor{primaries}
  5540. @item primaries
  5541. Specify output color primaries.
  5542. The accepted values are:
  5543. @table @samp
  5544. @item bt709
  5545. BT.709
  5546. @item bt470m
  5547. BT.470M
  5548. @item bt470bg
  5549. BT.470BG or BT.601-6 625
  5550. @item smpte170m
  5551. SMPTE-170M or BT.601-6 525
  5552. @item smpte240m
  5553. SMPTE-240M
  5554. @item film
  5555. film
  5556. @item smpte431
  5557. SMPTE-431
  5558. @item smpte432
  5559. SMPTE-432
  5560. @item bt2020
  5561. BT.2020
  5562. @item jedec-p22
  5563. JEDEC P22 phosphors
  5564. @end table
  5565. @anchor{range}
  5566. @item range
  5567. Specify output color range.
  5568. The accepted values are:
  5569. @table @samp
  5570. @item tv
  5571. TV (restricted) range
  5572. @item mpeg
  5573. MPEG (restricted) range
  5574. @item pc
  5575. PC (full) range
  5576. @item jpeg
  5577. JPEG (full) range
  5578. @end table
  5579. @item format
  5580. Specify output color format.
  5581. The accepted values are:
  5582. @table @samp
  5583. @item yuv420p
  5584. YUV 4:2:0 planar 8-bits
  5585. @item yuv420p10
  5586. YUV 4:2:0 planar 10-bits
  5587. @item yuv420p12
  5588. YUV 4:2:0 planar 12-bits
  5589. @item yuv422p
  5590. YUV 4:2:2 planar 8-bits
  5591. @item yuv422p10
  5592. YUV 4:2:2 planar 10-bits
  5593. @item yuv422p12
  5594. YUV 4:2:2 planar 12-bits
  5595. @item yuv444p
  5596. YUV 4:4:4 planar 8-bits
  5597. @item yuv444p10
  5598. YUV 4:4:4 planar 10-bits
  5599. @item yuv444p12
  5600. YUV 4:4:4 planar 12-bits
  5601. @end table
  5602. @item fast
  5603. Do a fast conversion, which skips gamma/primary correction. This will take
  5604. significantly less CPU, but will be mathematically incorrect. To get output
  5605. compatible with that produced by the colormatrix filter, use fast=1.
  5606. @item dither
  5607. Specify dithering mode.
  5608. The accepted values are:
  5609. @table @samp
  5610. @item none
  5611. No dithering
  5612. @item fsb
  5613. Floyd-Steinberg dithering
  5614. @end table
  5615. @item wpadapt
  5616. Whitepoint adaptation mode.
  5617. The accepted values are:
  5618. @table @samp
  5619. @item bradford
  5620. Bradford whitepoint adaptation
  5621. @item vonkries
  5622. von Kries whitepoint adaptation
  5623. @item identity
  5624. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5625. @end table
  5626. @item iall
  5627. Override all input properties at once. Same accepted values as @ref{all}.
  5628. @item ispace
  5629. Override input colorspace. Same accepted values as @ref{space}.
  5630. @item iprimaries
  5631. Override input color primaries. Same accepted values as @ref{primaries}.
  5632. @item itrc
  5633. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5634. @item irange
  5635. Override input color range. Same accepted values as @ref{range}.
  5636. @end table
  5637. The filter converts the transfer characteristics, color space and color
  5638. primaries to the specified user values. The output value, if not specified,
  5639. is set to a default value based on the "all" property. If that property is
  5640. also not specified, the filter will log an error. The output color range and
  5641. format default to the same value as the input color range and format. The
  5642. input transfer characteristics, color space, color primaries and color range
  5643. should be set on the input data. If any of these are missing, the filter will
  5644. log an error and no conversion will take place.
  5645. For example to convert the input to SMPTE-240M, use the command:
  5646. @example
  5647. colorspace=smpte240m
  5648. @end example
  5649. @section convolution
  5650. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5651. The filter accepts the following options:
  5652. @table @option
  5653. @item 0m
  5654. @item 1m
  5655. @item 2m
  5656. @item 3m
  5657. Set matrix for each plane.
  5658. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5659. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5660. @item 0rdiv
  5661. @item 1rdiv
  5662. @item 2rdiv
  5663. @item 3rdiv
  5664. Set multiplier for calculated value for each plane.
  5665. If unset or 0, it will be sum of all matrix elements.
  5666. @item 0bias
  5667. @item 1bias
  5668. @item 2bias
  5669. @item 3bias
  5670. Set bias for each plane. This value is added to the result of the multiplication.
  5671. Useful for making the overall image brighter or darker. Default is 0.0.
  5672. @item 0mode
  5673. @item 1mode
  5674. @item 2mode
  5675. @item 3mode
  5676. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5677. Default is @var{square}.
  5678. @end table
  5679. @subsection Examples
  5680. @itemize
  5681. @item
  5682. Apply sharpen:
  5683. @example
  5684. 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"
  5685. @end example
  5686. @item
  5687. Apply blur:
  5688. @example
  5689. 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"
  5690. @end example
  5691. @item
  5692. Apply edge enhance:
  5693. @example
  5694. 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"
  5695. @end example
  5696. @item
  5697. Apply edge detect:
  5698. @example
  5699. 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"
  5700. @end example
  5701. @item
  5702. Apply laplacian edge detector which includes diagonals:
  5703. @example
  5704. 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"
  5705. @end example
  5706. @item
  5707. Apply emboss:
  5708. @example
  5709. 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"
  5710. @end example
  5711. @end itemize
  5712. @section convolve
  5713. Apply 2D convolution of video stream in frequency domain using second stream
  5714. as impulse.
  5715. The filter accepts the following options:
  5716. @table @option
  5717. @item planes
  5718. Set which planes to process.
  5719. @item impulse
  5720. Set which impulse video frames will be processed, can be @var{first}
  5721. or @var{all}. Default is @var{all}.
  5722. @end table
  5723. The @code{convolve} filter also supports the @ref{framesync} options.
  5724. @section copy
  5725. Copy the input video source unchanged to the output. This is mainly useful for
  5726. testing purposes.
  5727. @anchor{coreimage}
  5728. @section coreimage
  5729. Video filtering on GPU using Apple's CoreImage API on OSX.
  5730. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5731. processed by video hardware. However, software-based OpenGL implementations
  5732. exist which means there is no guarantee for hardware processing. It depends on
  5733. the respective OSX.
  5734. There are many filters and image generators provided by Apple that come with a
  5735. large variety of options. The filter has to be referenced by its name along
  5736. with its options.
  5737. The coreimage filter accepts the following options:
  5738. @table @option
  5739. @item list_filters
  5740. List all available filters and generators along with all their respective
  5741. options as well as possible minimum and maximum values along with the default
  5742. values.
  5743. @example
  5744. list_filters=true
  5745. @end example
  5746. @item filter
  5747. Specify all filters by their respective name and options.
  5748. Use @var{list_filters} to determine all valid filter names and options.
  5749. Numerical options are specified by a float value and are automatically clamped
  5750. to their respective value range. Vector and color options have to be specified
  5751. by a list of space separated float values. Character escaping has to be done.
  5752. A special option name @code{default} is available to use default options for a
  5753. filter.
  5754. It is required to specify either @code{default} or at least one of the filter options.
  5755. All omitted options are used with their default values.
  5756. The syntax of the filter string is as follows:
  5757. @example
  5758. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5759. @end example
  5760. @item output_rect
  5761. Specify a rectangle where the output of the filter chain is copied into the
  5762. input image. It is given by a list of space separated float values:
  5763. @example
  5764. output_rect=x\ y\ width\ height
  5765. @end example
  5766. If not given, the output rectangle equals the dimensions of the input image.
  5767. The output rectangle is automatically cropped at the borders of the input
  5768. image. Negative values are valid for each component.
  5769. @example
  5770. output_rect=25\ 25\ 100\ 100
  5771. @end example
  5772. @end table
  5773. Several filters can be chained for successive processing without GPU-HOST
  5774. transfers allowing for fast processing of complex filter chains.
  5775. Currently, only filters with zero (generators) or exactly one (filters) input
  5776. image and one output image are supported. Also, transition filters are not yet
  5777. usable as intended.
  5778. Some filters generate output images with additional padding depending on the
  5779. respective filter kernel. The padding is automatically removed to ensure the
  5780. filter output has the same size as the input image.
  5781. For image generators, the size of the output image is determined by the
  5782. previous output image of the filter chain or the input image of the whole
  5783. filterchain, respectively. The generators do not use the pixel information of
  5784. this image to generate their output. However, the generated output is
  5785. blended onto this image, resulting in partial or complete coverage of the
  5786. output image.
  5787. The @ref{coreimagesrc} video source can be used for generating input images
  5788. which are directly fed into the filter chain. By using it, providing input
  5789. images by another video source or an input video is not required.
  5790. @subsection Examples
  5791. @itemize
  5792. @item
  5793. List all filters available:
  5794. @example
  5795. coreimage=list_filters=true
  5796. @end example
  5797. @item
  5798. Use the CIBoxBlur filter with default options to blur an image:
  5799. @example
  5800. coreimage=filter=CIBoxBlur@@default
  5801. @end example
  5802. @item
  5803. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5804. its center at 100x100 and a radius of 50 pixels:
  5805. @example
  5806. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5807. @end example
  5808. @item
  5809. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5810. given as complete and escaped command-line for Apple's standard bash shell:
  5811. @example
  5812. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5813. @end example
  5814. @end itemize
  5815. @section crop
  5816. Crop the input video to given dimensions.
  5817. It accepts the following parameters:
  5818. @table @option
  5819. @item w, out_w
  5820. The width of the output video. It defaults to @code{iw}.
  5821. This expression is evaluated only once during the filter
  5822. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5823. @item h, out_h
  5824. The height of the output video. It defaults to @code{ih}.
  5825. This expression is evaluated only once during the filter
  5826. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5827. @item x
  5828. The horizontal position, in the input video, of the left edge of the output
  5829. video. It defaults to @code{(in_w-out_w)/2}.
  5830. This expression is evaluated per-frame.
  5831. @item y
  5832. The vertical position, in the input video, of the top edge of the output video.
  5833. It defaults to @code{(in_h-out_h)/2}.
  5834. This expression is evaluated per-frame.
  5835. @item keep_aspect
  5836. If set to 1 will force the output display aspect ratio
  5837. to be the same of the input, by changing the output sample aspect
  5838. ratio. It defaults to 0.
  5839. @item exact
  5840. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5841. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5842. It defaults to 0.
  5843. @end table
  5844. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5845. expressions containing the following constants:
  5846. @table @option
  5847. @item x
  5848. @item y
  5849. The computed values for @var{x} and @var{y}. They are evaluated for
  5850. each new frame.
  5851. @item in_w
  5852. @item in_h
  5853. The input width and height.
  5854. @item iw
  5855. @item ih
  5856. These are the same as @var{in_w} and @var{in_h}.
  5857. @item out_w
  5858. @item out_h
  5859. The output (cropped) width and height.
  5860. @item ow
  5861. @item oh
  5862. These are the same as @var{out_w} and @var{out_h}.
  5863. @item a
  5864. same as @var{iw} / @var{ih}
  5865. @item sar
  5866. input sample aspect ratio
  5867. @item dar
  5868. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5869. @item hsub
  5870. @item vsub
  5871. horizontal and vertical chroma subsample values. For example for the
  5872. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5873. @item n
  5874. The number of the input frame, starting from 0.
  5875. @item pos
  5876. the position in the file of the input frame, NAN if unknown
  5877. @item t
  5878. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5879. @end table
  5880. The expression for @var{out_w} may depend on the value of @var{out_h},
  5881. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5882. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5883. evaluated after @var{out_w} and @var{out_h}.
  5884. The @var{x} and @var{y} parameters specify the expressions for the
  5885. position of the top-left corner of the output (non-cropped) area. They
  5886. are evaluated for each frame. If the evaluated value is not valid, it
  5887. is approximated to the nearest valid value.
  5888. The expression for @var{x} may depend on @var{y}, and the expression
  5889. for @var{y} may depend on @var{x}.
  5890. @subsection Examples
  5891. @itemize
  5892. @item
  5893. Crop area with size 100x100 at position (12,34).
  5894. @example
  5895. crop=100:100:12:34
  5896. @end example
  5897. Using named options, the example above becomes:
  5898. @example
  5899. crop=w=100:h=100:x=12:y=34
  5900. @end example
  5901. @item
  5902. Crop the central input area with size 100x100:
  5903. @example
  5904. crop=100:100
  5905. @end example
  5906. @item
  5907. Crop the central input area with size 2/3 of the input video:
  5908. @example
  5909. crop=2/3*in_w:2/3*in_h
  5910. @end example
  5911. @item
  5912. Crop the input video central square:
  5913. @example
  5914. crop=out_w=in_h
  5915. crop=in_h
  5916. @end example
  5917. @item
  5918. Delimit the rectangle with the top-left corner placed at position
  5919. 100:100 and the right-bottom corner corresponding to the right-bottom
  5920. corner of the input image.
  5921. @example
  5922. crop=in_w-100:in_h-100:100:100
  5923. @end example
  5924. @item
  5925. Crop 10 pixels from the left and right borders, and 20 pixels from
  5926. the top and bottom borders
  5927. @example
  5928. crop=in_w-2*10:in_h-2*20
  5929. @end example
  5930. @item
  5931. Keep only the bottom right quarter of the input image:
  5932. @example
  5933. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5934. @end example
  5935. @item
  5936. Crop height for getting Greek harmony:
  5937. @example
  5938. crop=in_w:1/PHI*in_w
  5939. @end example
  5940. @item
  5941. Apply trembling effect:
  5942. @example
  5943. 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)
  5944. @end example
  5945. @item
  5946. Apply erratic camera effect depending on timestamp:
  5947. @example
  5948. 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)"
  5949. @end example
  5950. @item
  5951. Set x depending on the value of y:
  5952. @example
  5953. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5954. @end example
  5955. @end itemize
  5956. @subsection Commands
  5957. This filter supports the following commands:
  5958. @table @option
  5959. @item w, out_w
  5960. @item h, out_h
  5961. @item x
  5962. @item y
  5963. Set width/height of the output video and the horizontal/vertical position
  5964. in the input video.
  5965. The command accepts the same syntax of the corresponding option.
  5966. If the specified expression is not valid, it is kept at its current
  5967. value.
  5968. @end table
  5969. @section cropdetect
  5970. Auto-detect the crop size.
  5971. It calculates the necessary cropping parameters and prints the
  5972. recommended parameters via the logging system. The detected dimensions
  5973. correspond to the non-black area of the input video.
  5974. It accepts the following parameters:
  5975. @table @option
  5976. @item limit
  5977. Set higher black value threshold, which can be optionally specified
  5978. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5979. value greater to the set value is considered non-black. It defaults to 24.
  5980. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5981. on the bitdepth of the pixel format.
  5982. @item round
  5983. The value which the width/height should be divisible by. It defaults to
  5984. 16. The offset is automatically adjusted to center the video. Use 2 to
  5985. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5986. encoding to most video codecs.
  5987. @item reset_count, reset
  5988. Set the counter that determines after how many frames cropdetect will
  5989. reset the previously detected largest video area and start over to
  5990. detect the current optimal crop area. Default value is 0.
  5991. This can be useful when channel logos distort the video area. 0
  5992. indicates 'never reset', and returns the largest area encountered during
  5993. playback.
  5994. @end table
  5995. @anchor{cue}
  5996. @section cue
  5997. Delay video filtering until a given wallclock timestamp. The filter first
  5998. passes on @option{preroll} amount of frames, then it buffers at most
  5999. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6000. it forwards the buffered frames and also any subsequent frames coming in its
  6001. input.
  6002. The filter can be used synchronize the output of multiple ffmpeg processes for
  6003. realtime output devices like decklink. By putting the delay in the filtering
  6004. chain and pre-buffering frames the process can pass on data to output almost
  6005. immediately after the target wallclock timestamp is reached.
  6006. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6007. some use cases.
  6008. @table @option
  6009. @item cue
  6010. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6011. @item preroll
  6012. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6013. @item buffer
  6014. The maximum duration of content to buffer before waiting for the cue expressed
  6015. in seconds. Default is 0.
  6016. @end table
  6017. @anchor{curves}
  6018. @section curves
  6019. Apply color adjustments using curves.
  6020. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6021. component (red, green and blue) has its values defined by @var{N} key points
  6022. tied from each other using a smooth curve. The x-axis represents the pixel
  6023. values from the input frame, and the y-axis the new pixel values to be set for
  6024. the output frame.
  6025. By default, a component curve is defined by the two points @var{(0;0)} and
  6026. @var{(1;1)}. This creates a straight line where each original pixel value is
  6027. "adjusted" to its own value, which means no change to the image.
  6028. The filter allows you to redefine these two points and add some more. A new
  6029. curve (using a natural cubic spline interpolation) will be define to pass
  6030. smoothly through all these new coordinates. The new defined points needs to be
  6031. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6032. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6033. the vector spaces, the values will be clipped accordingly.
  6034. The filter accepts the following options:
  6035. @table @option
  6036. @item preset
  6037. Select one of the available color presets. This option can be used in addition
  6038. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6039. options takes priority on the preset values.
  6040. Available presets are:
  6041. @table @samp
  6042. @item none
  6043. @item color_negative
  6044. @item cross_process
  6045. @item darker
  6046. @item increase_contrast
  6047. @item lighter
  6048. @item linear_contrast
  6049. @item medium_contrast
  6050. @item negative
  6051. @item strong_contrast
  6052. @item vintage
  6053. @end table
  6054. Default is @code{none}.
  6055. @item master, m
  6056. Set the master key points. These points will define a second pass mapping. It
  6057. is sometimes called a "luminance" or "value" mapping. It can be used with
  6058. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6059. post-processing LUT.
  6060. @item red, r
  6061. Set the key points for the red component.
  6062. @item green, g
  6063. Set the key points for the green component.
  6064. @item blue, b
  6065. Set the key points for the blue component.
  6066. @item all
  6067. Set the key points for all components (not including master).
  6068. Can be used in addition to the other key points component
  6069. options. In this case, the unset component(s) will fallback on this
  6070. @option{all} setting.
  6071. @item psfile
  6072. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6073. @item plot
  6074. Save Gnuplot script of the curves in specified file.
  6075. @end table
  6076. To avoid some filtergraph syntax conflicts, each key points list need to be
  6077. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6078. @subsection Examples
  6079. @itemize
  6080. @item
  6081. Increase slightly the middle level of blue:
  6082. @example
  6083. curves=blue='0/0 0.5/0.58 1/1'
  6084. @end example
  6085. @item
  6086. Vintage effect:
  6087. @example
  6088. 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'
  6089. @end example
  6090. Here we obtain the following coordinates for each components:
  6091. @table @var
  6092. @item red
  6093. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6094. @item green
  6095. @code{(0;0) (0.50;0.48) (1;1)}
  6096. @item blue
  6097. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6098. @end table
  6099. @item
  6100. The previous example can also be achieved with the associated built-in preset:
  6101. @example
  6102. curves=preset=vintage
  6103. @end example
  6104. @item
  6105. Or simply:
  6106. @example
  6107. curves=vintage
  6108. @end example
  6109. @item
  6110. Use a Photoshop preset and redefine the points of the green component:
  6111. @example
  6112. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6113. @end example
  6114. @item
  6115. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6116. and @command{gnuplot}:
  6117. @example
  6118. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6119. gnuplot -p /tmp/curves.plt
  6120. @end example
  6121. @end itemize
  6122. @section datascope
  6123. Video data analysis filter.
  6124. This filter shows hexadecimal pixel values of part of video.
  6125. The filter accepts the following options:
  6126. @table @option
  6127. @item size, s
  6128. Set output video size.
  6129. @item x
  6130. Set x offset from where to pick pixels.
  6131. @item y
  6132. Set y offset from where to pick pixels.
  6133. @item mode
  6134. Set scope mode, can be one of the following:
  6135. @table @samp
  6136. @item mono
  6137. Draw hexadecimal pixel values with white color on black background.
  6138. @item color
  6139. Draw hexadecimal pixel values with input video pixel color on black
  6140. background.
  6141. @item color2
  6142. Draw hexadecimal pixel values on color background picked from input video,
  6143. the text color is picked in such way so its always visible.
  6144. @end table
  6145. @item axis
  6146. Draw rows and columns numbers on left and top of video.
  6147. @item opacity
  6148. Set background opacity.
  6149. @end table
  6150. @section dctdnoiz
  6151. Denoise frames using 2D DCT (frequency domain filtering).
  6152. This filter is not designed for real time.
  6153. The filter accepts the following options:
  6154. @table @option
  6155. @item sigma, s
  6156. Set the noise sigma constant.
  6157. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6158. coefficient (absolute value) below this threshold with be dropped.
  6159. If you need a more advanced filtering, see @option{expr}.
  6160. Default is @code{0}.
  6161. @item overlap
  6162. Set number overlapping pixels for each block. Since the filter can be slow, you
  6163. may want to reduce this value, at the cost of a less effective filter and the
  6164. risk of various artefacts.
  6165. If the overlapping value doesn't permit processing the whole input width or
  6166. height, a warning will be displayed and according borders won't be denoised.
  6167. Default value is @var{blocksize}-1, which is the best possible setting.
  6168. @item expr, e
  6169. Set the coefficient factor expression.
  6170. For each coefficient of a DCT block, this expression will be evaluated as a
  6171. multiplier value for the coefficient.
  6172. If this is option is set, the @option{sigma} option will be ignored.
  6173. The absolute value of the coefficient can be accessed through the @var{c}
  6174. variable.
  6175. @item n
  6176. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6177. @var{blocksize}, which is the width and height of the processed blocks.
  6178. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6179. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6180. on the speed processing. Also, a larger block size does not necessarily means a
  6181. better de-noising.
  6182. @end table
  6183. @subsection Examples
  6184. Apply a denoise with a @option{sigma} of @code{4.5}:
  6185. @example
  6186. dctdnoiz=4.5
  6187. @end example
  6188. The same operation can be achieved using the expression system:
  6189. @example
  6190. dctdnoiz=e='gte(c, 4.5*3)'
  6191. @end example
  6192. Violent denoise using a block size of @code{16x16}:
  6193. @example
  6194. dctdnoiz=15:n=4
  6195. @end example
  6196. @section deband
  6197. Remove banding artifacts from input video.
  6198. It works by replacing banded pixels with average value of referenced pixels.
  6199. The filter accepts the following options:
  6200. @table @option
  6201. @item 1thr
  6202. @item 2thr
  6203. @item 3thr
  6204. @item 4thr
  6205. Set banding detection threshold for each plane. Default is 0.02.
  6206. Valid range is 0.00003 to 0.5.
  6207. If difference between current pixel and reference pixel is less than threshold,
  6208. it will be considered as banded.
  6209. @item range, r
  6210. Banding detection range in pixels. Default is 16. If positive, random number
  6211. in range 0 to set value will be used. If negative, exact absolute value
  6212. will be used.
  6213. The range defines square of four pixels around current pixel.
  6214. @item direction, d
  6215. Set direction in radians from which four pixel will be compared. If positive,
  6216. random direction from 0 to set direction will be picked. If negative, exact of
  6217. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6218. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6219. column.
  6220. @item blur, b
  6221. If enabled, current pixel is compared with average value of all four
  6222. surrounding pixels. The default is enabled. If disabled current pixel is
  6223. compared with all four surrounding pixels. The pixel is considered banded
  6224. if only all four differences with surrounding pixels are less than threshold.
  6225. @item coupling, c
  6226. If enabled, current pixel is changed if and only if all pixel components are banded,
  6227. e.g. banding detection threshold is triggered for all color components.
  6228. The default is disabled.
  6229. @end table
  6230. @section deblock
  6231. Remove blocking artifacts from input video.
  6232. The filter accepts the following options:
  6233. @table @option
  6234. @item filter
  6235. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6236. This controls what kind of deblocking is applied.
  6237. @item block
  6238. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6239. @item alpha
  6240. @item beta
  6241. @item gamma
  6242. @item delta
  6243. Set blocking detection thresholds. Allowed range is 0 to 1.
  6244. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6245. Using higher threshold gives more deblocking strength.
  6246. Setting @var{alpha} controls threshold detection at exact edge of block.
  6247. Remaining options controls threshold detection near the edge. Each one for
  6248. below/above or left/right. Setting any of those to @var{0} disables
  6249. deblocking.
  6250. @item planes
  6251. Set planes to filter. Default is to filter all available planes.
  6252. @end table
  6253. @subsection Examples
  6254. @itemize
  6255. @item
  6256. Deblock using weak filter and block size of 4 pixels.
  6257. @example
  6258. deblock=filter=weak:block=4
  6259. @end example
  6260. @item
  6261. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6262. deblocking more edges.
  6263. @example
  6264. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6265. @end example
  6266. @item
  6267. Similar as above, but filter only first plane.
  6268. @example
  6269. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6270. @end example
  6271. @item
  6272. Similar as above, but filter only second and third plane.
  6273. @example
  6274. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6275. @end example
  6276. @end itemize
  6277. @anchor{decimate}
  6278. @section decimate
  6279. Drop duplicated frames at regular intervals.
  6280. The filter accepts the following options:
  6281. @table @option
  6282. @item cycle
  6283. Set the number of frames from which one will be dropped. Setting this to
  6284. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6285. Default is @code{5}.
  6286. @item dupthresh
  6287. Set the threshold for duplicate detection. If the difference metric for a frame
  6288. is less than or equal to this value, then it is declared as duplicate. Default
  6289. is @code{1.1}
  6290. @item scthresh
  6291. Set scene change threshold. Default is @code{15}.
  6292. @item blockx
  6293. @item blocky
  6294. Set the size of the x and y-axis blocks used during metric calculations.
  6295. Larger blocks give better noise suppression, but also give worse detection of
  6296. small movements. Must be a power of two. Default is @code{32}.
  6297. @item ppsrc
  6298. Mark main input as a pre-processed input and activate clean source input
  6299. stream. This allows the input to be pre-processed with various filters to help
  6300. the metrics calculation while keeping the frame selection lossless. When set to
  6301. @code{1}, the first stream is for the pre-processed input, and the second
  6302. stream is the clean source from where the kept frames are chosen. Default is
  6303. @code{0}.
  6304. @item chroma
  6305. Set whether or not chroma is considered in the metric calculations. Default is
  6306. @code{1}.
  6307. @end table
  6308. @section deconvolve
  6309. Apply 2D deconvolution of video stream in frequency domain using second stream
  6310. as impulse.
  6311. The filter accepts the following options:
  6312. @table @option
  6313. @item planes
  6314. Set which planes to process.
  6315. @item impulse
  6316. Set which impulse video frames will be processed, can be @var{first}
  6317. or @var{all}. Default is @var{all}.
  6318. @item noise
  6319. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6320. and height are not same and not power of 2 or if stream prior to convolving
  6321. had noise.
  6322. @end table
  6323. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6324. @section dedot
  6325. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6326. It accepts the following options:
  6327. @table @option
  6328. @item m
  6329. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6330. @var{rainbows} for cross-color reduction.
  6331. @item lt
  6332. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6333. @item tl
  6334. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6335. @item tc
  6336. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6337. @item ct
  6338. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6339. @end table
  6340. @section deflate
  6341. Apply deflate effect to the video.
  6342. This filter replaces the pixel by the local(3x3) average by taking into account
  6343. only values lower than the pixel.
  6344. It accepts the following options:
  6345. @table @option
  6346. @item threshold0
  6347. @item threshold1
  6348. @item threshold2
  6349. @item threshold3
  6350. Limit the maximum change for each plane, default is 65535.
  6351. If 0, plane will remain unchanged.
  6352. @end table
  6353. @section deflicker
  6354. Remove temporal frame luminance variations.
  6355. It accepts the following options:
  6356. @table @option
  6357. @item size, s
  6358. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6359. @item mode, m
  6360. Set averaging mode to smooth temporal luminance variations.
  6361. Available values are:
  6362. @table @samp
  6363. @item am
  6364. Arithmetic mean
  6365. @item gm
  6366. Geometric mean
  6367. @item hm
  6368. Harmonic mean
  6369. @item qm
  6370. Quadratic mean
  6371. @item cm
  6372. Cubic mean
  6373. @item pm
  6374. Power mean
  6375. @item median
  6376. Median
  6377. @end table
  6378. @item bypass
  6379. Do not actually modify frame. Useful when one only wants metadata.
  6380. @end table
  6381. @section dejudder
  6382. Remove judder produced by partially interlaced telecined content.
  6383. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6384. source was partially telecined content then the output of @code{pullup,dejudder}
  6385. will have a variable frame rate. May change the recorded frame rate of the
  6386. container. Aside from that change, this filter will not affect constant frame
  6387. rate video.
  6388. The option available in this filter is:
  6389. @table @option
  6390. @item cycle
  6391. Specify the length of the window over which the judder repeats.
  6392. Accepts any integer greater than 1. Useful values are:
  6393. @table @samp
  6394. @item 4
  6395. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6396. @item 5
  6397. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6398. @item 20
  6399. If a mixture of the two.
  6400. @end table
  6401. The default is @samp{4}.
  6402. @end table
  6403. @section delogo
  6404. Suppress a TV station logo by a simple interpolation of the surrounding
  6405. pixels. Just set a rectangle covering the logo and watch it disappear
  6406. (and sometimes something even uglier appear - your mileage may vary).
  6407. It accepts the following parameters:
  6408. @table @option
  6409. @item x
  6410. @item y
  6411. Specify the top left corner coordinates of the logo. They must be
  6412. specified.
  6413. @item w
  6414. @item h
  6415. Specify the width and height of the logo to clear. They must be
  6416. specified.
  6417. @item band, t
  6418. Specify the thickness of the fuzzy edge of the rectangle (added to
  6419. @var{w} and @var{h}). The default value is 1. This option is
  6420. deprecated, setting higher values should no longer be necessary and
  6421. is not recommended.
  6422. @item show
  6423. When set to 1, a green rectangle is drawn on the screen to simplify
  6424. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6425. The default value is 0.
  6426. The rectangle is drawn on the outermost pixels which will be (partly)
  6427. replaced with interpolated values. The values of the next pixels
  6428. immediately outside this rectangle in each direction will be used to
  6429. compute the interpolated pixel values inside the rectangle.
  6430. @end table
  6431. @subsection Examples
  6432. @itemize
  6433. @item
  6434. Set a rectangle covering the area with top left corner coordinates 0,0
  6435. and size 100x77, and a band of size 10:
  6436. @example
  6437. delogo=x=0:y=0:w=100:h=77:band=10
  6438. @end example
  6439. @end itemize
  6440. @section derain
  6441. Remove the rain in the input image/video by applying the derain methods based on
  6442. convolutional neural networks. Supported models:
  6443. @itemize
  6444. @item
  6445. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6446. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6447. @end itemize
  6448. Training scripts as well as scripts for model generation are provided in
  6449. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6450. The filter accepts the following options:
  6451. @table @option
  6452. @item dnn_backend
  6453. Specify which DNN backend to use for model loading and execution. This option accepts
  6454. the following values:
  6455. @table @samp
  6456. @item native
  6457. Native implementation of DNN loading and execution.
  6458. @end table
  6459. Default value is @samp{native}.
  6460. @item model
  6461. Set path to model file specifying network architecture and its parameters.
  6462. Note that different backends use different file formats. TensorFlow backend
  6463. can load files for both formats, while native backend can load files for only
  6464. its format.
  6465. @end table
  6466. @section deshake
  6467. Attempt to fix small changes in horizontal and/or vertical shift. This
  6468. filter helps remove camera shake from hand-holding a camera, bumping a
  6469. tripod, moving on a vehicle, etc.
  6470. The filter accepts the following options:
  6471. @table @option
  6472. @item x
  6473. @item y
  6474. @item w
  6475. @item h
  6476. Specify a rectangular area where to limit the search for motion
  6477. vectors.
  6478. If desired the search for motion vectors can be limited to a
  6479. rectangular area of the frame defined by its top left corner, width
  6480. and height. These parameters have the same meaning as the drawbox
  6481. filter which can be used to visualise the position of the bounding
  6482. box.
  6483. This is useful when simultaneous movement of subjects within the frame
  6484. might be confused for camera motion by the motion vector search.
  6485. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6486. then the full frame is used. This allows later options to be set
  6487. without specifying the bounding box for the motion vector search.
  6488. Default - search the whole frame.
  6489. @item rx
  6490. @item ry
  6491. Specify the maximum extent of movement in x and y directions in the
  6492. range 0-64 pixels. Default 16.
  6493. @item edge
  6494. Specify how to generate pixels to fill blanks at the edge of the
  6495. frame. Available values are:
  6496. @table @samp
  6497. @item blank, 0
  6498. Fill zeroes at blank locations
  6499. @item original, 1
  6500. Original image at blank locations
  6501. @item clamp, 2
  6502. Extruded edge value at blank locations
  6503. @item mirror, 3
  6504. Mirrored edge at blank locations
  6505. @end table
  6506. Default value is @samp{mirror}.
  6507. @item blocksize
  6508. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6509. default 8.
  6510. @item contrast
  6511. Specify the contrast threshold for blocks. Only blocks with more than
  6512. the specified contrast (difference between darkest and lightest
  6513. pixels) will be considered. Range 1-255, default 125.
  6514. @item search
  6515. Specify the search strategy. Available values are:
  6516. @table @samp
  6517. @item exhaustive, 0
  6518. Set exhaustive search
  6519. @item less, 1
  6520. Set less exhaustive search.
  6521. @end table
  6522. Default value is @samp{exhaustive}.
  6523. @item filename
  6524. If set then a detailed log of the motion search is written to the
  6525. specified file.
  6526. @end table
  6527. @section despill
  6528. Remove unwanted contamination of foreground colors, caused by reflected color of
  6529. greenscreen or bluescreen.
  6530. This filter accepts the following options:
  6531. @table @option
  6532. @item type
  6533. Set what type of despill to use.
  6534. @item mix
  6535. Set how spillmap will be generated.
  6536. @item expand
  6537. Set how much to get rid of still remaining spill.
  6538. @item red
  6539. Controls amount of red in spill area.
  6540. @item green
  6541. Controls amount of green in spill area.
  6542. Should be -1 for greenscreen.
  6543. @item blue
  6544. Controls amount of blue in spill area.
  6545. Should be -1 for bluescreen.
  6546. @item brightness
  6547. Controls brightness of spill area, preserving colors.
  6548. @item alpha
  6549. Modify alpha from generated spillmap.
  6550. @end table
  6551. @section detelecine
  6552. Apply an exact inverse of the telecine operation. It requires a predefined
  6553. pattern specified using the pattern option which must be the same as that passed
  6554. to the telecine filter.
  6555. This filter accepts the following options:
  6556. @table @option
  6557. @item first_field
  6558. @table @samp
  6559. @item top, t
  6560. top field first
  6561. @item bottom, b
  6562. bottom field first
  6563. The default value is @code{top}.
  6564. @end table
  6565. @item pattern
  6566. A string of numbers representing the pulldown pattern you wish to apply.
  6567. The default value is @code{23}.
  6568. @item start_frame
  6569. A number representing position of the first frame with respect to the telecine
  6570. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6571. @end table
  6572. @section dilation
  6573. Apply dilation effect to the video.
  6574. This filter replaces the pixel by the local(3x3) maximum.
  6575. It accepts the following options:
  6576. @table @option
  6577. @item threshold0
  6578. @item threshold1
  6579. @item threshold2
  6580. @item threshold3
  6581. Limit the maximum change for each plane, default is 65535.
  6582. If 0, plane will remain unchanged.
  6583. @item coordinates
  6584. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6585. pixels are used.
  6586. Flags to local 3x3 coordinates maps like this:
  6587. 1 2 3
  6588. 4 5
  6589. 6 7 8
  6590. @end table
  6591. @section displace
  6592. Displace pixels as indicated by second and third input stream.
  6593. It takes three input streams and outputs one stream, the first input is the
  6594. source, and second and third input are displacement maps.
  6595. The second input specifies how much to displace pixels along the
  6596. x-axis, while the third input specifies how much to displace pixels
  6597. along the y-axis.
  6598. If one of displacement map streams terminates, last frame from that
  6599. displacement map will be used.
  6600. Note that once generated, displacements maps can be reused over and over again.
  6601. A description of the accepted options follows.
  6602. @table @option
  6603. @item edge
  6604. Set displace behavior for pixels that are out of range.
  6605. Available values are:
  6606. @table @samp
  6607. @item blank
  6608. Missing pixels are replaced by black pixels.
  6609. @item smear
  6610. Adjacent pixels will spread out to replace missing pixels.
  6611. @item wrap
  6612. Out of range pixels are wrapped so they point to pixels of other side.
  6613. @item mirror
  6614. Out of range pixels will be replaced with mirrored pixels.
  6615. @end table
  6616. Default is @samp{smear}.
  6617. @end table
  6618. @subsection Examples
  6619. @itemize
  6620. @item
  6621. Add ripple effect to rgb input of video size hd720:
  6622. @example
  6623. 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
  6624. @end example
  6625. @item
  6626. Add wave effect to rgb input of video size hd720:
  6627. @example
  6628. 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
  6629. @end example
  6630. @end itemize
  6631. @section drawbox
  6632. Draw a colored box on the input image.
  6633. It accepts the following parameters:
  6634. @table @option
  6635. @item x
  6636. @item y
  6637. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6638. @item width, w
  6639. @item height, h
  6640. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6641. the input width and height. It defaults to 0.
  6642. @item color, c
  6643. Specify the color of the box to write. For the general syntax of this option,
  6644. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6645. value @code{invert} is used, the box edge color is the same as the
  6646. video with inverted luma.
  6647. @item thickness, t
  6648. The expression which sets the thickness of the box edge.
  6649. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6650. See below for the list of accepted constants.
  6651. @item replace
  6652. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6653. will overwrite the video's color and alpha pixels.
  6654. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6655. @end table
  6656. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6657. following constants:
  6658. @table @option
  6659. @item dar
  6660. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6661. @item hsub
  6662. @item vsub
  6663. horizontal and vertical chroma subsample values. For example for the
  6664. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6665. @item in_h, ih
  6666. @item in_w, iw
  6667. The input width and height.
  6668. @item sar
  6669. The input sample aspect ratio.
  6670. @item x
  6671. @item y
  6672. The x and y offset coordinates where the box is drawn.
  6673. @item w
  6674. @item h
  6675. The width and height of the drawn box.
  6676. @item t
  6677. The thickness of the drawn box.
  6678. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6679. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6680. @end table
  6681. @subsection Examples
  6682. @itemize
  6683. @item
  6684. Draw a black box around the edge of the input image:
  6685. @example
  6686. drawbox
  6687. @end example
  6688. @item
  6689. Draw a box with color red and an opacity of 50%:
  6690. @example
  6691. drawbox=10:20:200:60:red@@0.5
  6692. @end example
  6693. The previous example can be specified as:
  6694. @example
  6695. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6696. @end example
  6697. @item
  6698. Fill the box with pink color:
  6699. @example
  6700. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6701. @end example
  6702. @item
  6703. Draw a 2-pixel red 2.40:1 mask:
  6704. @example
  6705. 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
  6706. @end example
  6707. @end itemize
  6708. @section drawgrid
  6709. Draw a grid on the input image.
  6710. It accepts the following parameters:
  6711. @table @option
  6712. @item x
  6713. @item y
  6714. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6715. @item width, w
  6716. @item height, h
  6717. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6718. input width and height, respectively, minus @code{thickness}, so image gets
  6719. framed. Default to 0.
  6720. @item color, c
  6721. Specify the color of the grid. For the general syntax of this option,
  6722. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6723. value @code{invert} is used, the grid color is the same as the
  6724. video with inverted luma.
  6725. @item thickness, t
  6726. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6727. See below for the list of accepted constants.
  6728. @item replace
  6729. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6730. will overwrite the video's color and alpha pixels.
  6731. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6732. @end table
  6733. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6734. following constants:
  6735. @table @option
  6736. @item dar
  6737. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6738. @item hsub
  6739. @item vsub
  6740. horizontal and vertical chroma subsample values. For example for the
  6741. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6742. @item in_h, ih
  6743. @item in_w, iw
  6744. The input grid cell width and height.
  6745. @item sar
  6746. The input sample aspect ratio.
  6747. @item x
  6748. @item y
  6749. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6750. @item w
  6751. @item h
  6752. The width and height of the drawn cell.
  6753. @item t
  6754. The thickness of the drawn cell.
  6755. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6756. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6757. @end table
  6758. @subsection Examples
  6759. @itemize
  6760. @item
  6761. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6762. @example
  6763. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6764. @end example
  6765. @item
  6766. Draw a white 3x3 grid with an opacity of 50%:
  6767. @example
  6768. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6769. @end example
  6770. @end itemize
  6771. @anchor{drawtext}
  6772. @section drawtext
  6773. Draw a text string or text from a specified file on top of a video, using the
  6774. libfreetype library.
  6775. To enable compilation of this filter, you need to configure FFmpeg with
  6776. @code{--enable-libfreetype}.
  6777. To enable default font fallback and the @var{font} option you need to
  6778. configure FFmpeg with @code{--enable-libfontconfig}.
  6779. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6780. @code{--enable-libfribidi}.
  6781. @subsection Syntax
  6782. It accepts the following parameters:
  6783. @table @option
  6784. @item box
  6785. Used to draw a box around text using the background color.
  6786. The value must be either 1 (enable) or 0 (disable).
  6787. The default value of @var{box} is 0.
  6788. @item boxborderw
  6789. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6790. The default value of @var{boxborderw} is 0.
  6791. @item boxcolor
  6792. The color to be used for drawing box around text. For the syntax of this
  6793. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6794. The default value of @var{boxcolor} is "white".
  6795. @item line_spacing
  6796. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6797. The default value of @var{line_spacing} is 0.
  6798. @item borderw
  6799. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6800. The default value of @var{borderw} is 0.
  6801. @item bordercolor
  6802. Set the color to be used for drawing border around text. For the syntax of this
  6803. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6804. The default value of @var{bordercolor} is "black".
  6805. @item expansion
  6806. Select how the @var{text} is expanded. Can be either @code{none},
  6807. @code{strftime} (deprecated) or
  6808. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6809. below for details.
  6810. @item basetime
  6811. Set a start time for the count. Value is in microseconds. Only applied
  6812. in the deprecated strftime expansion mode. To emulate in normal expansion
  6813. mode use the @code{pts} function, supplying the start time (in seconds)
  6814. as the second argument.
  6815. @item fix_bounds
  6816. If true, check and fix text coords to avoid clipping.
  6817. @item fontcolor
  6818. The color to be used for drawing fonts. For the syntax of this option, check
  6819. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6820. The default value of @var{fontcolor} is "black".
  6821. @item fontcolor_expr
  6822. String which is expanded the same way as @var{text} to obtain dynamic
  6823. @var{fontcolor} value. By default this option has empty value and is not
  6824. processed. When this option is set, it overrides @var{fontcolor} option.
  6825. @item font
  6826. The font family to be used for drawing text. By default Sans.
  6827. @item fontfile
  6828. The font file to be used for drawing text. The path must be included.
  6829. This parameter is mandatory if the fontconfig support is disabled.
  6830. @item alpha
  6831. Draw the text applying alpha blending. The value can
  6832. be a number between 0.0 and 1.0.
  6833. The expression accepts the same variables @var{x, y} as well.
  6834. The default value is 1.
  6835. Please see @var{fontcolor_expr}.
  6836. @item fontsize
  6837. The font size to be used for drawing text.
  6838. The default value of @var{fontsize} is 16.
  6839. @item text_shaping
  6840. If set to 1, attempt to shape the text (for example, reverse the order of
  6841. right-to-left text and join Arabic characters) before drawing it.
  6842. Otherwise, just draw the text exactly as given.
  6843. By default 1 (if supported).
  6844. @item ft_load_flags
  6845. The flags to be used for loading the fonts.
  6846. The flags map the corresponding flags supported by libfreetype, and are
  6847. a combination of the following values:
  6848. @table @var
  6849. @item default
  6850. @item no_scale
  6851. @item no_hinting
  6852. @item render
  6853. @item no_bitmap
  6854. @item vertical_layout
  6855. @item force_autohint
  6856. @item crop_bitmap
  6857. @item pedantic
  6858. @item ignore_global_advance_width
  6859. @item no_recurse
  6860. @item ignore_transform
  6861. @item monochrome
  6862. @item linear_design
  6863. @item no_autohint
  6864. @end table
  6865. Default value is "default".
  6866. For more information consult the documentation for the FT_LOAD_*
  6867. libfreetype flags.
  6868. @item shadowcolor
  6869. The color to be used for drawing a shadow behind the drawn text. For the
  6870. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6871. ffmpeg-utils manual,ffmpeg-utils}.
  6872. The default value of @var{shadowcolor} is "black".
  6873. @item shadowx
  6874. @item shadowy
  6875. The x and y offsets for the text shadow position with respect to the
  6876. position of the text. They can be either positive or negative
  6877. values. The default value for both is "0".
  6878. @item start_number
  6879. The starting frame number for the n/frame_num variable. The default value
  6880. is "0".
  6881. @item tabsize
  6882. The size in number of spaces to use for rendering the tab.
  6883. Default value is 4.
  6884. @item timecode
  6885. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6886. format. It can be used with or without text parameter. @var{timecode_rate}
  6887. option must be specified.
  6888. @item timecode_rate, rate, r
  6889. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6890. integer. Minimum value is "1".
  6891. Drop-frame timecode is supported for frame rates 30 & 60.
  6892. @item tc24hmax
  6893. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6894. Default is 0 (disabled).
  6895. @item text
  6896. The text string to be drawn. The text must be a sequence of UTF-8
  6897. encoded characters.
  6898. This parameter is mandatory if no file is specified with the parameter
  6899. @var{textfile}.
  6900. @item textfile
  6901. A text file containing text to be drawn. The text must be a sequence
  6902. of UTF-8 encoded characters.
  6903. This parameter is mandatory if no text string is specified with the
  6904. parameter @var{text}.
  6905. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6906. @item reload
  6907. If set to 1, the @var{textfile} will be reloaded before each frame.
  6908. Be sure to update it atomically, or it may be read partially, or even fail.
  6909. @item x
  6910. @item y
  6911. The expressions which specify the offsets where text will be drawn
  6912. within the video frame. They are relative to the top/left border of the
  6913. output image.
  6914. The default value of @var{x} and @var{y} is "0".
  6915. See below for the list of accepted constants and functions.
  6916. @end table
  6917. The parameters for @var{x} and @var{y} are expressions containing the
  6918. following constants and functions:
  6919. @table @option
  6920. @item dar
  6921. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6922. @item hsub
  6923. @item vsub
  6924. horizontal and vertical chroma subsample values. For example for the
  6925. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6926. @item line_h, lh
  6927. the height of each text line
  6928. @item main_h, h, H
  6929. the input height
  6930. @item main_w, w, W
  6931. the input width
  6932. @item max_glyph_a, ascent
  6933. the maximum distance from the baseline to the highest/upper grid
  6934. coordinate used to place a glyph outline point, for all the rendered
  6935. glyphs.
  6936. It is a positive value, due to the grid's orientation with the Y axis
  6937. upwards.
  6938. @item max_glyph_d, descent
  6939. the maximum distance from the baseline to the lowest grid coordinate
  6940. used to place a glyph outline point, for all the rendered glyphs.
  6941. This is a negative value, due to the grid's orientation, with the Y axis
  6942. upwards.
  6943. @item max_glyph_h
  6944. maximum glyph height, that is the maximum height for all the glyphs
  6945. contained in the rendered text, it is equivalent to @var{ascent} -
  6946. @var{descent}.
  6947. @item max_glyph_w
  6948. maximum glyph width, that is the maximum width for all the glyphs
  6949. contained in the rendered text
  6950. @item n
  6951. the number of input frame, starting from 0
  6952. @item rand(min, max)
  6953. return a random number included between @var{min} and @var{max}
  6954. @item sar
  6955. The input sample aspect ratio.
  6956. @item t
  6957. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6958. @item text_h, th
  6959. the height of the rendered text
  6960. @item text_w, tw
  6961. the width of the rendered text
  6962. @item x
  6963. @item y
  6964. the x and y offset coordinates where the text is drawn.
  6965. These parameters allow the @var{x} and @var{y} expressions to refer
  6966. to each other, so you can for example specify @code{y=x/dar}.
  6967. @item pict_type
  6968. A one character description of the current frame's picture type.
  6969. @item pkt_pos
  6970. The current packet's position in the input file or stream
  6971. (in bytes, from the start of the input). A value of -1 indicates
  6972. this info is not available.
  6973. @item pkt_duration
  6974. The current packet's duration, in seconds.
  6975. @item pkt_size
  6976. The current packet's size (in bytes).
  6977. @end table
  6978. @anchor{drawtext_expansion}
  6979. @subsection Text expansion
  6980. If @option{expansion} is set to @code{strftime},
  6981. the filter recognizes strftime() sequences in the provided text and
  6982. expands them accordingly. Check the documentation of strftime(). This
  6983. feature is deprecated.
  6984. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6985. If @option{expansion} is set to @code{normal} (which is the default),
  6986. the following expansion mechanism is used.
  6987. The backslash character @samp{\}, followed by any character, always expands to
  6988. the second character.
  6989. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6990. braces is a function name, possibly followed by arguments separated by ':'.
  6991. If the arguments contain special characters or delimiters (':' or '@}'),
  6992. they should be escaped.
  6993. Note that they probably must also be escaped as the value for the
  6994. @option{text} option in the filter argument string and as the filter
  6995. argument in the filtergraph description, and possibly also for the shell,
  6996. that makes up to four levels of escaping; using a text file avoids these
  6997. problems.
  6998. The following functions are available:
  6999. @table @command
  7000. @item expr, e
  7001. The expression evaluation result.
  7002. It must take one argument specifying the expression to be evaluated,
  7003. which accepts the same constants and functions as the @var{x} and
  7004. @var{y} values. Note that not all constants should be used, for
  7005. example the text size is not known when evaluating the expression, so
  7006. the constants @var{text_w} and @var{text_h} will have an undefined
  7007. value.
  7008. @item expr_int_format, eif
  7009. Evaluate the expression's value and output as formatted integer.
  7010. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7011. The second argument specifies the output format. Allowed values are @samp{x},
  7012. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7013. @code{printf} function.
  7014. The third parameter is optional and sets the number of positions taken by the output.
  7015. It can be used to add padding with zeros from the left.
  7016. @item gmtime
  7017. The time at which the filter is running, expressed in UTC.
  7018. It can accept an argument: a strftime() format string.
  7019. @item localtime
  7020. The time at which the filter is running, expressed in the local time zone.
  7021. It can accept an argument: a strftime() format string.
  7022. @item metadata
  7023. Frame metadata. Takes one or two arguments.
  7024. The first argument is mandatory and specifies the metadata key.
  7025. The second argument is optional and specifies a default value, used when the
  7026. metadata key is not found or empty.
  7027. Available metadata can be identified by inspecting entries
  7028. starting with TAG included within each frame section
  7029. printed by running @code{ffprobe -show_frames}.
  7030. String metadata generated in filters leading to
  7031. the drawtext filter are also available.
  7032. @item n, frame_num
  7033. The frame number, starting from 0.
  7034. @item pict_type
  7035. A one character description of the current picture type.
  7036. @item pts
  7037. The timestamp of the current frame.
  7038. It can take up to three arguments.
  7039. The first argument is the format of the timestamp; it defaults to @code{flt}
  7040. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7041. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7042. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7043. @code{localtime} stands for the timestamp of the frame formatted as
  7044. local time zone time.
  7045. The second argument is an offset added to the timestamp.
  7046. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7047. supplied to present the hour part of the formatted timestamp in 24h format
  7048. (00-23).
  7049. If the format is set to @code{localtime} or @code{gmtime},
  7050. a third argument may be supplied: a strftime() format string.
  7051. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7052. @end table
  7053. @subsection Commands
  7054. This filter supports altering parameters via commands:
  7055. @table @option
  7056. @item reinit
  7057. Alter existing filter parameters.
  7058. Syntax for the argument is the same as for filter invocation, e.g.
  7059. @example
  7060. fontsize=56:fontcolor=green:text='Hello World'
  7061. @end example
  7062. Full filter invocation with sendcmd would look like this:
  7063. @example
  7064. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7065. @end example
  7066. @end table
  7067. If the entire argument can't be parsed or applied as valid values then the filter will
  7068. continue with its existing parameters.
  7069. @subsection Examples
  7070. @itemize
  7071. @item
  7072. Draw "Test Text" with font FreeSerif, using the default values for the
  7073. optional parameters.
  7074. @example
  7075. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7076. @end example
  7077. @item
  7078. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7079. and y=50 (counting from the top-left corner of the screen), text is
  7080. yellow with a red box around it. Both the text and the box have an
  7081. opacity of 20%.
  7082. @example
  7083. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7084. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7085. @end example
  7086. Note that the double quotes are not necessary if spaces are not used
  7087. within the parameter list.
  7088. @item
  7089. Show the text at the center of the video frame:
  7090. @example
  7091. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7092. @end example
  7093. @item
  7094. Show the text at a random position, switching to a new position every 30 seconds:
  7095. @example
  7096. 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)"
  7097. @end example
  7098. @item
  7099. Show a text line sliding from right to left in the last row of the video
  7100. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7101. with no newlines.
  7102. @example
  7103. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7104. @end example
  7105. @item
  7106. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7107. @example
  7108. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7109. @end example
  7110. @item
  7111. Draw a single green letter "g", at the center of the input video.
  7112. The glyph baseline is placed at half screen height.
  7113. @example
  7114. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7115. @end example
  7116. @item
  7117. Show text for 1 second every 3 seconds:
  7118. @example
  7119. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7120. @end example
  7121. @item
  7122. Use fontconfig to set the font. Note that the colons need to be escaped.
  7123. @example
  7124. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7125. @end example
  7126. @item
  7127. Print the date of a real-time encoding (see strftime(3)):
  7128. @example
  7129. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7130. @end example
  7131. @item
  7132. Show text fading in and out (appearing/disappearing):
  7133. @example
  7134. #!/bin/sh
  7135. DS=1.0 # display start
  7136. DE=10.0 # display end
  7137. FID=1.5 # fade in duration
  7138. FOD=5 # fade out duration
  7139. 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 @}"
  7140. @end example
  7141. @item
  7142. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7143. and the @option{fontsize} value are included in the @option{y} offset.
  7144. @example
  7145. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7146. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7147. @end example
  7148. @end itemize
  7149. For more information about libfreetype, check:
  7150. @url{http://www.freetype.org/}.
  7151. For more information about fontconfig, check:
  7152. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7153. For more information about libfribidi, check:
  7154. @url{http://fribidi.org/}.
  7155. @section edgedetect
  7156. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7157. The filter accepts the following options:
  7158. @table @option
  7159. @item low
  7160. @item high
  7161. Set low and high threshold values used by the Canny thresholding
  7162. algorithm.
  7163. The high threshold selects the "strong" edge pixels, which are then
  7164. connected through 8-connectivity with the "weak" edge pixels selected
  7165. by the low threshold.
  7166. @var{low} and @var{high} threshold values must be chosen in the range
  7167. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7168. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7169. is @code{50/255}.
  7170. @item mode
  7171. Define the drawing mode.
  7172. @table @samp
  7173. @item wires
  7174. Draw white/gray wires on black background.
  7175. @item colormix
  7176. Mix the colors to create a paint/cartoon effect.
  7177. @item canny
  7178. Apply Canny edge detector on all selected planes.
  7179. @end table
  7180. Default value is @var{wires}.
  7181. @item planes
  7182. Select planes for filtering. By default all available planes are filtered.
  7183. @end table
  7184. @subsection Examples
  7185. @itemize
  7186. @item
  7187. Standard edge detection with custom values for the hysteresis thresholding:
  7188. @example
  7189. edgedetect=low=0.1:high=0.4
  7190. @end example
  7191. @item
  7192. Painting effect without thresholding:
  7193. @example
  7194. edgedetect=mode=colormix:high=0
  7195. @end example
  7196. @end itemize
  7197. @section eq
  7198. Set brightness, contrast, saturation and approximate gamma adjustment.
  7199. The filter accepts the following options:
  7200. @table @option
  7201. @item contrast
  7202. Set the contrast expression. The value must be a float value in range
  7203. @code{-2.0} to @code{2.0}. The default value is "1".
  7204. @item brightness
  7205. Set the brightness expression. The value must be a float value in
  7206. range @code{-1.0} to @code{1.0}. The default value is "0".
  7207. @item saturation
  7208. Set the saturation expression. The value must be a float in
  7209. range @code{0.0} to @code{3.0}. The default value is "1".
  7210. @item gamma
  7211. Set the gamma expression. The value must be a float in range
  7212. @code{0.1} to @code{10.0}. The default value is "1".
  7213. @item gamma_r
  7214. Set the gamma expression for red. The value must be a float in
  7215. range @code{0.1} to @code{10.0}. The default value is "1".
  7216. @item gamma_g
  7217. Set the gamma expression for green. The value must be a float in range
  7218. @code{0.1} to @code{10.0}. The default value is "1".
  7219. @item gamma_b
  7220. Set the gamma expression for blue. The value must be a float in range
  7221. @code{0.1} to @code{10.0}. The default value is "1".
  7222. @item gamma_weight
  7223. Set the gamma weight expression. It can be used to reduce the effect
  7224. of a high gamma value on bright image areas, e.g. keep them from
  7225. getting overamplified and just plain white. The value must be a float
  7226. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7227. gamma correction all the way down while @code{1.0} leaves it at its
  7228. full strength. Default is "1".
  7229. @item eval
  7230. Set when the expressions for brightness, contrast, saturation and
  7231. gamma expressions are evaluated.
  7232. It accepts the following values:
  7233. @table @samp
  7234. @item init
  7235. only evaluate expressions once during the filter initialization or
  7236. when a command is processed
  7237. @item frame
  7238. evaluate expressions for each incoming frame
  7239. @end table
  7240. Default value is @samp{init}.
  7241. @end table
  7242. The expressions accept the following parameters:
  7243. @table @option
  7244. @item n
  7245. frame count of the input frame starting from 0
  7246. @item pos
  7247. byte position of the corresponding packet in the input file, NAN if
  7248. unspecified
  7249. @item r
  7250. frame rate of the input video, NAN if the input frame rate is unknown
  7251. @item t
  7252. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7253. @end table
  7254. @subsection Commands
  7255. The filter supports the following commands:
  7256. @table @option
  7257. @item contrast
  7258. Set the contrast expression.
  7259. @item brightness
  7260. Set the brightness expression.
  7261. @item saturation
  7262. Set the saturation expression.
  7263. @item gamma
  7264. Set the gamma expression.
  7265. @item gamma_r
  7266. Set the gamma_r expression.
  7267. @item gamma_g
  7268. Set gamma_g expression.
  7269. @item gamma_b
  7270. Set gamma_b expression.
  7271. @item gamma_weight
  7272. Set gamma_weight expression.
  7273. The command accepts the same syntax of the corresponding option.
  7274. If the specified expression is not valid, it is kept at its current
  7275. value.
  7276. @end table
  7277. @section erosion
  7278. Apply erosion effect to the video.
  7279. This filter replaces the pixel by the local(3x3) minimum.
  7280. It accepts the following options:
  7281. @table @option
  7282. @item threshold0
  7283. @item threshold1
  7284. @item threshold2
  7285. @item threshold3
  7286. Limit the maximum change for each plane, default is 65535.
  7287. If 0, plane will remain unchanged.
  7288. @item coordinates
  7289. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7290. pixels are used.
  7291. Flags to local 3x3 coordinates maps like this:
  7292. 1 2 3
  7293. 4 5
  7294. 6 7 8
  7295. @end table
  7296. @section extractplanes
  7297. Extract color channel components from input video stream into
  7298. separate grayscale video streams.
  7299. The filter accepts the following option:
  7300. @table @option
  7301. @item planes
  7302. Set plane(s) to extract.
  7303. Available values for planes are:
  7304. @table @samp
  7305. @item y
  7306. @item u
  7307. @item v
  7308. @item a
  7309. @item r
  7310. @item g
  7311. @item b
  7312. @end table
  7313. Choosing planes not available in the input will result in an error.
  7314. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7315. with @code{y}, @code{u}, @code{v} planes at same time.
  7316. @end table
  7317. @subsection Examples
  7318. @itemize
  7319. @item
  7320. Extract luma, u and v color channel component from input video frame
  7321. into 3 grayscale outputs:
  7322. @example
  7323. 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
  7324. @end example
  7325. @end itemize
  7326. @section elbg
  7327. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7328. For each input image, the filter will compute the optimal mapping from
  7329. the input to the output given the codebook length, that is the number
  7330. of distinct output colors.
  7331. This filter accepts the following options.
  7332. @table @option
  7333. @item codebook_length, l
  7334. Set codebook length. The value must be a positive integer, and
  7335. represents the number of distinct output colors. Default value is 256.
  7336. @item nb_steps, n
  7337. Set the maximum number of iterations to apply for computing the optimal
  7338. mapping. The higher the value the better the result and the higher the
  7339. computation time. Default value is 1.
  7340. @item seed, s
  7341. Set a random seed, must be an integer included between 0 and
  7342. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7343. will try to use a good random seed on a best effort basis.
  7344. @item pal8
  7345. Set pal8 output pixel format. This option does not work with codebook
  7346. length greater than 256.
  7347. @end table
  7348. @section entropy
  7349. Measure graylevel entropy in histogram of color channels of video frames.
  7350. It accepts the following parameters:
  7351. @table @option
  7352. @item mode
  7353. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7354. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7355. between neighbour histogram values.
  7356. @end table
  7357. @section fade
  7358. Apply a fade-in/out effect to the input video.
  7359. It accepts the following parameters:
  7360. @table @option
  7361. @item type, t
  7362. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7363. effect.
  7364. Default is @code{in}.
  7365. @item start_frame, s
  7366. Specify the number of the frame to start applying the fade
  7367. effect at. Default is 0.
  7368. @item nb_frames, n
  7369. The number of frames that the fade effect lasts. At the end of the
  7370. fade-in effect, the output video will have the same intensity as the input video.
  7371. At the end of the fade-out transition, the output video will be filled with the
  7372. selected @option{color}.
  7373. Default is 25.
  7374. @item alpha
  7375. If set to 1, fade only alpha channel, if one exists on the input.
  7376. Default value is 0.
  7377. @item start_time, st
  7378. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7379. effect. If both start_frame and start_time are specified, the fade will start at
  7380. whichever comes last. Default is 0.
  7381. @item duration, d
  7382. The number of seconds for which the fade effect has to last. At the end of the
  7383. fade-in effect the output video will have the same intensity as the input video,
  7384. at the end of the fade-out transition the output video will be filled with the
  7385. selected @option{color}.
  7386. If both duration and nb_frames are specified, duration is used. Default is 0
  7387. (nb_frames is used by default).
  7388. @item color, c
  7389. Specify the color of the fade. Default is "black".
  7390. @end table
  7391. @subsection Examples
  7392. @itemize
  7393. @item
  7394. Fade in the first 30 frames of video:
  7395. @example
  7396. fade=in:0:30
  7397. @end example
  7398. The command above is equivalent to:
  7399. @example
  7400. fade=t=in:s=0:n=30
  7401. @end example
  7402. @item
  7403. Fade out the last 45 frames of a 200-frame video:
  7404. @example
  7405. fade=out:155:45
  7406. fade=type=out:start_frame=155:nb_frames=45
  7407. @end example
  7408. @item
  7409. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7410. @example
  7411. fade=in:0:25, fade=out:975:25
  7412. @end example
  7413. @item
  7414. Make the first 5 frames yellow, then fade in from frame 5-24:
  7415. @example
  7416. fade=in:5:20:color=yellow
  7417. @end example
  7418. @item
  7419. Fade in alpha over first 25 frames of video:
  7420. @example
  7421. fade=in:0:25:alpha=1
  7422. @end example
  7423. @item
  7424. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7425. @example
  7426. fade=t=in:st=5.5:d=0.5
  7427. @end example
  7428. @end itemize
  7429. @section fftfilt
  7430. Apply arbitrary expressions to samples in frequency domain
  7431. @table @option
  7432. @item dc_Y
  7433. Adjust the dc value (gain) of the luma plane of the image. The filter
  7434. accepts an integer value in range @code{0} to @code{1000}. The default
  7435. value is set to @code{0}.
  7436. @item dc_U
  7437. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7438. filter accepts an integer value in range @code{0} to @code{1000}. The
  7439. default value is set to @code{0}.
  7440. @item dc_V
  7441. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7442. filter accepts an integer value in range @code{0} to @code{1000}. The
  7443. default value is set to @code{0}.
  7444. @item weight_Y
  7445. Set the frequency domain weight expression for the luma plane.
  7446. @item weight_U
  7447. Set the frequency domain weight expression for the 1st chroma plane.
  7448. @item weight_V
  7449. Set the frequency domain weight expression for the 2nd chroma plane.
  7450. @item eval
  7451. Set when the expressions are evaluated.
  7452. It accepts the following values:
  7453. @table @samp
  7454. @item init
  7455. Only evaluate expressions once during the filter initialization.
  7456. @item frame
  7457. Evaluate expressions for each incoming frame.
  7458. @end table
  7459. Default value is @samp{init}.
  7460. The filter accepts the following variables:
  7461. @item X
  7462. @item Y
  7463. The coordinates of the current sample.
  7464. @item W
  7465. @item H
  7466. The width and height of the image.
  7467. @item N
  7468. The number of input frame, starting from 0.
  7469. @end table
  7470. @subsection Examples
  7471. @itemize
  7472. @item
  7473. High-pass:
  7474. @example
  7475. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7476. @end example
  7477. @item
  7478. Low-pass:
  7479. @example
  7480. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7481. @end example
  7482. @item
  7483. Sharpen:
  7484. @example
  7485. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7486. @end example
  7487. @item
  7488. Blur:
  7489. @example
  7490. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7491. @end example
  7492. @end itemize
  7493. @section fftdnoiz
  7494. Denoise frames using 3D FFT (frequency domain filtering).
  7495. The filter accepts the following options:
  7496. @table @option
  7497. @item sigma
  7498. Set the noise sigma constant. This sets denoising strength.
  7499. Default value is 1. Allowed range is from 0 to 30.
  7500. Using very high sigma with low overlap may give blocking artifacts.
  7501. @item amount
  7502. Set amount of denoising. By default all detected noise is reduced.
  7503. Default value is 1. Allowed range is from 0 to 1.
  7504. @item block
  7505. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7506. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7507. block size in pixels is 2^4 which is 16.
  7508. @item overlap
  7509. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7510. @item prev
  7511. Set number of previous frames to use for denoising. By default is set to 0.
  7512. @item next
  7513. Set number of next frames to to use for denoising. By default is set to 0.
  7514. @item planes
  7515. Set planes which will be filtered, by default are all available filtered
  7516. except alpha.
  7517. @end table
  7518. @section field
  7519. Extract a single field from an interlaced image using stride
  7520. arithmetic to avoid wasting CPU time. The output frames are marked as
  7521. non-interlaced.
  7522. The filter accepts the following options:
  7523. @table @option
  7524. @item type
  7525. Specify whether to extract the top (if the value is @code{0} or
  7526. @code{top}) or the bottom field (if the value is @code{1} or
  7527. @code{bottom}).
  7528. @end table
  7529. @section fieldhint
  7530. Create new frames by copying the top and bottom fields from surrounding frames
  7531. supplied as numbers by the hint file.
  7532. @table @option
  7533. @item hint
  7534. Set file containing hints: absolute/relative frame numbers.
  7535. There must be one line for each frame in a clip. Each line must contain two
  7536. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7537. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7538. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7539. for @code{relative} mode. First number tells from which frame to pick up top
  7540. field and second number tells from which frame to pick up bottom field.
  7541. If optionally followed by @code{+} output frame will be marked as interlaced,
  7542. else if followed by @code{-} output frame will be marked as progressive, else
  7543. it will be marked same as input frame.
  7544. If line starts with @code{#} or @code{;} that line is skipped.
  7545. @item mode
  7546. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7547. @end table
  7548. Example of first several lines of @code{hint} file for @code{relative} mode:
  7549. @example
  7550. 0,0 - # first frame
  7551. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7552. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7553. 1,0 -
  7554. 0,0 -
  7555. 0,0 -
  7556. 1,0 -
  7557. 1,0 -
  7558. 1,0 -
  7559. 0,0 -
  7560. 0,0 -
  7561. 1,0 -
  7562. 1,0 -
  7563. 1,0 -
  7564. 0,0 -
  7565. @end example
  7566. @section fieldmatch
  7567. Field matching filter for inverse telecine. It is meant to reconstruct the
  7568. progressive frames from a telecined stream. The filter does not drop duplicated
  7569. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7570. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7571. The separation of the field matching and the decimation is notably motivated by
  7572. the possibility of inserting a de-interlacing filter fallback between the two.
  7573. If the source has mixed telecined and real interlaced content,
  7574. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7575. But these remaining combed frames will be marked as interlaced, and thus can be
  7576. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7577. In addition to the various configuration options, @code{fieldmatch} can take an
  7578. optional second stream, activated through the @option{ppsrc} option. If
  7579. enabled, the frames reconstruction will be based on the fields and frames from
  7580. this second stream. This allows the first input to be pre-processed in order to
  7581. help the various algorithms of the filter, while keeping the output lossless
  7582. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7583. or brightness/contrast adjustments can help.
  7584. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7585. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7586. which @code{fieldmatch} is based on. While the semantic and usage are very
  7587. close, some behaviour and options names can differ.
  7588. The @ref{decimate} filter currently only works for constant frame rate input.
  7589. If your input has mixed telecined (30fps) and progressive content with a lower
  7590. framerate like 24fps use the following filterchain to produce the necessary cfr
  7591. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7592. The filter accepts the following options:
  7593. @table @option
  7594. @item order
  7595. Specify the assumed field order of the input stream. Available values are:
  7596. @table @samp
  7597. @item auto
  7598. Auto detect parity (use FFmpeg's internal parity value).
  7599. @item bff
  7600. Assume bottom field first.
  7601. @item tff
  7602. Assume top field first.
  7603. @end table
  7604. Note that it is sometimes recommended not to trust the parity announced by the
  7605. stream.
  7606. Default value is @var{auto}.
  7607. @item mode
  7608. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7609. sense that it won't risk creating jerkiness due to duplicate frames when
  7610. possible, but if there are bad edits or blended fields it will end up
  7611. outputting combed frames when a good match might actually exist. On the other
  7612. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7613. but will almost always find a good frame if there is one. The other values are
  7614. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7615. jerkiness and creating duplicate frames versus finding good matches in sections
  7616. with bad edits, orphaned fields, blended fields, etc.
  7617. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7618. Available values are:
  7619. @table @samp
  7620. @item pc
  7621. 2-way matching (p/c)
  7622. @item pc_n
  7623. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7624. @item pc_u
  7625. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7626. @item pc_n_ub
  7627. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7628. still combed (p/c + n + u/b)
  7629. @item pcn
  7630. 3-way matching (p/c/n)
  7631. @item pcn_ub
  7632. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7633. detected as combed (p/c/n + u/b)
  7634. @end table
  7635. The parenthesis at the end indicate the matches that would be used for that
  7636. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7637. @var{top}).
  7638. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7639. the slowest.
  7640. Default value is @var{pc_n}.
  7641. @item ppsrc
  7642. Mark the main input stream as a pre-processed input, and enable the secondary
  7643. input stream as the clean source to pick the fields from. See the filter
  7644. introduction for more details. It is similar to the @option{clip2} feature from
  7645. VFM/TFM.
  7646. Default value is @code{0} (disabled).
  7647. @item field
  7648. Set the field to match from. It is recommended to set this to the same value as
  7649. @option{order} unless you experience matching failures with that setting. In
  7650. certain circumstances changing the field that is used to match from can have a
  7651. large impact on matching performance. Available values are:
  7652. @table @samp
  7653. @item auto
  7654. Automatic (same value as @option{order}).
  7655. @item bottom
  7656. Match from the bottom field.
  7657. @item top
  7658. Match from the top field.
  7659. @end table
  7660. Default value is @var{auto}.
  7661. @item mchroma
  7662. Set whether or not chroma is included during the match comparisons. In most
  7663. cases it is recommended to leave this enabled. You should set this to @code{0}
  7664. only if your clip has bad chroma problems such as heavy rainbowing or other
  7665. artifacts. Setting this to @code{0} could also be used to speed things up at
  7666. the cost of some accuracy.
  7667. Default value is @code{1}.
  7668. @item y0
  7669. @item y1
  7670. These define an exclusion band which excludes the lines between @option{y0} and
  7671. @option{y1} from being included in the field matching decision. An exclusion
  7672. band can be used to ignore subtitles, a logo, or other things that may
  7673. interfere with the matching. @option{y0} sets the starting scan line and
  7674. @option{y1} sets the ending line; all lines in between @option{y0} and
  7675. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7676. @option{y0} and @option{y1} to the same value will disable the feature.
  7677. @option{y0} and @option{y1} defaults to @code{0}.
  7678. @item scthresh
  7679. Set the scene change detection threshold as a percentage of maximum change on
  7680. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7681. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7682. @option{scthresh} is @code{[0.0, 100.0]}.
  7683. Default value is @code{12.0}.
  7684. @item combmatch
  7685. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7686. account the combed scores of matches when deciding what match to use as the
  7687. final match. Available values are:
  7688. @table @samp
  7689. @item none
  7690. No final matching based on combed scores.
  7691. @item sc
  7692. Combed scores are only used when a scene change is detected.
  7693. @item full
  7694. Use combed scores all the time.
  7695. @end table
  7696. Default is @var{sc}.
  7697. @item combdbg
  7698. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7699. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7700. Available values are:
  7701. @table @samp
  7702. @item none
  7703. No forced calculation.
  7704. @item pcn
  7705. Force p/c/n calculations.
  7706. @item pcnub
  7707. Force p/c/n/u/b calculations.
  7708. @end table
  7709. Default value is @var{none}.
  7710. @item cthresh
  7711. This is the area combing threshold used for combed frame detection. This
  7712. essentially controls how "strong" or "visible" combing must be to be detected.
  7713. Larger values mean combing must be more visible and smaller values mean combing
  7714. can be less visible or strong and still be detected. Valid settings are from
  7715. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7716. be detected as combed). This is basically a pixel difference value. A good
  7717. range is @code{[8, 12]}.
  7718. Default value is @code{9}.
  7719. @item chroma
  7720. Sets whether or not chroma is considered in the combed frame decision. Only
  7721. disable this if your source has chroma problems (rainbowing, etc.) that are
  7722. causing problems for the combed frame detection with chroma enabled. Actually,
  7723. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7724. where there is chroma only combing in the source.
  7725. Default value is @code{0}.
  7726. @item blockx
  7727. @item blocky
  7728. Respectively set the x-axis and y-axis size of the window used during combed
  7729. frame detection. This has to do with the size of the area in which
  7730. @option{combpel} pixels are required to be detected as combed for a frame to be
  7731. declared combed. See the @option{combpel} parameter description for more info.
  7732. Possible values are any number that is a power of 2 starting at 4 and going up
  7733. to 512.
  7734. Default value is @code{16}.
  7735. @item combpel
  7736. The number of combed pixels inside any of the @option{blocky} by
  7737. @option{blockx} size blocks on the frame for the frame to be detected as
  7738. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7739. setting controls "how much" combing there must be in any localized area (a
  7740. window defined by the @option{blockx} and @option{blocky} settings) on the
  7741. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7742. which point no frames will ever be detected as combed). This setting is known
  7743. as @option{MI} in TFM/VFM vocabulary.
  7744. Default value is @code{80}.
  7745. @end table
  7746. @anchor{p/c/n/u/b meaning}
  7747. @subsection p/c/n/u/b meaning
  7748. @subsubsection p/c/n
  7749. We assume the following telecined stream:
  7750. @example
  7751. Top fields: 1 2 2 3 4
  7752. Bottom fields: 1 2 3 4 4
  7753. @end example
  7754. The numbers correspond to the progressive frame the fields relate to. Here, the
  7755. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7756. When @code{fieldmatch} is configured to run a matching from bottom
  7757. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7758. @example
  7759. Input stream:
  7760. T 1 2 2 3 4
  7761. B 1 2 3 4 4 <-- matching reference
  7762. Matches: c c n n c
  7763. Output stream:
  7764. T 1 2 3 4 4
  7765. B 1 2 3 4 4
  7766. @end example
  7767. As a result of the field matching, we can see that some frames get duplicated.
  7768. To perform a complete inverse telecine, you need to rely on a decimation filter
  7769. after this operation. See for instance the @ref{decimate} filter.
  7770. The same operation now matching from top fields (@option{field}=@var{top})
  7771. looks like this:
  7772. @example
  7773. Input stream:
  7774. T 1 2 2 3 4 <-- matching reference
  7775. B 1 2 3 4 4
  7776. Matches: c c p p c
  7777. Output stream:
  7778. T 1 2 2 3 4
  7779. B 1 2 2 3 4
  7780. @end example
  7781. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7782. basically, they refer to the frame and field of the opposite parity:
  7783. @itemize
  7784. @item @var{p} matches the field of the opposite parity in the previous frame
  7785. @item @var{c} matches the field of the opposite parity in the current frame
  7786. @item @var{n} matches the field of the opposite parity in the next frame
  7787. @end itemize
  7788. @subsubsection u/b
  7789. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7790. from the opposite parity flag. In the following examples, we assume that we are
  7791. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7792. 'x' is placed above and below each matched fields.
  7793. With bottom matching (@option{field}=@var{bottom}):
  7794. @example
  7795. Match: c p n b u
  7796. x x x x x
  7797. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7798. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7799. x x x x x
  7800. Output frames:
  7801. 2 1 2 2 2
  7802. 2 2 2 1 3
  7803. @end example
  7804. With top matching (@option{field}=@var{top}):
  7805. @example
  7806. Match: c p n b u
  7807. x x x x x
  7808. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7809. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7810. x x x x x
  7811. Output frames:
  7812. 2 2 2 1 2
  7813. 2 1 3 2 2
  7814. @end example
  7815. @subsection Examples
  7816. Simple IVTC of a top field first telecined stream:
  7817. @example
  7818. fieldmatch=order=tff:combmatch=none, decimate
  7819. @end example
  7820. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7821. @example
  7822. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7823. @end example
  7824. @section fieldorder
  7825. Transform the field order of the input video.
  7826. It accepts the following parameters:
  7827. @table @option
  7828. @item order
  7829. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7830. for bottom field first.
  7831. @end table
  7832. The default value is @samp{tff}.
  7833. The transformation is done by shifting the picture content up or down
  7834. by one line, and filling the remaining line with appropriate picture content.
  7835. This method is consistent with most broadcast field order converters.
  7836. If the input video is not flagged as being interlaced, or it is already
  7837. flagged as being of the required output field order, then this filter does
  7838. not alter the incoming video.
  7839. It is very useful when converting to or from PAL DV material,
  7840. which is bottom field first.
  7841. For example:
  7842. @example
  7843. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7844. @end example
  7845. @section fifo, afifo
  7846. Buffer input images and send them when they are requested.
  7847. It is mainly useful when auto-inserted by the libavfilter
  7848. framework.
  7849. It does not take parameters.
  7850. @section fillborders
  7851. Fill borders of the input video, without changing video stream dimensions.
  7852. Sometimes video can have garbage at the four edges and you may not want to
  7853. crop video input to keep size multiple of some number.
  7854. This filter accepts the following options:
  7855. @table @option
  7856. @item left
  7857. Number of pixels to fill from left border.
  7858. @item right
  7859. Number of pixels to fill from right border.
  7860. @item top
  7861. Number of pixels to fill from top border.
  7862. @item bottom
  7863. Number of pixels to fill from bottom border.
  7864. @item mode
  7865. Set fill mode.
  7866. It accepts the following values:
  7867. @table @samp
  7868. @item smear
  7869. fill pixels using outermost pixels
  7870. @item mirror
  7871. fill pixels using mirroring
  7872. @item fixed
  7873. fill pixels with constant value
  7874. @end table
  7875. Default is @var{smear}.
  7876. @item color
  7877. Set color for pixels in fixed mode. Default is @var{black}.
  7878. @end table
  7879. @section find_rect
  7880. Find a rectangular object
  7881. It accepts the following options:
  7882. @table @option
  7883. @item object
  7884. Filepath of the object image, needs to be in gray8.
  7885. @item threshold
  7886. Detection threshold, default is 0.5.
  7887. @item mipmaps
  7888. Number of mipmaps, default is 3.
  7889. @item xmin, ymin, xmax, ymax
  7890. Specifies the rectangle in which to search.
  7891. @end table
  7892. @subsection Examples
  7893. @itemize
  7894. @item
  7895. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7896. @example
  7897. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7898. @end example
  7899. @end itemize
  7900. @section cover_rect
  7901. Cover a rectangular object
  7902. It accepts the following options:
  7903. @table @option
  7904. @item cover
  7905. Filepath of the optional cover image, needs to be in yuv420.
  7906. @item mode
  7907. Set covering mode.
  7908. It accepts the following values:
  7909. @table @samp
  7910. @item cover
  7911. cover it by the supplied image
  7912. @item blur
  7913. cover it by interpolating the surrounding pixels
  7914. @end table
  7915. Default value is @var{blur}.
  7916. @end table
  7917. @subsection Examples
  7918. @itemize
  7919. @item
  7920. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7921. @example
  7922. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7923. @end example
  7924. @end itemize
  7925. @section floodfill
  7926. Flood area with values of same pixel components with another values.
  7927. It accepts the following options:
  7928. @table @option
  7929. @item x
  7930. Set pixel x coordinate.
  7931. @item y
  7932. Set pixel y coordinate.
  7933. @item s0
  7934. Set source #0 component value.
  7935. @item s1
  7936. Set source #1 component value.
  7937. @item s2
  7938. Set source #2 component value.
  7939. @item s3
  7940. Set source #3 component value.
  7941. @item d0
  7942. Set destination #0 component value.
  7943. @item d1
  7944. Set destination #1 component value.
  7945. @item d2
  7946. Set destination #2 component value.
  7947. @item d3
  7948. Set destination #3 component value.
  7949. @end table
  7950. @anchor{format}
  7951. @section format
  7952. Convert the input video to one of the specified pixel formats.
  7953. Libavfilter will try to pick one that is suitable as input to
  7954. the next filter.
  7955. It accepts the following parameters:
  7956. @table @option
  7957. @item pix_fmts
  7958. A '|'-separated list of pixel format names, such as
  7959. "pix_fmts=yuv420p|monow|rgb24".
  7960. @end table
  7961. @subsection Examples
  7962. @itemize
  7963. @item
  7964. Convert the input video to the @var{yuv420p} format
  7965. @example
  7966. format=pix_fmts=yuv420p
  7967. @end example
  7968. Convert the input video to any of the formats in the list
  7969. @example
  7970. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7971. @end example
  7972. @end itemize
  7973. @anchor{fps}
  7974. @section fps
  7975. Convert the video to specified constant frame rate by duplicating or dropping
  7976. frames as necessary.
  7977. It accepts the following parameters:
  7978. @table @option
  7979. @item fps
  7980. The desired output frame rate. The default is @code{25}.
  7981. @item start_time
  7982. Assume the first PTS should be the given value, in seconds. This allows for
  7983. padding/trimming at the start of stream. By default, no assumption is made
  7984. about the first frame's expected PTS, so no padding or trimming is done.
  7985. For example, this could be set to 0 to pad the beginning with duplicates of
  7986. the first frame if a video stream starts after the audio stream or to trim any
  7987. frames with a negative PTS.
  7988. @item round
  7989. Timestamp (PTS) rounding method.
  7990. Possible values are:
  7991. @table @option
  7992. @item zero
  7993. round towards 0
  7994. @item inf
  7995. round away from 0
  7996. @item down
  7997. round towards -infinity
  7998. @item up
  7999. round towards +infinity
  8000. @item near
  8001. round to nearest
  8002. @end table
  8003. The default is @code{near}.
  8004. @item eof_action
  8005. Action performed when reading the last frame.
  8006. Possible values are:
  8007. @table @option
  8008. @item round
  8009. Use same timestamp rounding method as used for other frames.
  8010. @item pass
  8011. Pass through last frame if input duration has not been reached yet.
  8012. @end table
  8013. The default is @code{round}.
  8014. @end table
  8015. Alternatively, the options can be specified as a flat string:
  8016. @var{fps}[:@var{start_time}[:@var{round}]].
  8017. See also the @ref{setpts} filter.
  8018. @subsection Examples
  8019. @itemize
  8020. @item
  8021. A typical usage in order to set the fps to 25:
  8022. @example
  8023. fps=fps=25
  8024. @end example
  8025. @item
  8026. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8027. @example
  8028. fps=fps=film:round=near
  8029. @end example
  8030. @end itemize
  8031. @section framepack
  8032. Pack two different video streams into a stereoscopic video, setting proper
  8033. metadata on supported codecs. The two views should have the same size and
  8034. framerate and processing will stop when the shorter video ends. Please note
  8035. that you may conveniently adjust view properties with the @ref{scale} and
  8036. @ref{fps} filters.
  8037. It accepts the following parameters:
  8038. @table @option
  8039. @item format
  8040. The desired packing format. Supported values are:
  8041. @table @option
  8042. @item sbs
  8043. The views are next to each other (default).
  8044. @item tab
  8045. The views are on top of each other.
  8046. @item lines
  8047. The views are packed by line.
  8048. @item columns
  8049. The views are packed by column.
  8050. @item frameseq
  8051. The views are temporally interleaved.
  8052. @end table
  8053. @end table
  8054. Some examples:
  8055. @example
  8056. # Convert left and right views into a frame-sequential video
  8057. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8058. # Convert views into a side-by-side video with the same output resolution as the input
  8059. 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
  8060. @end example
  8061. @section framerate
  8062. Change the frame rate by interpolating new video output frames from the source
  8063. frames.
  8064. This filter is not designed to function correctly with interlaced media. If
  8065. you wish to change the frame rate of interlaced media then you are required
  8066. to deinterlace before this filter and re-interlace after this filter.
  8067. A description of the accepted options follows.
  8068. @table @option
  8069. @item fps
  8070. Specify the output frames per second. This option can also be specified
  8071. as a value alone. The default is @code{50}.
  8072. @item interp_start
  8073. Specify the start of a range where the output frame will be created as a
  8074. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8075. the default is @code{15}.
  8076. @item interp_end
  8077. Specify the end of a range where the output frame will be created as a
  8078. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8079. the default is @code{240}.
  8080. @item scene
  8081. Specify the level at which a scene change is detected as a value between
  8082. 0 and 100 to indicate a new scene; a low value reflects a low
  8083. probability for the current frame to introduce a new scene, while a higher
  8084. value means the current frame is more likely to be one.
  8085. The default is @code{8.2}.
  8086. @item flags
  8087. Specify flags influencing the filter process.
  8088. Available value for @var{flags} is:
  8089. @table @option
  8090. @item scene_change_detect, scd
  8091. Enable scene change detection using the value of the option @var{scene}.
  8092. This flag is enabled by default.
  8093. @end table
  8094. @end table
  8095. @section framestep
  8096. Select one frame every N-th frame.
  8097. This filter accepts the following option:
  8098. @table @option
  8099. @item step
  8100. Select frame after every @code{step} frames.
  8101. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8102. @end table
  8103. @section freezedetect
  8104. Detect frozen video.
  8105. This filter logs a message and sets frame metadata when it detects that the
  8106. input video has no significant change in content during a specified duration.
  8107. Video freeze detection calculates the mean average absolute difference of all
  8108. the components of video frames and compares it to a noise floor.
  8109. The printed times and duration are expressed in seconds. The
  8110. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8111. whose timestamp equals or exceeds the detection duration and it contains the
  8112. timestamp of the first frame of the freeze. The
  8113. @code{lavfi.freezedetect.freeze_duration} and
  8114. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8115. after the freeze.
  8116. The filter accepts the following options:
  8117. @table @option
  8118. @item noise, n
  8119. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8120. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8121. 0.001.
  8122. @item duration, d
  8123. Set freeze duration until notification (default is 2 seconds).
  8124. @end table
  8125. @anchor{frei0r}
  8126. @section frei0r
  8127. Apply a frei0r effect to the input video.
  8128. To enable the compilation of this filter, you need to install the frei0r
  8129. header and configure FFmpeg with @code{--enable-frei0r}.
  8130. It accepts the following parameters:
  8131. @table @option
  8132. @item filter_name
  8133. The name of the frei0r effect to load. If the environment variable
  8134. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8135. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8136. Otherwise, the standard frei0r paths are searched, in this order:
  8137. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8138. @file{/usr/lib/frei0r-1/}.
  8139. @item filter_params
  8140. A '|'-separated list of parameters to pass to the frei0r effect.
  8141. @end table
  8142. A frei0r effect parameter can be a boolean (its value is either
  8143. "y" or "n"), a double, a color (specified as
  8144. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8145. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8146. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8147. a position (specified as @var{X}/@var{Y}, where
  8148. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8149. The number and types of parameters depend on the loaded effect. If an
  8150. effect parameter is not specified, the default value is set.
  8151. @subsection Examples
  8152. @itemize
  8153. @item
  8154. Apply the distort0r effect, setting the first two double parameters:
  8155. @example
  8156. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8157. @end example
  8158. @item
  8159. Apply the colordistance effect, taking a color as the first parameter:
  8160. @example
  8161. frei0r=colordistance:0.2/0.3/0.4
  8162. frei0r=colordistance:violet
  8163. frei0r=colordistance:0x112233
  8164. @end example
  8165. @item
  8166. Apply the perspective effect, specifying the top left and top right image
  8167. positions:
  8168. @example
  8169. frei0r=perspective:0.2/0.2|0.8/0.2
  8170. @end example
  8171. @end itemize
  8172. For more information, see
  8173. @url{http://frei0r.dyne.org}
  8174. @section fspp
  8175. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8176. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8177. processing filter, one of them is performed once per block, not per pixel.
  8178. This allows for much higher speed.
  8179. The filter accepts the following options:
  8180. @table @option
  8181. @item quality
  8182. Set quality. This option defines the number of levels for averaging. It accepts
  8183. an integer in the range 4-5. Default value is @code{4}.
  8184. @item qp
  8185. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8186. If not set, the filter will use the QP from the video stream (if available).
  8187. @item strength
  8188. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8189. more details but also more artifacts, while higher values make the image smoother
  8190. but also blurrier. Default value is @code{0} − PSNR optimal.
  8191. @item use_bframe_qp
  8192. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8193. option may cause flicker since the B-Frames have often larger QP. Default is
  8194. @code{0} (not enabled).
  8195. @end table
  8196. @section gblur
  8197. Apply Gaussian blur filter.
  8198. The filter accepts the following options:
  8199. @table @option
  8200. @item sigma
  8201. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8202. @item steps
  8203. Set number of steps for Gaussian approximation. Default is @code{1}.
  8204. @item planes
  8205. Set which planes to filter. By default all planes are filtered.
  8206. @item sigmaV
  8207. Set vertical sigma, if negative it will be same as @code{sigma}.
  8208. Default is @code{-1}.
  8209. @end table
  8210. @section geq
  8211. Apply generic equation to each pixel.
  8212. The filter accepts the following options:
  8213. @table @option
  8214. @item lum_expr, lum
  8215. Set the luminance expression.
  8216. @item cb_expr, cb
  8217. Set the chrominance blue expression.
  8218. @item cr_expr, cr
  8219. Set the chrominance red expression.
  8220. @item alpha_expr, a
  8221. Set the alpha expression.
  8222. @item red_expr, r
  8223. Set the red expression.
  8224. @item green_expr, g
  8225. Set the green expression.
  8226. @item blue_expr, b
  8227. Set the blue expression.
  8228. @end table
  8229. The colorspace is selected according to the specified options. If one
  8230. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8231. options is specified, the filter will automatically select a YCbCr
  8232. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8233. @option{blue_expr} options is specified, it will select an RGB
  8234. colorspace.
  8235. If one of the chrominance expression is not defined, it falls back on the other
  8236. one. If no alpha expression is specified it will evaluate to opaque value.
  8237. If none of chrominance expressions are specified, they will evaluate
  8238. to the luminance expression.
  8239. The expressions can use the following variables and functions:
  8240. @table @option
  8241. @item N
  8242. The sequential number of the filtered frame, starting from @code{0}.
  8243. @item X
  8244. @item Y
  8245. The coordinates of the current sample.
  8246. @item W
  8247. @item H
  8248. The width and height of the image.
  8249. @item SW
  8250. @item SH
  8251. Width and height scale depending on the currently filtered plane. It is the
  8252. ratio between the corresponding luma plane number of pixels and the current
  8253. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8254. @code{0.5,0.5} for chroma planes.
  8255. @item T
  8256. Time of the current frame, expressed in seconds.
  8257. @item p(x, y)
  8258. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8259. plane.
  8260. @item lum(x, y)
  8261. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8262. plane.
  8263. @item cb(x, y)
  8264. Return the value of the pixel at location (@var{x},@var{y}) of the
  8265. blue-difference chroma plane. Return 0 if there is no such plane.
  8266. @item cr(x, y)
  8267. Return the value of the pixel at location (@var{x},@var{y}) of the
  8268. red-difference chroma plane. Return 0 if there is no such plane.
  8269. @item r(x, y)
  8270. @item g(x, y)
  8271. @item b(x, y)
  8272. Return the value of the pixel at location (@var{x},@var{y}) of the
  8273. red/green/blue component. Return 0 if there is no such component.
  8274. @item alpha(x, y)
  8275. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8276. plane. Return 0 if there is no such plane.
  8277. @end table
  8278. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8279. automatically clipped to the closer edge.
  8280. @subsection Examples
  8281. @itemize
  8282. @item
  8283. Flip the image horizontally:
  8284. @example
  8285. geq=p(W-X\,Y)
  8286. @end example
  8287. @item
  8288. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8289. wavelength of 100 pixels:
  8290. @example
  8291. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8292. @end example
  8293. @item
  8294. Generate a fancy enigmatic moving light:
  8295. @example
  8296. 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
  8297. @end example
  8298. @item
  8299. Generate a quick emboss effect:
  8300. @example
  8301. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8302. @end example
  8303. @item
  8304. Modify RGB components depending on pixel position:
  8305. @example
  8306. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8307. @end example
  8308. @item
  8309. Create a radial gradient that is the same size as the input (also see
  8310. the @ref{vignette} filter):
  8311. @example
  8312. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8313. @end example
  8314. @end itemize
  8315. @section gradfun
  8316. Fix the banding artifacts that are sometimes introduced into nearly flat
  8317. regions by truncation to 8-bit color depth.
  8318. Interpolate the gradients that should go where the bands are, and
  8319. dither them.
  8320. It is designed for playback only. Do not use it prior to
  8321. lossy compression, because compression tends to lose the dither and
  8322. bring back the bands.
  8323. It accepts the following parameters:
  8324. @table @option
  8325. @item strength
  8326. The maximum amount by which the filter will change any one pixel. This is also
  8327. the threshold for detecting nearly flat regions. Acceptable values range from
  8328. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8329. valid range.
  8330. @item radius
  8331. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8332. gradients, but also prevents the filter from modifying the pixels near detailed
  8333. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8334. values will be clipped to the valid range.
  8335. @end table
  8336. Alternatively, the options can be specified as a flat string:
  8337. @var{strength}[:@var{radius}]
  8338. @subsection Examples
  8339. @itemize
  8340. @item
  8341. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8342. @example
  8343. gradfun=3.5:8
  8344. @end example
  8345. @item
  8346. Specify radius, omitting the strength (which will fall-back to the default
  8347. value):
  8348. @example
  8349. gradfun=radius=8
  8350. @end example
  8351. @end itemize
  8352. @section graphmonitor, agraphmonitor
  8353. Show various filtergraph stats.
  8354. With this filter one can debug complete filtergraph.
  8355. Especially issues with links filling with queued frames.
  8356. The filter accepts the following options:
  8357. @table @option
  8358. @item size, s
  8359. Set video output size. Default is @var{hd720}.
  8360. @item opacity, o
  8361. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8362. @item mode, m
  8363. Set output mode, can be @var{fulll} or @var{compact}.
  8364. In @var{compact} mode only filters with some queued frames have displayed stats.
  8365. @item flags, f
  8366. Set flags which enable which stats are shown in video.
  8367. Available values for flags are:
  8368. @table @samp
  8369. @item queue
  8370. Display number of queued frames in each link.
  8371. @item frame_count_in
  8372. Display number of frames taken from filter.
  8373. @item frame_count_out
  8374. Display number of frames given out from filter.
  8375. @item pts
  8376. Display current filtered frame pts.
  8377. @item time
  8378. Display current filtered frame time.
  8379. @item timebase
  8380. Display time base for filter link.
  8381. @item format
  8382. Display used format for filter link.
  8383. @item size
  8384. Display video size or number of audio channels in case of audio used by filter link.
  8385. @item rate
  8386. Display video frame rate or sample rate in case of audio used by filter link.
  8387. @end table
  8388. @item rate, r
  8389. Set upper limit for video rate of output stream, Default value is @var{25}.
  8390. This guarantee that output video frame rate will not be higher than this value.
  8391. @end table
  8392. @section greyedge
  8393. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8394. and corrects the scene colors accordingly.
  8395. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8396. The filter accepts the following options:
  8397. @table @option
  8398. @item difford
  8399. The order of differentiation to be applied on the scene. Must be chosen in the range
  8400. [0,2] and default value is 1.
  8401. @item minknorm
  8402. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8403. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8404. max value instead of calculating Minkowski distance.
  8405. @item sigma
  8406. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8407. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8408. can't be equal to 0 if @var{difford} is greater than 0.
  8409. @end table
  8410. @subsection Examples
  8411. @itemize
  8412. @item
  8413. Grey Edge:
  8414. @example
  8415. greyedge=difford=1:minknorm=5:sigma=2
  8416. @end example
  8417. @item
  8418. Max Edge:
  8419. @example
  8420. greyedge=difford=1:minknorm=0:sigma=2
  8421. @end example
  8422. @end itemize
  8423. @anchor{haldclut}
  8424. @section haldclut
  8425. Apply a Hald CLUT to a video stream.
  8426. First input is the video stream to process, and second one is the Hald CLUT.
  8427. The Hald CLUT input can be a simple picture or a complete video stream.
  8428. The filter accepts the following options:
  8429. @table @option
  8430. @item shortest
  8431. Force termination when the shortest input terminates. Default is @code{0}.
  8432. @item repeatlast
  8433. Continue applying the last CLUT after the end of the stream. A value of
  8434. @code{0} disable the filter after the last frame of the CLUT is reached.
  8435. Default is @code{1}.
  8436. @end table
  8437. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8438. filters share the same internals).
  8439. This filter also supports the @ref{framesync} options.
  8440. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8441. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8442. @subsection Workflow examples
  8443. @subsubsection Hald CLUT video stream
  8444. Generate an identity Hald CLUT stream altered with various effects:
  8445. @example
  8446. 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
  8447. @end example
  8448. Note: make sure you use a lossless codec.
  8449. Then use it with @code{haldclut} to apply it on some random stream:
  8450. @example
  8451. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8452. @end example
  8453. The Hald CLUT will be applied to the 10 first seconds (duration of
  8454. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8455. to the remaining frames of the @code{mandelbrot} stream.
  8456. @subsubsection Hald CLUT with preview
  8457. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8458. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8459. biggest possible square starting at the top left of the picture. The remaining
  8460. padding pixels (bottom or right) will be ignored. This area can be used to add
  8461. a preview of the Hald CLUT.
  8462. Typically, the following generated Hald CLUT will be supported by the
  8463. @code{haldclut} filter:
  8464. @example
  8465. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8466. pad=iw+320 [padded_clut];
  8467. smptebars=s=320x256, split [a][b];
  8468. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8469. [main][b] overlay=W-320" -frames:v 1 clut.png
  8470. @end example
  8471. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8472. bars are displayed on the right-top, and below the same color bars processed by
  8473. the color changes.
  8474. Then, the effect of this Hald CLUT can be visualized with:
  8475. @example
  8476. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8477. @end example
  8478. @section hflip
  8479. Flip the input video horizontally.
  8480. For example, to horizontally flip the input video with @command{ffmpeg}:
  8481. @example
  8482. ffmpeg -i in.avi -vf "hflip" out.avi
  8483. @end example
  8484. @section histeq
  8485. This filter applies a global color histogram equalization on a
  8486. per-frame basis.
  8487. It can be used to correct video that has a compressed range of pixel
  8488. intensities. The filter redistributes the pixel intensities to
  8489. equalize their distribution across the intensity range. It may be
  8490. viewed as an "automatically adjusting contrast filter". This filter is
  8491. useful only for correcting degraded or poorly captured source
  8492. video.
  8493. The filter accepts the following options:
  8494. @table @option
  8495. @item strength
  8496. Determine the amount of equalization to be applied. As the strength
  8497. is reduced, the distribution of pixel intensities more-and-more
  8498. approaches that of the input frame. The value must be a float number
  8499. in the range [0,1] and defaults to 0.200.
  8500. @item intensity
  8501. Set the maximum intensity that can generated and scale the output
  8502. values appropriately. The strength should be set as desired and then
  8503. the intensity can be limited if needed to avoid washing-out. The value
  8504. must be a float number in the range [0,1] and defaults to 0.210.
  8505. @item antibanding
  8506. Set the antibanding level. If enabled the filter will randomly vary
  8507. the luminance of output pixels by a small amount to avoid banding of
  8508. the histogram. Possible values are @code{none}, @code{weak} or
  8509. @code{strong}. It defaults to @code{none}.
  8510. @end table
  8511. @section histogram
  8512. Compute and draw a color distribution histogram for the input video.
  8513. The computed histogram is a representation of the color component
  8514. distribution in an image.
  8515. Standard histogram displays the color components distribution in an image.
  8516. Displays color graph for each color component. Shows distribution of
  8517. the Y, U, V, A or R, G, B components, depending on input format, in the
  8518. current frame. Below each graph a color component scale meter is shown.
  8519. The filter accepts the following options:
  8520. @table @option
  8521. @item level_height
  8522. Set height of level. Default value is @code{200}.
  8523. Allowed range is [50, 2048].
  8524. @item scale_height
  8525. Set height of color scale. Default value is @code{12}.
  8526. Allowed range is [0, 40].
  8527. @item display_mode
  8528. Set display mode.
  8529. It accepts the following values:
  8530. @table @samp
  8531. @item stack
  8532. Per color component graphs are placed below each other.
  8533. @item parade
  8534. Per color component graphs are placed side by side.
  8535. @item overlay
  8536. Presents information identical to that in the @code{parade}, except
  8537. that the graphs representing color components are superimposed directly
  8538. over one another.
  8539. @end table
  8540. Default is @code{stack}.
  8541. @item levels_mode
  8542. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8543. Default is @code{linear}.
  8544. @item components
  8545. Set what color components to display.
  8546. Default is @code{7}.
  8547. @item fgopacity
  8548. Set foreground opacity. Default is @code{0.7}.
  8549. @item bgopacity
  8550. Set background opacity. Default is @code{0.5}.
  8551. @end table
  8552. @subsection Examples
  8553. @itemize
  8554. @item
  8555. Calculate and draw histogram:
  8556. @example
  8557. ffplay -i input -vf histogram
  8558. @end example
  8559. @end itemize
  8560. @anchor{hqdn3d}
  8561. @section hqdn3d
  8562. This is a high precision/quality 3d denoise filter. It aims to reduce
  8563. image noise, producing smooth images and making still images really
  8564. still. It should enhance compressibility.
  8565. It accepts the following optional parameters:
  8566. @table @option
  8567. @item luma_spatial
  8568. A non-negative floating point number which specifies spatial luma strength.
  8569. It defaults to 4.0.
  8570. @item chroma_spatial
  8571. A non-negative floating point number which specifies spatial chroma strength.
  8572. It defaults to 3.0*@var{luma_spatial}/4.0.
  8573. @item luma_tmp
  8574. A floating point number which specifies luma temporal strength. It defaults to
  8575. 6.0*@var{luma_spatial}/4.0.
  8576. @item chroma_tmp
  8577. A floating point number which specifies chroma temporal strength. It defaults to
  8578. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8579. @end table
  8580. @anchor{hwdownload}
  8581. @section hwdownload
  8582. Download hardware frames to system memory.
  8583. The input must be in hardware frames, and the output a non-hardware format.
  8584. Not all formats will be supported on the output - it may be necessary to insert
  8585. an additional @option{format} filter immediately following in the graph to get
  8586. the output in a supported format.
  8587. @section hwmap
  8588. Map hardware frames to system memory or to another device.
  8589. This filter has several different modes of operation; which one is used depends
  8590. on the input and output formats:
  8591. @itemize
  8592. @item
  8593. Hardware frame input, normal frame output
  8594. Map the input frames to system memory and pass them to the output. If the
  8595. original hardware frame is later required (for example, after overlaying
  8596. something else on part of it), the @option{hwmap} filter can be used again
  8597. in the next mode to retrieve it.
  8598. @item
  8599. Normal frame input, hardware frame output
  8600. If the input is actually a software-mapped hardware frame, then unmap it -
  8601. that is, return the original hardware frame.
  8602. Otherwise, a device must be provided. Create new hardware surfaces on that
  8603. device for the output, then map them back to the software format at the input
  8604. and give those frames to the preceding filter. This will then act like the
  8605. @option{hwupload} filter, but may be able to avoid an additional copy when
  8606. the input is already in a compatible format.
  8607. @item
  8608. Hardware frame input and output
  8609. A device must be supplied for the output, either directly or with the
  8610. @option{derive_device} option. The input and output devices must be of
  8611. different types and compatible - the exact meaning of this is
  8612. system-dependent, but typically it means that they must refer to the same
  8613. underlying hardware context (for example, refer to the same graphics card).
  8614. If the input frames were originally created on the output device, then unmap
  8615. to retrieve the original frames.
  8616. Otherwise, map the frames to the output device - create new hardware frames
  8617. on the output corresponding to the frames on the input.
  8618. @end itemize
  8619. The following additional parameters are accepted:
  8620. @table @option
  8621. @item mode
  8622. Set the frame mapping mode. Some combination of:
  8623. @table @var
  8624. @item read
  8625. The mapped frame should be readable.
  8626. @item write
  8627. The mapped frame should be writeable.
  8628. @item overwrite
  8629. The mapping will always overwrite the entire frame.
  8630. This may improve performance in some cases, as the original contents of the
  8631. frame need not be loaded.
  8632. @item direct
  8633. The mapping must not involve any copying.
  8634. Indirect mappings to copies of frames are created in some cases where either
  8635. direct mapping is not possible or it would have unexpected properties.
  8636. Setting this flag ensures that the mapping is direct and will fail if that is
  8637. not possible.
  8638. @end table
  8639. Defaults to @var{read+write} if not specified.
  8640. @item derive_device @var{type}
  8641. Rather than using the device supplied at initialisation, instead derive a new
  8642. device of type @var{type} from the device the input frames exist on.
  8643. @item reverse
  8644. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8645. and map them back to the source. This may be necessary in some cases where
  8646. a mapping in one direction is required but only the opposite direction is
  8647. supported by the devices being used.
  8648. This option is dangerous - it may break the preceding filter in undefined
  8649. ways if there are any additional constraints on that filter's output.
  8650. Do not use it without fully understanding the implications of its use.
  8651. @end table
  8652. @anchor{hwupload}
  8653. @section hwupload
  8654. Upload system memory frames to hardware surfaces.
  8655. The device to upload to must be supplied when the filter is initialised. If
  8656. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8657. option.
  8658. @anchor{hwupload_cuda}
  8659. @section hwupload_cuda
  8660. Upload system memory frames to a CUDA device.
  8661. It accepts the following optional parameters:
  8662. @table @option
  8663. @item device
  8664. The number of the CUDA device to use
  8665. @end table
  8666. @section hqx
  8667. Apply a high-quality magnification filter designed for pixel art. This filter
  8668. was originally created by Maxim Stepin.
  8669. It accepts the following option:
  8670. @table @option
  8671. @item n
  8672. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8673. @code{hq3x} and @code{4} for @code{hq4x}.
  8674. Default is @code{3}.
  8675. @end table
  8676. @section hstack
  8677. Stack input videos horizontally.
  8678. All streams must be of same pixel format and of same height.
  8679. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8680. to create same output.
  8681. The filter accept the following option:
  8682. @table @option
  8683. @item inputs
  8684. Set number of input streams. Default is 2.
  8685. @item shortest
  8686. If set to 1, force the output to terminate when the shortest input
  8687. terminates. Default value is 0.
  8688. @end table
  8689. @section hue
  8690. Modify the hue and/or the saturation of the input.
  8691. It accepts the following parameters:
  8692. @table @option
  8693. @item h
  8694. Specify the hue angle as a number of degrees. It accepts an expression,
  8695. and defaults to "0".
  8696. @item s
  8697. Specify the saturation in the [-10,10] range. It accepts an expression and
  8698. defaults to "1".
  8699. @item H
  8700. Specify the hue angle as a number of radians. It accepts an
  8701. expression, and defaults to "0".
  8702. @item b
  8703. Specify the brightness in the [-10,10] range. It accepts an expression and
  8704. defaults to "0".
  8705. @end table
  8706. @option{h} and @option{H} are mutually exclusive, and can't be
  8707. specified at the same time.
  8708. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8709. expressions containing the following constants:
  8710. @table @option
  8711. @item n
  8712. frame count of the input frame starting from 0
  8713. @item pts
  8714. presentation timestamp of the input frame expressed in time base units
  8715. @item r
  8716. frame rate of the input video, NAN if the input frame rate is unknown
  8717. @item t
  8718. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8719. @item tb
  8720. time base of the input video
  8721. @end table
  8722. @subsection Examples
  8723. @itemize
  8724. @item
  8725. Set the hue to 90 degrees and the saturation to 1.0:
  8726. @example
  8727. hue=h=90:s=1
  8728. @end example
  8729. @item
  8730. Same command but expressing the hue in radians:
  8731. @example
  8732. hue=H=PI/2:s=1
  8733. @end example
  8734. @item
  8735. Rotate hue and make the saturation swing between 0
  8736. and 2 over a period of 1 second:
  8737. @example
  8738. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8739. @end example
  8740. @item
  8741. Apply a 3 seconds saturation fade-in effect starting at 0:
  8742. @example
  8743. hue="s=min(t/3\,1)"
  8744. @end example
  8745. The general fade-in expression can be written as:
  8746. @example
  8747. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8748. @end example
  8749. @item
  8750. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8751. @example
  8752. hue="s=max(0\, min(1\, (8-t)/3))"
  8753. @end example
  8754. The general fade-out expression can be written as:
  8755. @example
  8756. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8757. @end example
  8758. @end itemize
  8759. @subsection Commands
  8760. This filter supports the following commands:
  8761. @table @option
  8762. @item b
  8763. @item s
  8764. @item h
  8765. @item H
  8766. Modify the hue and/or the saturation and/or brightness of the input video.
  8767. The command accepts the same syntax of the corresponding option.
  8768. If the specified expression is not valid, it is kept at its current
  8769. value.
  8770. @end table
  8771. @section hysteresis
  8772. Grow first stream into second stream by connecting components.
  8773. This makes it possible to build more robust edge masks.
  8774. This filter accepts the following options:
  8775. @table @option
  8776. @item planes
  8777. Set which planes will be processed as bitmap, unprocessed planes will be
  8778. copied from first stream.
  8779. By default value 0xf, all planes will be processed.
  8780. @item threshold
  8781. Set threshold which is used in filtering. If pixel component value is higher than
  8782. this value filter algorithm for connecting components is activated.
  8783. By default value is 0.
  8784. @end table
  8785. @section idet
  8786. Detect video interlacing type.
  8787. This filter tries to detect if the input frames are interlaced, progressive,
  8788. top or bottom field first. It will also try to detect fields that are
  8789. repeated between adjacent frames (a sign of telecine).
  8790. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8791. Multiple frame detection incorporates the classification history of previous frames.
  8792. The filter will log these metadata values:
  8793. @table @option
  8794. @item single.current_frame
  8795. Detected type of current frame using single-frame detection. One of:
  8796. ``tff'' (top field first), ``bff'' (bottom field first),
  8797. ``progressive'', or ``undetermined''
  8798. @item single.tff
  8799. Cumulative number of frames detected as top field first using single-frame detection.
  8800. @item multiple.tff
  8801. Cumulative number of frames detected as top field first using multiple-frame detection.
  8802. @item single.bff
  8803. Cumulative number of frames detected as bottom field first using single-frame detection.
  8804. @item multiple.current_frame
  8805. Detected type of current frame using multiple-frame detection. One of:
  8806. ``tff'' (top field first), ``bff'' (bottom field first),
  8807. ``progressive'', or ``undetermined''
  8808. @item multiple.bff
  8809. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8810. @item single.progressive
  8811. Cumulative number of frames detected as progressive using single-frame detection.
  8812. @item multiple.progressive
  8813. Cumulative number of frames detected as progressive using multiple-frame detection.
  8814. @item single.undetermined
  8815. Cumulative number of frames that could not be classified using single-frame detection.
  8816. @item multiple.undetermined
  8817. Cumulative number of frames that could not be classified using multiple-frame detection.
  8818. @item repeated.current_frame
  8819. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8820. @item repeated.neither
  8821. Cumulative number of frames with no repeated field.
  8822. @item repeated.top
  8823. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8824. @item repeated.bottom
  8825. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8826. @end table
  8827. The filter accepts the following options:
  8828. @table @option
  8829. @item intl_thres
  8830. Set interlacing threshold.
  8831. @item prog_thres
  8832. Set progressive threshold.
  8833. @item rep_thres
  8834. Threshold for repeated field detection.
  8835. @item half_life
  8836. Number of frames after which a given frame's contribution to the
  8837. statistics is halved (i.e., it contributes only 0.5 to its
  8838. classification). The default of 0 means that all frames seen are given
  8839. full weight of 1.0 forever.
  8840. @item analyze_interlaced_flag
  8841. When this is not 0 then idet will use the specified number of frames to determine
  8842. if the interlaced flag is accurate, it will not count undetermined frames.
  8843. If the flag is found to be accurate it will be used without any further
  8844. computations, if it is found to be inaccurate it will be cleared without any
  8845. further computations. This allows inserting the idet filter as a low computational
  8846. method to clean up the interlaced flag
  8847. @end table
  8848. @section il
  8849. Deinterleave or interleave fields.
  8850. This filter allows one to process interlaced images fields without
  8851. deinterlacing them. Deinterleaving splits the input frame into 2
  8852. fields (so called half pictures). Odd lines are moved to the top
  8853. half of the output image, even lines to the bottom half.
  8854. You can process (filter) them independently and then re-interleave them.
  8855. The filter accepts the following options:
  8856. @table @option
  8857. @item luma_mode, l
  8858. @item chroma_mode, c
  8859. @item alpha_mode, a
  8860. Available values for @var{luma_mode}, @var{chroma_mode} and
  8861. @var{alpha_mode} are:
  8862. @table @samp
  8863. @item none
  8864. Do nothing.
  8865. @item deinterleave, d
  8866. Deinterleave fields, placing one above the other.
  8867. @item interleave, i
  8868. Interleave fields. Reverse the effect of deinterleaving.
  8869. @end table
  8870. Default value is @code{none}.
  8871. @item luma_swap, ls
  8872. @item chroma_swap, cs
  8873. @item alpha_swap, as
  8874. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8875. @end table
  8876. @section inflate
  8877. Apply inflate effect to the video.
  8878. This filter replaces the pixel by the local(3x3) average by taking into account
  8879. only values higher than the pixel.
  8880. It accepts the following options:
  8881. @table @option
  8882. @item threshold0
  8883. @item threshold1
  8884. @item threshold2
  8885. @item threshold3
  8886. Limit the maximum change for each plane, default is 65535.
  8887. If 0, plane will remain unchanged.
  8888. @end table
  8889. @section interlace
  8890. Simple interlacing filter from progressive contents. This interleaves upper (or
  8891. lower) lines from odd frames with lower (or upper) lines from even frames,
  8892. halving the frame rate and preserving image height.
  8893. @example
  8894. Original Original New Frame
  8895. Frame 'j' Frame 'j+1' (tff)
  8896. ========== =========== ==================
  8897. Line 0 --------------------> Frame 'j' Line 0
  8898. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8899. Line 2 ---------------------> Frame 'j' Line 2
  8900. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8901. ... ... ...
  8902. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8903. @end example
  8904. It accepts the following optional parameters:
  8905. @table @option
  8906. @item scan
  8907. This determines whether the interlaced frame is taken from the even
  8908. (tff - default) or odd (bff) lines of the progressive frame.
  8909. @item lowpass
  8910. Vertical lowpass filter to avoid twitter interlacing and
  8911. reduce moire patterns.
  8912. @table @samp
  8913. @item 0, off
  8914. Disable vertical lowpass filter
  8915. @item 1, linear
  8916. Enable linear filter (default)
  8917. @item 2, complex
  8918. Enable complex filter. This will slightly less reduce twitter and moire
  8919. but better retain detail and subjective sharpness impression.
  8920. @end table
  8921. @end table
  8922. @section kerndeint
  8923. Deinterlace input video by applying Donald Graft's adaptive kernel
  8924. deinterling. Work on interlaced parts of a video to produce
  8925. progressive frames.
  8926. The description of the accepted parameters follows.
  8927. @table @option
  8928. @item thresh
  8929. Set the threshold which affects the filter's tolerance when
  8930. determining if a pixel line must be processed. It must be an integer
  8931. in the range [0,255] and defaults to 10. A value of 0 will result in
  8932. applying the process on every pixels.
  8933. @item map
  8934. Paint pixels exceeding the threshold value to white if set to 1.
  8935. Default is 0.
  8936. @item order
  8937. Set the fields order. Swap fields if set to 1, leave fields alone if
  8938. 0. Default is 0.
  8939. @item sharp
  8940. Enable additional sharpening if set to 1. Default is 0.
  8941. @item twoway
  8942. Enable twoway sharpening if set to 1. Default is 0.
  8943. @end table
  8944. @subsection Examples
  8945. @itemize
  8946. @item
  8947. Apply default values:
  8948. @example
  8949. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8950. @end example
  8951. @item
  8952. Enable additional sharpening:
  8953. @example
  8954. kerndeint=sharp=1
  8955. @end example
  8956. @item
  8957. Paint processed pixels in white:
  8958. @example
  8959. kerndeint=map=1
  8960. @end example
  8961. @end itemize
  8962. @section lagfun
  8963. Slowly update darker pixels.
  8964. This filter makes short flashes of light appear longer.
  8965. This filter accepts the following options:
  8966. @table @option
  8967. @item decay
  8968. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  8969. @item planes
  8970. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  8971. @end table
  8972. @section lenscorrection
  8973. Correct radial lens distortion
  8974. This filter can be used to correct for radial distortion as can result from the use
  8975. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8976. one can use tools available for example as part of opencv or simply trial-and-error.
  8977. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8978. and extract the k1 and k2 coefficients from the resulting matrix.
  8979. Note that effectively the same filter is available in the open-source tools Krita and
  8980. Digikam from the KDE project.
  8981. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8982. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8983. brightness distribution, so you may want to use both filters together in certain
  8984. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8985. be applied before or after lens correction.
  8986. @subsection Options
  8987. The filter accepts the following options:
  8988. @table @option
  8989. @item cx
  8990. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8991. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8992. width. Default is 0.5.
  8993. @item cy
  8994. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8995. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8996. height. Default is 0.5.
  8997. @item k1
  8998. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8999. no correction. Default is 0.
  9000. @item k2
  9001. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9002. 0 means no correction. Default is 0.
  9003. @end table
  9004. The formula that generates the correction is:
  9005. @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)
  9006. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9007. distances from the focal point in the source and target images, respectively.
  9008. @section lensfun
  9009. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9010. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9011. to apply the lens correction. The filter will load the lensfun database and
  9012. query it to find the corresponding camera and lens entries in the database. As
  9013. long as these entries can be found with the given options, the filter can
  9014. perform corrections on frames. Note that incomplete strings will result in the
  9015. filter choosing the best match with the given options, and the filter will
  9016. output the chosen camera and lens models (logged with level "info"). You must
  9017. provide the make, camera model, and lens model as they are required.
  9018. The filter accepts the following options:
  9019. @table @option
  9020. @item make
  9021. The make of the camera (for example, "Canon"). This option is required.
  9022. @item model
  9023. The model of the camera (for example, "Canon EOS 100D"). This option is
  9024. required.
  9025. @item lens_model
  9026. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9027. option is required.
  9028. @item mode
  9029. The type of correction to apply. The following values are valid options:
  9030. @table @samp
  9031. @item vignetting
  9032. Enables fixing lens vignetting.
  9033. @item geometry
  9034. Enables fixing lens geometry. This is the default.
  9035. @item subpixel
  9036. Enables fixing chromatic aberrations.
  9037. @item vig_geo
  9038. Enables fixing lens vignetting and lens geometry.
  9039. @item vig_subpixel
  9040. Enables fixing lens vignetting and chromatic aberrations.
  9041. @item distortion
  9042. Enables fixing both lens geometry and chromatic aberrations.
  9043. @item all
  9044. Enables all possible corrections.
  9045. @end table
  9046. @item focal_length
  9047. The focal length of the image/video (zoom; expected constant for video). For
  9048. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9049. range should be chosen when using that lens. Default 18.
  9050. @item aperture
  9051. The aperture of the image/video (expected constant for video). Note that
  9052. aperture is only used for vignetting correction. Default 3.5.
  9053. @item focus_distance
  9054. The focus distance of the image/video (expected constant for video). Note that
  9055. focus distance is only used for vignetting and only slightly affects the
  9056. vignetting correction process. If unknown, leave it at the default value (which
  9057. is 1000).
  9058. @item scale
  9059. The scale factor which is applied after transformation. After correction the
  9060. video is no longer necessarily rectangular. This parameter controls how much of
  9061. the resulting image is visible. The value 0 means that a value will be chosen
  9062. automatically such that there is little or no unmapped area in the output
  9063. image. 1.0 means that no additional scaling is done. Lower values may result
  9064. in more of the corrected image being visible, while higher values may avoid
  9065. unmapped areas in the output.
  9066. @item target_geometry
  9067. The target geometry of the output image/video. The following values are valid
  9068. options:
  9069. @table @samp
  9070. @item rectilinear (default)
  9071. @item fisheye
  9072. @item panoramic
  9073. @item equirectangular
  9074. @item fisheye_orthographic
  9075. @item fisheye_stereographic
  9076. @item fisheye_equisolid
  9077. @item fisheye_thoby
  9078. @end table
  9079. @item reverse
  9080. Apply the reverse of image correction (instead of correcting distortion, apply
  9081. it).
  9082. @item interpolation
  9083. The type of interpolation used when correcting distortion. The following values
  9084. are valid options:
  9085. @table @samp
  9086. @item nearest
  9087. @item linear (default)
  9088. @item lanczos
  9089. @end table
  9090. @end table
  9091. @subsection Examples
  9092. @itemize
  9093. @item
  9094. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9095. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9096. aperture of "8.0".
  9097. @example
  9098. 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
  9099. @end example
  9100. @item
  9101. Apply the same as before, but only for the first 5 seconds of video.
  9102. @example
  9103. 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
  9104. @end example
  9105. @end itemize
  9106. @section libvmaf
  9107. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9108. score between two input videos.
  9109. The obtained VMAF score is printed through the logging system.
  9110. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9111. After installing the library it can be enabled using:
  9112. @code{./configure --enable-libvmaf --enable-version3}.
  9113. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9114. The filter has following options:
  9115. @table @option
  9116. @item model_path
  9117. Set the model path which is to be used for SVM.
  9118. Default value: @code{"vmaf_v0.6.1.pkl"}
  9119. @item log_path
  9120. Set the file path to be used to store logs.
  9121. @item log_fmt
  9122. Set the format of the log file (xml or json).
  9123. @item enable_transform
  9124. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9125. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9126. Default value: @code{false}
  9127. @item phone_model
  9128. Invokes the phone model which will generate VMAF scores higher than in the
  9129. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9130. @item psnr
  9131. Enables computing psnr along with vmaf.
  9132. @item ssim
  9133. Enables computing ssim along with vmaf.
  9134. @item ms_ssim
  9135. Enables computing ms_ssim along with vmaf.
  9136. @item pool
  9137. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  9138. @item n_threads
  9139. Set number of threads to be used when computing vmaf.
  9140. @item n_subsample
  9141. Set interval for frame subsampling used when computing vmaf.
  9142. @item enable_conf_interval
  9143. Enables confidence interval.
  9144. @end table
  9145. This filter also supports the @ref{framesync} options.
  9146. On the below examples the input file @file{main.mpg} being processed is
  9147. compared with the reference file @file{ref.mpg}.
  9148. @example
  9149. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9150. @end example
  9151. Example with options:
  9152. @example
  9153. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9154. @end example
  9155. @section limiter
  9156. Limits the pixel components values to the specified range [min, max].
  9157. The filter accepts the following options:
  9158. @table @option
  9159. @item min
  9160. Lower bound. Defaults to the lowest allowed value for the input.
  9161. @item max
  9162. Upper bound. Defaults to the highest allowed value for the input.
  9163. @item planes
  9164. Specify which planes will be processed. Defaults to all available.
  9165. @end table
  9166. @section loop
  9167. Loop video frames.
  9168. The filter accepts the following options:
  9169. @table @option
  9170. @item loop
  9171. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9172. Default is 0.
  9173. @item size
  9174. Set maximal size in number of frames. Default is 0.
  9175. @item start
  9176. Set first frame of loop. Default is 0.
  9177. @end table
  9178. @subsection Examples
  9179. @itemize
  9180. @item
  9181. Loop single first frame infinitely:
  9182. @example
  9183. loop=loop=-1:size=1:start=0
  9184. @end example
  9185. @item
  9186. Loop single first frame 10 times:
  9187. @example
  9188. loop=loop=10:size=1:start=0
  9189. @end example
  9190. @item
  9191. Loop 10 first frames 5 times:
  9192. @example
  9193. loop=loop=5:size=10:start=0
  9194. @end example
  9195. @end itemize
  9196. @section lut1d
  9197. Apply a 1D LUT to an input video.
  9198. The filter accepts the following options:
  9199. @table @option
  9200. @item file
  9201. Set the 1D LUT file name.
  9202. Currently supported formats:
  9203. @table @samp
  9204. @item cube
  9205. Iridas
  9206. @item csp
  9207. cineSpace
  9208. @end table
  9209. @item interp
  9210. Select interpolation mode.
  9211. Available values are:
  9212. @table @samp
  9213. @item nearest
  9214. Use values from the nearest defined point.
  9215. @item linear
  9216. Interpolate values using the linear interpolation.
  9217. @item cosine
  9218. Interpolate values using the cosine interpolation.
  9219. @item cubic
  9220. Interpolate values using the cubic interpolation.
  9221. @item spline
  9222. Interpolate values using the spline interpolation.
  9223. @end table
  9224. @end table
  9225. @anchor{lut3d}
  9226. @section lut3d
  9227. Apply a 3D LUT to an input video.
  9228. The filter accepts the following options:
  9229. @table @option
  9230. @item file
  9231. Set the 3D LUT file name.
  9232. Currently supported formats:
  9233. @table @samp
  9234. @item 3dl
  9235. AfterEffects
  9236. @item cube
  9237. Iridas
  9238. @item dat
  9239. DaVinci
  9240. @item m3d
  9241. Pandora
  9242. @item csp
  9243. cineSpace
  9244. @end table
  9245. @item interp
  9246. Select interpolation mode.
  9247. Available values are:
  9248. @table @samp
  9249. @item nearest
  9250. Use values from the nearest defined point.
  9251. @item trilinear
  9252. Interpolate values using the 8 points defining a cube.
  9253. @item tetrahedral
  9254. Interpolate values using a tetrahedron.
  9255. @end table
  9256. @end table
  9257. @section lumakey
  9258. Turn certain luma values into transparency.
  9259. The filter accepts the following options:
  9260. @table @option
  9261. @item threshold
  9262. Set the luma which will be used as base for transparency.
  9263. Default value is @code{0}.
  9264. @item tolerance
  9265. Set the range of luma values to be keyed out.
  9266. Default value is @code{0}.
  9267. @item softness
  9268. Set the range of softness. Default value is @code{0}.
  9269. Use this to control gradual transition from zero to full transparency.
  9270. @end table
  9271. @section lut, lutrgb, lutyuv
  9272. Compute a look-up table for binding each pixel component input value
  9273. to an output value, and apply it to the input video.
  9274. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9275. to an RGB input video.
  9276. These filters accept the following parameters:
  9277. @table @option
  9278. @item c0
  9279. set first pixel component expression
  9280. @item c1
  9281. set second pixel component expression
  9282. @item c2
  9283. set third pixel component expression
  9284. @item c3
  9285. set fourth pixel component expression, corresponds to the alpha component
  9286. @item r
  9287. set red component expression
  9288. @item g
  9289. set green component expression
  9290. @item b
  9291. set blue component expression
  9292. @item a
  9293. alpha component expression
  9294. @item y
  9295. set Y/luminance component expression
  9296. @item u
  9297. set U/Cb component expression
  9298. @item v
  9299. set V/Cr component expression
  9300. @end table
  9301. Each of them specifies the expression to use for computing the lookup table for
  9302. the corresponding pixel component values.
  9303. The exact component associated to each of the @var{c*} options depends on the
  9304. format in input.
  9305. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9306. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9307. The expressions can contain the following constants and functions:
  9308. @table @option
  9309. @item w
  9310. @item h
  9311. The input width and height.
  9312. @item val
  9313. The input value for the pixel component.
  9314. @item clipval
  9315. The input value, clipped to the @var{minval}-@var{maxval} range.
  9316. @item maxval
  9317. The maximum value for the pixel component.
  9318. @item minval
  9319. The minimum value for the pixel component.
  9320. @item negval
  9321. The negated value for the pixel component value, clipped to the
  9322. @var{minval}-@var{maxval} range; it corresponds to the expression
  9323. "maxval-clipval+minval".
  9324. @item clip(val)
  9325. The computed value in @var{val}, clipped to the
  9326. @var{minval}-@var{maxval} range.
  9327. @item gammaval(gamma)
  9328. The computed gamma correction value of the pixel component value,
  9329. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9330. expression
  9331. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9332. @end table
  9333. All expressions default to "val".
  9334. @subsection Examples
  9335. @itemize
  9336. @item
  9337. Negate input video:
  9338. @example
  9339. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9340. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9341. @end example
  9342. The above is the same as:
  9343. @example
  9344. lutrgb="r=negval:g=negval:b=negval"
  9345. lutyuv="y=negval:u=negval:v=negval"
  9346. @end example
  9347. @item
  9348. Negate luminance:
  9349. @example
  9350. lutyuv=y=negval
  9351. @end example
  9352. @item
  9353. Remove chroma components, turning the video into a graytone image:
  9354. @example
  9355. lutyuv="u=128:v=128"
  9356. @end example
  9357. @item
  9358. Apply a luma burning effect:
  9359. @example
  9360. lutyuv="y=2*val"
  9361. @end example
  9362. @item
  9363. Remove green and blue components:
  9364. @example
  9365. lutrgb="g=0:b=0"
  9366. @end example
  9367. @item
  9368. Set a constant alpha channel value on input:
  9369. @example
  9370. format=rgba,lutrgb=a="maxval-minval/2"
  9371. @end example
  9372. @item
  9373. Correct luminance gamma by a factor of 0.5:
  9374. @example
  9375. lutyuv=y=gammaval(0.5)
  9376. @end example
  9377. @item
  9378. Discard least significant bits of luma:
  9379. @example
  9380. lutyuv=y='bitand(val, 128+64+32)'
  9381. @end example
  9382. @item
  9383. Technicolor like effect:
  9384. @example
  9385. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9386. @end example
  9387. @end itemize
  9388. @section lut2, tlut2
  9389. The @code{lut2} filter takes two input streams and outputs one
  9390. stream.
  9391. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9392. from one single stream.
  9393. This filter accepts the following parameters:
  9394. @table @option
  9395. @item c0
  9396. set first pixel component expression
  9397. @item c1
  9398. set second pixel component expression
  9399. @item c2
  9400. set third pixel component expression
  9401. @item c3
  9402. set fourth pixel component expression, corresponds to the alpha component
  9403. @item d
  9404. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9405. which means bit depth is automatically picked from first input format.
  9406. @end table
  9407. Each of them specifies the expression to use for computing the lookup table for
  9408. the corresponding pixel component values.
  9409. The exact component associated to each of the @var{c*} options depends on the
  9410. format in inputs.
  9411. The expressions can contain the following constants:
  9412. @table @option
  9413. @item w
  9414. @item h
  9415. The input width and height.
  9416. @item x
  9417. The first input value for the pixel component.
  9418. @item y
  9419. The second input value for the pixel component.
  9420. @item bdx
  9421. The first input video bit depth.
  9422. @item bdy
  9423. The second input video bit depth.
  9424. @end table
  9425. All expressions default to "x".
  9426. @subsection Examples
  9427. @itemize
  9428. @item
  9429. Highlight differences between two RGB video streams:
  9430. @example
  9431. 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)'
  9432. @end example
  9433. @item
  9434. Highlight differences between two YUV video streams:
  9435. @example
  9436. 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)'
  9437. @end example
  9438. @item
  9439. Show max difference between two video streams:
  9440. @example
  9441. 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)))'
  9442. @end example
  9443. @end itemize
  9444. @section maskedclamp
  9445. Clamp the first input stream with the second input and third input stream.
  9446. Returns the value of first stream to be between second input
  9447. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9448. This filter accepts the following options:
  9449. @table @option
  9450. @item undershoot
  9451. Default value is @code{0}.
  9452. @item overshoot
  9453. Default value is @code{0}.
  9454. @item planes
  9455. Set which planes will be processed as bitmap, unprocessed planes will be
  9456. copied from first stream.
  9457. By default value 0xf, all planes will be processed.
  9458. @end table
  9459. @section maskedmerge
  9460. Merge the first input stream with the second input stream using per pixel
  9461. weights in the third input stream.
  9462. A value of 0 in the third stream pixel component means that pixel component
  9463. from first stream is returned unchanged, while maximum value (eg. 255 for
  9464. 8-bit videos) means that pixel component from second stream is returned
  9465. unchanged. Intermediate values define the amount of merging between both
  9466. input stream's pixel components.
  9467. This filter accepts the following options:
  9468. @table @option
  9469. @item planes
  9470. Set which planes will be processed as bitmap, unprocessed planes will be
  9471. copied from first stream.
  9472. By default value 0xf, all planes will be processed.
  9473. @end table
  9474. @section maskfun
  9475. Create mask from input video.
  9476. For example it is useful to create motion masks after @code{tblend} filter.
  9477. This filter accepts the following options:
  9478. @table @option
  9479. @item low
  9480. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9481. @item high
  9482. Set high threshold. Any pixel component higher than this value will be set to max value
  9483. allowed for current pixel format.
  9484. @item planes
  9485. Set planes to filter, by default all available planes are filtered.
  9486. @item fill
  9487. Fill all frame pixels with this value.
  9488. @item sum
  9489. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9490. average, output frame will be completely filled with value set by @var{fill} option.
  9491. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9492. @end table
  9493. @section mcdeint
  9494. Apply motion-compensation deinterlacing.
  9495. It needs one field per frame as input and must thus be used together
  9496. with yadif=1/3 or equivalent.
  9497. This filter accepts the following options:
  9498. @table @option
  9499. @item mode
  9500. Set the deinterlacing mode.
  9501. It accepts one of the following values:
  9502. @table @samp
  9503. @item fast
  9504. @item medium
  9505. @item slow
  9506. use iterative motion estimation
  9507. @item extra_slow
  9508. like @samp{slow}, but use multiple reference frames.
  9509. @end table
  9510. Default value is @samp{fast}.
  9511. @item parity
  9512. Set the picture field parity assumed for the input video. It must be
  9513. one of the following values:
  9514. @table @samp
  9515. @item 0, tff
  9516. assume top field first
  9517. @item 1, bff
  9518. assume bottom field first
  9519. @end table
  9520. Default value is @samp{bff}.
  9521. @item qp
  9522. Set per-block quantization parameter (QP) used by the internal
  9523. encoder.
  9524. Higher values should result in a smoother motion vector field but less
  9525. optimal individual vectors. Default value is 1.
  9526. @end table
  9527. @section mergeplanes
  9528. Merge color channel components from several video streams.
  9529. The filter accepts up to 4 input streams, and merge selected input
  9530. planes to the output video.
  9531. This filter accepts the following options:
  9532. @table @option
  9533. @item mapping
  9534. Set input to output plane mapping. Default is @code{0}.
  9535. The mappings is specified as a bitmap. It should be specified as a
  9536. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9537. mapping for the first plane of the output stream. 'A' sets the number of
  9538. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9539. corresponding input to use (from 0 to 3). The rest of the mappings is
  9540. similar, 'Bb' describes the mapping for the output stream second
  9541. plane, 'Cc' describes the mapping for the output stream third plane and
  9542. 'Dd' describes the mapping for the output stream fourth plane.
  9543. @item format
  9544. Set output pixel format. Default is @code{yuva444p}.
  9545. @end table
  9546. @subsection Examples
  9547. @itemize
  9548. @item
  9549. Merge three gray video streams of same width and height into single video stream:
  9550. @example
  9551. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9552. @end example
  9553. @item
  9554. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9555. @example
  9556. [a0][a1]mergeplanes=0x00010210:yuva444p
  9557. @end example
  9558. @item
  9559. Swap Y and A plane in yuva444p stream:
  9560. @example
  9561. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9562. @end example
  9563. @item
  9564. Swap U and V plane in yuv420p stream:
  9565. @example
  9566. format=yuv420p,mergeplanes=0x000201:yuv420p
  9567. @end example
  9568. @item
  9569. Cast a rgb24 clip to yuv444p:
  9570. @example
  9571. format=rgb24,mergeplanes=0x000102:yuv444p
  9572. @end example
  9573. @end itemize
  9574. @section mestimate
  9575. Estimate and export motion vectors using block matching algorithms.
  9576. Motion vectors are stored in frame side data to be used by other filters.
  9577. This filter accepts the following options:
  9578. @table @option
  9579. @item method
  9580. Specify the motion estimation method. Accepts one of the following values:
  9581. @table @samp
  9582. @item esa
  9583. Exhaustive search algorithm.
  9584. @item tss
  9585. Three step search algorithm.
  9586. @item tdls
  9587. Two dimensional logarithmic search algorithm.
  9588. @item ntss
  9589. New three step search algorithm.
  9590. @item fss
  9591. Four step search algorithm.
  9592. @item ds
  9593. Diamond search algorithm.
  9594. @item hexbs
  9595. Hexagon-based search algorithm.
  9596. @item epzs
  9597. Enhanced predictive zonal search algorithm.
  9598. @item umh
  9599. Uneven multi-hexagon search algorithm.
  9600. @end table
  9601. Default value is @samp{esa}.
  9602. @item mb_size
  9603. Macroblock size. Default @code{16}.
  9604. @item search_param
  9605. Search parameter. Default @code{7}.
  9606. @end table
  9607. @section midequalizer
  9608. Apply Midway Image Equalization effect using two video streams.
  9609. Midway Image Equalization adjusts a pair of images to have the same
  9610. histogram, while maintaining their dynamics as much as possible. It's
  9611. useful for e.g. matching exposures from a pair of stereo cameras.
  9612. This filter has two inputs and one output, which must be of same pixel format, but
  9613. may be of different sizes. The output of filter is first input adjusted with
  9614. midway histogram of both inputs.
  9615. This filter accepts the following option:
  9616. @table @option
  9617. @item planes
  9618. Set which planes to process. Default is @code{15}, which is all available planes.
  9619. @end table
  9620. @section minterpolate
  9621. Convert the video to specified frame rate using motion interpolation.
  9622. This filter accepts the following options:
  9623. @table @option
  9624. @item fps
  9625. 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}.
  9626. @item mi_mode
  9627. Motion interpolation mode. Following values are accepted:
  9628. @table @samp
  9629. @item dup
  9630. Duplicate previous or next frame for interpolating new ones.
  9631. @item blend
  9632. Blend source frames. Interpolated frame is mean of previous and next frames.
  9633. @item mci
  9634. Motion compensated interpolation. Following options are effective when this mode is selected:
  9635. @table @samp
  9636. @item mc_mode
  9637. Motion compensation mode. Following values are accepted:
  9638. @table @samp
  9639. @item obmc
  9640. Overlapped block motion compensation.
  9641. @item aobmc
  9642. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9643. @end table
  9644. Default mode is @samp{obmc}.
  9645. @item me_mode
  9646. Motion estimation mode. Following values are accepted:
  9647. @table @samp
  9648. @item bidir
  9649. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9650. @item bilat
  9651. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9652. @end table
  9653. Default mode is @samp{bilat}.
  9654. @item me
  9655. The algorithm to be used for motion estimation. Following values are accepted:
  9656. @table @samp
  9657. @item esa
  9658. Exhaustive search algorithm.
  9659. @item tss
  9660. Three step search algorithm.
  9661. @item tdls
  9662. Two dimensional logarithmic search algorithm.
  9663. @item ntss
  9664. New three step search algorithm.
  9665. @item fss
  9666. Four step search algorithm.
  9667. @item ds
  9668. Diamond search algorithm.
  9669. @item hexbs
  9670. Hexagon-based search algorithm.
  9671. @item epzs
  9672. Enhanced predictive zonal search algorithm.
  9673. @item umh
  9674. Uneven multi-hexagon search algorithm.
  9675. @end table
  9676. Default algorithm is @samp{epzs}.
  9677. @item mb_size
  9678. Macroblock size. Default @code{16}.
  9679. @item search_param
  9680. Motion estimation search parameter. Default @code{32}.
  9681. @item vsbmc
  9682. 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).
  9683. @end table
  9684. @end table
  9685. @item scd
  9686. 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:
  9687. @table @samp
  9688. @item none
  9689. Disable scene change detection.
  9690. @item fdiff
  9691. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9692. @end table
  9693. Default method is @samp{fdiff}.
  9694. @item scd_threshold
  9695. Scene change detection threshold. Default is @code{5.0}.
  9696. @end table
  9697. @section mix
  9698. Mix several video input streams into one video stream.
  9699. A description of the accepted options follows.
  9700. @table @option
  9701. @item nb_inputs
  9702. The number of inputs. If unspecified, it defaults to 2.
  9703. @item weights
  9704. Specify weight of each input video stream as sequence.
  9705. Each weight is separated by space. If number of weights
  9706. is smaller than number of @var{frames} last specified
  9707. weight will be used for all remaining unset weights.
  9708. @item scale
  9709. Specify scale, if it is set it will be multiplied with sum
  9710. of each weight multiplied with pixel values to give final destination
  9711. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9712. @item duration
  9713. Specify how end of stream is determined.
  9714. @table @samp
  9715. @item longest
  9716. The duration of the longest input. (default)
  9717. @item shortest
  9718. The duration of the shortest input.
  9719. @item first
  9720. The duration of the first input.
  9721. @end table
  9722. @end table
  9723. @section mpdecimate
  9724. Drop frames that do not differ greatly from the previous frame in
  9725. order to reduce frame rate.
  9726. The main use of this filter is for very-low-bitrate encoding
  9727. (e.g. streaming over dialup modem), but it could in theory be used for
  9728. fixing movies that were inverse-telecined incorrectly.
  9729. A description of the accepted options follows.
  9730. @table @option
  9731. @item max
  9732. Set the maximum number of consecutive frames which can be dropped (if
  9733. positive), or the minimum interval between dropped frames (if
  9734. negative). If the value is 0, the frame is dropped disregarding the
  9735. number of previous sequentially dropped frames.
  9736. Default value is 0.
  9737. @item hi
  9738. @item lo
  9739. @item frac
  9740. Set the dropping threshold values.
  9741. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9742. represent actual pixel value differences, so a threshold of 64
  9743. corresponds to 1 unit of difference for each pixel, or the same spread
  9744. out differently over the block.
  9745. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9746. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9747. meaning the whole image) differ by more than a threshold of @option{lo}.
  9748. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9749. 64*5, and default value for @option{frac} is 0.33.
  9750. @end table
  9751. @section negate
  9752. Negate (invert) the input video.
  9753. It accepts the following option:
  9754. @table @option
  9755. @item negate_alpha
  9756. With value 1, it negates the alpha component, if present. Default value is 0.
  9757. @end table
  9758. @anchor{nlmeans}
  9759. @section nlmeans
  9760. Denoise frames using Non-Local Means algorithm.
  9761. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9762. context similarity is defined by comparing their surrounding patches of size
  9763. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9764. around the pixel.
  9765. Note that the research area defines centers for patches, which means some
  9766. patches will be made of pixels outside that research area.
  9767. The filter accepts the following options.
  9768. @table @option
  9769. @item s
  9770. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9771. @item p
  9772. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9773. @item pc
  9774. Same as @option{p} but for chroma planes.
  9775. The default value is @var{0} and means automatic.
  9776. @item r
  9777. Set research size. Default is 15. Must be odd number in range [0, 99].
  9778. @item rc
  9779. Same as @option{r} but for chroma planes.
  9780. The default value is @var{0} and means automatic.
  9781. @end table
  9782. @section nnedi
  9783. Deinterlace video using neural network edge directed interpolation.
  9784. This filter accepts the following options:
  9785. @table @option
  9786. @item weights
  9787. Mandatory option, without binary file filter can not work.
  9788. Currently file can be found here:
  9789. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9790. @item deint
  9791. Set which frames to deinterlace, by default it is @code{all}.
  9792. Can be @code{all} or @code{interlaced}.
  9793. @item field
  9794. Set mode of operation.
  9795. Can be one of the following:
  9796. @table @samp
  9797. @item af
  9798. Use frame flags, both fields.
  9799. @item a
  9800. Use frame flags, single field.
  9801. @item t
  9802. Use top field only.
  9803. @item b
  9804. Use bottom field only.
  9805. @item tf
  9806. Use both fields, top first.
  9807. @item bf
  9808. Use both fields, bottom first.
  9809. @end table
  9810. @item planes
  9811. Set which planes to process, by default filter process all frames.
  9812. @item nsize
  9813. Set size of local neighborhood around each pixel, used by the predictor neural
  9814. network.
  9815. Can be one of the following:
  9816. @table @samp
  9817. @item s8x6
  9818. @item s16x6
  9819. @item s32x6
  9820. @item s48x6
  9821. @item s8x4
  9822. @item s16x4
  9823. @item s32x4
  9824. @end table
  9825. @item nns
  9826. Set the number of neurons in predictor neural network.
  9827. Can be one of the following:
  9828. @table @samp
  9829. @item n16
  9830. @item n32
  9831. @item n64
  9832. @item n128
  9833. @item n256
  9834. @end table
  9835. @item qual
  9836. Controls the number of different neural network predictions that are blended
  9837. together to compute the final output value. Can be @code{fast}, default or
  9838. @code{slow}.
  9839. @item etype
  9840. Set which set of weights to use in the predictor.
  9841. Can be one of the following:
  9842. @table @samp
  9843. @item a
  9844. weights trained to minimize absolute error
  9845. @item s
  9846. weights trained to minimize squared error
  9847. @end table
  9848. @item pscrn
  9849. Controls whether or not the prescreener neural network is used to decide
  9850. which pixels should be processed by the predictor neural network and which
  9851. can be handled by simple cubic interpolation.
  9852. The prescreener is trained to know whether cubic interpolation will be
  9853. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9854. The computational complexity of the prescreener nn is much less than that of
  9855. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9856. using the prescreener generally results in much faster processing.
  9857. The prescreener is pretty accurate, so the difference between using it and not
  9858. using it is almost always unnoticeable.
  9859. Can be one of the following:
  9860. @table @samp
  9861. @item none
  9862. @item original
  9863. @item new
  9864. @end table
  9865. Default is @code{new}.
  9866. @item fapprox
  9867. Set various debugging flags.
  9868. @end table
  9869. @section noformat
  9870. Force libavfilter not to use any of the specified pixel formats for the
  9871. input to the next filter.
  9872. It accepts the following parameters:
  9873. @table @option
  9874. @item pix_fmts
  9875. A '|'-separated list of pixel format names, such as
  9876. pix_fmts=yuv420p|monow|rgb24".
  9877. @end table
  9878. @subsection Examples
  9879. @itemize
  9880. @item
  9881. Force libavfilter to use a format different from @var{yuv420p} for the
  9882. input to the vflip filter:
  9883. @example
  9884. noformat=pix_fmts=yuv420p,vflip
  9885. @end example
  9886. @item
  9887. Convert the input video to any of the formats not contained in the list:
  9888. @example
  9889. noformat=yuv420p|yuv444p|yuv410p
  9890. @end example
  9891. @end itemize
  9892. @section noise
  9893. Add noise on video input frame.
  9894. The filter accepts the following options:
  9895. @table @option
  9896. @item all_seed
  9897. @item c0_seed
  9898. @item c1_seed
  9899. @item c2_seed
  9900. @item c3_seed
  9901. Set noise seed for specific pixel component or all pixel components in case
  9902. of @var{all_seed}. Default value is @code{123457}.
  9903. @item all_strength, alls
  9904. @item c0_strength, c0s
  9905. @item c1_strength, c1s
  9906. @item c2_strength, c2s
  9907. @item c3_strength, c3s
  9908. Set noise strength for specific pixel component or all pixel components in case
  9909. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9910. @item all_flags, allf
  9911. @item c0_flags, c0f
  9912. @item c1_flags, c1f
  9913. @item c2_flags, c2f
  9914. @item c3_flags, c3f
  9915. Set pixel component flags or set flags for all components if @var{all_flags}.
  9916. Available values for component flags are:
  9917. @table @samp
  9918. @item a
  9919. averaged temporal noise (smoother)
  9920. @item p
  9921. mix random noise with a (semi)regular pattern
  9922. @item t
  9923. temporal noise (noise pattern changes between frames)
  9924. @item u
  9925. uniform noise (gaussian otherwise)
  9926. @end table
  9927. @end table
  9928. @subsection Examples
  9929. Add temporal and uniform noise to input video:
  9930. @example
  9931. noise=alls=20:allf=t+u
  9932. @end example
  9933. @section normalize
  9934. Normalize RGB video (aka histogram stretching, contrast stretching).
  9935. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9936. For each channel of each frame, the filter computes the input range and maps
  9937. it linearly to the user-specified output range. The output range defaults
  9938. to the full dynamic range from pure black to pure white.
  9939. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9940. changes in brightness) caused when small dark or bright objects enter or leave
  9941. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9942. video camera, and, like a video camera, it may cause a period of over- or
  9943. under-exposure of the video.
  9944. The R,G,B channels can be normalized independently, which may cause some
  9945. color shifting, or linked together as a single channel, which prevents
  9946. color shifting. Linked normalization preserves hue. Independent normalization
  9947. does not, so it can be used to remove some color casts. Independent and linked
  9948. normalization can be combined in any ratio.
  9949. The normalize filter accepts the following options:
  9950. @table @option
  9951. @item blackpt
  9952. @item whitept
  9953. Colors which define the output range. The minimum input value is mapped to
  9954. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9955. The defaults are black and white respectively. Specifying white for
  9956. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9957. normalized video. Shades of grey can be used to reduce the dynamic range
  9958. (contrast). Specifying saturated colors here can create some interesting
  9959. effects.
  9960. @item smoothing
  9961. The number of previous frames to use for temporal smoothing. The input range
  9962. of each channel is smoothed using a rolling average over the current frame
  9963. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9964. smoothing).
  9965. @item independence
  9966. Controls the ratio of independent (color shifting) channel normalization to
  9967. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9968. independent. Defaults to 1.0 (fully independent).
  9969. @item strength
  9970. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9971. expensive no-op. Defaults to 1.0 (full strength).
  9972. @end table
  9973. @subsection Examples
  9974. Stretch video contrast to use the full dynamic range, with no temporal
  9975. smoothing; may flicker depending on the source content:
  9976. @example
  9977. normalize=blackpt=black:whitept=white:smoothing=0
  9978. @end example
  9979. As above, but with 50 frames of temporal smoothing; flicker should be
  9980. reduced, depending on the source content:
  9981. @example
  9982. normalize=blackpt=black:whitept=white:smoothing=50
  9983. @end example
  9984. As above, but with hue-preserving linked channel normalization:
  9985. @example
  9986. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9987. @end example
  9988. As above, but with half strength:
  9989. @example
  9990. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9991. @end example
  9992. Map the darkest input color to red, the brightest input color to cyan:
  9993. @example
  9994. normalize=blackpt=red:whitept=cyan
  9995. @end example
  9996. @section null
  9997. Pass the video source unchanged to the output.
  9998. @section ocr
  9999. Optical Character Recognition
  10000. This filter uses Tesseract for optical character recognition. To enable
  10001. compilation of this filter, you need to configure FFmpeg with
  10002. @code{--enable-libtesseract}.
  10003. It accepts the following options:
  10004. @table @option
  10005. @item datapath
  10006. Set datapath to tesseract data. Default is to use whatever was
  10007. set at installation.
  10008. @item language
  10009. Set language, default is "eng".
  10010. @item whitelist
  10011. Set character whitelist.
  10012. @item blacklist
  10013. Set character blacklist.
  10014. @end table
  10015. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10016. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10017. @section ocv
  10018. Apply a video transform using libopencv.
  10019. To enable this filter, install the libopencv library and headers and
  10020. configure FFmpeg with @code{--enable-libopencv}.
  10021. It accepts the following parameters:
  10022. @table @option
  10023. @item filter_name
  10024. The name of the libopencv filter to apply.
  10025. @item filter_params
  10026. The parameters to pass to the libopencv filter. If not specified, the default
  10027. values are assumed.
  10028. @end table
  10029. Refer to the official libopencv documentation for more precise
  10030. information:
  10031. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10032. Several libopencv filters are supported; see the following subsections.
  10033. @anchor{dilate}
  10034. @subsection dilate
  10035. Dilate an image by using a specific structuring element.
  10036. It corresponds to the libopencv function @code{cvDilate}.
  10037. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10038. @var{struct_el} represents a structuring element, and has the syntax:
  10039. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10040. @var{cols} and @var{rows} represent the number of columns and rows of
  10041. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10042. point, and @var{shape} the shape for the structuring element. @var{shape}
  10043. must be "rect", "cross", "ellipse", or "custom".
  10044. If the value for @var{shape} is "custom", it must be followed by a
  10045. string of the form "=@var{filename}". The file with name
  10046. @var{filename} is assumed to represent a binary image, with each
  10047. printable character corresponding to a bright pixel. When a custom
  10048. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10049. or columns and rows of the read file are assumed instead.
  10050. The default value for @var{struct_el} is "3x3+0x0/rect".
  10051. @var{nb_iterations} specifies the number of times the transform is
  10052. applied to the image, and defaults to 1.
  10053. Some examples:
  10054. @example
  10055. # Use the default values
  10056. ocv=dilate
  10057. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10058. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10059. # Read the shape from the file diamond.shape, iterating two times.
  10060. # The file diamond.shape may contain a pattern of characters like this
  10061. # *
  10062. # ***
  10063. # *****
  10064. # ***
  10065. # *
  10066. # The specified columns and rows are ignored
  10067. # but the anchor point coordinates are not
  10068. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10069. @end example
  10070. @subsection erode
  10071. Erode an image by using a specific structuring element.
  10072. It corresponds to the libopencv function @code{cvErode}.
  10073. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10074. with the same syntax and semantics as the @ref{dilate} filter.
  10075. @subsection smooth
  10076. Smooth the input video.
  10077. The filter takes the following parameters:
  10078. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10079. @var{type} is the type of smooth filter to apply, and must be one of
  10080. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10081. or "bilateral". The default value is "gaussian".
  10082. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10083. depend on the smooth type. @var{param1} and
  10084. @var{param2} accept integer positive values or 0. @var{param3} and
  10085. @var{param4} accept floating point values.
  10086. The default value for @var{param1} is 3. The default value for the
  10087. other parameters is 0.
  10088. These parameters correspond to the parameters assigned to the
  10089. libopencv function @code{cvSmooth}.
  10090. @section oscilloscope
  10091. 2D Video Oscilloscope.
  10092. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10093. It accepts the following parameters:
  10094. @table @option
  10095. @item x
  10096. Set scope center x position.
  10097. @item y
  10098. Set scope center y position.
  10099. @item s
  10100. Set scope size, relative to frame diagonal.
  10101. @item t
  10102. Set scope tilt/rotation.
  10103. @item o
  10104. Set trace opacity.
  10105. @item tx
  10106. Set trace center x position.
  10107. @item ty
  10108. Set trace center y position.
  10109. @item tw
  10110. Set trace width, relative to width of frame.
  10111. @item th
  10112. Set trace height, relative to height of frame.
  10113. @item c
  10114. Set which components to trace. By default it traces first three components.
  10115. @item g
  10116. Draw trace grid. By default is enabled.
  10117. @item st
  10118. Draw some statistics. By default is enabled.
  10119. @item sc
  10120. Draw scope. By default is enabled.
  10121. @end table
  10122. @subsection Examples
  10123. @itemize
  10124. @item
  10125. Inspect full first row of video frame.
  10126. @example
  10127. oscilloscope=x=0.5:y=0:s=1
  10128. @end example
  10129. @item
  10130. Inspect full last row of video frame.
  10131. @example
  10132. oscilloscope=x=0.5:y=1:s=1
  10133. @end example
  10134. @item
  10135. Inspect full 5th line of video frame of height 1080.
  10136. @example
  10137. oscilloscope=x=0.5:y=5/1080:s=1
  10138. @end example
  10139. @item
  10140. Inspect full last column of video frame.
  10141. @example
  10142. oscilloscope=x=1:y=0.5:s=1:t=1
  10143. @end example
  10144. @end itemize
  10145. @anchor{overlay}
  10146. @section overlay
  10147. Overlay one video on top of another.
  10148. It takes two inputs and has one output. The first input is the "main"
  10149. video on which the second input is overlaid.
  10150. It accepts the following parameters:
  10151. A description of the accepted options follows.
  10152. @table @option
  10153. @item x
  10154. @item y
  10155. Set the expression for the x and y coordinates of the overlaid video
  10156. on the main video. Default value is "0" for both expressions. In case
  10157. the expression is invalid, it is set to a huge value (meaning that the
  10158. overlay will not be displayed within the output visible area).
  10159. @item eof_action
  10160. See @ref{framesync}.
  10161. @item eval
  10162. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10163. It accepts the following values:
  10164. @table @samp
  10165. @item init
  10166. only evaluate expressions once during the filter initialization or
  10167. when a command is processed
  10168. @item frame
  10169. evaluate expressions for each incoming frame
  10170. @end table
  10171. Default value is @samp{frame}.
  10172. @item shortest
  10173. See @ref{framesync}.
  10174. @item format
  10175. Set the format for the output video.
  10176. It accepts the following values:
  10177. @table @samp
  10178. @item yuv420
  10179. force YUV420 output
  10180. @item yuv422
  10181. force YUV422 output
  10182. @item yuv444
  10183. force YUV444 output
  10184. @item rgb
  10185. force packed RGB output
  10186. @item gbrp
  10187. force planar RGB output
  10188. @item auto
  10189. automatically pick format
  10190. @end table
  10191. Default value is @samp{yuv420}.
  10192. @item repeatlast
  10193. See @ref{framesync}.
  10194. @item alpha
  10195. Set format of alpha of the overlaid video, it can be @var{straight} or
  10196. @var{premultiplied}. Default is @var{straight}.
  10197. @end table
  10198. The @option{x}, and @option{y} expressions can contain the following
  10199. parameters.
  10200. @table @option
  10201. @item main_w, W
  10202. @item main_h, H
  10203. The main input width and height.
  10204. @item overlay_w, w
  10205. @item overlay_h, h
  10206. The overlay input width and height.
  10207. @item x
  10208. @item y
  10209. The computed values for @var{x} and @var{y}. They are evaluated for
  10210. each new frame.
  10211. @item hsub
  10212. @item vsub
  10213. horizontal and vertical chroma subsample values of the output
  10214. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10215. @var{vsub} is 1.
  10216. @item n
  10217. the number of input frame, starting from 0
  10218. @item pos
  10219. the position in the file of the input frame, NAN if unknown
  10220. @item t
  10221. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10222. @end table
  10223. This filter also supports the @ref{framesync} options.
  10224. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10225. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10226. when @option{eval} is set to @samp{init}.
  10227. Be aware that frames are taken from each input video in timestamp
  10228. order, hence, if their initial timestamps differ, it is a good idea
  10229. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10230. have them begin in the same zero timestamp, as the example for
  10231. the @var{movie} filter does.
  10232. You can chain together more overlays but you should test the
  10233. efficiency of such approach.
  10234. @subsection Commands
  10235. This filter supports the following commands:
  10236. @table @option
  10237. @item x
  10238. @item y
  10239. Modify the x and y of the overlay input.
  10240. The command accepts the same syntax of the corresponding option.
  10241. If the specified expression is not valid, it is kept at its current
  10242. value.
  10243. @end table
  10244. @subsection Examples
  10245. @itemize
  10246. @item
  10247. Draw the overlay at 10 pixels from the bottom right corner of the main
  10248. video:
  10249. @example
  10250. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10251. @end example
  10252. Using named options the example above becomes:
  10253. @example
  10254. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10255. @end example
  10256. @item
  10257. Insert a transparent PNG logo in the bottom left corner of the input,
  10258. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10259. @example
  10260. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10261. @end example
  10262. @item
  10263. Insert 2 different transparent PNG logos (second logo on bottom
  10264. right corner) using the @command{ffmpeg} tool:
  10265. @example
  10266. 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
  10267. @end example
  10268. @item
  10269. Add a transparent color layer on top of the main video; @code{WxH}
  10270. must specify the size of the main input to the overlay filter:
  10271. @example
  10272. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10273. @end example
  10274. @item
  10275. Play an original video and a filtered version (here with the deshake
  10276. filter) side by side using the @command{ffplay} tool:
  10277. @example
  10278. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10279. @end example
  10280. The above command is the same as:
  10281. @example
  10282. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10283. @end example
  10284. @item
  10285. Make a sliding overlay appearing from the left to the right top part of the
  10286. screen starting since time 2:
  10287. @example
  10288. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10289. @end example
  10290. @item
  10291. Compose output by putting two input videos side to side:
  10292. @example
  10293. ffmpeg -i left.avi -i right.avi -filter_complex "
  10294. nullsrc=size=200x100 [background];
  10295. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10296. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10297. [background][left] overlay=shortest=1 [background+left];
  10298. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10299. "
  10300. @end example
  10301. @item
  10302. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10303. @example
  10304. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10305. -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]'
  10306. masked.avi
  10307. @end example
  10308. @item
  10309. Chain several overlays in cascade:
  10310. @example
  10311. nullsrc=s=200x200 [bg];
  10312. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10313. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10314. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10315. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10316. [in3] null, [mid2] overlay=100:100 [out0]
  10317. @end example
  10318. @end itemize
  10319. @section owdenoise
  10320. Apply Overcomplete Wavelet denoiser.
  10321. The filter accepts the following options:
  10322. @table @option
  10323. @item depth
  10324. Set depth.
  10325. Larger depth values will denoise lower frequency components more, but
  10326. slow down filtering.
  10327. Must be an int in the range 8-16, default is @code{8}.
  10328. @item luma_strength, ls
  10329. Set luma strength.
  10330. Must be a double value in the range 0-1000, default is @code{1.0}.
  10331. @item chroma_strength, cs
  10332. Set chroma strength.
  10333. Must be a double value in the range 0-1000, default is @code{1.0}.
  10334. @end table
  10335. @anchor{pad}
  10336. @section pad
  10337. Add paddings to the input image, and place the original input at the
  10338. provided @var{x}, @var{y} coordinates.
  10339. It accepts the following parameters:
  10340. @table @option
  10341. @item width, w
  10342. @item height, h
  10343. Specify an expression for the size of the output image with the
  10344. paddings added. If the value for @var{width} or @var{height} is 0, the
  10345. corresponding input size is used for the output.
  10346. The @var{width} expression can reference the value set by the
  10347. @var{height} expression, and vice versa.
  10348. The default value of @var{width} and @var{height} is 0.
  10349. @item x
  10350. @item y
  10351. Specify the offsets to place the input image at within the padded area,
  10352. with respect to the top/left border of the output image.
  10353. The @var{x} expression can reference the value set by the @var{y}
  10354. expression, and vice versa.
  10355. The default value of @var{x} and @var{y} is 0.
  10356. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10357. so the input image is centered on the padded area.
  10358. @item color
  10359. Specify the color of the padded area. For the syntax of this option,
  10360. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10361. manual,ffmpeg-utils}.
  10362. The default value of @var{color} is "black".
  10363. @item eval
  10364. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10365. It accepts the following values:
  10366. @table @samp
  10367. @item init
  10368. Only evaluate expressions once during the filter initialization or when
  10369. a command is processed.
  10370. @item frame
  10371. Evaluate expressions for each incoming frame.
  10372. @end table
  10373. Default value is @samp{init}.
  10374. @item aspect
  10375. Pad to aspect instead to a resolution.
  10376. @end table
  10377. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10378. options are expressions containing the following constants:
  10379. @table @option
  10380. @item in_w
  10381. @item in_h
  10382. The input video width and height.
  10383. @item iw
  10384. @item ih
  10385. These are the same as @var{in_w} and @var{in_h}.
  10386. @item out_w
  10387. @item out_h
  10388. The output width and height (the size of the padded area), as
  10389. specified by the @var{width} and @var{height} expressions.
  10390. @item ow
  10391. @item oh
  10392. These are the same as @var{out_w} and @var{out_h}.
  10393. @item x
  10394. @item y
  10395. The x and y offsets as specified by the @var{x} and @var{y}
  10396. expressions, or NAN if not yet specified.
  10397. @item a
  10398. same as @var{iw} / @var{ih}
  10399. @item sar
  10400. input sample aspect ratio
  10401. @item dar
  10402. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10403. @item hsub
  10404. @item vsub
  10405. The horizontal and vertical chroma subsample values. For example for the
  10406. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10407. @end table
  10408. @subsection Examples
  10409. @itemize
  10410. @item
  10411. Add paddings with the color "violet" to the input video. The output video
  10412. size is 640x480, and the top-left corner of the input video is placed at
  10413. column 0, row 40
  10414. @example
  10415. pad=640:480:0:40:violet
  10416. @end example
  10417. The example above is equivalent to the following command:
  10418. @example
  10419. pad=width=640:height=480:x=0:y=40:color=violet
  10420. @end example
  10421. @item
  10422. Pad the input to get an output with dimensions increased by 3/2,
  10423. and put the input video at the center of the padded area:
  10424. @example
  10425. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10426. @end example
  10427. @item
  10428. Pad the input to get a squared output with size equal to the maximum
  10429. value between the input width and height, and put the input video at
  10430. the center of the padded area:
  10431. @example
  10432. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10433. @end example
  10434. @item
  10435. Pad the input to get a final w/h ratio of 16:9:
  10436. @example
  10437. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10438. @end example
  10439. @item
  10440. In case of anamorphic video, in order to set the output display aspect
  10441. correctly, it is necessary to use @var{sar} in the expression,
  10442. according to the relation:
  10443. @example
  10444. (ih * X / ih) * sar = output_dar
  10445. X = output_dar / sar
  10446. @end example
  10447. Thus the previous example needs to be modified to:
  10448. @example
  10449. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10450. @end example
  10451. @item
  10452. Double the output size and put the input video in the bottom-right
  10453. corner of the output padded area:
  10454. @example
  10455. pad="2*iw:2*ih:ow-iw:oh-ih"
  10456. @end example
  10457. @end itemize
  10458. @anchor{palettegen}
  10459. @section palettegen
  10460. Generate one palette for a whole video stream.
  10461. It accepts the following options:
  10462. @table @option
  10463. @item max_colors
  10464. Set the maximum number of colors to quantize in the palette.
  10465. Note: the palette will still contain 256 colors; the unused palette entries
  10466. will be black.
  10467. @item reserve_transparent
  10468. Create a palette of 255 colors maximum and reserve the last one for
  10469. transparency. Reserving the transparency color is useful for GIF optimization.
  10470. If not set, the maximum of colors in the palette will be 256. You probably want
  10471. to disable this option for a standalone image.
  10472. Set by default.
  10473. @item transparency_color
  10474. Set the color that will be used as background for transparency.
  10475. @item stats_mode
  10476. Set statistics mode.
  10477. It accepts the following values:
  10478. @table @samp
  10479. @item full
  10480. Compute full frame histograms.
  10481. @item diff
  10482. Compute histograms only for the part that differs from previous frame. This
  10483. might be relevant to give more importance to the moving part of your input if
  10484. the background is static.
  10485. @item single
  10486. Compute new histogram for each frame.
  10487. @end table
  10488. Default value is @var{full}.
  10489. @end table
  10490. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10491. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10492. color quantization of the palette. This information is also visible at
  10493. @var{info} logging level.
  10494. @subsection Examples
  10495. @itemize
  10496. @item
  10497. Generate a representative palette of a given video using @command{ffmpeg}:
  10498. @example
  10499. ffmpeg -i input.mkv -vf palettegen palette.png
  10500. @end example
  10501. @end itemize
  10502. @section paletteuse
  10503. Use a palette to downsample an input video stream.
  10504. The filter takes two inputs: one video stream and a palette. The palette must
  10505. be a 256 pixels image.
  10506. It accepts the following options:
  10507. @table @option
  10508. @item dither
  10509. Select dithering mode. Available algorithms are:
  10510. @table @samp
  10511. @item bayer
  10512. Ordered 8x8 bayer dithering (deterministic)
  10513. @item heckbert
  10514. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10515. Note: this dithering is sometimes considered "wrong" and is included as a
  10516. reference.
  10517. @item floyd_steinberg
  10518. Floyd and Steingberg dithering (error diffusion)
  10519. @item sierra2
  10520. Frankie Sierra dithering v2 (error diffusion)
  10521. @item sierra2_4a
  10522. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10523. @end table
  10524. Default is @var{sierra2_4a}.
  10525. @item bayer_scale
  10526. When @var{bayer} dithering is selected, this option defines the scale of the
  10527. pattern (how much the crosshatch pattern is visible). A low value means more
  10528. visible pattern for less banding, and higher value means less visible pattern
  10529. at the cost of more banding.
  10530. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10531. @item diff_mode
  10532. If set, define the zone to process
  10533. @table @samp
  10534. @item rectangle
  10535. Only the changing rectangle will be reprocessed. This is similar to GIF
  10536. cropping/offsetting compression mechanism. This option can be useful for speed
  10537. if only a part of the image is changing, and has use cases such as limiting the
  10538. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10539. moving scene (it leads to more deterministic output if the scene doesn't change
  10540. much, and as a result less moving noise and better GIF compression).
  10541. @end table
  10542. Default is @var{none}.
  10543. @item new
  10544. Take new palette for each output frame.
  10545. @item alpha_threshold
  10546. Sets the alpha threshold for transparency. Alpha values above this threshold
  10547. will be treated as completely opaque, and values below this threshold will be
  10548. treated as completely transparent.
  10549. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10550. @end table
  10551. @subsection Examples
  10552. @itemize
  10553. @item
  10554. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10555. using @command{ffmpeg}:
  10556. @example
  10557. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10558. @end example
  10559. @end itemize
  10560. @section perspective
  10561. Correct perspective of video not recorded perpendicular to the screen.
  10562. A description of the accepted parameters follows.
  10563. @table @option
  10564. @item x0
  10565. @item y0
  10566. @item x1
  10567. @item y1
  10568. @item x2
  10569. @item y2
  10570. @item x3
  10571. @item y3
  10572. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10573. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10574. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10575. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10576. then the corners of the source will be sent to the specified coordinates.
  10577. The expressions can use the following variables:
  10578. @table @option
  10579. @item W
  10580. @item H
  10581. the width and height of video frame.
  10582. @item in
  10583. Input frame count.
  10584. @item on
  10585. Output frame count.
  10586. @end table
  10587. @item interpolation
  10588. Set interpolation for perspective correction.
  10589. It accepts the following values:
  10590. @table @samp
  10591. @item linear
  10592. @item cubic
  10593. @end table
  10594. Default value is @samp{linear}.
  10595. @item sense
  10596. Set interpretation of coordinate options.
  10597. It accepts the following values:
  10598. @table @samp
  10599. @item 0, source
  10600. Send point in the source specified by the given coordinates to
  10601. the corners of the destination.
  10602. @item 1, destination
  10603. Send the corners of the source to the point in the destination specified
  10604. by the given coordinates.
  10605. Default value is @samp{source}.
  10606. @end table
  10607. @item eval
  10608. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10609. It accepts the following values:
  10610. @table @samp
  10611. @item init
  10612. only evaluate expressions once during the filter initialization or
  10613. when a command is processed
  10614. @item frame
  10615. evaluate expressions for each incoming frame
  10616. @end table
  10617. Default value is @samp{init}.
  10618. @end table
  10619. @section phase
  10620. Delay interlaced video by one field time so that the field order changes.
  10621. The intended use is to fix PAL movies that have been captured with the
  10622. opposite field order to the film-to-video transfer.
  10623. A description of the accepted parameters follows.
  10624. @table @option
  10625. @item mode
  10626. Set phase mode.
  10627. It accepts the following values:
  10628. @table @samp
  10629. @item t
  10630. Capture field order top-first, transfer bottom-first.
  10631. Filter will delay the bottom field.
  10632. @item b
  10633. Capture field order bottom-first, transfer top-first.
  10634. Filter will delay the top field.
  10635. @item p
  10636. Capture and transfer with the same field order. This mode only exists
  10637. for the documentation of the other options to refer to, but if you
  10638. actually select it, the filter will faithfully do nothing.
  10639. @item a
  10640. Capture field order determined automatically by field flags, transfer
  10641. opposite.
  10642. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10643. basis using field flags. If no field information is available,
  10644. then this works just like @samp{u}.
  10645. @item u
  10646. Capture unknown or varying, transfer opposite.
  10647. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10648. analyzing the images and selecting the alternative that produces best
  10649. match between the fields.
  10650. @item T
  10651. Capture top-first, transfer unknown or varying.
  10652. Filter selects among @samp{t} and @samp{p} using image analysis.
  10653. @item B
  10654. Capture bottom-first, transfer unknown or varying.
  10655. Filter selects among @samp{b} and @samp{p} using image analysis.
  10656. @item A
  10657. Capture determined by field flags, transfer unknown or varying.
  10658. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10659. image analysis. If no field information is available, then this works just
  10660. like @samp{U}. This is the default mode.
  10661. @item U
  10662. Both capture and transfer unknown or varying.
  10663. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10664. @end table
  10665. @end table
  10666. @section pixdesctest
  10667. Pixel format descriptor test filter, mainly useful for internal
  10668. testing. The output video should be equal to the input video.
  10669. For example:
  10670. @example
  10671. format=monow, pixdesctest
  10672. @end example
  10673. can be used to test the monowhite pixel format descriptor definition.
  10674. @section pixscope
  10675. Display sample values of color channels. Mainly useful for checking color
  10676. and levels. Minimum supported resolution is 640x480.
  10677. The filters accept the following options:
  10678. @table @option
  10679. @item x
  10680. Set scope X position, relative offset on X axis.
  10681. @item y
  10682. Set scope Y position, relative offset on Y axis.
  10683. @item w
  10684. Set scope width.
  10685. @item h
  10686. Set scope height.
  10687. @item o
  10688. Set window opacity. This window also holds statistics about pixel area.
  10689. @item wx
  10690. Set window X position, relative offset on X axis.
  10691. @item wy
  10692. Set window Y position, relative offset on Y axis.
  10693. @end table
  10694. @section pp
  10695. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10696. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10697. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10698. Each subfilter and some options have a short and a long name that can be used
  10699. interchangeably, i.e. dr/dering are the same.
  10700. The filters accept the following options:
  10701. @table @option
  10702. @item subfilters
  10703. Set postprocessing subfilters string.
  10704. @end table
  10705. All subfilters share common options to determine their scope:
  10706. @table @option
  10707. @item a/autoq
  10708. Honor the quality commands for this subfilter.
  10709. @item c/chrom
  10710. Do chrominance filtering, too (default).
  10711. @item y/nochrom
  10712. Do luminance filtering only (no chrominance).
  10713. @item n/noluma
  10714. Do chrominance filtering only (no luminance).
  10715. @end table
  10716. These options can be appended after the subfilter name, separated by a '|'.
  10717. Available subfilters are:
  10718. @table @option
  10719. @item hb/hdeblock[|difference[|flatness]]
  10720. Horizontal deblocking filter
  10721. @table @option
  10722. @item difference
  10723. Difference factor where higher values mean more deblocking (default: @code{32}).
  10724. @item flatness
  10725. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10726. @end table
  10727. @item vb/vdeblock[|difference[|flatness]]
  10728. Vertical deblocking filter
  10729. @table @option
  10730. @item difference
  10731. Difference factor where higher values mean more deblocking (default: @code{32}).
  10732. @item flatness
  10733. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10734. @end table
  10735. @item ha/hadeblock[|difference[|flatness]]
  10736. Accurate horizontal deblocking filter
  10737. @table @option
  10738. @item difference
  10739. Difference factor where higher values mean more deblocking (default: @code{32}).
  10740. @item flatness
  10741. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10742. @end table
  10743. @item va/vadeblock[|difference[|flatness]]
  10744. Accurate vertical deblocking filter
  10745. @table @option
  10746. @item difference
  10747. Difference factor where higher values mean more deblocking (default: @code{32}).
  10748. @item flatness
  10749. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10750. @end table
  10751. @end table
  10752. The horizontal and vertical deblocking filters share the difference and
  10753. flatness values so you cannot set different horizontal and vertical
  10754. thresholds.
  10755. @table @option
  10756. @item h1/x1hdeblock
  10757. Experimental horizontal deblocking filter
  10758. @item v1/x1vdeblock
  10759. Experimental vertical deblocking filter
  10760. @item dr/dering
  10761. Deringing filter
  10762. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10763. @table @option
  10764. @item threshold1
  10765. larger -> stronger filtering
  10766. @item threshold2
  10767. larger -> stronger filtering
  10768. @item threshold3
  10769. larger -> stronger filtering
  10770. @end table
  10771. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10772. @table @option
  10773. @item f/fullyrange
  10774. Stretch luminance to @code{0-255}.
  10775. @end table
  10776. @item lb/linblenddeint
  10777. Linear blend deinterlacing filter that deinterlaces the given block by
  10778. filtering all lines with a @code{(1 2 1)} filter.
  10779. @item li/linipoldeint
  10780. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10781. linearly interpolating every second line.
  10782. @item ci/cubicipoldeint
  10783. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10784. cubically interpolating every second line.
  10785. @item md/mediandeint
  10786. Median deinterlacing filter that deinterlaces the given block by applying a
  10787. median filter to every second line.
  10788. @item fd/ffmpegdeint
  10789. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10790. second line with a @code{(-1 4 2 4 -1)} filter.
  10791. @item l5/lowpass5
  10792. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10793. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10794. @item fq/forceQuant[|quantizer]
  10795. Overrides the quantizer table from the input with the constant quantizer you
  10796. specify.
  10797. @table @option
  10798. @item quantizer
  10799. Quantizer to use
  10800. @end table
  10801. @item de/default
  10802. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10803. @item fa/fast
  10804. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10805. @item ac
  10806. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10807. @end table
  10808. @subsection Examples
  10809. @itemize
  10810. @item
  10811. Apply horizontal and vertical deblocking, deringing and automatic
  10812. brightness/contrast:
  10813. @example
  10814. pp=hb/vb/dr/al
  10815. @end example
  10816. @item
  10817. Apply default filters without brightness/contrast correction:
  10818. @example
  10819. pp=de/-al
  10820. @end example
  10821. @item
  10822. Apply default filters and temporal denoiser:
  10823. @example
  10824. pp=default/tmpnoise|1|2|3
  10825. @end example
  10826. @item
  10827. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10828. automatically depending on available CPU time:
  10829. @example
  10830. pp=hb|y/vb|a
  10831. @end example
  10832. @end itemize
  10833. @section pp7
  10834. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10835. similar to spp = 6 with 7 point DCT, where only the center sample is
  10836. used after IDCT.
  10837. The filter accepts the following options:
  10838. @table @option
  10839. @item qp
  10840. Force a constant quantization parameter. It accepts an integer in range
  10841. 0 to 63. If not set, the filter will use the QP from the video stream
  10842. (if available).
  10843. @item mode
  10844. Set thresholding mode. Available modes are:
  10845. @table @samp
  10846. @item hard
  10847. Set hard thresholding.
  10848. @item soft
  10849. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10850. @item medium
  10851. Set medium thresholding (good results, default).
  10852. @end table
  10853. @end table
  10854. @section premultiply
  10855. Apply alpha premultiply effect to input video stream using first plane
  10856. of second stream as alpha.
  10857. Both streams must have same dimensions and same pixel format.
  10858. The filter accepts the following option:
  10859. @table @option
  10860. @item planes
  10861. Set which planes will be processed, unprocessed planes will be copied.
  10862. By default value 0xf, all planes will be processed.
  10863. @item inplace
  10864. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10865. @end table
  10866. @section prewitt
  10867. Apply prewitt operator to input video stream.
  10868. The filter accepts the following option:
  10869. @table @option
  10870. @item planes
  10871. Set which planes will be processed, unprocessed planes will be copied.
  10872. By default value 0xf, all planes will be processed.
  10873. @item scale
  10874. Set value which will be multiplied with filtered result.
  10875. @item delta
  10876. Set value which will be added to filtered result.
  10877. @end table
  10878. @anchor{program_opencl}
  10879. @section program_opencl
  10880. Filter video using an OpenCL program.
  10881. @table @option
  10882. @item source
  10883. OpenCL program source file.
  10884. @item kernel
  10885. Kernel name in program.
  10886. @item inputs
  10887. Number of inputs to the filter. Defaults to 1.
  10888. @item size, s
  10889. Size of output frames. Defaults to the same as the first input.
  10890. @end table
  10891. The program source file must contain a kernel function with the given name,
  10892. which will be run once for each plane of the output. Each run on a plane
  10893. gets enqueued as a separate 2D global NDRange with one work-item for each
  10894. pixel to be generated. The global ID offset for each work-item is therefore
  10895. the coordinates of a pixel in the destination image.
  10896. The kernel function needs to take the following arguments:
  10897. @itemize
  10898. @item
  10899. Destination image, @var{__write_only image2d_t}.
  10900. This image will become the output; the kernel should write all of it.
  10901. @item
  10902. Frame index, @var{unsigned int}.
  10903. This is a counter starting from zero and increasing by one for each frame.
  10904. @item
  10905. Source images, @var{__read_only image2d_t}.
  10906. These are the most recent images on each input. The kernel may read from
  10907. them to generate the output, but they can't be written to.
  10908. @end itemize
  10909. Example programs:
  10910. @itemize
  10911. @item
  10912. Copy the input to the output (output must be the same size as the input).
  10913. @verbatim
  10914. __kernel void copy(__write_only image2d_t destination,
  10915. unsigned int index,
  10916. __read_only image2d_t source)
  10917. {
  10918. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10919. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10920. float4 value = read_imagef(source, sampler, location);
  10921. write_imagef(destination, location, value);
  10922. }
  10923. @end verbatim
  10924. @item
  10925. Apply a simple transformation, rotating the input by an amount increasing
  10926. with the index counter. Pixel values are linearly interpolated by the
  10927. sampler, and the output need not have the same dimensions as the input.
  10928. @verbatim
  10929. __kernel void rotate_image(__write_only image2d_t dst,
  10930. unsigned int index,
  10931. __read_only image2d_t src)
  10932. {
  10933. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10934. CLK_FILTER_LINEAR);
  10935. float angle = (float)index / 100.0f;
  10936. float2 dst_dim = convert_float2(get_image_dim(dst));
  10937. float2 src_dim = convert_float2(get_image_dim(src));
  10938. float2 dst_cen = dst_dim / 2.0f;
  10939. float2 src_cen = src_dim / 2.0f;
  10940. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10941. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10942. float2 src_pos = {
  10943. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10944. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10945. };
  10946. src_pos = src_pos * src_dim / dst_dim;
  10947. float2 src_loc = src_pos + src_cen;
  10948. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10949. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10950. write_imagef(dst, dst_loc, 0.5f);
  10951. else
  10952. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10953. }
  10954. @end verbatim
  10955. @item
  10956. Blend two inputs together, with the amount of each input used varying
  10957. with the index counter.
  10958. @verbatim
  10959. __kernel void blend_images(__write_only image2d_t dst,
  10960. unsigned int index,
  10961. __read_only image2d_t src1,
  10962. __read_only image2d_t src2)
  10963. {
  10964. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10965. CLK_FILTER_LINEAR);
  10966. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10967. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10968. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10969. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10970. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10971. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10972. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10973. }
  10974. @end verbatim
  10975. @end itemize
  10976. @section pseudocolor
  10977. Alter frame colors in video with pseudocolors.
  10978. This filter accept the following options:
  10979. @table @option
  10980. @item c0
  10981. set pixel first component expression
  10982. @item c1
  10983. set pixel second component expression
  10984. @item c2
  10985. set pixel third component expression
  10986. @item c3
  10987. set pixel fourth component expression, corresponds to the alpha component
  10988. @item i
  10989. set component to use as base for altering colors
  10990. @end table
  10991. Each of them specifies the expression to use for computing the lookup table for
  10992. the corresponding pixel component values.
  10993. The expressions can contain the following constants and functions:
  10994. @table @option
  10995. @item w
  10996. @item h
  10997. The input width and height.
  10998. @item val
  10999. The input value for the pixel component.
  11000. @item ymin, umin, vmin, amin
  11001. The minimum allowed component value.
  11002. @item ymax, umax, vmax, amax
  11003. The maximum allowed component value.
  11004. @end table
  11005. All expressions default to "val".
  11006. @subsection Examples
  11007. @itemize
  11008. @item
  11009. Change too high luma values to gradient:
  11010. @example
  11011. 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'"
  11012. @end example
  11013. @end itemize
  11014. @section psnr
  11015. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11016. Ratio) between two input videos.
  11017. This filter takes in input two input videos, the first input is
  11018. considered the "main" source and is passed unchanged to the
  11019. output. The second input is used as a "reference" video for computing
  11020. the PSNR.
  11021. Both video inputs must have the same resolution and pixel format for
  11022. this filter to work correctly. Also it assumes that both inputs
  11023. have the same number of frames, which are compared one by one.
  11024. The obtained average PSNR is printed through the logging system.
  11025. The filter stores the accumulated MSE (mean squared error) of each
  11026. frame, and at the end of the processing it is averaged across all frames
  11027. equally, and the following formula is applied to obtain the PSNR:
  11028. @example
  11029. PSNR = 10*log10(MAX^2/MSE)
  11030. @end example
  11031. Where MAX is the average of the maximum values of each component of the
  11032. image.
  11033. The description of the accepted parameters follows.
  11034. @table @option
  11035. @item stats_file, f
  11036. If specified the filter will use the named file to save the PSNR of
  11037. each individual frame. When filename equals "-" the data is sent to
  11038. standard output.
  11039. @item stats_version
  11040. Specifies which version of the stats file format to use. Details of
  11041. each format are written below.
  11042. Default value is 1.
  11043. @item stats_add_max
  11044. Determines whether the max value is output to the stats log.
  11045. Default value is 0.
  11046. Requires stats_version >= 2. If this is set and stats_version < 2,
  11047. the filter will return an error.
  11048. @end table
  11049. This filter also supports the @ref{framesync} options.
  11050. The file printed if @var{stats_file} is selected, contains a sequence of
  11051. key/value pairs of the form @var{key}:@var{value} for each compared
  11052. couple of frames.
  11053. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11054. the list of per-frame-pair stats, with key value pairs following the frame
  11055. format with the following parameters:
  11056. @table @option
  11057. @item psnr_log_version
  11058. The version of the log file format. Will match @var{stats_version}.
  11059. @item fields
  11060. A comma separated list of the per-frame-pair parameters included in
  11061. the log.
  11062. @end table
  11063. A description of each shown per-frame-pair parameter follows:
  11064. @table @option
  11065. @item n
  11066. sequential number of the input frame, starting from 1
  11067. @item mse_avg
  11068. Mean Square Error pixel-by-pixel average difference of the compared
  11069. frames, averaged over all the image components.
  11070. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11071. Mean Square Error pixel-by-pixel average difference of the compared
  11072. frames for the component specified by the suffix.
  11073. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11074. Peak Signal to Noise ratio of the compared frames for the component
  11075. specified by the suffix.
  11076. @item max_avg, max_y, max_u, max_v
  11077. Maximum allowed value for each channel, and average over all
  11078. channels.
  11079. @end table
  11080. For example:
  11081. @example
  11082. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11083. [main][ref] psnr="stats_file=stats.log" [out]
  11084. @end example
  11085. On this example the input file being processed is compared with the
  11086. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11087. is stored in @file{stats.log}.
  11088. @anchor{pullup}
  11089. @section pullup
  11090. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11091. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11092. content.
  11093. The pullup filter is designed to take advantage of future context in making
  11094. its decisions. This filter is stateless in the sense that it does not lock
  11095. onto a pattern to follow, but it instead looks forward to the following
  11096. fields in order to identify matches and rebuild progressive frames.
  11097. To produce content with an even framerate, insert the fps filter after
  11098. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11099. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11100. The filter accepts the following options:
  11101. @table @option
  11102. @item jl
  11103. @item jr
  11104. @item jt
  11105. @item jb
  11106. These options set the amount of "junk" to ignore at the left, right, top, and
  11107. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11108. while top and bottom are in units of 2 lines.
  11109. The default is 8 pixels on each side.
  11110. @item sb
  11111. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11112. filter generating an occasional mismatched frame, but it may also cause an
  11113. excessive number of frames to be dropped during high motion sequences.
  11114. Conversely, setting it to -1 will make filter match fields more easily.
  11115. This may help processing of video where there is slight blurring between
  11116. the fields, but may also cause there to be interlaced frames in the output.
  11117. Default value is @code{0}.
  11118. @item mp
  11119. Set the metric plane to use. It accepts the following values:
  11120. @table @samp
  11121. @item l
  11122. Use luma plane.
  11123. @item u
  11124. Use chroma blue plane.
  11125. @item v
  11126. Use chroma red plane.
  11127. @end table
  11128. This option may be set to use chroma plane instead of the default luma plane
  11129. for doing filter's computations. This may improve accuracy on very clean
  11130. source material, but more likely will decrease accuracy, especially if there
  11131. is chroma noise (rainbow effect) or any grayscale video.
  11132. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11133. load and make pullup usable in realtime on slow machines.
  11134. @end table
  11135. For best results (without duplicated frames in the output file) it is
  11136. necessary to change the output frame rate. For example, to inverse
  11137. telecine NTSC input:
  11138. @example
  11139. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11140. @end example
  11141. @section qp
  11142. Change video quantization parameters (QP).
  11143. The filter accepts the following option:
  11144. @table @option
  11145. @item qp
  11146. Set expression for quantization parameter.
  11147. @end table
  11148. The expression is evaluated through the eval API and can contain, among others,
  11149. the following constants:
  11150. @table @var
  11151. @item known
  11152. 1 if index is not 129, 0 otherwise.
  11153. @item qp
  11154. Sequential index starting from -129 to 128.
  11155. @end table
  11156. @subsection Examples
  11157. @itemize
  11158. @item
  11159. Some equation like:
  11160. @example
  11161. qp=2+2*sin(PI*qp)
  11162. @end example
  11163. @end itemize
  11164. @section random
  11165. Flush video frames from internal cache of frames into a random order.
  11166. No frame is discarded.
  11167. Inspired by @ref{frei0r} nervous filter.
  11168. @table @option
  11169. @item frames
  11170. Set size in number of frames of internal cache, in range from @code{2} to
  11171. @code{512}. Default is @code{30}.
  11172. @item seed
  11173. Set seed for random number generator, must be an integer included between
  11174. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11175. less than @code{0}, the filter will try to use a good random seed on a
  11176. best effort basis.
  11177. @end table
  11178. @section readeia608
  11179. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11180. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11181. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11182. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11183. @table @option
  11184. @item lavfi.readeia608.X.cc
  11185. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11186. @item lavfi.readeia608.X.line
  11187. The number of the line on which the EIA-608 data was identified and read.
  11188. @end table
  11189. This filter accepts the following options:
  11190. @table @option
  11191. @item scan_min
  11192. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11193. @item scan_max
  11194. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11195. @item mac
  11196. Set minimal acceptable amplitude change for sync codes detection.
  11197. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  11198. @item spw
  11199. Set the ratio of width reserved for sync code detection.
  11200. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  11201. @item mhd
  11202. Set the max peaks height difference for sync code detection.
  11203. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11204. @item mpd
  11205. Set max peaks period difference for sync code detection.
  11206. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11207. @item msd
  11208. Set the first two max start code bits differences.
  11209. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  11210. @item bhd
  11211. Set the minimum ratio of bits height compared to 3rd start code bit.
  11212. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  11213. @item th_w
  11214. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  11215. @item th_b
  11216. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  11217. @item chp
  11218. Enable checking the parity bit. In the event of a parity error, the filter will output
  11219. @code{0x00} for that character. Default is false.
  11220. @end table
  11221. @subsection Examples
  11222. @itemize
  11223. @item
  11224. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11225. @example
  11226. 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
  11227. @end example
  11228. @end itemize
  11229. @section readvitc
  11230. Read vertical interval timecode (VITC) information from the top lines of a
  11231. video frame.
  11232. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11233. timecode value, if a valid timecode has been detected. Further metadata key
  11234. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11235. timecode data has been found or not.
  11236. This filter accepts the following options:
  11237. @table @option
  11238. @item scan_max
  11239. Set the maximum number of lines to scan for VITC data. If the value is set to
  11240. @code{-1} the full video frame is scanned. Default is @code{45}.
  11241. @item thr_b
  11242. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11243. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11244. @item thr_w
  11245. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11246. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11247. @end table
  11248. @subsection Examples
  11249. @itemize
  11250. @item
  11251. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11252. draw @code{--:--:--:--} as a placeholder:
  11253. @example
  11254. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11255. @end example
  11256. @end itemize
  11257. @section remap
  11258. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11259. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11260. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11261. value for pixel will be used for destination pixel.
  11262. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11263. will have Xmap/Ymap video stream dimensions.
  11264. Xmap and Ymap input video streams are 16bit depth, single channel.
  11265. @section removegrain
  11266. The removegrain filter is a spatial denoiser for progressive video.
  11267. @table @option
  11268. @item m0
  11269. Set mode for the first plane.
  11270. @item m1
  11271. Set mode for the second plane.
  11272. @item m2
  11273. Set mode for the third plane.
  11274. @item m3
  11275. Set mode for the fourth plane.
  11276. @end table
  11277. Range of mode is from 0 to 24. Description of each mode follows:
  11278. @table @var
  11279. @item 0
  11280. Leave input plane unchanged. Default.
  11281. @item 1
  11282. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11283. @item 2
  11284. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11285. @item 3
  11286. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11287. @item 4
  11288. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11289. This is equivalent to a median filter.
  11290. @item 5
  11291. Line-sensitive clipping giving the minimal change.
  11292. @item 6
  11293. Line-sensitive clipping, intermediate.
  11294. @item 7
  11295. Line-sensitive clipping, intermediate.
  11296. @item 8
  11297. Line-sensitive clipping, intermediate.
  11298. @item 9
  11299. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11300. @item 10
  11301. Replaces the target pixel with the closest neighbour.
  11302. @item 11
  11303. [1 2 1] horizontal and vertical kernel blur.
  11304. @item 12
  11305. Same as mode 11.
  11306. @item 13
  11307. Bob mode, interpolates top field from the line where the neighbours
  11308. pixels are the closest.
  11309. @item 14
  11310. Bob mode, interpolates bottom field from the line where the neighbours
  11311. pixels are the closest.
  11312. @item 15
  11313. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11314. interpolation formula.
  11315. @item 16
  11316. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11317. interpolation formula.
  11318. @item 17
  11319. Clips the pixel with the minimum and maximum of respectively the maximum and
  11320. minimum of each pair of opposite neighbour pixels.
  11321. @item 18
  11322. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11323. the current pixel is minimal.
  11324. @item 19
  11325. Replaces the pixel with the average of its 8 neighbours.
  11326. @item 20
  11327. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11328. @item 21
  11329. Clips pixels using the averages of opposite neighbour.
  11330. @item 22
  11331. Same as mode 21 but simpler and faster.
  11332. @item 23
  11333. Small edge and halo removal, but reputed useless.
  11334. @item 24
  11335. Similar as 23.
  11336. @end table
  11337. @section removelogo
  11338. Suppress a TV station logo, using an image file to determine which
  11339. pixels comprise the logo. It works by filling in the pixels that
  11340. comprise the logo with neighboring pixels.
  11341. The filter accepts the following options:
  11342. @table @option
  11343. @item filename, f
  11344. Set the filter bitmap file, which can be any image format supported by
  11345. libavformat. The width and height of the image file must match those of the
  11346. video stream being processed.
  11347. @end table
  11348. Pixels in the provided bitmap image with a value of zero are not
  11349. considered part of the logo, non-zero pixels are considered part of
  11350. the logo. If you use white (255) for the logo and black (0) for the
  11351. rest, you will be safe. For making the filter bitmap, it is
  11352. recommended to take a screen capture of a black frame with the logo
  11353. visible, and then using a threshold filter followed by the erode
  11354. filter once or twice.
  11355. If needed, little splotches can be fixed manually. Remember that if
  11356. logo pixels are not covered, the filter quality will be much
  11357. reduced. Marking too many pixels as part of the logo does not hurt as
  11358. much, but it will increase the amount of blurring needed to cover over
  11359. the image and will destroy more information than necessary, and extra
  11360. pixels will slow things down on a large logo.
  11361. @section repeatfields
  11362. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11363. fields based on its value.
  11364. @section reverse
  11365. Reverse a video clip.
  11366. Warning: This filter requires memory to buffer the entire clip, so trimming
  11367. is suggested.
  11368. @subsection Examples
  11369. @itemize
  11370. @item
  11371. Take the first 5 seconds of a clip, and reverse it.
  11372. @example
  11373. trim=end=5,reverse
  11374. @end example
  11375. @end itemize
  11376. @section rgbashift
  11377. Shift R/G/B/A pixels horizontally and/or vertically.
  11378. The filter accepts the following options:
  11379. @table @option
  11380. @item rh
  11381. Set amount to shift red horizontally.
  11382. @item rv
  11383. Set amount to shift red vertically.
  11384. @item gh
  11385. Set amount to shift green horizontally.
  11386. @item gv
  11387. Set amount to shift green vertically.
  11388. @item bh
  11389. Set amount to shift blue horizontally.
  11390. @item bv
  11391. Set amount to shift blue vertically.
  11392. @item ah
  11393. Set amount to shift alpha horizontally.
  11394. @item av
  11395. Set amount to shift alpha vertically.
  11396. @item edge
  11397. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11398. @end table
  11399. @section roberts
  11400. Apply roberts cross operator to input video stream.
  11401. The filter accepts the following option:
  11402. @table @option
  11403. @item planes
  11404. Set which planes will be processed, unprocessed planes will be copied.
  11405. By default value 0xf, all planes will be processed.
  11406. @item scale
  11407. Set value which will be multiplied with filtered result.
  11408. @item delta
  11409. Set value which will be added to filtered result.
  11410. @end table
  11411. @section rotate
  11412. Rotate video by an arbitrary angle expressed in radians.
  11413. The filter accepts the following options:
  11414. A description of the optional parameters follows.
  11415. @table @option
  11416. @item angle, a
  11417. Set an expression for the angle by which to rotate the input video
  11418. clockwise, expressed as a number of radians. A negative value will
  11419. result in a counter-clockwise rotation. By default it is set to "0".
  11420. This expression is evaluated for each frame.
  11421. @item out_w, ow
  11422. Set the output width expression, default value is "iw".
  11423. This expression is evaluated just once during configuration.
  11424. @item out_h, oh
  11425. Set the output height expression, default value is "ih".
  11426. This expression is evaluated just once during configuration.
  11427. @item bilinear
  11428. Enable bilinear interpolation if set to 1, a value of 0 disables
  11429. it. Default value is 1.
  11430. @item fillcolor, c
  11431. Set the color used to fill the output area not covered by the rotated
  11432. image. For the general syntax of this option, check the
  11433. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11434. If the special value "none" is selected then no
  11435. background is printed (useful for example if the background is never shown).
  11436. Default value is "black".
  11437. @end table
  11438. The expressions for the angle and the output size can contain the
  11439. following constants and functions:
  11440. @table @option
  11441. @item n
  11442. sequential number of the input frame, starting from 0. It is always NAN
  11443. before the first frame is filtered.
  11444. @item t
  11445. time in seconds of the input frame, it is set to 0 when the filter is
  11446. configured. It is always NAN before the first frame is filtered.
  11447. @item hsub
  11448. @item vsub
  11449. horizontal and vertical chroma subsample values. For example for the
  11450. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11451. @item in_w, iw
  11452. @item in_h, ih
  11453. the input video width and height
  11454. @item out_w, ow
  11455. @item out_h, oh
  11456. the output width and height, that is the size of the padded area as
  11457. specified by the @var{width} and @var{height} expressions
  11458. @item rotw(a)
  11459. @item roth(a)
  11460. the minimal width/height required for completely containing the input
  11461. video rotated by @var{a} radians.
  11462. These are only available when computing the @option{out_w} and
  11463. @option{out_h} expressions.
  11464. @end table
  11465. @subsection Examples
  11466. @itemize
  11467. @item
  11468. Rotate the input by PI/6 radians clockwise:
  11469. @example
  11470. rotate=PI/6
  11471. @end example
  11472. @item
  11473. Rotate the input by PI/6 radians counter-clockwise:
  11474. @example
  11475. rotate=-PI/6
  11476. @end example
  11477. @item
  11478. Rotate the input by 45 degrees clockwise:
  11479. @example
  11480. rotate=45*PI/180
  11481. @end example
  11482. @item
  11483. Apply a constant rotation with period T, starting from an angle of PI/3:
  11484. @example
  11485. rotate=PI/3+2*PI*t/T
  11486. @end example
  11487. @item
  11488. Make the input video rotation oscillating with a period of T
  11489. seconds and an amplitude of A radians:
  11490. @example
  11491. rotate=A*sin(2*PI/T*t)
  11492. @end example
  11493. @item
  11494. Rotate the video, output size is chosen so that the whole rotating
  11495. input video is always completely contained in the output:
  11496. @example
  11497. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11498. @end example
  11499. @item
  11500. Rotate the video, reduce the output size so that no background is ever
  11501. shown:
  11502. @example
  11503. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11504. @end example
  11505. @end itemize
  11506. @subsection Commands
  11507. The filter supports the following commands:
  11508. @table @option
  11509. @item a, angle
  11510. Set the angle expression.
  11511. The command accepts the same syntax of the corresponding option.
  11512. If the specified expression is not valid, it is kept at its current
  11513. value.
  11514. @end table
  11515. @section sab
  11516. Apply Shape Adaptive Blur.
  11517. The filter accepts the following options:
  11518. @table @option
  11519. @item luma_radius, lr
  11520. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11521. value is 1.0. A greater value will result in a more blurred image, and
  11522. in slower processing.
  11523. @item luma_pre_filter_radius, lpfr
  11524. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11525. value is 1.0.
  11526. @item luma_strength, ls
  11527. Set luma maximum difference between pixels to still be considered, must
  11528. be a value in the 0.1-100.0 range, default value is 1.0.
  11529. @item chroma_radius, cr
  11530. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11531. greater value will result in a more blurred image, and in slower
  11532. processing.
  11533. @item chroma_pre_filter_radius, cpfr
  11534. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11535. @item chroma_strength, cs
  11536. Set chroma maximum difference between pixels to still be considered,
  11537. must be a value in the -0.9-100.0 range.
  11538. @end table
  11539. Each chroma option value, if not explicitly specified, is set to the
  11540. corresponding luma option value.
  11541. @anchor{scale}
  11542. @section scale
  11543. Scale (resize) the input video, using the libswscale library.
  11544. The scale filter forces the output display aspect ratio to be the same
  11545. of the input, by changing the output sample aspect ratio.
  11546. If the input image format is different from the format requested by
  11547. the next filter, the scale filter will convert the input to the
  11548. requested format.
  11549. @subsection Options
  11550. The filter accepts the following options, or any of the options
  11551. supported by the libswscale scaler.
  11552. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11553. the complete list of scaler options.
  11554. @table @option
  11555. @item width, w
  11556. @item height, h
  11557. Set the output video dimension expression. Default value is the input
  11558. dimension.
  11559. If the @var{width} or @var{w} value is 0, the input width is used for
  11560. the output. If the @var{height} or @var{h} value is 0, the input height
  11561. is used for the output.
  11562. If one and only one of the values is -n with n >= 1, the scale filter
  11563. will use a value that maintains the aspect ratio of the input image,
  11564. calculated from the other specified dimension. After that it will,
  11565. however, make sure that the calculated dimension is divisible by n and
  11566. adjust the value if necessary.
  11567. If both values are -n with n >= 1, the behavior will be identical to
  11568. both values being set to 0 as previously detailed.
  11569. See below for the list of accepted constants for use in the dimension
  11570. expression.
  11571. @item eval
  11572. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11573. @table @samp
  11574. @item init
  11575. Only evaluate expressions once during the filter initialization or when a command is processed.
  11576. @item frame
  11577. Evaluate expressions for each incoming frame.
  11578. @end table
  11579. Default value is @samp{init}.
  11580. @item interl
  11581. Set the interlacing mode. It accepts the following values:
  11582. @table @samp
  11583. @item 1
  11584. Force interlaced aware scaling.
  11585. @item 0
  11586. Do not apply interlaced scaling.
  11587. @item -1
  11588. Select interlaced aware scaling depending on whether the source frames
  11589. are flagged as interlaced or not.
  11590. @end table
  11591. Default value is @samp{0}.
  11592. @item flags
  11593. Set libswscale scaling flags. See
  11594. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11595. complete list of values. If not explicitly specified the filter applies
  11596. the default flags.
  11597. @item param0, param1
  11598. Set libswscale input parameters for scaling algorithms that need them. See
  11599. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11600. complete documentation. If not explicitly specified the filter applies
  11601. empty parameters.
  11602. @item size, s
  11603. Set the video size. For the syntax of this option, check the
  11604. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11605. @item in_color_matrix
  11606. @item out_color_matrix
  11607. Set in/output YCbCr color space type.
  11608. This allows the autodetected value to be overridden as well as allows forcing
  11609. a specific value used for the output and encoder.
  11610. If not specified, the color space type depends on the pixel format.
  11611. Possible values:
  11612. @table @samp
  11613. @item auto
  11614. Choose automatically.
  11615. @item bt709
  11616. Format conforming to International Telecommunication Union (ITU)
  11617. Recommendation BT.709.
  11618. @item fcc
  11619. Set color space conforming to the United States Federal Communications
  11620. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11621. @item bt601
  11622. @item bt470
  11623. @item smpte170m
  11624. Set color space conforming to:
  11625. @itemize
  11626. @item
  11627. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11628. @item
  11629. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11630. @item
  11631. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11632. @end itemize
  11633. @item smpte240m
  11634. Set color space conforming to SMPTE ST 240:1999.
  11635. @item bt2020
  11636. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  11637. @end table
  11638. @item in_range
  11639. @item out_range
  11640. Set in/output YCbCr sample range.
  11641. This allows the autodetected value to be overridden as well as allows forcing
  11642. a specific value used for the output and encoder. If not specified, the
  11643. range depends on the pixel format. Possible values:
  11644. @table @samp
  11645. @item auto/unknown
  11646. Choose automatically.
  11647. @item jpeg/full/pc
  11648. Set full range (0-255 in case of 8-bit luma).
  11649. @item mpeg/limited/tv
  11650. Set "MPEG" range (16-235 in case of 8-bit luma).
  11651. @end table
  11652. @item force_original_aspect_ratio
  11653. Enable decreasing or increasing output video width or height if necessary to
  11654. keep the original aspect ratio. Possible values:
  11655. @table @samp
  11656. @item disable
  11657. Scale the video as specified and disable this feature.
  11658. @item decrease
  11659. The output video dimensions will automatically be decreased if needed.
  11660. @item increase
  11661. The output video dimensions will automatically be increased if needed.
  11662. @end table
  11663. One useful instance of this option is that when you know a specific device's
  11664. maximum allowed resolution, you can use this to limit the output video to
  11665. that, while retaining the aspect ratio. For example, device A allows
  11666. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11667. decrease) and specifying 1280x720 to the command line makes the output
  11668. 1280x533.
  11669. Please note that this is a different thing than specifying -1 for @option{w}
  11670. or @option{h}, you still need to specify the output resolution for this option
  11671. to work.
  11672. @end table
  11673. The values of the @option{w} and @option{h} options are expressions
  11674. containing the following constants:
  11675. @table @var
  11676. @item in_w
  11677. @item in_h
  11678. The input width and height
  11679. @item iw
  11680. @item ih
  11681. These are the same as @var{in_w} and @var{in_h}.
  11682. @item out_w
  11683. @item out_h
  11684. The output (scaled) width and height
  11685. @item ow
  11686. @item oh
  11687. These are the same as @var{out_w} and @var{out_h}
  11688. @item a
  11689. The same as @var{iw} / @var{ih}
  11690. @item sar
  11691. input sample aspect ratio
  11692. @item dar
  11693. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11694. @item hsub
  11695. @item vsub
  11696. horizontal and vertical input chroma subsample values. For example for the
  11697. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11698. @item ohsub
  11699. @item ovsub
  11700. horizontal and vertical output chroma subsample values. For example for the
  11701. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11702. @end table
  11703. @subsection Examples
  11704. @itemize
  11705. @item
  11706. Scale the input video to a size of 200x100
  11707. @example
  11708. scale=w=200:h=100
  11709. @end example
  11710. This is equivalent to:
  11711. @example
  11712. scale=200:100
  11713. @end example
  11714. or:
  11715. @example
  11716. scale=200x100
  11717. @end example
  11718. @item
  11719. Specify a size abbreviation for the output size:
  11720. @example
  11721. scale=qcif
  11722. @end example
  11723. which can also be written as:
  11724. @example
  11725. scale=size=qcif
  11726. @end example
  11727. @item
  11728. Scale the input to 2x:
  11729. @example
  11730. scale=w=2*iw:h=2*ih
  11731. @end example
  11732. @item
  11733. The above is the same as:
  11734. @example
  11735. scale=2*in_w:2*in_h
  11736. @end example
  11737. @item
  11738. Scale the input to 2x with forced interlaced scaling:
  11739. @example
  11740. scale=2*iw:2*ih:interl=1
  11741. @end example
  11742. @item
  11743. Scale the input to half size:
  11744. @example
  11745. scale=w=iw/2:h=ih/2
  11746. @end example
  11747. @item
  11748. Increase the width, and set the height to the same size:
  11749. @example
  11750. scale=3/2*iw:ow
  11751. @end example
  11752. @item
  11753. Seek Greek harmony:
  11754. @example
  11755. scale=iw:1/PHI*iw
  11756. scale=ih*PHI:ih
  11757. @end example
  11758. @item
  11759. Increase the height, and set the width to 3/2 of the height:
  11760. @example
  11761. scale=w=3/2*oh:h=3/5*ih
  11762. @end example
  11763. @item
  11764. Increase the size, making the size a multiple of the chroma
  11765. subsample values:
  11766. @example
  11767. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11768. @end example
  11769. @item
  11770. Increase the width to a maximum of 500 pixels,
  11771. keeping the same aspect ratio as the input:
  11772. @example
  11773. scale=w='min(500\, iw*3/2):h=-1'
  11774. @end example
  11775. @item
  11776. Make pixels square by combining scale and setsar:
  11777. @example
  11778. scale='trunc(ih*dar):ih',setsar=1/1
  11779. @end example
  11780. @item
  11781. Make pixels square by combining scale and setsar,
  11782. making sure the resulting resolution is even (required by some codecs):
  11783. @example
  11784. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11785. @end example
  11786. @end itemize
  11787. @subsection Commands
  11788. This filter supports the following commands:
  11789. @table @option
  11790. @item width, w
  11791. @item height, h
  11792. Set the output video dimension expression.
  11793. The command accepts the same syntax of the corresponding option.
  11794. If the specified expression is not valid, it is kept at its current
  11795. value.
  11796. @end table
  11797. @section scale_npp
  11798. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11799. format conversion on CUDA video frames. Setting the output width and height
  11800. works in the same way as for the @var{scale} filter.
  11801. The following additional options are accepted:
  11802. @table @option
  11803. @item format
  11804. The pixel format of the output CUDA frames. If set to the string "same" (the
  11805. default), the input format will be kept. Note that automatic format negotiation
  11806. and conversion is not yet supported for hardware frames
  11807. @item interp_algo
  11808. The interpolation algorithm used for resizing. One of the following:
  11809. @table @option
  11810. @item nn
  11811. Nearest neighbour.
  11812. @item linear
  11813. @item cubic
  11814. @item cubic2p_bspline
  11815. 2-parameter cubic (B=1, C=0)
  11816. @item cubic2p_catmullrom
  11817. 2-parameter cubic (B=0, C=1/2)
  11818. @item cubic2p_b05c03
  11819. 2-parameter cubic (B=1/2, C=3/10)
  11820. @item super
  11821. Supersampling
  11822. @item lanczos
  11823. @end table
  11824. @end table
  11825. @section scale2ref
  11826. Scale (resize) the input video, based on a reference video.
  11827. See the scale filter for available options, scale2ref supports the same but
  11828. uses the reference video instead of the main input as basis. scale2ref also
  11829. supports the following additional constants for the @option{w} and
  11830. @option{h} options:
  11831. @table @var
  11832. @item main_w
  11833. @item main_h
  11834. The main input video's width and height
  11835. @item main_a
  11836. The same as @var{main_w} / @var{main_h}
  11837. @item main_sar
  11838. The main input video's sample aspect ratio
  11839. @item main_dar, mdar
  11840. The main input video's display aspect ratio. Calculated from
  11841. @code{(main_w / main_h) * main_sar}.
  11842. @item main_hsub
  11843. @item main_vsub
  11844. The main input video's horizontal and vertical chroma subsample values.
  11845. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11846. is 1.
  11847. @end table
  11848. @subsection Examples
  11849. @itemize
  11850. @item
  11851. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11852. @example
  11853. 'scale2ref[b][a];[a][b]overlay'
  11854. @end example
  11855. @item
  11856. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  11857. @example
  11858. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  11859. @end example
  11860. @end itemize
  11861. @anchor{selectivecolor}
  11862. @section selectivecolor
  11863. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11864. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11865. by the "purity" of the color (that is, how saturated it already is).
  11866. This filter is similar to the Adobe Photoshop Selective Color tool.
  11867. The filter accepts the following options:
  11868. @table @option
  11869. @item correction_method
  11870. Select color correction method.
  11871. Available values are:
  11872. @table @samp
  11873. @item absolute
  11874. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11875. component value).
  11876. @item relative
  11877. Specified adjustments are relative to the original component value.
  11878. @end table
  11879. Default is @code{absolute}.
  11880. @item reds
  11881. Adjustments for red pixels (pixels where the red component is the maximum)
  11882. @item yellows
  11883. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11884. @item greens
  11885. Adjustments for green pixels (pixels where the green component is the maximum)
  11886. @item cyans
  11887. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11888. @item blues
  11889. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11890. @item magentas
  11891. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11892. @item whites
  11893. Adjustments for white pixels (pixels where all components are greater than 128)
  11894. @item neutrals
  11895. Adjustments for all pixels except pure black and pure white
  11896. @item blacks
  11897. Adjustments for black pixels (pixels where all components are lesser than 128)
  11898. @item psfile
  11899. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11900. @end table
  11901. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11902. 4 space separated floating point adjustment values in the [-1,1] range,
  11903. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11904. pixels of its range.
  11905. @subsection Examples
  11906. @itemize
  11907. @item
  11908. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11909. increase magenta by 27% in blue areas:
  11910. @example
  11911. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11912. @end example
  11913. @item
  11914. Use a Photoshop selective color preset:
  11915. @example
  11916. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11917. @end example
  11918. @end itemize
  11919. @anchor{separatefields}
  11920. @section separatefields
  11921. The @code{separatefields} takes a frame-based video input and splits
  11922. each frame into its components fields, producing a new half height clip
  11923. with twice the frame rate and twice the frame count.
  11924. This filter use field-dominance information in frame to decide which
  11925. of each pair of fields to place first in the output.
  11926. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11927. @section setdar, setsar
  11928. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11929. output video.
  11930. This is done by changing the specified Sample (aka Pixel) Aspect
  11931. Ratio, according to the following equation:
  11932. @example
  11933. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11934. @end example
  11935. Keep in mind that the @code{setdar} filter does not modify the pixel
  11936. dimensions of the video frame. Also, the display aspect ratio set by
  11937. this filter may be changed by later filters in the filterchain,
  11938. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11939. applied.
  11940. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11941. the filter output video.
  11942. Note that as a consequence of the application of this filter, the
  11943. output display aspect ratio will change according to the equation
  11944. above.
  11945. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11946. filter may be changed by later filters in the filterchain, e.g. if
  11947. another "setsar" or a "setdar" filter is applied.
  11948. It accepts the following parameters:
  11949. @table @option
  11950. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11951. Set the aspect ratio used by the filter.
  11952. The parameter can be a floating point number string, an expression, or
  11953. a string of the form @var{num}:@var{den}, where @var{num} and
  11954. @var{den} are the numerator and denominator of the aspect ratio. If
  11955. the parameter is not specified, it is assumed the value "0".
  11956. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11957. should be escaped.
  11958. @item max
  11959. Set the maximum integer value to use for expressing numerator and
  11960. denominator when reducing the expressed aspect ratio to a rational.
  11961. Default value is @code{100}.
  11962. @end table
  11963. The parameter @var{sar} is an expression containing
  11964. the following constants:
  11965. @table @option
  11966. @item E, PI, PHI
  11967. These are approximated values for the mathematical constants e
  11968. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11969. @item w, h
  11970. The input width and height.
  11971. @item a
  11972. These are the same as @var{w} / @var{h}.
  11973. @item sar
  11974. The input sample aspect ratio.
  11975. @item dar
  11976. The input display aspect ratio. It is the same as
  11977. (@var{w} / @var{h}) * @var{sar}.
  11978. @item hsub, vsub
  11979. Horizontal and vertical chroma subsample values. For example, for the
  11980. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11981. @end table
  11982. @subsection Examples
  11983. @itemize
  11984. @item
  11985. To change the display aspect ratio to 16:9, specify one of the following:
  11986. @example
  11987. setdar=dar=1.77777
  11988. setdar=dar=16/9
  11989. @end example
  11990. @item
  11991. To change the sample aspect ratio to 10:11, specify:
  11992. @example
  11993. setsar=sar=10/11
  11994. @end example
  11995. @item
  11996. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11997. 1000 in the aspect ratio reduction, use the command:
  11998. @example
  11999. setdar=ratio=16/9:max=1000
  12000. @end example
  12001. @end itemize
  12002. @anchor{setfield}
  12003. @section setfield
  12004. Force field for the output video frame.
  12005. The @code{setfield} filter marks the interlace type field for the
  12006. output frames. It does not change the input frame, but only sets the
  12007. corresponding property, which affects how the frame is treated by
  12008. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12009. The filter accepts the following options:
  12010. @table @option
  12011. @item mode
  12012. Available values are:
  12013. @table @samp
  12014. @item auto
  12015. Keep the same field property.
  12016. @item bff
  12017. Mark the frame as bottom-field-first.
  12018. @item tff
  12019. Mark the frame as top-field-first.
  12020. @item prog
  12021. Mark the frame as progressive.
  12022. @end table
  12023. @end table
  12024. @anchor{setparams}
  12025. @section setparams
  12026. Force frame parameter for the output video frame.
  12027. The @code{setparams} filter marks interlace and color range for the
  12028. output frames. It does not change the input frame, but only sets the
  12029. corresponding property, which affects how the frame is treated by
  12030. filters/encoders.
  12031. @table @option
  12032. @item field_mode
  12033. Available values are:
  12034. @table @samp
  12035. @item auto
  12036. Keep the same field property (default).
  12037. @item bff
  12038. Mark the frame as bottom-field-first.
  12039. @item tff
  12040. Mark the frame as top-field-first.
  12041. @item prog
  12042. Mark the frame as progressive.
  12043. @end table
  12044. @item range
  12045. Available values are:
  12046. @table @samp
  12047. @item auto
  12048. Keep the same color range property (default).
  12049. @item unspecified, unknown
  12050. Mark the frame as unspecified color range.
  12051. @item limited, tv, mpeg
  12052. Mark the frame as limited range.
  12053. @item full, pc, jpeg
  12054. Mark the frame as full range.
  12055. @end table
  12056. @item color_primaries
  12057. Set the color primaries.
  12058. Available values are:
  12059. @table @samp
  12060. @item auto
  12061. Keep the same color primaries property (default).
  12062. @item bt709
  12063. @item unknown
  12064. @item bt470m
  12065. @item bt470bg
  12066. @item smpte170m
  12067. @item smpte240m
  12068. @item film
  12069. @item bt2020
  12070. @item smpte428
  12071. @item smpte431
  12072. @item smpte432
  12073. @item jedec-p22
  12074. @end table
  12075. @item color_trc
  12076. Set the color transfer.
  12077. Available values are:
  12078. @table @samp
  12079. @item auto
  12080. Keep the same color trc property (default).
  12081. @item bt709
  12082. @item unknown
  12083. @item bt470m
  12084. @item bt470bg
  12085. @item smpte170m
  12086. @item smpte240m
  12087. @item linear
  12088. @item log100
  12089. @item log316
  12090. @item iec61966-2-4
  12091. @item bt1361e
  12092. @item iec61966-2-1
  12093. @item bt2020-10
  12094. @item bt2020-12
  12095. @item smpte2084
  12096. @item smpte428
  12097. @item arib-std-b67
  12098. @end table
  12099. @item colorspace
  12100. Set the colorspace.
  12101. Available values are:
  12102. @table @samp
  12103. @item auto
  12104. Keep the same colorspace property (default).
  12105. @item gbr
  12106. @item bt709
  12107. @item unknown
  12108. @item fcc
  12109. @item bt470bg
  12110. @item smpte170m
  12111. @item smpte240m
  12112. @item ycgco
  12113. @item bt2020nc
  12114. @item bt2020c
  12115. @item smpte2085
  12116. @item chroma-derived-nc
  12117. @item chroma-derived-c
  12118. @item ictcp
  12119. @end table
  12120. @end table
  12121. @section showinfo
  12122. Show a line containing various information for each input video frame.
  12123. The input video is not modified.
  12124. This filter supports the following options:
  12125. @table @option
  12126. @item checksum
  12127. Calculate checksums of each plane. By default enabled.
  12128. @end table
  12129. The shown line contains a sequence of key/value pairs of the form
  12130. @var{key}:@var{value}.
  12131. The following values are shown in the output:
  12132. @table @option
  12133. @item n
  12134. The (sequential) number of the input frame, starting from 0.
  12135. @item pts
  12136. The Presentation TimeStamp of the input frame, expressed as a number of
  12137. time base units. The time base unit depends on the filter input pad.
  12138. @item pts_time
  12139. The Presentation TimeStamp of the input frame, expressed as a number of
  12140. seconds.
  12141. @item pos
  12142. The position of the frame in the input stream, or -1 if this information is
  12143. unavailable and/or meaningless (for example in case of synthetic video).
  12144. @item fmt
  12145. The pixel format name.
  12146. @item sar
  12147. The sample aspect ratio of the input frame, expressed in the form
  12148. @var{num}/@var{den}.
  12149. @item s
  12150. The size of the input frame. For the syntax of this option, check the
  12151. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12152. @item i
  12153. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12154. for bottom field first).
  12155. @item iskey
  12156. This is 1 if the frame is a key frame, 0 otherwise.
  12157. @item type
  12158. The picture type of the input frame ("I" for an I-frame, "P" for a
  12159. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12160. Also refer to the documentation of the @code{AVPictureType} enum and of
  12161. the @code{av_get_picture_type_char} function defined in
  12162. @file{libavutil/avutil.h}.
  12163. @item checksum
  12164. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12165. @item plane_checksum
  12166. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12167. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12168. @end table
  12169. @section showpalette
  12170. Displays the 256 colors palette of each frame. This filter is only relevant for
  12171. @var{pal8} pixel format frames.
  12172. It accepts the following option:
  12173. @table @option
  12174. @item s
  12175. Set the size of the box used to represent one palette color entry. Default is
  12176. @code{30} (for a @code{30x30} pixel box).
  12177. @end table
  12178. @section shuffleframes
  12179. Reorder and/or duplicate and/or drop video frames.
  12180. It accepts the following parameters:
  12181. @table @option
  12182. @item mapping
  12183. Set the destination indexes of input frames.
  12184. This is space or '|' separated list of indexes that maps input frames to output
  12185. frames. Number of indexes also sets maximal value that each index may have.
  12186. '-1' index have special meaning and that is to drop frame.
  12187. @end table
  12188. The first frame has the index 0. The default is to keep the input unchanged.
  12189. @subsection Examples
  12190. @itemize
  12191. @item
  12192. Swap second and third frame of every three frames of the input:
  12193. @example
  12194. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12195. @end example
  12196. @item
  12197. Swap 10th and 1st frame of every ten frames of the input:
  12198. @example
  12199. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12200. @end example
  12201. @end itemize
  12202. @section shuffleplanes
  12203. Reorder and/or duplicate video planes.
  12204. It accepts the following parameters:
  12205. @table @option
  12206. @item map0
  12207. The index of the input plane to be used as the first output plane.
  12208. @item map1
  12209. The index of the input plane to be used as the second output plane.
  12210. @item map2
  12211. The index of the input plane to be used as the third output plane.
  12212. @item map3
  12213. The index of the input plane to be used as the fourth output plane.
  12214. @end table
  12215. The first plane has the index 0. The default is to keep the input unchanged.
  12216. @subsection Examples
  12217. @itemize
  12218. @item
  12219. Swap the second and third planes of the input:
  12220. @example
  12221. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12222. @end example
  12223. @end itemize
  12224. @anchor{signalstats}
  12225. @section signalstats
  12226. Evaluate various visual metrics that assist in determining issues associated
  12227. with the digitization of analog video media.
  12228. By default the filter will log these metadata values:
  12229. @table @option
  12230. @item YMIN
  12231. Display the minimal Y value contained within the input frame. Expressed in
  12232. range of [0-255].
  12233. @item YLOW
  12234. Display the Y value at the 10% percentile within the input frame. Expressed in
  12235. range of [0-255].
  12236. @item YAVG
  12237. Display the average Y value within the input frame. Expressed in range of
  12238. [0-255].
  12239. @item YHIGH
  12240. Display the Y value at the 90% percentile within the input frame. Expressed in
  12241. range of [0-255].
  12242. @item YMAX
  12243. Display the maximum Y value contained within the input frame. Expressed in
  12244. range of [0-255].
  12245. @item UMIN
  12246. Display the minimal U value contained within the input frame. Expressed in
  12247. range of [0-255].
  12248. @item ULOW
  12249. Display the U value at the 10% percentile within the input frame. Expressed in
  12250. range of [0-255].
  12251. @item UAVG
  12252. Display the average U value within the input frame. Expressed in range of
  12253. [0-255].
  12254. @item UHIGH
  12255. Display the U value at the 90% percentile within the input frame. Expressed in
  12256. range of [0-255].
  12257. @item UMAX
  12258. Display the maximum U value contained within the input frame. Expressed in
  12259. range of [0-255].
  12260. @item VMIN
  12261. Display the minimal V value contained within the input frame. Expressed in
  12262. range of [0-255].
  12263. @item VLOW
  12264. Display the V value at the 10% percentile within the input frame. Expressed in
  12265. range of [0-255].
  12266. @item VAVG
  12267. Display the average V value within the input frame. Expressed in range of
  12268. [0-255].
  12269. @item VHIGH
  12270. Display the V value at the 90% percentile within the input frame. Expressed in
  12271. range of [0-255].
  12272. @item VMAX
  12273. Display the maximum V value contained within the input frame. Expressed in
  12274. range of [0-255].
  12275. @item SATMIN
  12276. Display the minimal saturation value contained within the input frame.
  12277. Expressed in range of [0-~181.02].
  12278. @item SATLOW
  12279. Display the saturation value at the 10% percentile within the input frame.
  12280. Expressed in range of [0-~181.02].
  12281. @item SATAVG
  12282. Display the average saturation value within the input frame. Expressed in range
  12283. of [0-~181.02].
  12284. @item SATHIGH
  12285. Display the saturation value at the 90% percentile within the input frame.
  12286. Expressed in range of [0-~181.02].
  12287. @item SATMAX
  12288. Display the maximum saturation value contained within the input frame.
  12289. Expressed in range of [0-~181.02].
  12290. @item HUEMED
  12291. Display the median value for hue within the input frame. Expressed in range of
  12292. [0-360].
  12293. @item HUEAVG
  12294. Display the average value for hue within the input frame. Expressed in range of
  12295. [0-360].
  12296. @item YDIF
  12297. Display the average of sample value difference between all values of the Y
  12298. plane in the current frame and corresponding values of the previous input frame.
  12299. Expressed in range of [0-255].
  12300. @item UDIF
  12301. Display the average of sample value difference between all values of the U
  12302. plane in the current frame and corresponding values of the previous input frame.
  12303. Expressed in range of [0-255].
  12304. @item VDIF
  12305. Display the average of sample value difference between all values of the V
  12306. plane in the current frame and corresponding values of the previous input frame.
  12307. Expressed in range of [0-255].
  12308. @item YBITDEPTH
  12309. Display bit depth of Y plane in current frame.
  12310. Expressed in range of [0-16].
  12311. @item UBITDEPTH
  12312. Display bit depth of U plane in current frame.
  12313. Expressed in range of [0-16].
  12314. @item VBITDEPTH
  12315. Display bit depth of V plane in current frame.
  12316. Expressed in range of [0-16].
  12317. @end table
  12318. The filter accepts the following options:
  12319. @table @option
  12320. @item stat
  12321. @item out
  12322. @option{stat} specify an additional form of image analysis.
  12323. @option{out} output video with the specified type of pixel highlighted.
  12324. Both options accept the following values:
  12325. @table @samp
  12326. @item tout
  12327. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12328. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12329. include the results of video dropouts, head clogs, or tape tracking issues.
  12330. @item vrep
  12331. Identify @var{vertical line repetition}. Vertical line repetition includes
  12332. similar rows of pixels within a frame. In born-digital video vertical line
  12333. repetition is common, but this pattern is uncommon in video digitized from an
  12334. analog source. When it occurs in video that results from the digitization of an
  12335. analog source it can indicate concealment from a dropout compensator.
  12336. @item brng
  12337. Identify pixels that fall outside of legal broadcast range.
  12338. @end table
  12339. @item color, c
  12340. Set the highlight color for the @option{out} option. The default color is
  12341. yellow.
  12342. @end table
  12343. @subsection Examples
  12344. @itemize
  12345. @item
  12346. Output data of various video metrics:
  12347. @example
  12348. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12349. @end example
  12350. @item
  12351. Output specific data about the minimum and maximum values of the Y plane per frame:
  12352. @example
  12353. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12354. @end example
  12355. @item
  12356. Playback video while highlighting pixels that are outside of broadcast range in red.
  12357. @example
  12358. ffplay example.mov -vf signalstats="out=brng:color=red"
  12359. @end example
  12360. @item
  12361. Playback video with signalstats metadata drawn over the frame.
  12362. @example
  12363. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12364. @end example
  12365. The contents of signalstat_drawtext.txt used in the command are:
  12366. @example
  12367. time %@{pts:hms@}
  12368. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12369. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12370. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12371. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12372. @end example
  12373. @end itemize
  12374. @anchor{signature}
  12375. @section signature
  12376. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12377. input. In this case the matching between the inputs can be calculated additionally.
  12378. The filter always passes through the first input. The signature of each stream can
  12379. be written into a file.
  12380. It accepts the following options:
  12381. @table @option
  12382. @item detectmode
  12383. Enable or disable the matching process.
  12384. Available values are:
  12385. @table @samp
  12386. @item off
  12387. Disable the calculation of a matching (default).
  12388. @item full
  12389. Calculate the matching for the whole video and output whether the whole video
  12390. matches or only parts.
  12391. @item fast
  12392. Calculate only until a matching is found or the video ends. Should be faster in
  12393. some cases.
  12394. @end table
  12395. @item nb_inputs
  12396. Set the number of inputs. The option value must be a non negative integer.
  12397. Default value is 1.
  12398. @item filename
  12399. Set the path to which the output is written. If there is more than one input,
  12400. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12401. integer), that will be replaced with the input number. If no filename is
  12402. specified, no output will be written. This is the default.
  12403. @item format
  12404. Choose the output format.
  12405. Available values are:
  12406. @table @samp
  12407. @item binary
  12408. Use the specified binary representation (default).
  12409. @item xml
  12410. Use the specified xml representation.
  12411. @end table
  12412. @item th_d
  12413. Set threshold to detect one word as similar. The option value must be an integer
  12414. greater than zero. The default value is 9000.
  12415. @item th_dc
  12416. Set threshold to detect all words as similar. The option value must be an integer
  12417. greater than zero. The default value is 60000.
  12418. @item th_xh
  12419. Set threshold to detect frames as similar. The option value must be an integer
  12420. greater than zero. The default value is 116.
  12421. @item th_di
  12422. Set the minimum length of a sequence in frames to recognize it as matching
  12423. sequence. The option value must be a non negative integer value.
  12424. The default value is 0.
  12425. @item th_it
  12426. Set the minimum relation, that matching frames to all frames must have.
  12427. The option value must be a double value between 0 and 1. The default value is 0.5.
  12428. @end table
  12429. @subsection Examples
  12430. @itemize
  12431. @item
  12432. To calculate the signature of an input video and store it in signature.bin:
  12433. @example
  12434. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12435. @end example
  12436. @item
  12437. To detect whether two videos match and store the signatures in XML format in
  12438. signature0.xml and signature1.xml:
  12439. @example
  12440. 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 -
  12441. @end example
  12442. @end itemize
  12443. @anchor{smartblur}
  12444. @section smartblur
  12445. Blur the input video without impacting the outlines.
  12446. It accepts the following options:
  12447. @table @option
  12448. @item luma_radius, lr
  12449. Set the luma radius. The option value must be a float number in
  12450. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12451. used to blur the image (slower if larger). Default value is 1.0.
  12452. @item luma_strength, ls
  12453. Set the luma strength. The option value must be a float number
  12454. in the range [-1.0,1.0] that configures the blurring. A value included
  12455. in [0.0,1.0] will blur the image whereas a value included in
  12456. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12457. @item luma_threshold, lt
  12458. Set the luma threshold used as a coefficient to determine
  12459. whether a pixel should be blurred or not. The option value must be an
  12460. integer in the range [-30,30]. A value of 0 will filter all the image,
  12461. a value included in [0,30] will filter flat areas and a value included
  12462. in [-30,0] will filter edges. Default value is 0.
  12463. @item chroma_radius, cr
  12464. Set the chroma radius. The option value must be a float number in
  12465. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12466. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12467. @item chroma_strength, cs
  12468. Set the chroma strength. The option value must be a float number
  12469. in the range [-1.0,1.0] that configures the blurring. A value included
  12470. in [0.0,1.0] will blur the image whereas a value included in
  12471. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12472. @item chroma_threshold, ct
  12473. Set the chroma threshold used as a coefficient to determine
  12474. whether a pixel should be blurred or not. The option value must be an
  12475. integer in the range [-30,30]. A value of 0 will filter all the image,
  12476. a value included in [0,30] will filter flat areas and a value included
  12477. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12478. @end table
  12479. If a chroma option is not explicitly set, the corresponding luma value
  12480. is set.
  12481. @section ssim
  12482. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12483. This filter takes in input two input videos, the first input is
  12484. considered the "main" source and is passed unchanged to the
  12485. output. The second input is used as a "reference" video for computing
  12486. the SSIM.
  12487. Both video inputs must have the same resolution and pixel format for
  12488. this filter to work correctly. Also it assumes that both inputs
  12489. have the same number of frames, which are compared one by one.
  12490. The filter stores the calculated SSIM of each frame.
  12491. The description of the accepted parameters follows.
  12492. @table @option
  12493. @item stats_file, f
  12494. If specified the filter will use the named file to save the SSIM of
  12495. each individual frame. When filename equals "-" the data is sent to
  12496. standard output.
  12497. @end table
  12498. The file printed if @var{stats_file} is selected, contains a sequence of
  12499. key/value pairs of the form @var{key}:@var{value} for each compared
  12500. couple of frames.
  12501. A description of each shown parameter follows:
  12502. @table @option
  12503. @item n
  12504. sequential number of the input frame, starting from 1
  12505. @item Y, U, V, R, G, B
  12506. SSIM of the compared frames for the component specified by the suffix.
  12507. @item All
  12508. SSIM of the compared frames for the whole frame.
  12509. @item dB
  12510. Same as above but in dB representation.
  12511. @end table
  12512. This filter also supports the @ref{framesync} options.
  12513. For example:
  12514. @example
  12515. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12516. [main][ref] ssim="stats_file=stats.log" [out]
  12517. @end example
  12518. On this example the input file being processed is compared with the
  12519. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12520. is stored in @file{stats.log}.
  12521. Another example with both psnr and ssim at same time:
  12522. @example
  12523. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12524. @end example
  12525. @section stereo3d
  12526. Convert between different stereoscopic image formats.
  12527. The filters accept the following options:
  12528. @table @option
  12529. @item in
  12530. Set stereoscopic image format of input.
  12531. Available values for input image formats are:
  12532. @table @samp
  12533. @item sbsl
  12534. side by side parallel (left eye left, right eye right)
  12535. @item sbsr
  12536. side by side crosseye (right eye left, left eye right)
  12537. @item sbs2l
  12538. side by side parallel with half width resolution
  12539. (left eye left, right eye right)
  12540. @item sbs2r
  12541. side by side crosseye with half width resolution
  12542. (right eye left, left eye right)
  12543. @item abl
  12544. above-below (left eye above, right eye below)
  12545. @item abr
  12546. above-below (right eye above, left eye below)
  12547. @item ab2l
  12548. above-below with half height resolution
  12549. (left eye above, right eye below)
  12550. @item ab2r
  12551. above-below with half height resolution
  12552. (right eye above, left eye below)
  12553. @item al
  12554. alternating frames (left eye first, right eye second)
  12555. @item ar
  12556. alternating frames (right eye first, left eye second)
  12557. @item irl
  12558. interleaved rows (left eye has top row, right eye starts on next row)
  12559. @item irr
  12560. interleaved rows (right eye has top row, left eye starts on next row)
  12561. @item icl
  12562. interleaved columns, left eye first
  12563. @item icr
  12564. interleaved columns, right eye first
  12565. Default value is @samp{sbsl}.
  12566. @end table
  12567. @item out
  12568. Set stereoscopic image format of output.
  12569. @table @samp
  12570. @item sbsl
  12571. side by side parallel (left eye left, right eye right)
  12572. @item sbsr
  12573. side by side crosseye (right eye left, left eye right)
  12574. @item sbs2l
  12575. side by side parallel with half width resolution
  12576. (left eye left, right eye right)
  12577. @item sbs2r
  12578. side by side crosseye with half width resolution
  12579. (right eye left, left eye right)
  12580. @item abl
  12581. above-below (left eye above, right eye below)
  12582. @item abr
  12583. above-below (right eye above, left eye below)
  12584. @item ab2l
  12585. above-below with half height resolution
  12586. (left eye above, right eye below)
  12587. @item ab2r
  12588. above-below with half height resolution
  12589. (right eye above, left eye below)
  12590. @item al
  12591. alternating frames (left eye first, right eye second)
  12592. @item ar
  12593. alternating frames (right eye first, left eye second)
  12594. @item irl
  12595. interleaved rows (left eye has top row, right eye starts on next row)
  12596. @item irr
  12597. interleaved rows (right eye has top row, left eye starts on next row)
  12598. @item arbg
  12599. anaglyph red/blue gray
  12600. (red filter on left eye, blue filter on right eye)
  12601. @item argg
  12602. anaglyph red/green gray
  12603. (red filter on left eye, green filter on right eye)
  12604. @item arcg
  12605. anaglyph red/cyan gray
  12606. (red filter on left eye, cyan filter on right eye)
  12607. @item arch
  12608. anaglyph red/cyan half colored
  12609. (red filter on left eye, cyan filter on right eye)
  12610. @item arcc
  12611. anaglyph red/cyan color
  12612. (red filter on left eye, cyan filter on right eye)
  12613. @item arcd
  12614. anaglyph red/cyan color optimized with the least squares projection of dubois
  12615. (red filter on left eye, cyan filter on right eye)
  12616. @item agmg
  12617. anaglyph green/magenta gray
  12618. (green filter on left eye, magenta filter on right eye)
  12619. @item agmh
  12620. anaglyph green/magenta half colored
  12621. (green filter on left eye, magenta filter on right eye)
  12622. @item agmc
  12623. anaglyph green/magenta colored
  12624. (green filter on left eye, magenta filter on right eye)
  12625. @item agmd
  12626. anaglyph green/magenta color optimized with the least squares projection of dubois
  12627. (green filter on left eye, magenta filter on right eye)
  12628. @item aybg
  12629. anaglyph yellow/blue gray
  12630. (yellow filter on left eye, blue filter on right eye)
  12631. @item aybh
  12632. anaglyph yellow/blue half colored
  12633. (yellow filter on left eye, blue filter on right eye)
  12634. @item aybc
  12635. anaglyph yellow/blue colored
  12636. (yellow filter on left eye, blue filter on right eye)
  12637. @item aybd
  12638. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12639. (yellow filter on left eye, blue filter on right eye)
  12640. @item ml
  12641. mono output (left eye only)
  12642. @item mr
  12643. mono output (right eye only)
  12644. @item chl
  12645. checkerboard, left eye first
  12646. @item chr
  12647. checkerboard, right eye first
  12648. @item icl
  12649. interleaved columns, left eye first
  12650. @item icr
  12651. interleaved columns, right eye first
  12652. @item hdmi
  12653. HDMI frame pack
  12654. @end table
  12655. Default value is @samp{arcd}.
  12656. @end table
  12657. @subsection Examples
  12658. @itemize
  12659. @item
  12660. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12661. @example
  12662. stereo3d=sbsl:aybd
  12663. @end example
  12664. @item
  12665. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12666. @example
  12667. stereo3d=abl:sbsr
  12668. @end example
  12669. @end itemize
  12670. @section streamselect, astreamselect
  12671. Select video or audio streams.
  12672. The filter accepts the following options:
  12673. @table @option
  12674. @item inputs
  12675. Set number of inputs. Default is 2.
  12676. @item map
  12677. Set input indexes to remap to outputs.
  12678. @end table
  12679. @subsection Commands
  12680. The @code{streamselect} and @code{astreamselect} filter supports the following
  12681. commands:
  12682. @table @option
  12683. @item map
  12684. Set input indexes to remap to outputs.
  12685. @end table
  12686. @subsection Examples
  12687. @itemize
  12688. @item
  12689. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12690. @example
  12691. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12692. @end example
  12693. @item
  12694. Same as above, but for audio:
  12695. @example
  12696. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12697. @end example
  12698. @end itemize
  12699. @section sobel
  12700. Apply sobel operator to input video stream.
  12701. The filter accepts the following option:
  12702. @table @option
  12703. @item planes
  12704. Set which planes will be processed, unprocessed planes will be copied.
  12705. By default value 0xf, all planes will be processed.
  12706. @item scale
  12707. Set value which will be multiplied with filtered result.
  12708. @item delta
  12709. Set value which will be added to filtered result.
  12710. @end table
  12711. @anchor{spp}
  12712. @section spp
  12713. Apply a simple postprocessing filter that compresses and decompresses the image
  12714. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12715. and average the results.
  12716. The filter accepts the following options:
  12717. @table @option
  12718. @item quality
  12719. Set quality. This option defines the number of levels for averaging. It accepts
  12720. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12721. effect. A value of @code{6} means the higher quality. For each increment of
  12722. that value the speed drops by a factor of approximately 2. Default value is
  12723. @code{3}.
  12724. @item qp
  12725. Force a constant quantization parameter. If not set, the filter will use the QP
  12726. from the video stream (if available).
  12727. @item mode
  12728. Set thresholding mode. Available modes are:
  12729. @table @samp
  12730. @item hard
  12731. Set hard thresholding (default).
  12732. @item soft
  12733. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12734. @end table
  12735. @item use_bframe_qp
  12736. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12737. option may cause flicker since the B-Frames have often larger QP. Default is
  12738. @code{0} (not enabled).
  12739. @end table
  12740. @section sr
  12741. Scale the input by applying one of the super-resolution methods based on
  12742. convolutional neural networks. Supported models:
  12743. @itemize
  12744. @item
  12745. Super-Resolution Convolutional Neural Network model (SRCNN).
  12746. See @url{https://arxiv.org/abs/1501.00092}.
  12747. @item
  12748. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12749. See @url{https://arxiv.org/abs/1609.05158}.
  12750. @end itemize
  12751. Training scripts as well as scripts for model file (.pb) saving can be found at
  12752. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  12753. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12754. Native model files (.model) can be generated from TensorFlow model
  12755. files (.pb) by using tools/python/convert.py
  12756. The filter accepts the following options:
  12757. @table @option
  12758. @item dnn_backend
  12759. Specify which DNN backend to use for model loading and execution. This option accepts
  12760. the following values:
  12761. @table @samp
  12762. @item native
  12763. Native implementation of DNN loading and execution.
  12764. @item tensorflow
  12765. TensorFlow backend. To enable this backend you
  12766. need to install the TensorFlow for C library (see
  12767. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12768. @code{--enable-libtensorflow}
  12769. @end table
  12770. Default value is @samp{native}.
  12771. @item model
  12772. Set path to model file specifying network architecture and its parameters.
  12773. Note that different backends use different file formats. TensorFlow backend
  12774. can load files for both formats, while native backend can load files for only
  12775. its format.
  12776. @item scale_factor
  12777. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12778. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12779. input upscaled using bicubic upscaling with proper scale factor.
  12780. @end table
  12781. @anchor{subtitles}
  12782. @section subtitles
  12783. Draw subtitles on top of input video using the libass library.
  12784. To enable compilation of this filter you need to configure FFmpeg with
  12785. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12786. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12787. Alpha) subtitles format.
  12788. The filter accepts the following options:
  12789. @table @option
  12790. @item filename, f
  12791. Set the filename of the subtitle file to read. It must be specified.
  12792. @item original_size
  12793. Specify the size of the original video, the video for which the ASS file
  12794. was composed. For the syntax of this option, check the
  12795. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12796. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12797. correctly scale the fonts if the aspect ratio has been changed.
  12798. @item fontsdir
  12799. Set a directory path containing fonts that can be used by the filter.
  12800. These fonts will be used in addition to whatever the font provider uses.
  12801. @item alpha
  12802. Process alpha channel, by default alpha channel is untouched.
  12803. @item charenc
  12804. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12805. useful if not UTF-8.
  12806. @item stream_index, si
  12807. Set subtitles stream index. @code{subtitles} filter only.
  12808. @item force_style
  12809. Override default style or script info parameters of the subtitles. It accepts a
  12810. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12811. @end table
  12812. If the first key is not specified, it is assumed that the first value
  12813. specifies the @option{filename}.
  12814. For example, to render the file @file{sub.srt} on top of the input
  12815. video, use the command:
  12816. @example
  12817. subtitles=sub.srt
  12818. @end example
  12819. which is equivalent to:
  12820. @example
  12821. subtitles=filename=sub.srt
  12822. @end example
  12823. To render the default subtitles stream from file @file{video.mkv}, use:
  12824. @example
  12825. subtitles=video.mkv
  12826. @end example
  12827. To render the second subtitles stream from that file, use:
  12828. @example
  12829. subtitles=video.mkv:si=1
  12830. @end example
  12831. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12832. @code{DejaVu Serif}, use:
  12833. @example
  12834. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12835. @end example
  12836. @section super2xsai
  12837. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12838. Interpolate) pixel art scaling algorithm.
  12839. Useful for enlarging pixel art images without reducing sharpness.
  12840. @section swaprect
  12841. Swap two rectangular objects in video.
  12842. This filter accepts the following options:
  12843. @table @option
  12844. @item w
  12845. Set object width.
  12846. @item h
  12847. Set object height.
  12848. @item x1
  12849. Set 1st rect x coordinate.
  12850. @item y1
  12851. Set 1st rect y coordinate.
  12852. @item x2
  12853. Set 2nd rect x coordinate.
  12854. @item y2
  12855. Set 2nd rect y coordinate.
  12856. All expressions are evaluated once for each frame.
  12857. @end table
  12858. The all options are expressions containing the following constants:
  12859. @table @option
  12860. @item w
  12861. @item h
  12862. The input width and height.
  12863. @item a
  12864. same as @var{w} / @var{h}
  12865. @item sar
  12866. input sample aspect ratio
  12867. @item dar
  12868. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12869. @item n
  12870. The number of the input frame, starting from 0.
  12871. @item t
  12872. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12873. @item pos
  12874. the position in the file of the input frame, NAN if unknown
  12875. @end table
  12876. @section swapuv
  12877. Swap U & V plane.
  12878. @section telecine
  12879. Apply telecine process to the video.
  12880. This filter accepts the following options:
  12881. @table @option
  12882. @item first_field
  12883. @table @samp
  12884. @item top, t
  12885. top field first
  12886. @item bottom, b
  12887. bottom field first
  12888. The default value is @code{top}.
  12889. @end table
  12890. @item pattern
  12891. A string of numbers representing the pulldown pattern you wish to apply.
  12892. The default value is @code{23}.
  12893. @end table
  12894. @example
  12895. Some typical patterns:
  12896. NTSC output (30i):
  12897. 27.5p: 32222
  12898. 24p: 23 (classic)
  12899. 24p: 2332 (preferred)
  12900. 20p: 33
  12901. 18p: 334
  12902. 16p: 3444
  12903. PAL output (25i):
  12904. 27.5p: 12222
  12905. 24p: 222222222223 ("Euro pulldown")
  12906. 16.67p: 33
  12907. 16p: 33333334
  12908. @end example
  12909. @section threshold
  12910. Apply threshold effect to video stream.
  12911. This filter needs four video streams to perform thresholding.
  12912. First stream is stream we are filtering.
  12913. Second stream is holding threshold values, third stream is holding min values,
  12914. and last, fourth stream is holding max values.
  12915. The filter accepts the following option:
  12916. @table @option
  12917. @item planes
  12918. Set which planes will be processed, unprocessed planes will be copied.
  12919. By default value 0xf, all planes will be processed.
  12920. @end table
  12921. For example if first stream pixel's component value is less then threshold value
  12922. of pixel component from 2nd threshold stream, third stream value will picked,
  12923. otherwise fourth stream pixel component value will be picked.
  12924. Using color source filter one can perform various types of thresholding:
  12925. @subsection Examples
  12926. @itemize
  12927. @item
  12928. Binary threshold, using gray color as threshold:
  12929. @example
  12930. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12931. @end example
  12932. @item
  12933. Inverted binary threshold, using gray color as threshold:
  12934. @example
  12935. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12936. @end example
  12937. @item
  12938. Truncate binary threshold, using gray color as threshold:
  12939. @example
  12940. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12941. @end example
  12942. @item
  12943. Threshold to zero, using gray color as threshold:
  12944. @example
  12945. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12946. @end example
  12947. @item
  12948. Inverted threshold to zero, using gray color as threshold:
  12949. @example
  12950. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12951. @end example
  12952. @end itemize
  12953. @section thumbnail
  12954. Select the most representative frame in a given sequence of consecutive frames.
  12955. The filter accepts the following options:
  12956. @table @option
  12957. @item n
  12958. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12959. will pick one of them, and then handle the next batch of @var{n} frames until
  12960. the end. Default is @code{100}.
  12961. @end table
  12962. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12963. value will result in a higher memory usage, so a high value is not recommended.
  12964. @subsection Examples
  12965. @itemize
  12966. @item
  12967. Extract one picture each 50 frames:
  12968. @example
  12969. thumbnail=50
  12970. @end example
  12971. @item
  12972. Complete example of a thumbnail creation with @command{ffmpeg}:
  12973. @example
  12974. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12975. @end example
  12976. @end itemize
  12977. @section tile
  12978. Tile several successive frames together.
  12979. The filter accepts the following options:
  12980. @table @option
  12981. @item layout
  12982. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12983. this option, check the
  12984. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12985. @item nb_frames
  12986. Set the maximum number of frames to render in the given area. It must be less
  12987. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12988. the area will be used.
  12989. @item margin
  12990. Set the outer border margin in pixels.
  12991. @item padding
  12992. Set the inner border thickness (i.e. the number of pixels between frames). For
  12993. more advanced padding options (such as having different values for the edges),
  12994. refer to the pad video filter.
  12995. @item color
  12996. Specify the color of the unused area. For the syntax of this option, check the
  12997. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12998. The default value of @var{color} is "black".
  12999. @item overlap
  13000. Set the number of frames to overlap when tiling several successive frames together.
  13001. The value must be between @code{0} and @var{nb_frames - 1}.
  13002. @item init_padding
  13003. Set the number of frames to initially be empty before displaying first output frame.
  13004. This controls how soon will one get first output frame.
  13005. The value must be between @code{0} and @var{nb_frames - 1}.
  13006. @end table
  13007. @subsection Examples
  13008. @itemize
  13009. @item
  13010. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13011. @example
  13012. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13013. @end example
  13014. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13015. duplicating each output frame to accommodate the originally detected frame
  13016. rate.
  13017. @item
  13018. Display @code{5} pictures in an area of @code{3x2} frames,
  13019. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13020. mixed flat and named options:
  13021. @example
  13022. tile=3x2:nb_frames=5:padding=7:margin=2
  13023. @end example
  13024. @end itemize
  13025. @section tinterlace
  13026. Perform various types of temporal field interlacing.
  13027. Frames are counted starting from 1, so the first input frame is
  13028. considered odd.
  13029. The filter accepts the following options:
  13030. @table @option
  13031. @item mode
  13032. Specify the mode of the interlacing. This option can also be specified
  13033. as a value alone. See below for a list of values for this option.
  13034. Available values are:
  13035. @table @samp
  13036. @item merge, 0
  13037. Move odd frames into the upper field, even into the lower field,
  13038. generating a double height frame at half frame rate.
  13039. @example
  13040. ------> time
  13041. Input:
  13042. Frame 1 Frame 2 Frame 3 Frame 4
  13043. 11111 22222 33333 44444
  13044. 11111 22222 33333 44444
  13045. 11111 22222 33333 44444
  13046. 11111 22222 33333 44444
  13047. Output:
  13048. 11111 33333
  13049. 22222 44444
  13050. 11111 33333
  13051. 22222 44444
  13052. 11111 33333
  13053. 22222 44444
  13054. 11111 33333
  13055. 22222 44444
  13056. @end example
  13057. @item drop_even, 1
  13058. Only output odd frames, even frames are dropped, generating a frame with
  13059. unchanged height at half frame rate.
  13060. @example
  13061. ------> time
  13062. Input:
  13063. Frame 1 Frame 2 Frame 3 Frame 4
  13064. 11111 22222 33333 44444
  13065. 11111 22222 33333 44444
  13066. 11111 22222 33333 44444
  13067. 11111 22222 33333 44444
  13068. Output:
  13069. 11111 33333
  13070. 11111 33333
  13071. 11111 33333
  13072. 11111 33333
  13073. @end example
  13074. @item drop_odd, 2
  13075. Only output even frames, odd frames are dropped, generating a frame with
  13076. unchanged height at half frame rate.
  13077. @example
  13078. ------> time
  13079. Input:
  13080. Frame 1 Frame 2 Frame 3 Frame 4
  13081. 11111 22222 33333 44444
  13082. 11111 22222 33333 44444
  13083. 11111 22222 33333 44444
  13084. 11111 22222 33333 44444
  13085. Output:
  13086. 22222 44444
  13087. 22222 44444
  13088. 22222 44444
  13089. 22222 44444
  13090. @end example
  13091. @item pad, 3
  13092. Expand each frame to full height, but pad alternate lines with black,
  13093. generating a frame with double height at the same input frame rate.
  13094. @example
  13095. ------> time
  13096. Input:
  13097. Frame 1 Frame 2 Frame 3 Frame 4
  13098. 11111 22222 33333 44444
  13099. 11111 22222 33333 44444
  13100. 11111 22222 33333 44444
  13101. 11111 22222 33333 44444
  13102. Output:
  13103. 11111 ..... 33333 .....
  13104. ..... 22222 ..... 44444
  13105. 11111 ..... 33333 .....
  13106. ..... 22222 ..... 44444
  13107. 11111 ..... 33333 .....
  13108. ..... 22222 ..... 44444
  13109. 11111 ..... 33333 .....
  13110. ..... 22222 ..... 44444
  13111. @end example
  13112. @item interleave_top, 4
  13113. Interleave the upper field from odd frames with the lower field from
  13114. even frames, generating a frame with unchanged height at half frame rate.
  13115. @example
  13116. ------> time
  13117. Input:
  13118. Frame 1 Frame 2 Frame 3 Frame 4
  13119. 11111<- 22222 33333<- 44444
  13120. 11111 22222<- 33333 44444<-
  13121. 11111<- 22222 33333<- 44444
  13122. 11111 22222<- 33333 44444<-
  13123. Output:
  13124. 11111 33333
  13125. 22222 44444
  13126. 11111 33333
  13127. 22222 44444
  13128. @end example
  13129. @item interleave_bottom, 5
  13130. Interleave the lower field from odd frames with the upper field from
  13131. even frames, generating a frame with unchanged height at half frame rate.
  13132. @example
  13133. ------> time
  13134. Input:
  13135. Frame 1 Frame 2 Frame 3 Frame 4
  13136. 11111 22222<- 33333 44444<-
  13137. 11111<- 22222 33333<- 44444
  13138. 11111 22222<- 33333 44444<-
  13139. 11111<- 22222 33333<- 44444
  13140. Output:
  13141. 22222 44444
  13142. 11111 33333
  13143. 22222 44444
  13144. 11111 33333
  13145. @end example
  13146. @item interlacex2, 6
  13147. Double frame rate with unchanged height. Frames are inserted each
  13148. containing the second temporal field from the previous input frame and
  13149. the first temporal field from the next input frame. This mode relies on
  13150. the top_field_first flag. Useful for interlaced video displays with no
  13151. field synchronisation.
  13152. @example
  13153. ------> time
  13154. Input:
  13155. Frame 1 Frame 2 Frame 3 Frame 4
  13156. 11111 22222 33333 44444
  13157. 11111 22222 33333 44444
  13158. 11111 22222 33333 44444
  13159. 11111 22222 33333 44444
  13160. Output:
  13161. 11111 22222 22222 33333 33333 44444 44444
  13162. 11111 11111 22222 22222 33333 33333 44444
  13163. 11111 22222 22222 33333 33333 44444 44444
  13164. 11111 11111 22222 22222 33333 33333 44444
  13165. @end example
  13166. @item mergex2, 7
  13167. Move odd frames into the upper field, even into the lower field,
  13168. generating a double height frame at same frame rate.
  13169. @example
  13170. ------> time
  13171. Input:
  13172. Frame 1 Frame 2 Frame 3 Frame 4
  13173. 11111 22222 33333 44444
  13174. 11111 22222 33333 44444
  13175. 11111 22222 33333 44444
  13176. 11111 22222 33333 44444
  13177. Output:
  13178. 11111 33333 33333 55555
  13179. 22222 22222 44444 44444
  13180. 11111 33333 33333 55555
  13181. 22222 22222 44444 44444
  13182. 11111 33333 33333 55555
  13183. 22222 22222 44444 44444
  13184. 11111 33333 33333 55555
  13185. 22222 22222 44444 44444
  13186. @end example
  13187. @end table
  13188. Numeric values are deprecated but are accepted for backward
  13189. compatibility reasons.
  13190. Default mode is @code{merge}.
  13191. @item flags
  13192. Specify flags influencing the filter process.
  13193. Available value for @var{flags} is:
  13194. @table @option
  13195. @item low_pass_filter, vlpf
  13196. Enable linear vertical low-pass filtering in the filter.
  13197. Vertical low-pass filtering is required when creating an interlaced
  13198. destination from a progressive source which contains high-frequency
  13199. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13200. patterning.
  13201. @item complex_filter, cvlpf
  13202. Enable complex vertical low-pass filtering.
  13203. This will slightly less reduce interlace 'twitter' and Moire
  13204. patterning but better retain detail and subjective sharpness impression.
  13205. @end table
  13206. Vertical low-pass filtering can only be enabled for @option{mode}
  13207. @var{interleave_top} and @var{interleave_bottom}.
  13208. @end table
  13209. @section tmix
  13210. Mix successive video frames.
  13211. A description of the accepted options follows.
  13212. @table @option
  13213. @item frames
  13214. The number of successive frames to mix. If unspecified, it defaults to 3.
  13215. @item weights
  13216. Specify weight of each input video frame.
  13217. Each weight is separated by space. If number of weights is smaller than
  13218. number of @var{frames} last specified weight will be used for all remaining
  13219. unset weights.
  13220. @item scale
  13221. Specify scale, if it is set it will be multiplied with sum
  13222. of each weight multiplied with pixel values to give final destination
  13223. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13224. @end table
  13225. @subsection Examples
  13226. @itemize
  13227. @item
  13228. Average 7 successive frames:
  13229. @example
  13230. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13231. @end example
  13232. @item
  13233. Apply simple temporal convolution:
  13234. @example
  13235. tmix=frames=3:weights="-1 3 -1"
  13236. @end example
  13237. @item
  13238. Similar as above but only showing temporal differences:
  13239. @example
  13240. tmix=frames=3:weights="-1 2 -1":scale=1
  13241. @end example
  13242. @end itemize
  13243. @anchor{tonemap}
  13244. @section tonemap
  13245. Tone map colors from different dynamic ranges.
  13246. This filter expects data in single precision floating point, as it needs to
  13247. operate on (and can output) out-of-range values. Another filter, such as
  13248. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13249. The tonemapping algorithms implemented only work on linear light, so input
  13250. data should be linearized beforehand (and possibly correctly tagged).
  13251. @example
  13252. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13253. @end example
  13254. @subsection Options
  13255. The filter accepts the following options.
  13256. @table @option
  13257. @item tonemap
  13258. Set the tone map algorithm to use.
  13259. Possible values are:
  13260. @table @var
  13261. @item none
  13262. Do not apply any tone map, only desaturate overbright pixels.
  13263. @item clip
  13264. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13265. in-range values, while distorting out-of-range values.
  13266. @item linear
  13267. Stretch the entire reference gamut to a linear multiple of the display.
  13268. @item gamma
  13269. Fit a logarithmic transfer between the tone curves.
  13270. @item reinhard
  13271. Preserve overall image brightness with a simple curve, using nonlinear
  13272. contrast, which results in flattening details and degrading color accuracy.
  13273. @item hable
  13274. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13275. of slightly darkening everything. Use it when detail preservation is more
  13276. important than color and brightness accuracy.
  13277. @item mobius
  13278. Smoothly map out-of-range values, while retaining contrast and colors for
  13279. in-range material as much as possible. Use it when color accuracy is more
  13280. important than detail preservation.
  13281. @end table
  13282. Default is none.
  13283. @item param
  13284. Tune the tone mapping algorithm.
  13285. This affects the following algorithms:
  13286. @table @var
  13287. @item none
  13288. Ignored.
  13289. @item linear
  13290. Specifies the scale factor to use while stretching.
  13291. Default to 1.0.
  13292. @item gamma
  13293. Specifies the exponent of the function.
  13294. Default to 1.8.
  13295. @item clip
  13296. Specify an extra linear coefficient to multiply into the signal before clipping.
  13297. Default to 1.0.
  13298. @item reinhard
  13299. Specify the local contrast coefficient at the display peak.
  13300. Default to 0.5, which means that in-gamut values will be about half as bright
  13301. as when clipping.
  13302. @item hable
  13303. Ignored.
  13304. @item mobius
  13305. Specify the transition point from linear to mobius transform. Every value
  13306. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13307. more accurate the result will be, at the cost of losing bright details.
  13308. Default to 0.3, which due to the steep initial slope still preserves in-range
  13309. colors fairly accurately.
  13310. @end table
  13311. @item desat
  13312. Apply desaturation for highlights that exceed this level of brightness. The
  13313. higher the parameter, the more color information will be preserved. This
  13314. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13315. (smoothly) turning into white instead. This makes images feel more natural,
  13316. at the cost of reducing information about out-of-range colors.
  13317. The default of 2.0 is somewhat conservative and will mostly just apply to
  13318. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13319. This option works only if the input frame has a supported color tag.
  13320. @item peak
  13321. Override signal/nominal/reference peak with this value. Useful when the
  13322. embedded peak information in display metadata is not reliable or when tone
  13323. mapping from a lower range to a higher range.
  13324. @end table
  13325. @section tpad
  13326. Temporarily pad video frames.
  13327. The filter accepts the following options:
  13328. @table @option
  13329. @item start
  13330. Specify number of delay frames before input video stream.
  13331. @item stop
  13332. Specify number of padding frames after input video stream.
  13333. Set to -1 to pad indefinitely.
  13334. @item start_mode
  13335. Set kind of frames added to beginning of stream.
  13336. Can be either @var{add} or @var{clone}.
  13337. With @var{add} frames of solid-color are added.
  13338. With @var{clone} frames are clones of first frame.
  13339. @item stop_mode
  13340. Set kind of frames added to end of stream.
  13341. Can be either @var{add} or @var{clone}.
  13342. With @var{add} frames of solid-color are added.
  13343. With @var{clone} frames are clones of last frame.
  13344. @item start_duration, stop_duration
  13345. Specify the duration of the start/stop delay. See
  13346. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13347. for the accepted syntax.
  13348. These options override @var{start} and @var{stop}.
  13349. @item color
  13350. Specify the color of the padded area. For the syntax of this option,
  13351. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13352. manual,ffmpeg-utils}.
  13353. The default value of @var{color} is "black".
  13354. @end table
  13355. @anchor{transpose}
  13356. @section transpose
  13357. Transpose rows with columns in the input video and optionally flip it.
  13358. It accepts the following parameters:
  13359. @table @option
  13360. @item dir
  13361. Specify the transposition direction.
  13362. Can assume the following values:
  13363. @table @samp
  13364. @item 0, 4, cclock_flip
  13365. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13366. @example
  13367. L.R L.l
  13368. . . -> . .
  13369. l.r R.r
  13370. @end example
  13371. @item 1, 5, clock
  13372. Rotate by 90 degrees clockwise, that is:
  13373. @example
  13374. L.R l.L
  13375. . . -> . .
  13376. l.r r.R
  13377. @end example
  13378. @item 2, 6, cclock
  13379. Rotate by 90 degrees counterclockwise, that is:
  13380. @example
  13381. L.R R.r
  13382. . . -> . .
  13383. l.r L.l
  13384. @end example
  13385. @item 3, 7, clock_flip
  13386. Rotate by 90 degrees clockwise and vertically flip, that is:
  13387. @example
  13388. L.R r.R
  13389. . . -> . .
  13390. l.r l.L
  13391. @end example
  13392. @end table
  13393. For values between 4-7, the transposition is only done if the input
  13394. video geometry is portrait and not landscape. These values are
  13395. deprecated, the @code{passthrough} option should be used instead.
  13396. Numerical values are deprecated, and should be dropped in favor of
  13397. symbolic constants.
  13398. @item passthrough
  13399. Do not apply the transposition if the input geometry matches the one
  13400. specified by the specified value. It accepts the following values:
  13401. @table @samp
  13402. @item none
  13403. Always apply transposition.
  13404. @item portrait
  13405. Preserve portrait geometry (when @var{height} >= @var{width}).
  13406. @item landscape
  13407. Preserve landscape geometry (when @var{width} >= @var{height}).
  13408. @end table
  13409. Default value is @code{none}.
  13410. @end table
  13411. For example to rotate by 90 degrees clockwise and preserve portrait
  13412. layout:
  13413. @example
  13414. transpose=dir=1:passthrough=portrait
  13415. @end example
  13416. The command above can also be specified as:
  13417. @example
  13418. transpose=1:portrait
  13419. @end example
  13420. @section transpose_npp
  13421. Transpose rows with columns in the input video and optionally flip it.
  13422. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13423. It accepts the following parameters:
  13424. @table @option
  13425. @item dir
  13426. Specify the transposition direction.
  13427. Can assume the following values:
  13428. @table @samp
  13429. @item cclock_flip
  13430. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13431. @item clock
  13432. Rotate by 90 degrees clockwise.
  13433. @item cclock
  13434. Rotate by 90 degrees counterclockwise.
  13435. @item clock_flip
  13436. Rotate by 90 degrees clockwise and vertically flip.
  13437. @end table
  13438. @item passthrough
  13439. Do not apply the transposition if the input geometry matches the one
  13440. specified by the specified value. It accepts the following values:
  13441. @table @samp
  13442. @item none
  13443. Always apply transposition. (default)
  13444. @item portrait
  13445. Preserve portrait geometry (when @var{height} >= @var{width}).
  13446. @item landscape
  13447. Preserve landscape geometry (when @var{width} >= @var{height}).
  13448. @end table
  13449. @end table
  13450. @section trim
  13451. Trim the input so that the output contains one continuous subpart of the input.
  13452. It accepts the following parameters:
  13453. @table @option
  13454. @item start
  13455. Specify the time of the start of the kept section, i.e. the frame with the
  13456. timestamp @var{start} will be the first frame in the output.
  13457. @item end
  13458. Specify the time of the first frame that will be dropped, i.e. the frame
  13459. immediately preceding the one with the timestamp @var{end} will be the last
  13460. frame in the output.
  13461. @item start_pts
  13462. This is the same as @var{start}, except this option sets the start timestamp
  13463. in timebase units instead of seconds.
  13464. @item end_pts
  13465. This is the same as @var{end}, except this option sets the end timestamp
  13466. in timebase units instead of seconds.
  13467. @item duration
  13468. The maximum duration of the output in seconds.
  13469. @item start_frame
  13470. The number of the first frame that should be passed to the output.
  13471. @item end_frame
  13472. The number of the first frame that should be dropped.
  13473. @end table
  13474. @option{start}, @option{end}, and @option{duration} are expressed as time
  13475. duration specifications; see
  13476. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13477. for the accepted syntax.
  13478. Note that the first two sets of the start/end options and the @option{duration}
  13479. option look at the frame timestamp, while the _frame variants simply count the
  13480. frames that pass through the filter. Also note that this filter does not modify
  13481. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13482. setpts filter after the trim filter.
  13483. If multiple start or end options are set, this filter tries to be greedy and
  13484. keep all the frames that match at least one of the specified constraints. To keep
  13485. only the part that matches all the constraints at once, chain multiple trim
  13486. filters.
  13487. The defaults are such that all the input is kept. So it is possible to set e.g.
  13488. just the end values to keep everything before the specified time.
  13489. Examples:
  13490. @itemize
  13491. @item
  13492. Drop everything except the second minute of input:
  13493. @example
  13494. ffmpeg -i INPUT -vf trim=60:120
  13495. @end example
  13496. @item
  13497. Keep only the first second:
  13498. @example
  13499. ffmpeg -i INPUT -vf trim=duration=1
  13500. @end example
  13501. @end itemize
  13502. @section unpremultiply
  13503. Apply alpha unpremultiply effect to input video stream using first plane
  13504. of second stream as alpha.
  13505. Both streams must have same dimensions and same pixel format.
  13506. The filter accepts the following option:
  13507. @table @option
  13508. @item planes
  13509. Set which planes will be processed, unprocessed planes will be copied.
  13510. By default value 0xf, all planes will be processed.
  13511. If the format has 1 or 2 components, then luma is bit 0.
  13512. If the format has 3 or 4 components:
  13513. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13514. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13515. If present, the alpha channel is always the last bit.
  13516. @item inplace
  13517. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13518. @end table
  13519. @anchor{unsharp}
  13520. @section unsharp
  13521. Sharpen or blur the input video.
  13522. It accepts the following parameters:
  13523. @table @option
  13524. @item luma_msize_x, lx
  13525. Set the luma matrix horizontal size. It must be an odd integer between
  13526. 3 and 23. The default value is 5.
  13527. @item luma_msize_y, ly
  13528. Set the luma matrix vertical size. It must be an odd integer between 3
  13529. and 23. The default value is 5.
  13530. @item luma_amount, la
  13531. Set the luma effect strength. It must be a floating point number, reasonable
  13532. values lay between -1.5 and 1.5.
  13533. Negative values will blur the input video, while positive values will
  13534. sharpen it, a value of zero will disable the effect.
  13535. Default value is 1.0.
  13536. @item chroma_msize_x, cx
  13537. Set the chroma matrix horizontal size. It must be an odd integer
  13538. between 3 and 23. The default value is 5.
  13539. @item chroma_msize_y, cy
  13540. Set the chroma matrix vertical size. It must be an odd integer
  13541. between 3 and 23. The default value is 5.
  13542. @item chroma_amount, ca
  13543. Set the chroma effect strength. It must be a floating point number, reasonable
  13544. values lay between -1.5 and 1.5.
  13545. Negative values will blur the input video, while positive values will
  13546. sharpen it, a value of zero will disable the effect.
  13547. Default value is 0.0.
  13548. @end table
  13549. All parameters are optional and default to the equivalent of the
  13550. string '5:5:1.0:5:5:0.0'.
  13551. @subsection Examples
  13552. @itemize
  13553. @item
  13554. Apply strong luma sharpen effect:
  13555. @example
  13556. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13557. @end example
  13558. @item
  13559. Apply a strong blur of both luma and chroma parameters:
  13560. @example
  13561. unsharp=7:7:-2:7:7:-2
  13562. @end example
  13563. @end itemize
  13564. @section uspp
  13565. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13566. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13567. shifts and average the results.
  13568. The way this differs from the behavior of spp is that uspp actually encodes &
  13569. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13570. DCT similar to MJPEG.
  13571. The filter accepts the following options:
  13572. @table @option
  13573. @item quality
  13574. Set quality. This option defines the number of levels for averaging. It accepts
  13575. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13576. effect. A value of @code{8} means the higher quality. For each increment of
  13577. that value the speed drops by a factor of approximately 2. Default value is
  13578. @code{3}.
  13579. @item qp
  13580. Force a constant quantization parameter. If not set, the filter will use the QP
  13581. from the video stream (if available).
  13582. @end table
  13583. @section vaguedenoiser
  13584. Apply a wavelet based denoiser.
  13585. It transforms each frame from the video input into the wavelet domain,
  13586. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13587. the obtained coefficients. It does an inverse wavelet transform after.
  13588. Due to wavelet properties, it should give a nice smoothed result, and
  13589. reduced noise, without blurring picture features.
  13590. This filter accepts the following options:
  13591. @table @option
  13592. @item threshold
  13593. The filtering strength. The higher, the more filtered the video will be.
  13594. Hard thresholding can use a higher threshold than soft thresholding
  13595. before the video looks overfiltered. Default value is 2.
  13596. @item method
  13597. The filtering method the filter will use.
  13598. It accepts the following values:
  13599. @table @samp
  13600. @item hard
  13601. All values under the threshold will be zeroed.
  13602. @item soft
  13603. All values under the threshold will be zeroed. All values above will be
  13604. reduced by the threshold.
  13605. @item garrote
  13606. Scales or nullifies coefficients - intermediary between (more) soft and
  13607. (less) hard thresholding.
  13608. @end table
  13609. Default is garrote.
  13610. @item nsteps
  13611. Number of times, the wavelet will decompose the picture. Picture can't
  13612. be decomposed beyond a particular point (typically, 8 for a 640x480
  13613. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13614. @item percent
  13615. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13616. @item planes
  13617. A list of the planes to process. By default all planes are processed.
  13618. @end table
  13619. @section vectorscope
  13620. Display 2 color component values in the two dimensional graph (which is called
  13621. a vectorscope).
  13622. This filter accepts the following options:
  13623. @table @option
  13624. @item mode, m
  13625. Set vectorscope mode.
  13626. It accepts the following values:
  13627. @table @samp
  13628. @item gray
  13629. Gray values are displayed on graph, higher brightness means more pixels have
  13630. same component color value on location in graph. This is the default mode.
  13631. @item color
  13632. Gray values are displayed on graph. Surrounding pixels values which are not
  13633. present in video frame are drawn in gradient of 2 color components which are
  13634. set by option @code{x} and @code{y}. The 3rd color component is static.
  13635. @item color2
  13636. Actual color components values present in video frame are displayed on graph.
  13637. @item color3
  13638. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13639. on graph increases value of another color component, which is luminance by
  13640. default values of @code{x} and @code{y}.
  13641. @item color4
  13642. Actual colors present in video frame are displayed on graph. If two different
  13643. colors map to same position on graph then color with higher value of component
  13644. not present in graph is picked.
  13645. @item color5
  13646. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13647. component picked from radial gradient.
  13648. @end table
  13649. @item x
  13650. Set which color component will be represented on X-axis. Default is @code{1}.
  13651. @item y
  13652. Set which color component will be represented on Y-axis. Default is @code{2}.
  13653. @item intensity, i
  13654. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13655. of color component which represents frequency of (X, Y) location in graph.
  13656. @item envelope, e
  13657. @table @samp
  13658. @item none
  13659. No envelope, this is default.
  13660. @item instant
  13661. Instant envelope, even darkest single pixel will be clearly highlighted.
  13662. @item peak
  13663. Hold maximum and minimum values presented in graph over time. This way you
  13664. can still spot out of range values without constantly looking at vectorscope.
  13665. @item peak+instant
  13666. Peak and instant envelope combined together.
  13667. @end table
  13668. @item graticule, g
  13669. Set what kind of graticule to draw.
  13670. @table @samp
  13671. @item none
  13672. @item green
  13673. @item color
  13674. @end table
  13675. @item opacity, o
  13676. Set graticule opacity.
  13677. @item flags, f
  13678. Set graticule flags.
  13679. @table @samp
  13680. @item white
  13681. Draw graticule for white point.
  13682. @item black
  13683. Draw graticule for black point.
  13684. @item name
  13685. Draw color points short names.
  13686. @end table
  13687. @item bgopacity, b
  13688. Set background opacity.
  13689. @item lthreshold, l
  13690. Set low threshold for color component not represented on X or Y axis.
  13691. Values lower than this value will be ignored. Default is 0.
  13692. Note this value is multiplied with actual max possible value one pixel component
  13693. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13694. is 0.1 * 255 = 25.
  13695. @item hthreshold, h
  13696. Set high threshold for color component not represented on X or Y axis.
  13697. Values higher than this value will be ignored. Default is 1.
  13698. Note this value is multiplied with actual max possible value one pixel component
  13699. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13700. is 0.9 * 255 = 230.
  13701. @item colorspace, c
  13702. Set what kind of colorspace to use when drawing graticule.
  13703. @table @samp
  13704. @item auto
  13705. @item 601
  13706. @item 709
  13707. @end table
  13708. Default is auto.
  13709. @end table
  13710. @anchor{vidstabdetect}
  13711. @section vidstabdetect
  13712. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13713. @ref{vidstabtransform} for pass 2.
  13714. This filter generates a file with relative translation and rotation
  13715. transform information about subsequent frames, which is then used by
  13716. the @ref{vidstabtransform} filter.
  13717. To enable compilation of this filter you need to configure FFmpeg with
  13718. @code{--enable-libvidstab}.
  13719. This filter accepts the following options:
  13720. @table @option
  13721. @item result
  13722. Set the path to the file used to write the transforms information.
  13723. Default value is @file{transforms.trf}.
  13724. @item shakiness
  13725. Set how shaky the video is and how quick the camera is. It accepts an
  13726. integer in the range 1-10, a value of 1 means little shakiness, a
  13727. value of 10 means strong shakiness. Default value is 5.
  13728. @item accuracy
  13729. Set the accuracy of the detection process. It must be a value in the
  13730. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13731. accuracy. Default value is 15.
  13732. @item stepsize
  13733. Set stepsize of the search process. The region around minimum is
  13734. scanned with 1 pixel resolution. Default value is 6.
  13735. @item mincontrast
  13736. Set minimum contrast. Below this value a local measurement field is
  13737. discarded. Must be a floating point value in the range 0-1. Default
  13738. value is 0.3.
  13739. @item tripod
  13740. Set reference frame number for tripod mode.
  13741. If enabled, the motion of the frames is compared to a reference frame
  13742. in the filtered stream, identified by the specified number. The idea
  13743. is to compensate all movements in a more-or-less static scene and keep
  13744. the camera view absolutely still.
  13745. If set to 0, it is disabled. The frames are counted starting from 1.
  13746. @item show
  13747. Show fields and transforms in the resulting frames. It accepts an
  13748. integer in the range 0-2. Default value is 0, which disables any
  13749. visualization.
  13750. @end table
  13751. @subsection Examples
  13752. @itemize
  13753. @item
  13754. Use default values:
  13755. @example
  13756. vidstabdetect
  13757. @end example
  13758. @item
  13759. Analyze strongly shaky movie and put the results in file
  13760. @file{mytransforms.trf}:
  13761. @example
  13762. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13763. @end example
  13764. @item
  13765. Visualize the result of internal transformations in the resulting
  13766. video:
  13767. @example
  13768. vidstabdetect=show=1
  13769. @end example
  13770. @item
  13771. Analyze a video with medium shakiness using @command{ffmpeg}:
  13772. @example
  13773. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13774. @end example
  13775. @end itemize
  13776. @anchor{vidstabtransform}
  13777. @section vidstabtransform
  13778. Video stabilization/deshaking: pass 2 of 2,
  13779. see @ref{vidstabdetect} for pass 1.
  13780. Read a file with transform information for each frame and
  13781. apply/compensate them. Together with the @ref{vidstabdetect}
  13782. filter this can be used to deshake videos. See also
  13783. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13784. the @ref{unsharp} filter, see below.
  13785. To enable compilation of this filter you need to configure FFmpeg with
  13786. @code{--enable-libvidstab}.
  13787. @subsection Options
  13788. @table @option
  13789. @item input
  13790. Set path to the file used to read the transforms. Default value is
  13791. @file{transforms.trf}.
  13792. @item smoothing
  13793. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13794. camera movements. Default value is 10.
  13795. For example a number of 10 means that 21 frames are used (10 in the
  13796. past and 10 in the future) to smoothen the motion in the video. A
  13797. larger value leads to a smoother video, but limits the acceleration of
  13798. the camera (pan/tilt movements). 0 is a special case where a static
  13799. camera is simulated.
  13800. @item optalgo
  13801. Set the camera path optimization algorithm.
  13802. Accepted values are:
  13803. @table @samp
  13804. @item gauss
  13805. gaussian kernel low-pass filter on camera motion (default)
  13806. @item avg
  13807. averaging on transformations
  13808. @end table
  13809. @item maxshift
  13810. Set maximal number of pixels to translate frames. Default value is -1,
  13811. meaning no limit.
  13812. @item maxangle
  13813. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13814. value is -1, meaning no limit.
  13815. @item crop
  13816. Specify how to deal with borders that may be visible due to movement
  13817. compensation.
  13818. Available values are:
  13819. @table @samp
  13820. @item keep
  13821. keep image information from previous frame (default)
  13822. @item black
  13823. fill the border black
  13824. @end table
  13825. @item invert
  13826. Invert transforms if set to 1. Default value is 0.
  13827. @item relative
  13828. Consider transforms as relative to previous frame if set to 1,
  13829. absolute if set to 0. Default value is 0.
  13830. @item zoom
  13831. Set percentage to zoom. A positive value will result in a zoom-in
  13832. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13833. zoom).
  13834. @item optzoom
  13835. Set optimal zooming to avoid borders.
  13836. Accepted values are:
  13837. @table @samp
  13838. @item 0
  13839. disabled
  13840. @item 1
  13841. optimal static zoom value is determined (only very strong movements
  13842. will lead to visible borders) (default)
  13843. @item 2
  13844. optimal adaptive zoom value is determined (no borders will be
  13845. visible), see @option{zoomspeed}
  13846. @end table
  13847. Note that the value given at zoom is added to the one calculated here.
  13848. @item zoomspeed
  13849. Set percent to zoom maximally each frame (enabled when
  13850. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13851. 0.25.
  13852. @item interpol
  13853. Specify type of interpolation.
  13854. Available values are:
  13855. @table @samp
  13856. @item no
  13857. no interpolation
  13858. @item linear
  13859. linear only horizontal
  13860. @item bilinear
  13861. linear in both directions (default)
  13862. @item bicubic
  13863. cubic in both directions (slow)
  13864. @end table
  13865. @item tripod
  13866. Enable virtual tripod mode if set to 1, which is equivalent to
  13867. @code{relative=0:smoothing=0}. Default value is 0.
  13868. Use also @code{tripod} option of @ref{vidstabdetect}.
  13869. @item debug
  13870. Increase log verbosity if set to 1. Also the detected global motions
  13871. are written to the temporary file @file{global_motions.trf}. Default
  13872. value is 0.
  13873. @end table
  13874. @subsection Examples
  13875. @itemize
  13876. @item
  13877. Use @command{ffmpeg} for a typical stabilization with default values:
  13878. @example
  13879. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13880. @end example
  13881. Note the use of the @ref{unsharp} filter which is always recommended.
  13882. @item
  13883. Zoom in a bit more and load transform data from a given file:
  13884. @example
  13885. vidstabtransform=zoom=5:input="mytransforms.trf"
  13886. @end example
  13887. @item
  13888. Smoothen the video even more:
  13889. @example
  13890. vidstabtransform=smoothing=30
  13891. @end example
  13892. @end itemize
  13893. @section vflip
  13894. Flip the input video vertically.
  13895. For example, to vertically flip a video with @command{ffmpeg}:
  13896. @example
  13897. ffmpeg -i in.avi -vf "vflip" out.avi
  13898. @end example
  13899. @section vfrdet
  13900. Detect variable frame rate video.
  13901. This filter tries to detect if the input is variable or constant frame rate.
  13902. At end it will output number of frames detected as having variable delta pts,
  13903. and ones with constant delta pts.
  13904. If there was frames with variable delta, than it will also show min and max delta
  13905. encountered.
  13906. @section vibrance
  13907. Boost or alter saturation.
  13908. The filter accepts the following options:
  13909. @table @option
  13910. @item intensity
  13911. Set strength of boost if positive value or strength of alter if negative value.
  13912. Default is 0. Allowed range is from -2 to 2.
  13913. @item rbal
  13914. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  13915. @item gbal
  13916. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  13917. @item bbal
  13918. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  13919. @item rlum
  13920. Set the red luma coefficient.
  13921. @item glum
  13922. Set the green luma coefficient.
  13923. @item blum
  13924. Set the blue luma coefficient.
  13925. @item alternate
  13926. If @code{intensity} is negative and this is set to 1, colors will change,
  13927. otherwise colors will be less saturated, more towards gray.
  13928. @end table
  13929. @anchor{vignette}
  13930. @section vignette
  13931. Make or reverse a natural vignetting effect.
  13932. The filter accepts the following options:
  13933. @table @option
  13934. @item angle, a
  13935. Set lens angle expression as a number of radians.
  13936. The value is clipped in the @code{[0,PI/2]} range.
  13937. Default value: @code{"PI/5"}
  13938. @item x0
  13939. @item y0
  13940. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13941. by default.
  13942. @item mode
  13943. Set forward/backward mode.
  13944. Available modes are:
  13945. @table @samp
  13946. @item forward
  13947. The larger the distance from the central point, the darker the image becomes.
  13948. @item backward
  13949. The larger the distance from the central point, the brighter the image becomes.
  13950. This can be used to reverse a vignette effect, though there is no automatic
  13951. detection to extract the lens @option{angle} and other settings (yet). It can
  13952. also be used to create a burning effect.
  13953. @end table
  13954. Default value is @samp{forward}.
  13955. @item eval
  13956. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13957. It accepts the following values:
  13958. @table @samp
  13959. @item init
  13960. Evaluate expressions only once during the filter initialization.
  13961. @item frame
  13962. Evaluate expressions for each incoming frame. This is way slower than the
  13963. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13964. allows advanced dynamic expressions.
  13965. @end table
  13966. Default value is @samp{init}.
  13967. @item dither
  13968. Set dithering to reduce the circular banding effects. Default is @code{1}
  13969. (enabled).
  13970. @item aspect
  13971. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13972. Setting this value to the SAR of the input will make a rectangular vignetting
  13973. following the dimensions of the video.
  13974. Default is @code{1/1}.
  13975. @end table
  13976. @subsection Expressions
  13977. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13978. following parameters.
  13979. @table @option
  13980. @item w
  13981. @item h
  13982. input width and height
  13983. @item n
  13984. the number of input frame, starting from 0
  13985. @item pts
  13986. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13987. @var{TB} units, NAN if undefined
  13988. @item r
  13989. frame rate of the input video, NAN if the input frame rate is unknown
  13990. @item t
  13991. the PTS (Presentation TimeStamp) of the filtered video frame,
  13992. expressed in seconds, NAN if undefined
  13993. @item tb
  13994. time base of the input video
  13995. @end table
  13996. @subsection Examples
  13997. @itemize
  13998. @item
  13999. Apply simple strong vignetting effect:
  14000. @example
  14001. vignette=PI/4
  14002. @end example
  14003. @item
  14004. Make a flickering vignetting:
  14005. @example
  14006. vignette='PI/4+random(1)*PI/50':eval=frame
  14007. @end example
  14008. @end itemize
  14009. @section vmafmotion
  14010. Obtain the average vmaf motion score of a video.
  14011. It is one of the component filters of VMAF.
  14012. The obtained average motion score is printed through the logging system.
  14013. In the below example the input file @file{ref.mpg} is being processed and score
  14014. is computed.
  14015. @example
  14016. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  14017. @end example
  14018. @section vstack
  14019. Stack input videos vertically.
  14020. All streams must be of same pixel format and of same width.
  14021. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  14022. to create same output.
  14023. The filter accept the following option:
  14024. @table @option
  14025. @item inputs
  14026. Set number of input streams. Default is 2.
  14027. @item shortest
  14028. If set to 1, force the output to terminate when the shortest input
  14029. terminates. Default value is 0.
  14030. @end table
  14031. @section w3fdif
  14032. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  14033. Deinterlacing Filter").
  14034. Based on the process described by Martin Weston for BBC R&D, and
  14035. implemented based on the de-interlace algorithm written by Jim
  14036. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  14037. uses filter coefficients calculated by BBC R&D.
  14038. This filter use field-dominance information in frame to decide which
  14039. of each pair of fields to place first in the output.
  14040. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  14041. There are two sets of filter coefficients, so called "simple":
  14042. and "complex". Which set of filter coefficients is used can
  14043. be set by passing an optional parameter:
  14044. @table @option
  14045. @item filter
  14046. Set the interlacing filter coefficients. Accepts one of the following values:
  14047. @table @samp
  14048. @item simple
  14049. Simple filter coefficient set.
  14050. @item complex
  14051. More-complex filter coefficient set.
  14052. @end table
  14053. Default value is @samp{complex}.
  14054. @item deint
  14055. Specify which frames to deinterlace. Accept one of the following values:
  14056. @table @samp
  14057. @item all
  14058. Deinterlace all frames,
  14059. @item interlaced
  14060. Only deinterlace frames marked as interlaced.
  14061. @end table
  14062. Default value is @samp{all}.
  14063. @end table
  14064. @section waveform
  14065. Video waveform monitor.
  14066. The waveform monitor plots color component intensity. By default luminance
  14067. only. Each column of the waveform corresponds to a column of pixels in the
  14068. source video.
  14069. It accepts the following options:
  14070. @table @option
  14071. @item mode, m
  14072. Can be either @code{row}, or @code{column}. Default is @code{column}.
  14073. In row mode, the graph on the left side represents color component value 0 and
  14074. the right side represents value = 255. In column mode, the top side represents
  14075. color component value = 0 and bottom side represents value = 255.
  14076. @item intensity, i
  14077. Set intensity. Smaller values are useful to find out how many values of the same
  14078. luminance are distributed across input rows/columns.
  14079. Default value is @code{0.04}. Allowed range is [0, 1].
  14080. @item mirror, r
  14081. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  14082. In mirrored mode, higher values will be represented on the left
  14083. side for @code{row} mode and at the top for @code{column} mode. Default is
  14084. @code{1} (mirrored).
  14085. @item display, d
  14086. Set display mode.
  14087. It accepts the following values:
  14088. @table @samp
  14089. @item overlay
  14090. Presents information identical to that in the @code{parade}, except
  14091. that the graphs representing color components are superimposed directly
  14092. over one another.
  14093. This display mode makes it easier to spot relative differences or similarities
  14094. in overlapping areas of the color components that are supposed to be identical,
  14095. such as neutral whites, grays, or blacks.
  14096. @item stack
  14097. Display separate graph for the color components side by side in
  14098. @code{row} mode or one below the other in @code{column} mode.
  14099. @item parade
  14100. Display separate graph for the color components side by side in
  14101. @code{column} mode or one below the other in @code{row} mode.
  14102. Using this display mode makes it easy to spot color casts in the highlights
  14103. and shadows of an image, by comparing the contours of the top and the bottom
  14104. graphs of each waveform. Since whites, grays, and blacks are characterized
  14105. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  14106. should display three waveforms of roughly equal width/height. If not, the
  14107. correction is easy to perform by making level adjustments the three waveforms.
  14108. @end table
  14109. Default is @code{stack}.
  14110. @item components, c
  14111. Set which color components to display. Default is 1, which means only luminance
  14112. or red color component if input is in RGB colorspace. If is set for example to
  14113. 7 it will display all 3 (if) available color components.
  14114. @item envelope, e
  14115. @table @samp
  14116. @item none
  14117. No envelope, this is default.
  14118. @item instant
  14119. Instant envelope, minimum and maximum values presented in graph will be easily
  14120. visible even with small @code{step} value.
  14121. @item peak
  14122. Hold minimum and maximum values presented in graph across time. This way you
  14123. can still spot out of range values without constantly looking at waveforms.
  14124. @item peak+instant
  14125. Peak and instant envelope combined together.
  14126. @end table
  14127. @item filter, f
  14128. @table @samp
  14129. @item lowpass
  14130. No filtering, this is default.
  14131. @item flat
  14132. Luma and chroma combined together.
  14133. @item aflat
  14134. Similar as above, but shows difference between blue and red chroma.
  14135. @item xflat
  14136. Similar as above, but use different colors.
  14137. @item chroma
  14138. Displays only chroma.
  14139. @item color
  14140. Displays actual color value on waveform.
  14141. @item acolor
  14142. Similar as above, but with luma showing frequency of chroma values.
  14143. @end table
  14144. @item graticule, g
  14145. Set which graticule to display.
  14146. @table @samp
  14147. @item none
  14148. Do not display graticule.
  14149. @item green
  14150. Display green graticule showing legal broadcast ranges.
  14151. @item orange
  14152. Display orange graticule showing legal broadcast ranges.
  14153. @end table
  14154. @item opacity, o
  14155. Set graticule opacity.
  14156. @item flags, fl
  14157. Set graticule flags.
  14158. @table @samp
  14159. @item numbers
  14160. Draw numbers above lines. By default enabled.
  14161. @item dots
  14162. Draw dots instead of lines.
  14163. @end table
  14164. @item scale, s
  14165. Set scale used for displaying graticule.
  14166. @table @samp
  14167. @item digital
  14168. @item millivolts
  14169. @item ire
  14170. @end table
  14171. Default is digital.
  14172. @item bgopacity, b
  14173. Set background opacity.
  14174. @end table
  14175. @section weave, doubleweave
  14176. The @code{weave} takes a field-based video input and join
  14177. each two sequential fields into single frame, producing a new double
  14178. height clip with half the frame rate and half the frame count.
  14179. The @code{doubleweave} works same as @code{weave} but without
  14180. halving frame rate and frame count.
  14181. It accepts the following option:
  14182. @table @option
  14183. @item first_field
  14184. Set first field. Available values are:
  14185. @table @samp
  14186. @item top, t
  14187. Set the frame as top-field-first.
  14188. @item bottom, b
  14189. Set the frame as bottom-field-first.
  14190. @end table
  14191. @end table
  14192. @subsection Examples
  14193. @itemize
  14194. @item
  14195. Interlace video using @ref{select} and @ref{separatefields} filter:
  14196. @example
  14197. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  14198. @end example
  14199. @end itemize
  14200. @section xbr
  14201. Apply the xBR high-quality magnification filter which is designed for pixel
  14202. art. It follows a set of edge-detection rules, see
  14203. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  14204. It accepts the following option:
  14205. @table @option
  14206. @item n
  14207. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  14208. @code{3xBR} and @code{4} for @code{4xBR}.
  14209. Default is @code{3}.
  14210. @end table
  14211. @section xmedian
  14212. Pick median pixels from several input videos.
  14213. The filter accept the following options:
  14214. @table @option
  14215. @item inputs
  14216. Set number of inputs.
  14217. Default is 3. Allowed range is from 3 to 255.
  14218. If number of inputs is even number, than result will be mean value between two median values.
  14219. @item planes
  14220. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14221. @end table
  14222. @section xstack
  14223. Stack video inputs into custom layout.
  14224. All streams must be of same pixel format.
  14225. The filter accept the following option:
  14226. @table @option
  14227. @item inputs
  14228. Set number of input streams. Default is 2.
  14229. @item layout
  14230. Specify layout of inputs.
  14231. This option requires the desired layout configuration to be explicitly set by the user.
  14232. This sets position of each video input in output. Each input
  14233. is separated by '|'.
  14234. The first number represents the column, and the second number represents the row.
  14235. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  14236. where X is video input from which to take width or height.
  14237. Multiple values can be used when separated by '+'. In such
  14238. case values are summed together.
  14239. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  14240. a layout must be set by the user.
  14241. @item shortest
  14242. If set to 1, force the output to terminate when the shortest input
  14243. terminates. Default value is 0.
  14244. @end table
  14245. @subsection Examples
  14246. @itemize
  14247. @item
  14248. Display 4 inputs into 2x2 grid,
  14249. note that if inputs are of different sizes unused gaps might appear,
  14250. as not all of output video is used.
  14251. @example
  14252. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  14253. @end example
  14254. @item
  14255. Display 4 inputs into 1x4 grid,
  14256. note that if inputs are of different sizes unused gaps might appear,
  14257. as not all of output video is used.
  14258. @example
  14259. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  14260. @end example
  14261. @item
  14262. Display 9 inputs into 3x3 grid,
  14263. note that if inputs are of different sizes unused gaps might appear,
  14264. as not all of output video is used.
  14265. @example
  14266. 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
  14267. @end example
  14268. @end itemize
  14269. @anchor{yadif}
  14270. @section yadif
  14271. Deinterlace the input video ("yadif" means "yet another deinterlacing
  14272. filter").
  14273. It accepts the following parameters:
  14274. @table @option
  14275. @item mode
  14276. The interlacing mode to adopt. It accepts one of the following values:
  14277. @table @option
  14278. @item 0, send_frame
  14279. Output one frame for each frame.
  14280. @item 1, send_field
  14281. Output one frame for each field.
  14282. @item 2, send_frame_nospatial
  14283. Like @code{send_frame}, but it skips the spatial interlacing check.
  14284. @item 3, send_field_nospatial
  14285. Like @code{send_field}, but it skips the spatial interlacing check.
  14286. @end table
  14287. The default value is @code{send_frame}.
  14288. @item parity
  14289. The picture field parity assumed for the input interlaced video. It accepts one
  14290. of the following values:
  14291. @table @option
  14292. @item 0, tff
  14293. Assume the top field is first.
  14294. @item 1, bff
  14295. Assume the bottom field is first.
  14296. @item -1, auto
  14297. Enable automatic detection of field parity.
  14298. @end table
  14299. The default value is @code{auto}.
  14300. If the interlacing is unknown or the decoder does not export this information,
  14301. top field first will be assumed.
  14302. @item deint
  14303. Specify which frames to deinterlace. Accept one of the following
  14304. values:
  14305. @table @option
  14306. @item 0, all
  14307. Deinterlace all frames.
  14308. @item 1, interlaced
  14309. Only deinterlace frames marked as interlaced.
  14310. @end table
  14311. The default value is @code{all}.
  14312. @end table
  14313. @section yadif_cuda
  14314. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14315. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14316. and/or nvenc.
  14317. It accepts the following parameters:
  14318. @table @option
  14319. @item mode
  14320. The interlacing mode to adopt. It accepts one of the following values:
  14321. @table @option
  14322. @item 0, send_frame
  14323. Output one frame for each frame.
  14324. @item 1, send_field
  14325. Output one frame for each field.
  14326. @item 2, send_frame_nospatial
  14327. Like @code{send_frame}, but it skips the spatial interlacing check.
  14328. @item 3, send_field_nospatial
  14329. Like @code{send_field}, but it skips the spatial interlacing check.
  14330. @end table
  14331. The default value is @code{send_frame}.
  14332. @item parity
  14333. The picture field parity assumed for the input interlaced video. It accepts one
  14334. of the following values:
  14335. @table @option
  14336. @item 0, tff
  14337. Assume the top field is first.
  14338. @item 1, bff
  14339. Assume the bottom field is first.
  14340. @item -1, auto
  14341. Enable automatic detection of field parity.
  14342. @end table
  14343. The default value is @code{auto}.
  14344. If the interlacing is unknown or the decoder does not export this information,
  14345. top field first will be assumed.
  14346. @item deint
  14347. Specify which frames to deinterlace. Accept one of the following
  14348. values:
  14349. @table @option
  14350. @item 0, all
  14351. Deinterlace all frames.
  14352. @item 1, interlaced
  14353. Only deinterlace frames marked as interlaced.
  14354. @end table
  14355. The default value is @code{all}.
  14356. @end table
  14357. @section zoompan
  14358. Apply Zoom & Pan effect.
  14359. This filter accepts the following options:
  14360. @table @option
  14361. @item zoom, z
  14362. Set the zoom expression. Range is 1-10. Default is 1.
  14363. @item x
  14364. @item y
  14365. Set the x and y expression. Default is 0.
  14366. @item d
  14367. Set the duration expression in number of frames.
  14368. This sets for how many number of frames effect will last for
  14369. single input image.
  14370. @item s
  14371. Set the output image size, default is 'hd720'.
  14372. @item fps
  14373. Set the output frame rate, default is '25'.
  14374. @end table
  14375. Each expression can contain the following constants:
  14376. @table @option
  14377. @item in_w, iw
  14378. Input width.
  14379. @item in_h, ih
  14380. Input height.
  14381. @item out_w, ow
  14382. Output width.
  14383. @item out_h, oh
  14384. Output height.
  14385. @item in
  14386. Input frame count.
  14387. @item on
  14388. Output frame count.
  14389. @item x
  14390. @item y
  14391. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14392. for current input frame.
  14393. @item px
  14394. @item py
  14395. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14396. not yet such frame (first input frame).
  14397. @item zoom
  14398. Last calculated zoom from 'z' expression for current input frame.
  14399. @item pzoom
  14400. Last calculated zoom of last output frame of previous input frame.
  14401. @item duration
  14402. Number of output frames for current input frame. Calculated from 'd' expression
  14403. for each input frame.
  14404. @item pduration
  14405. number of output frames created for previous input frame
  14406. @item a
  14407. Rational number: input width / input height
  14408. @item sar
  14409. sample aspect ratio
  14410. @item dar
  14411. display aspect ratio
  14412. @end table
  14413. @subsection Examples
  14414. @itemize
  14415. @item
  14416. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14417. @example
  14418. 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
  14419. @end example
  14420. @item
  14421. Zoom-in up to 1.5 and pan always at center of picture:
  14422. @example
  14423. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14424. @end example
  14425. @item
  14426. Same as above but without pausing:
  14427. @example
  14428. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14429. @end example
  14430. @end itemize
  14431. @anchor{zscale}
  14432. @section zscale
  14433. Scale (resize) the input video, using the z.lib library:
  14434. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14435. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14436. The zscale filter forces the output display aspect ratio to be the same
  14437. as the input, by changing the output sample aspect ratio.
  14438. If the input image format is different from the format requested by
  14439. the next filter, the zscale filter will convert the input to the
  14440. requested format.
  14441. @subsection Options
  14442. The filter accepts the following options.
  14443. @table @option
  14444. @item width, w
  14445. @item height, h
  14446. Set the output video dimension expression. Default value is the input
  14447. dimension.
  14448. If the @var{width} or @var{w} value is 0, the input width is used for
  14449. the output. If the @var{height} or @var{h} value is 0, the input height
  14450. is used for the output.
  14451. If one and only one of the values is -n with n >= 1, the zscale filter
  14452. will use a value that maintains the aspect ratio of the input image,
  14453. calculated from the other specified dimension. After that it will,
  14454. however, make sure that the calculated dimension is divisible by n and
  14455. adjust the value if necessary.
  14456. If both values are -n with n >= 1, the behavior will be identical to
  14457. both values being set to 0 as previously detailed.
  14458. See below for the list of accepted constants for use in the dimension
  14459. expression.
  14460. @item size, s
  14461. Set the video size. For the syntax of this option, check the
  14462. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14463. @item dither, d
  14464. Set the dither type.
  14465. Possible values are:
  14466. @table @var
  14467. @item none
  14468. @item ordered
  14469. @item random
  14470. @item error_diffusion
  14471. @end table
  14472. Default is none.
  14473. @item filter, f
  14474. Set the resize filter type.
  14475. Possible values are:
  14476. @table @var
  14477. @item point
  14478. @item bilinear
  14479. @item bicubic
  14480. @item spline16
  14481. @item spline36
  14482. @item lanczos
  14483. @end table
  14484. Default is bilinear.
  14485. @item range, r
  14486. Set the color range.
  14487. Possible values are:
  14488. @table @var
  14489. @item input
  14490. @item limited
  14491. @item full
  14492. @end table
  14493. Default is same as input.
  14494. @item primaries, p
  14495. Set the color primaries.
  14496. Possible values are:
  14497. @table @var
  14498. @item input
  14499. @item 709
  14500. @item unspecified
  14501. @item 170m
  14502. @item 240m
  14503. @item 2020
  14504. @end table
  14505. Default is same as input.
  14506. @item transfer, t
  14507. Set the transfer characteristics.
  14508. Possible values are:
  14509. @table @var
  14510. @item input
  14511. @item 709
  14512. @item unspecified
  14513. @item 601
  14514. @item linear
  14515. @item 2020_10
  14516. @item 2020_12
  14517. @item smpte2084
  14518. @item iec61966-2-1
  14519. @item arib-std-b67
  14520. @end table
  14521. Default is same as input.
  14522. @item matrix, m
  14523. Set the colorspace matrix.
  14524. Possible value are:
  14525. @table @var
  14526. @item input
  14527. @item 709
  14528. @item unspecified
  14529. @item 470bg
  14530. @item 170m
  14531. @item 2020_ncl
  14532. @item 2020_cl
  14533. @end table
  14534. Default is same as input.
  14535. @item rangein, rin
  14536. Set the input color range.
  14537. Possible values are:
  14538. @table @var
  14539. @item input
  14540. @item limited
  14541. @item full
  14542. @end table
  14543. Default is same as input.
  14544. @item primariesin, pin
  14545. Set the input color primaries.
  14546. Possible values are:
  14547. @table @var
  14548. @item input
  14549. @item 709
  14550. @item unspecified
  14551. @item 170m
  14552. @item 240m
  14553. @item 2020
  14554. @end table
  14555. Default is same as input.
  14556. @item transferin, tin
  14557. Set the input transfer characteristics.
  14558. Possible values are:
  14559. @table @var
  14560. @item input
  14561. @item 709
  14562. @item unspecified
  14563. @item 601
  14564. @item linear
  14565. @item 2020_10
  14566. @item 2020_12
  14567. @end table
  14568. Default is same as input.
  14569. @item matrixin, min
  14570. Set the input colorspace matrix.
  14571. Possible value are:
  14572. @table @var
  14573. @item input
  14574. @item 709
  14575. @item unspecified
  14576. @item 470bg
  14577. @item 170m
  14578. @item 2020_ncl
  14579. @item 2020_cl
  14580. @end table
  14581. @item chromal, c
  14582. Set the output chroma location.
  14583. Possible values are:
  14584. @table @var
  14585. @item input
  14586. @item left
  14587. @item center
  14588. @item topleft
  14589. @item top
  14590. @item bottomleft
  14591. @item bottom
  14592. @end table
  14593. @item chromalin, cin
  14594. Set the input chroma location.
  14595. Possible values are:
  14596. @table @var
  14597. @item input
  14598. @item left
  14599. @item center
  14600. @item topleft
  14601. @item top
  14602. @item bottomleft
  14603. @item bottom
  14604. @end table
  14605. @item npl
  14606. Set the nominal peak luminance.
  14607. @end table
  14608. The values of the @option{w} and @option{h} options are expressions
  14609. containing the following constants:
  14610. @table @var
  14611. @item in_w
  14612. @item in_h
  14613. The input width and height
  14614. @item iw
  14615. @item ih
  14616. These are the same as @var{in_w} and @var{in_h}.
  14617. @item out_w
  14618. @item out_h
  14619. The output (scaled) width and height
  14620. @item ow
  14621. @item oh
  14622. These are the same as @var{out_w} and @var{out_h}
  14623. @item a
  14624. The same as @var{iw} / @var{ih}
  14625. @item sar
  14626. input sample aspect ratio
  14627. @item dar
  14628. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14629. @item hsub
  14630. @item vsub
  14631. horizontal and vertical input chroma subsample values. For example for the
  14632. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14633. @item ohsub
  14634. @item ovsub
  14635. horizontal and vertical output chroma subsample values. For example for the
  14636. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14637. @end table
  14638. @table @option
  14639. @end table
  14640. @c man end VIDEO FILTERS
  14641. @chapter OpenCL Video Filters
  14642. @c man begin OPENCL VIDEO FILTERS
  14643. Below is a description of the currently available OpenCL video filters.
  14644. To enable compilation of these filters you need to configure FFmpeg with
  14645. @code{--enable-opencl}.
  14646. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14647. @table @option
  14648. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14649. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14650. given device parameters.
  14651. @item -filter_hw_device @var{name}
  14652. Pass the hardware device called @var{name} to all filters in any filter graph.
  14653. @end table
  14654. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14655. @itemize
  14656. @item
  14657. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14658. @example
  14659. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14660. @end example
  14661. @end itemize
  14662. 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.
  14663. @section avgblur_opencl
  14664. Apply average blur filter.
  14665. The filter accepts the following options:
  14666. @table @option
  14667. @item sizeX
  14668. Set horizontal radius size.
  14669. Range is @code{[1, 1024]} and default value is @code{1}.
  14670. @item planes
  14671. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14672. @item sizeY
  14673. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14674. @end table
  14675. @subsection Example
  14676. @itemize
  14677. @item
  14678. 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.
  14679. @example
  14680. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14681. @end example
  14682. @end itemize
  14683. @section boxblur_opencl
  14684. Apply a boxblur algorithm to the input video.
  14685. It accepts the following parameters:
  14686. @table @option
  14687. @item luma_radius, lr
  14688. @item luma_power, lp
  14689. @item chroma_radius, cr
  14690. @item chroma_power, cp
  14691. @item alpha_radius, ar
  14692. @item alpha_power, ap
  14693. @end table
  14694. A description of the accepted options follows.
  14695. @table @option
  14696. @item luma_radius, lr
  14697. @item chroma_radius, cr
  14698. @item alpha_radius, ar
  14699. Set an expression for the box radius in pixels used for blurring the
  14700. corresponding input plane.
  14701. The radius value must be a non-negative number, and must not be
  14702. greater than the value of the expression @code{min(w,h)/2} for the
  14703. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14704. planes.
  14705. Default value for @option{luma_radius} is "2". If not specified,
  14706. @option{chroma_radius} and @option{alpha_radius} default to the
  14707. corresponding value set for @option{luma_radius}.
  14708. The expressions can contain the following constants:
  14709. @table @option
  14710. @item w
  14711. @item h
  14712. The input width and height in pixels.
  14713. @item cw
  14714. @item ch
  14715. The input chroma image width and height in pixels.
  14716. @item hsub
  14717. @item vsub
  14718. The horizontal and vertical chroma subsample values. For example, for the
  14719. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14720. @end table
  14721. @item luma_power, lp
  14722. @item chroma_power, cp
  14723. @item alpha_power, ap
  14724. Specify how many times the boxblur filter is applied to the
  14725. corresponding plane.
  14726. Default value for @option{luma_power} is 2. If not specified,
  14727. @option{chroma_power} and @option{alpha_power} default to the
  14728. corresponding value set for @option{luma_power}.
  14729. A value of 0 will disable the effect.
  14730. @end table
  14731. @subsection Examples
  14732. 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.
  14733. @itemize
  14734. @item
  14735. Apply a boxblur filter with the luma, chroma, and alpha radius
  14736. 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.
  14737. @example
  14738. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14739. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14740. @end example
  14741. @item
  14742. 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.
  14743. For the luma plane, a 2x2 box radius will be run once.
  14744. For the chroma plane, a 4x4 box radius will be run 5 times.
  14745. For the alpha plane, a 3x3 box radius will be run 7 times.
  14746. @example
  14747. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14748. @end example
  14749. @end itemize
  14750. @section convolution_opencl
  14751. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14752. The filter accepts the following options:
  14753. @table @option
  14754. @item 0m
  14755. @item 1m
  14756. @item 2m
  14757. @item 3m
  14758. Set matrix for each plane.
  14759. Matrix is sequence of 9, 25 or 49 signed numbers.
  14760. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14761. @item 0rdiv
  14762. @item 1rdiv
  14763. @item 2rdiv
  14764. @item 3rdiv
  14765. Set multiplier for calculated value for each plane.
  14766. If unset or 0, it will be sum of all matrix elements.
  14767. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14768. @item 0bias
  14769. @item 1bias
  14770. @item 2bias
  14771. @item 3bias
  14772. Set bias for each plane. This value is added to the result of the multiplication.
  14773. Useful for making the overall image brighter or darker.
  14774. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  14775. @end table
  14776. @subsection Examples
  14777. @itemize
  14778. @item
  14779. Apply sharpen:
  14780. @example
  14781. -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
  14782. @end example
  14783. @item
  14784. Apply blur:
  14785. @example
  14786. -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
  14787. @end example
  14788. @item
  14789. Apply edge enhance:
  14790. @example
  14791. -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
  14792. @end example
  14793. @item
  14794. Apply edge detect:
  14795. @example
  14796. -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
  14797. @end example
  14798. @item
  14799. Apply laplacian edge detector which includes diagonals:
  14800. @example
  14801. -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
  14802. @end example
  14803. @item
  14804. Apply emboss:
  14805. @example
  14806. -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
  14807. @end example
  14808. @end itemize
  14809. @section dilation_opencl
  14810. Apply dilation effect to the video.
  14811. This filter replaces the pixel by the local(3x3) maximum.
  14812. It accepts the following options:
  14813. @table @option
  14814. @item threshold0
  14815. @item threshold1
  14816. @item threshold2
  14817. @item threshold3
  14818. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14819. If @code{0}, plane will remain unchanged.
  14820. @item coordinates
  14821. Flag which specifies the pixel to refer to.
  14822. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14823. Flags to local 3x3 coordinates region centered on @code{x}:
  14824. 1 2 3
  14825. 4 x 5
  14826. 6 7 8
  14827. @end table
  14828. @subsection Example
  14829. @itemize
  14830. @item
  14831. 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.
  14832. @example
  14833. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14834. @end example
  14835. @end itemize
  14836. @section erosion_opencl
  14837. Apply erosion effect to the video.
  14838. This filter replaces the pixel by the local(3x3) minimum.
  14839. It accepts the following options:
  14840. @table @option
  14841. @item threshold0
  14842. @item threshold1
  14843. @item threshold2
  14844. @item threshold3
  14845. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14846. If @code{0}, plane will remain unchanged.
  14847. @item coordinates
  14848. Flag which specifies the pixel to refer to.
  14849. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14850. Flags to local 3x3 coordinates region centered on @code{x}:
  14851. 1 2 3
  14852. 4 x 5
  14853. 6 7 8
  14854. @end table
  14855. @subsection Example
  14856. @itemize
  14857. @item
  14858. 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.
  14859. @example
  14860. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14861. @end example
  14862. @end itemize
  14863. @section colorkey_opencl
  14864. RGB colorspace color keying.
  14865. The filter accepts the following options:
  14866. @table @option
  14867. @item color
  14868. The color which will be replaced with transparency.
  14869. @item similarity
  14870. Similarity percentage with the key color.
  14871. 0.01 matches only the exact key color, while 1.0 matches everything.
  14872. @item blend
  14873. Blend percentage.
  14874. 0.0 makes pixels either fully transparent, or not transparent at all.
  14875. Higher values result in semi-transparent pixels, with a higher transparency
  14876. the more similar the pixels color is to the key color.
  14877. @end table
  14878. @subsection Examples
  14879. @itemize
  14880. @item
  14881. Make every semi-green pixel in the input transparent with some slight blending:
  14882. @example
  14883. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  14884. @end example
  14885. @end itemize
  14886. @section nlmeans_opencl
  14887. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  14888. @section overlay_opencl
  14889. Overlay one video on top of another.
  14890. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  14891. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  14892. The filter accepts the following options:
  14893. @table @option
  14894. @item x
  14895. Set the x coordinate of the overlaid video on the main video.
  14896. Default value is @code{0}.
  14897. @item y
  14898. Set the x coordinate of the overlaid video on the main video.
  14899. Default value is @code{0}.
  14900. @end table
  14901. @subsection Examples
  14902. @itemize
  14903. @item
  14904. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  14905. @example
  14906. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14907. @end example
  14908. @item
  14909. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  14910. @example
  14911. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14912. @end example
  14913. @end itemize
  14914. @section prewitt_opencl
  14915. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  14916. The filter accepts the following option:
  14917. @table @option
  14918. @item planes
  14919. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14920. @item scale
  14921. Set value which will be multiplied with filtered result.
  14922. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14923. @item delta
  14924. Set value which will be added to filtered result.
  14925. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14926. @end table
  14927. @subsection Example
  14928. @itemize
  14929. @item
  14930. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  14931. @example
  14932. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14933. @end example
  14934. @end itemize
  14935. @section roberts_opencl
  14936. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  14937. The filter accepts the following option:
  14938. @table @option
  14939. @item planes
  14940. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14941. @item scale
  14942. Set value which will be multiplied with filtered result.
  14943. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14944. @item delta
  14945. Set value which will be added to filtered result.
  14946. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14947. @end table
  14948. @subsection Example
  14949. @itemize
  14950. @item
  14951. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  14952. @example
  14953. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14954. @end example
  14955. @end itemize
  14956. @section sobel_opencl
  14957. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  14958. The filter accepts the following option:
  14959. @table @option
  14960. @item planes
  14961. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14962. @item scale
  14963. Set value which will be multiplied with filtered result.
  14964. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14965. @item delta
  14966. Set value which will be added to filtered result.
  14967. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14968. @end table
  14969. @subsection Example
  14970. @itemize
  14971. @item
  14972. Apply sobel operator with scale set to 2 and delta set to 10
  14973. @example
  14974. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14975. @end example
  14976. @end itemize
  14977. @section tonemap_opencl
  14978. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  14979. It accepts the following parameters:
  14980. @table @option
  14981. @item tonemap
  14982. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  14983. @item param
  14984. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  14985. @item desat
  14986. Apply desaturation for highlights that exceed this level of brightness. The
  14987. higher the parameter, the more color information will be preserved. This
  14988. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14989. (smoothly) turning into white instead. This makes images feel more natural,
  14990. at the cost of reducing information about out-of-range colors.
  14991. The default value is 0.5, and the algorithm here is a little different from
  14992. the cpu version tonemap currently. A setting of 0.0 disables this option.
  14993. @item threshold
  14994. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  14995. is used to detect whether the scene has changed or not. If the distance between
  14996. the current frame average brightness and the current running average exceeds
  14997. a threshold value, we would re-calculate scene average and peak brightness.
  14998. The default value is 0.2.
  14999. @item format
  15000. Specify the output pixel format.
  15001. Currently supported formats are:
  15002. @table @var
  15003. @item p010
  15004. @item nv12
  15005. @end table
  15006. @item range, r
  15007. Set the output color range.
  15008. Possible values are:
  15009. @table @var
  15010. @item tv/mpeg
  15011. @item pc/jpeg
  15012. @end table
  15013. Default is same as input.
  15014. @item primaries, p
  15015. Set the output color primaries.
  15016. Possible values are:
  15017. @table @var
  15018. @item bt709
  15019. @item bt2020
  15020. @end table
  15021. Default is same as input.
  15022. @item transfer, t
  15023. Set the output transfer characteristics.
  15024. Possible values are:
  15025. @table @var
  15026. @item bt709
  15027. @item bt2020
  15028. @end table
  15029. Default is bt709.
  15030. @item matrix, m
  15031. Set the output colorspace matrix.
  15032. Possible value are:
  15033. @table @var
  15034. @item bt709
  15035. @item bt2020
  15036. @end table
  15037. Default is same as input.
  15038. @end table
  15039. @subsection Example
  15040. @itemize
  15041. @item
  15042. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  15043. @example
  15044. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  15045. @end example
  15046. @end itemize
  15047. @section unsharp_opencl
  15048. Sharpen or blur the input video.
  15049. It accepts the following parameters:
  15050. @table @option
  15051. @item luma_msize_x, lx
  15052. Set the luma matrix horizontal size.
  15053. Range is @code{[1, 23]} and default value is @code{5}.
  15054. @item luma_msize_y, ly
  15055. Set the luma matrix vertical size.
  15056. Range is @code{[1, 23]} and default value is @code{5}.
  15057. @item luma_amount, la
  15058. Set the luma effect strength.
  15059. Range is @code{[-10, 10]} and default value is @code{1.0}.
  15060. Negative values will blur the input video, while positive values will
  15061. sharpen it, a value of zero will disable the effect.
  15062. @item chroma_msize_x, cx
  15063. Set the chroma matrix horizontal size.
  15064. Range is @code{[1, 23]} and default value is @code{5}.
  15065. @item chroma_msize_y, cy
  15066. Set the chroma matrix vertical size.
  15067. Range is @code{[1, 23]} and default value is @code{5}.
  15068. @item chroma_amount, ca
  15069. Set the chroma effect strength.
  15070. Range is @code{[-10, 10]} and default value is @code{0.0}.
  15071. Negative values will blur the input video, while positive values will
  15072. sharpen it, a value of zero will disable the effect.
  15073. @end table
  15074. All parameters are optional and default to the equivalent of the
  15075. string '5:5:1.0:5:5:0.0'.
  15076. @subsection Examples
  15077. @itemize
  15078. @item
  15079. Apply strong luma sharpen effect:
  15080. @example
  15081. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  15082. @end example
  15083. @item
  15084. Apply a strong blur of both luma and chroma parameters:
  15085. @example
  15086. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  15087. @end example
  15088. @end itemize
  15089. @c man end OPENCL VIDEO FILTERS
  15090. @chapter Video Sources
  15091. @c man begin VIDEO SOURCES
  15092. Below is a description of the currently available video sources.
  15093. @section buffer
  15094. Buffer video frames, and make them available to the filter chain.
  15095. This source is mainly intended for a programmatic use, in particular
  15096. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  15097. It accepts the following parameters:
  15098. @table @option
  15099. @item video_size
  15100. Specify the size (width and height) of the buffered video frames. For the
  15101. syntax of this option, check the
  15102. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15103. @item width
  15104. The input video width.
  15105. @item height
  15106. The input video height.
  15107. @item pix_fmt
  15108. A string representing the pixel format of the buffered video frames.
  15109. It may be a number corresponding to a pixel format, or a pixel format
  15110. name.
  15111. @item time_base
  15112. Specify the timebase assumed by the timestamps of the buffered frames.
  15113. @item frame_rate
  15114. Specify the frame rate expected for the video stream.
  15115. @item pixel_aspect, sar
  15116. The sample (pixel) aspect ratio of the input video.
  15117. @item sws_param
  15118. Specify the optional parameters to be used for the scale filter which
  15119. is automatically inserted when an input change is detected in the
  15120. input size or format.
  15121. @item hw_frames_ctx
  15122. When using a hardware pixel format, this should be a reference to an
  15123. AVHWFramesContext describing input frames.
  15124. @end table
  15125. For example:
  15126. @example
  15127. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  15128. @end example
  15129. will instruct the source to accept video frames with size 320x240 and
  15130. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  15131. square pixels (1:1 sample aspect ratio).
  15132. Since the pixel format with name "yuv410p" corresponds to the number 6
  15133. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  15134. this example corresponds to:
  15135. @example
  15136. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  15137. @end example
  15138. Alternatively, the options can be specified as a flat string, but this
  15139. syntax is deprecated:
  15140. @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}]
  15141. @section cellauto
  15142. Create a pattern generated by an elementary cellular automaton.
  15143. The initial state of the cellular automaton can be defined through the
  15144. @option{filename} and @option{pattern} options. If such options are
  15145. not specified an initial state is created randomly.
  15146. At each new frame a new row in the video is filled with the result of
  15147. the cellular automaton next generation. The behavior when the whole
  15148. frame is filled is defined by the @option{scroll} option.
  15149. This source accepts the following options:
  15150. @table @option
  15151. @item filename, f
  15152. Read the initial cellular automaton state, i.e. the starting row, from
  15153. the specified file.
  15154. In the file, each non-whitespace character is considered an alive
  15155. cell, a newline will terminate the row, and further characters in the
  15156. file will be ignored.
  15157. @item pattern, p
  15158. Read the initial cellular automaton state, i.e. the starting row, from
  15159. the specified string.
  15160. Each non-whitespace character in the string is considered an alive
  15161. cell, a newline will terminate the row, and further characters in the
  15162. string will be ignored.
  15163. @item rate, r
  15164. Set the video rate, that is the number of frames generated per second.
  15165. Default is 25.
  15166. @item random_fill_ratio, ratio
  15167. Set the random fill ratio for the initial cellular automaton row. It
  15168. is a floating point number value ranging from 0 to 1, defaults to
  15169. 1/PHI.
  15170. This option is ignored when a file or a pattern is specified.
  15171. @item random_seed, seed
  15172. Set the seed for filling randomly the initial row, must be an integer
  15173. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15174. set to -1, the filter will try to use a good random seed on a best
  15175. effort basis.
  15176. @item rule
  15177. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  15178. Default value is 110.
  15179. @item size, s
  15180. Set the size of the output video. For the syntax of this option, check the
  15181. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15182. If @option{filename} or @option{pattern} is specified, the size is set
  15183. by default to the width of the specified initial state row, and the
  15184. height is set to @var{width} * PHI.
  15185. If @option{size} is set, it must contain the width of the specified
  15186. pattern string, and the specified pattern will be centered in the
  15187. larger row.
  15188. If a filename or a pattern string is not specified, the size value
  15189. defaults to "320x518" (used for a randomly generated initial state).
  15190. @item scroll
  15191. If set to 1, scroll the output upward when all the rows in the output
  15192. have been already filled. If set to 0, the new generated row will be
  15193. written over the top row just after the bottom row is filled.
  15194. Defaults to 1.
  15195. @item start_full, full
  15196. If set to 1, completely fill the output with generated rows before
  15197. outputting the first frame.
  15198. This is the default behavior, for disabling set the value to 0.
  15199. @item stitch
  15200. If set to 1, stitch the left and right row edges together.
  15201. This is the default behavior, for disabling set the value to 0.
  15202. @end table
  15203. @subsection Examples
  15204. @itemize
  15205. @item
  15206. Read the initial state from @file{pattern}, and specify an output of
  15207. size 200x400.
  15208. @example
  15209. cellauto=f=pattern:s=200x400
  15210. @end example
  15211. @item
  15212. Generate a random initial row with a width of 200 cells, with a fill
  15213. ratio of 2/3:
  15214. @example
  15215. cellauto=ratio=2/3:s=200x200
  15216. @end example
  15217. @item
  15218. Create a pattern generated by rule 18 starting by a single alive cell
  15219. centered on an initial row with width 100:
  15220. @example
  15221. cellauto=p=@@:s=100x400:full=0:rule=18
  15222. @end example
  15223. @item
  15224. Specify a more elaborated initial pattern:
  15225. @example
  15226. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  15227. @end example
  15228. @end itemize
  15229. @anchor{coreimagesrc}
  15230. @section coreimagesrc
  15231. Video source generated on GPU using Apple's CoreImage API on OSX.
  15232. This video source is a specialized version of the @ref{coreimage} video filter.
  15233. Use a core image generator at the beginning of the applied filterchain to
  15234. generate the content.
  15235. The coreimagesrc video source accepts the following options:
  15236. @table @option
  15237. @item list_generators
  15238. List all available generators along with all their respective options as well as
  15239. possible minimum and maximum values along with the default values.
  15240. @example
  15241. list_generators=true
  15242. @end example
  15243. @item size, s
  15244. Specify the size of the sourced video. For the syntax of this option, check the
  15245. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15246. The default value is @code{320x240}.
  15247. @item rate, r
  15248. Specify the frame rate of the sourced video, as the number of frames
  15249. generated per second. It has to be a string in the format
  15250. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15251. number or a valid video frame rate abbreviation. The default value is
  15252. "25".
  15253. @item sar
  15254. Set the sample aspect ratio of the sourced video.
  15255. @item duration, d
  15256. Set the duration of the sourced video. See
  15257. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15258. for the accepted syntax.
  15259. If not specified, or the expressed duration is negative, the video is
  15260. supposed to be generated forever.
  15261. @end table
  15262. Additionally, all options of the @ref{coreimage} video filter are accepted.
  15263. A complete filterchain can be used for further processing of the
  15264. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  15265. and examples for details.
  15266. @subsection Examples
  15267. @itemize
  15268. @item
  15269. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  15270. given as complete and escaped command-line for Apple's standard bash shell:
  15271. @example
  15272. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  15273. @end example
  15274. This example is equivalent to the QRCode example of @ref{coreimage} without the
  15275. need for a nullsrc video source.
  15276. @end itemize
  15277. @section mandelbrot
  15278. Generate a Mandelbrot set fractal, and progressively zoom towards the
  15279. point specified with @var{start_x} and @var{start_y}.
  15280. This source accepts the following options:
  15281. @table @option
  15282. @item end_pts
  15283. Set the terminal pts value. Default value is 400.
  15284. @item end_scale
  15285. Set the terminal scale value.
  15286. Must be a floating point value. Default value is 0.3.
  15287. @item inner
  15288. Set the inner coloring mode, that is the algorithm used to draw the
  15289. Mandelbrot fractal internal region.
  15290. It shall assume one of the following values:
  15291. @table @option
  15292. @item black
  15293. Set black mode.
  15294. @item convergence
  15295. Show time until convergence.
  15296. @item mincol
  15297. Set color based on point closest to the origin of the iterations.
  15298. @item period
  15299. Set period mode.
  15300. @end table
  15301. Default value is @var{mincol}.
  15302. @item bailout
  15303. Set the bailout value. Default value is 10.0.
  15304. @item maxiter
  15305. Set the maximum of iterations performed by the rendering
  15306. algorithm. Default value is 7189.
  15307. @item outer
  15308. Set outer coloring mode.
  15309. It shall assume one of following values:
  15310. @table @option
  15311. @item iteration_count
  15312. Set iteration count mode.
  15313. @item normalized_iteration_count
  15314. set normalized iteration count mode.
  15315. @end table
  15316. Default value is @var{normalized_iteration_count}.
  15317. @item rate, r
  15318. Set frame rate, expressed as number of frames per second. Default
  15319. value is "25".
  15320. @item size, s
  15321. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15322. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15323. @item start_scale
  15324. Set the initial scale value. Default value is 3.0.
  15325. @item start_x
  15326. Set the initial x position. Must be a floating point value between
  15327. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15328. @item start_y
  15329. Set the initial y position. Must be a floating point value between
  15330. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15331. @end table
  15332. @section mptestsrc
  15333. Generate various test patterns, as generated by the MPlayer test filter.
  15334. The size of the generated video is fixed, and is 256x256.
  15335. This source is useful in particular for testing encoding features.
  15336. This source accepts the following options:
  15337. @table @option
  15338. @item rate, r
  15339. Specify the frame rate of the sourced video, as the number of frames
  15340. generated per second. It has to be a string in the format
  15341. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15342. number or a valid video frame rate abbreviation. The default value is
  15343. "25".
  15344. @item duration, d
  15345. Set the duration of the sourced video. See
  15346. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15347. for the accepted syntax.
  15348. If not specified, or the expressed duration is negative, the video is
  15349. supposed to be generated forever.
  15350. @item test, t
  15351. Set the number or the name of the test to perform. Supported tests are:
  15352. @table @option
  15353. @item dc_luma
  15354. @item dc_chroma
  15355. @item freq_luma
  15356. @item freq_chroma
  15357. @item amp_luma
  15358. @item amp_chroma
  15359. @item cbp
  15360. @item mv
  15361. @item ring1
  15362. @item ring2
  15363. @item all
  15364. @end table
  15365. Default value is "all", which will cycle through the list of all tests.
  15366. @end table
  15367. Some examples:
  15368. @example
  15369. mptestsrc=t=dc_luma
  15370. @end example
  15371. will generate a "dc_luma" test pattern.
  15372. @section frei0r_src
  15373. Provide a frei0r source.
  15374. To enable compilation of this filter you need to install the frei0r
  15375. header and configure FFmpeg with @code{--enable-frei0r}.
  15376. This source accepts the following parameters:
  15377. @table @option
  15378. @item size
  15379. The size of the video to generate. For the syntax of this option, check the
  15380. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15381. @item framerate
  15382. The framerate of the generated video. It may be a string of the form
  15383. @var{num}/@var{den} or a frame rate abbreviation.
  15384. @item filter_name
  15385. The name to the frei0r source to load. For more information regarding frei0r and
  15386. how to set the parameters, read the @ref{frei0r} section in the video filters
  15387. documentation.
  15388. @item filter_params
  15389. A '|'-separated list of parameters to pass to the frei0r source.
  15390. @end table
  15391. For example, to generate a frei0r partik0l source with size 200x200
  15392. and frame rate 10 which is overlaid on the overlay filter main input:
  15393. @example
  15394. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15395. @end example
  15396. @section life
  15397. Generate a life pattern.
  15398. This source is based on a generalization of John Conway's life game.
  15399. The sourced input represents a life grid, each pixel represents a cell
  15400. which can be in one of two possible states, alive or dead. Every cell
  15401. interacts with its eight neighbours, which are the cells that are
  15402. horizontally, vertically, or diagonally adjacent.
  15403. At each interaction the grid evolves according to the adopted rule,
  15404. which specifies the number of neighbor alive cells which will make a
  15405. cell stay alive or born. The @option{rule} option allows one to specify
  15406. the rule to adopt.
  15407. This source accepts the following options:
  15408. @table @option
  15409. @item filename, f
  15410. Set the file from which to read the initial grid state. In the file,
  15411. each non-whitespace character is considered an alive cell, and newline
  15412. is used to delimit the end of each row.
  15413. If this option is not specified, the initial grid is generated
  15414. randomly.
  15415. @item rate, r
  15416. Set the video rate, that is the number of frames generated per second.
  15417. Default is 25.
  15418. @item random_fill_ratio, ratio
  15419. Set the random fill ratio for the initial random grid. It is a
  15420. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15421. It is ignored when a file is specified.
  15422. @item random_seed, seed
  15423. Set the seed for filling the initial random grid, must be an integer
  15424. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15425. set to -1, the filter will try to use a good random seed on a best
  15426. effort basis.
  15427. @item rule
  15428. Set the life rule.
  15429. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15430. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15431. @var{NS} specifies the number of alive neighbor cells which make a
  15432. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15433. which make a dead cell to become alive (i.e. to "born").
  15434. "s" and "b" can be used in place of "S" and "B", respectively.
  15435. Alternatively a rule can be specified by an 18-bits integer. The 9
  15436. high order bits are used to encode the next cell state if it is alive
  15437. for each number of neighbor alive cells, the low order bits specify
  15438. the rule for "borning" new cells. Higher order bits encode for an
  15439. higher number of neighbor cells.
  15440. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15441. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15442. Default value is "S23/B3", which is the original Conway's game of life
  15443. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15444. cells, and will born a new cell if there are three alive cells around
  15445. a dead cell.
  15446. @item size, s
  15447. Set the size of the output video. For the syntax of this option, check the
  15448. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15449. If @option{filename} is specified, the size is set by default to the
  15450. same size of the input file. If @option{size} is set, it must contain
  15451. the size specified in the input file, and the initial grid defined in
  15452. that file is centered in the larger resulting area.
  15453. If a filename is not specified, the size value defaults to "320x240"
  15454. (used for a randomly generated initial grid).
  15455. @item stitch
  15456. If set to 1, stitch the left and right grid edges together, and the
  15457. top and bottom edges also. Defaults to 1.
  15458. @item mold
  15459. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15460. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15461. value from 0 to 255.
  15462. @item life_color
  15463. Set the color of living (or new born) cells.
  15464. @item death_color
  15465. Set the color of dead cells. If @option{mold} is set, this is the first color
  15466. used to represent a dead cell.
  15467. @item mold_color
  15468. Set mold color, for definitely dead and moldy cells.
  15469. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15470. ffmpeg-utils manual,ffmpeg-utils}.
  15471. @end table
  15472. @subsection Examples
  15473. @itemize
  15474. @item
  15475. Read a grid from @file{pattern}, and center it on a grid of size
  15476. 300x300 pixels:
  15477. @example
  15478. life=f=pattern:s=300x300
  15479. @end example
  15480. @item
  15481. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15482. @example
  15483. life=ratio=2/3:s=200x200
  15484. @end example
  15485. @item
  15486. Specify a custom rule for evolving a randomly generated grid:
  15487. @example
  15488. life=rule=S14/B34
  15489. @end example
  15490. @item
  15491. Full example with slow death effect (mold) using @command{ffplay}:
  15492. @example
  15493. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15494. @end example
  15495. @end itemize
  15496. @anchor{allrgb}
  15497. @anchor{allyuv}
  15498. @anchor{color}
  15499. @anchor{haldclutsrc}
  15500. @anchor{nullsrc}
  15501. @anchor{pal75bars}
  15502. @anchor{pal100bars}
  15503. @anchor{rgbtestsrc}
  15504. @anchor{smptebars}
  15505. @anchor{smptehdbars}
  15506. @anchor{testsrc}
  15507. @anchor{testsrc2}
  15508. @anchor{yuvtestsrc}
  15509. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15510. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15511. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15512. The @code{color} source provides an uniformly colored input.
  15513. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15514. @ref{haldclut} filter.
  15515. The @code{nullsrc} source returns unprocessed video frames. It is
  15516. mainly useful to be employed in analysis / debugging tools, or as the
  15517. source for filters which ignore the input data.
  15518. The @code{pal75bars} source generates a color bars pattern, based on
  15519. EBU PAL recommendations with 75% color levels.
  15520. The @code{pal100bars} source generates a color bars pattern, based on
  15521. EBU PAL recommendations with 100% color levels.
  15522. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15523. detecting RGB vs BGR issues. You should see a red, green and blue
  15524. stripe from top to bottom.
  15525. The @code{smptebars} source generates a color bars pattern, based on
  15526. the SMPTE Engineering Guideline EG 1-1990.
  15527. The @code{smptehdbars} source generates a color bars pattern, based on
  15528. the SMPTE RP 219-2002.
  15529. The @code{testsrc} source generates a test video pattern, showing a
  15530. color pattern, a scrolling gradient and a timestamp. This is mainly
  15531. intended for testing purposes.
  15532. The @code{testsrc2} source is similar to testsrc, but supports more
  15533. pixel formats instead of just @code{rgb24}. This allows using it as an
  15534. input for other tests without requiring a format conversion.
  15535. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15536. see a y, cb and cr stripe from top to bottom.
  15537. The sources accept the following parameters:
  15538. @table @option
  15539. @item level
  15540. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15541. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15542. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15543. coded on a @code{1/(N*N)} scale.
  15544. @item color, c
  15545. Specify the color of the source, only available in the @code{color}
  15546. source. For the syntax of this option, check the
  15547. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15548. @item size, s
  15549. Specify the size of the sourced video. For the syntax of this option, check the
  15550. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15551. The default value is @code{320x240}.
  15552. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15553. @code{haldclutsrc} filters.
  15554. @item rate, r
  15555. Specify the frame rate of the sourced video, as the number of frames
  15556. generated per second. It has to be a string in the format
  15557. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15558. number or a valid video frame rate abbreviation. The default value is
  15559. "25".
  15560. @item duration, d
  15561. Set the duration of the sourced video. See
  15562. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15563. for the accepted syntax.
  15564. If not specified, or the expressed duration is negative, the video is
  15565. supposed to be generated forever.
  15566. @item sar
  15567. Set the sample aspect ratio of the sourced video.
  15568. @item alpha
  15569. Specify the alpha (opacity) of the background, only available in the
  15570. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15571. 255 (fully opaque, the default).
  15572. @item decimals, n
  15573. Set the number of decimals to show in the timestamp, only available in the
  15574. @code{testsrc} source.
  15575. The displayed timestamp value will correspond to the original
  15576. timestamp value multiplied by the power of 10 of the specified
  15577. value. Default value is 0.
  15578. @end table
  15579. @subsection Examples
  15580. @itemize
  15581. @item
  15582. Generate a video with a duration of 5.3 seconds, with size
  15583. 176x144 and a frame rate of 10 frames per second:
  15584. @example
  15585. testsrc=duration=5.3:size=qcif:rate=10
  15586. @end example
  15587. @item
  15588. The following graph description will generate a red source
  15589. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15590. frames per second:
  15591. @example
  15592. color=c=red@@0.2:s=qcif:r=10
  15593. @end example
  15594. @item
  15595. If the input content is to be ignored, @code{nullsrc} can be used. The
  15596. following command generates noise in the luminance plane by employing
  15597. the @code{geq} filter:
  15598. @example
  15599. nullsrc=s=256x256, geq=random(1)*255:128:128
  15600. @end example
  15601. @end itemize
  15602. @subsection Commands
  15603. The @code{color} source supports the following commands:
  15604. @table @option
  15605. @item c, color
  15606. Set the color of the created image. Accepts the same syntax of the
  15607. corresponding @option{color} option.
  15608. @end table
  15609. @section openclsrc
  15610. Generate video using an OpenCL program.
  15611. @table @option
  15612. @item source
  15613. OpenCL program source file.
  15614. @item kernel
  15615. Kernel name in program.
  15616. @item size, s
  15617. Size of frames to generate. This must be set.
  15618. @item format
  15619. Pixel format to use for the generated frames. This must be set.
  15620. @item rate, r
  15621. Number of frames generated every second. Default value is '25'.
  15622. @end table
  15623. For details of how the program loading works, see the @ref{program_opencl}
  15624. filter.
  15625. Example programs:
  15626. @itemize
  15627. @item
  15628. Generate a colour ramp by setting pixel values from the position of the pixel
  15629. in the output image. (Note that this will work with all pixel formats, but
  15630. the generated output will not be the same.)
  15631. @verbatim
  15632. __kernel void ramp(__write_only image2d_t dst,
  15633. unsigned int index)
  15634. {
  15635. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15636. float4 val;
  15637. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15638. write_imagef(dst, loc, val);
  15639. }
  15640. @end verbatim
  15641. @item
  15642. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15643. @verbatim
  15644. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15645. unsigned int index)
  15646. {
  15647. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15648. float4 value = 0.0f;
  15649. int x = loc.x + index;
  15650. int y = loc.y + index;
  15651. while (x > 0 || y > 0) {
  15652. if (x % 3 == 1 && y % 3 == 1) {
  15653. value = 1.0f;
  15654. break;
  15655. }
  15656. x /= 3;
  15657. y /= 3;
  15658. }
  15659. write_imagef(dst, loc, value);
  15660. }
  15661. @end verbatim
  15662. @end itemize
  15663. @c man end VIDEO SOURCES
  15664. @chapter Video Sinks
  15665. @c man begin VIDEO SINKS
  15666. Below is a description of the currently available video sinks.
  15667. @section buffersink
  15668. Buffer video frames, and make them available to the end of the filter
  15669. graph.
  15670. This sink is mainly intended for programmatic use, in particular
  15671. through the interface defined in @file{libavfilter/buffersink.h}
  15672. or the options system.
  15673. It accepts a pointer to an AVBufferSinkContext structure, which
  15674. defines the incoming buffers' formats, to be passed as the opaque
  15675. parameter to @code{avfilter_init_filter} for initialization.
  15676. @section nullsink
  15677. Null video sink: do absolutely nothing with the input video. It is
  15678. mainly useful as a template and for use in analysis / debugging
  15679. tools.
  15680. @c man end VIDEO SINKS
  15681. @chapter Multimedia Filters
  15682. @c man begin MULTIMEDIA FILTERS
  15683. Below is a description of the currently available multimedia filters.
  15684. @section abitscope
  15685. Convert input audio to a video output, displaying the audio bit scope.
  15686. The filter accepts the following options:
  15687. @table @option
  15688. @item rate, r
  15689. Set frame rate, expressed as number of frames per second. Default
  15690. value is "25".
  15691. @item size, s
  15692. Specify the video size for the output. For the syntax of this option, check the
  15693. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15694. Default value is @code{1024x256}.
  15695. @item colors
  15696. Specify list of colors separated by space or by '|' which will be used to
  15697. draw channels. Unrecognized or missing colors will be replaced
  15698. by white color.
  15699. @end table
  15700. @section ahistogram
  15701. Convert input audio to a video output, displaying the volume histogram.
  15702. The filter accepts the following options:
  15703. @table @option
  15704. @item dmode
  15705. Specify how histogram is calculated.
  15706. It accepts the following values:
  15707. @table @samp
  15708. @item single
  15709. Use single histogram for all channels.
  15710. @item separate
  15711. Use separate histogram for each channel.
  15712. @end table
  15713. Default is @code{single}.
  15714. @item rate, r
  15715. Set frame rate, expressed as number of frames per second. Default
  15716. value is "25".
  15717. @item size, s
  15718. Specify the video size for the output. For the syntax of this option, check the
  15719. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15720. Default value is @code{hd720}.
  15721. @item scale
  15722. Set display scale.
  15723. It accepts the following values:
  15724. @table @samp
  15725. @item log
  15726. logarithmic
  15727. @item sqrt
  15728. square root
  15729. @item cbrt
  15730. cubic root
  15731. @item lin
  15732. linear
  15733. @item rlog
  15734. reverse logarithmic
  15735. @end table
  15736. Default is @code{log}.
  15737. @item ascale
  15738. Set amplitude scale.
  15739. It accepts the following values:
  15740. @table @samp
  15741. @item log
  15742. logarithmic
  15743. @item lin
  15744. linear
  15745. @end table
  15746. Default is @code{log}.
  15747. @item acount
  15748. Set how much frames to accumulate in histogram.
  15749. Default is 1. Setting this to -1 accumulates all frames.
  15750. @item rheight
  15751. Set histogram ratio of window height.
  15752. @item slide
  15753. Set sonogram sliding.
  15754. It accepts the following values:
  15755. @table @samp
  15756. @item replace
  15757. replace old rows with new ones.
  15758. @item scroll
  15759. scroll from top to bottom.
  15760. @end table
  15761. Default is @code{replace}.
  15762. @end table
  15763. @section aphasemeter
  15764. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  15765. representing mean phase of current audio frame. A video output can also be produced and is
  15766. enabled by default. The audio is passed through as first output.
  15767. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  15768. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  15769. and @code{1} means channels are in phase.
  15770. The filter accepts the following options, all related to its video output:
  15771. @table @option
  15772. @item rate, r
  15773. Set the output frame rate. Default value is @code{25}.
  15774. @item size, s
  15775. Set the video size for the output. For the syntax of this option, check the
  15776. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15777. Default value is @code{800x400}.
  15778. @item rc
  15779. @item gc
  15780. @item bc
  15781. Specify the red, green, blue contrast. Default values are @code{2},
  15782. @code{7} and @code{1}.
  15783. Allowed range is @code{[0, 255]}.
  15784. @item mpc
  15785. Set color which will be used for drawing median phase. If color is
  15786. @code{none} which is default, no median phase value will be drawn.
  15787. @item video
  15788. Enable video output. Default is enabled.
  15789. @end table
  15790. @section avectorscope
  15791. Convert input audio to a video output, representing the audio vector
  15792. scope.
  15793. The filter is used to measure the difference between channels of stereo
  15794. audio stream. A monoaural signal, consisting of identical left and right
  15795. signal, results in straight vertical line. Any stereo separation is visible
  15796. as a deviation from this line, creating a Lissajous figure.
  15797. If the straight (or deviation from it) but horizontal line appears this
  15798. indicates that the left and right channels are out of phase.
  15799. The filter accepts the following options:
  15800. @table @option
  15801. @item mode, m
  15802. Set the vectorscope mode.
  15803. Available values are:
  15804. @table @samp
  15805. @item lissajous
  15806. Lissajous rotated by 45 degrees.
  15807. @item lissajous_xy
  15808. Same as above but not rotated.
  15809. @item polar
  15810. Shape resembling half of circle.
  15811. @end table
  15812. Default value is @samp{lissajous}.
  15813. @item size, s
  15814. Set the video size for the output. For the syntax of this option, check the
  15815. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15816. Default value is @code{400x400}.
  15817. @item rate, r
  15818. Set the output frame rate. Default value is @code{25}.
  15819. @item rc
  15820. @item gc
  15821. @item bc
  15822. @item ac
  15823. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  15824. @code{160}, @code{80} and @code{255}.
  15825. Allowed range is @code{[0, 255]}.
  15826. @item rf
  15827. @item gf
  15828. @item bf
  15829. @item af
  15830. Specify the red, green, blue and alpha fade. Default values are @code{15},
  15831. @code{10}, @code{5} and @code{5}.
  15832. Allowed range is @code{[0, 255]}.
  15833. @item zoom
  15834. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  15835. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  15836. @item draw
  15837. Set the vectorscope drawing mode.
  15838. Available values are:
  15839. @table @samp
  15840. @item dot
  15841. Draw dot for each sample.
  15842. @item line
  15843. Draw line between previous and current sample.
  15844. @end table
  15845. Default value is @samp{dot}.
  15846. @item scale
  15847. Specify amplitude scale of audio samples.
  15848. Available values are:
  15849. @table @samp
  15850. @item lin
  15851. Linear.
  15852. @item sqrt
  15853. Square root.
  15854. @item cbrt
  15855. Cubic root.
  15856. @item log
  15857. Logarithmic.
  15858. @end table
  15859. @item swap
  15860. Swap left channel axis with right channel axis.
  15861. @item mirror
  15862. Mirror axis.
  15863. @table @samp
  15864. @item none
  15865. No mirror.
  15866. @item x
  15867. Mirror only x axis.
  15868. @item y
  15869. Mirror only y axis.
  15870. @item xy
  15871. Mirror both axis.
  15872. @end table
  15873. @end table
  15874. @subsection Examples
  15875. @itemize
  15876. @item
  15877. Complete example using @command{ffplay}:
  15878. @example
  15879. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15880. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  15881. @end example
  15882. @end itemize
  15883. @section bench, abench
  15884. Benchmark part of a filtergraph.
  15885. The filter accepts the following options:
  15886. @table @option
  15887. @item action
  15888. Start or stop a timer.
  15889. Available values are:
  15890. @table @samp
  15891. @item start
  15892. Get the current time, set it as frame metadata (using the key
  15893. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  15894. @item stop
  15895. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  15896. the input frame metadata to get the time difference. Time difference, average,
  15897. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  15898. @code{min}) are then printed. The timestamps are expressed in seconds.
  15899. @end table
  15900. @end table
  15901. @subsection Examples
  15902. @itemize
  15903. @item
  15904. Benchmark @ref{selectivecolor} filter:
  15905. @example
  15906. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  15907. @end example
  15908. @end itemize
  15909. @section concat
  15910. Concatenate audio and video streams, joining them together one after the
  15911. other.
  15912. The filter works on segments of synchronized video and audio streams. All
  15913. segments must have the same number of streams of each type, and that will
  15914. also be the number of streams at output.
  15915. The filter accepts the following options:
  15916. @table @option
  15917. @item n
  15918. Set the number of segments. Default is 2.
  15919. @item v
  15920. Set the number of output video streams, that is also the number of video
  15921. streams in each segment. Default is 1.
  15922. @item a
  15923. Set the number of output audio streams, that is also the number of audio
  15924. streams in each segment. Default is 0.
  15925. @item unsafe
  15926. Activate unsafe mode: do not fail if segments have a different format.
  15927. @end table
  15928. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  15929. @var{a} audio outputs.
  15930. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  15931. segment, in the same order as the outputs, then the inputs for the second
  15932. segment, etc.
  15933. Related streams do not always have exactly the same duration, for various
  15934. reasons including codec frame size or sloppy authoring. For that reason,
  15935. related synchronized streams (e.g. a video and its audio track) should be
  15936. concatenated at once. The concat filter will use the duration of the longest
  15937. stream in each segment (except the last one), and if necessary pad shorter
  15938. audio streams with silence.
  15939. For this filter to work correctly, all segments must start at timestamp 0.
  15940. All corresponding streams must have the same parameters in all segments; the
  15941. filtering system will automatically select a common pixel format for video
  15942. streams, and a common sample format, sample rate and channel layout for
  15943. audio streams, but other settings, such as resolution, must be converted
  15944. explicitly by the user.
  15945. Different frame rates are acceptable but will result in variable frame rate
  15946. at output; be sure to configure the output file to handle it.
  15947. @subsection Examples
  15948. @itemize
  15949. @item
  15950. Concatenate an opening, an episode and an ending, all in bilingual version
  15951. (video in stream 0, audio in streams 1 and 2):
  15952. @example
  15953. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  15954. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  15955. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  15956. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  15957. @end example
  15958. @item
  15959. Concatenate two parts, handling audio and video separately, using the
  15960. (a)movie sources, and adjusting the resolution:
  15961. @example
  15962. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  15963. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  15964. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  15965. @end example
  15966. Note that a desync will happen at the stitch if the audio and video streams
  15967. do not have exactly the same duration in the first file.
  15968. @end itemize
  15969. @subsection Commands
  15970. This filter supports the following commands:
  15971. @table @option
  15972. @item next
  15973. Close the current segment and step to the next one
  15974. @end table
  15975. @section drawgraph, adrawgraph
  15976. Draw a graph using input video or audio metadata.
  15977. It accepts the following parameters:
  15978. @table @option
  15979. @item m1
  15980. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  15981. @item fg1
  15982. Set 1st foreground color expression.
  15983. @item m2
  15984. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  15985. @item fg2
  15986. Set 2nd foreground color expression.
  15987. @item m3
  15988. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  15989. @item fg3
  15990. Set 3rd foreground color expression.
  15991. @item m4
  15992. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  15993. @item fg4
  15994. Set 4th foreground color expression.
  15995. @item min
  15996. Set minimal value of metadata value.
  15997. @item max
  15998. Set maximal value of metadata value.
  15999. @item bg
  16000. Set graph background color. Default is white.
  16001. @item mode
  16002. Set graph mode.
  16003. Available values for mode is:
  16004. @table @samp
  16005. @item bar
  16006. @item dot
  16007. @item line
  16008. @end table
  16009. Default is @code{line}.
  16010. @item slide
  16011. Set slide mode.
  16012. Available values for slide is:
  16013. @table @samp
  16014. @item frame
  16015. Draw new frame when right border is reached.
  16016. @item replace
  16017. Replace old columns with new ones.
  16018. @item scroll
  16019. Scroll from right to left.
  16020. @item rscroll
  16021. Scroll from left to right.
  16022. @item picture
  16023. Draw single picture.
  16024. @end table
  16025. Default is @code{frame}.
  16026. @item size
  16027. Set size of graph video. For the syntax of this option, check the
  16028. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16029. The default value is @code{900x256}.
  16030. The foreground color expressions can use the following variables:
  16031. @table @option
  16032. @item MIN
  16033. Minimal value of metadata value.
  16034. @item MAX
  16035. Maximal value of metadata value.
  16036. @item VAL
  16037. Current metadata key value.
  16038. @end table
  16039. The color is defined as 0xAABBGGRR.
  16040. @end table
  16041. Example using metadata from @ref{signalstats} filter:
  16042. @example
  16043. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  16044. @end example
  16045. Example using metadata from @ref{ebur128} filter:
  16046. @example
  16047. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  16048. @end example
  16049. @anchor{ebur128}
  16050. @section ebur128
  16051. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  16052. level. By default, it logs a message at a frequency of 10Hz with the
  16053. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  16054. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  16055. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  16056. sample format is double-precision floating point. The input stream will be converted to
  16057. this specification, if needed. Users may need to insert aformat and/or aresample filters
  16058. after this filter to obtain the original parameters.
  16059. The filter also has a video output (see the @var{video} option) with a real
  16060. time graph to observe the loudness evolution. The graphic contains the logged
  16061. message mentioned above, so it is not printed anymore when this option is set,
  16062. unless the verbose logging is set. The main graphing area contains the
  16063. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  16064. the momentary loudness (400 milliseconds), but can optionally be configured
  16065. to instead display short-term loudness (see @var{gauge}).
  16066. The green area marks a +/- 1LU target range around the target loudness
  16067. (-23LUFS by default, unless modified through @var{target}).
  16068. More information about the Loudness Recommendation EBU R128 on
  16069. @url{http://tech.ebu.ch/loudness}.
  16070. The filter accepts the following options:
  16071. @table @option
  16072. @item video
  16073. Activate the video output. The audio stream is passed unchanged whether this
  16074. option is set or no. The video stream will be the first output stream if
  16075. activated. Default is @code{0}.
  16076. @item size
  16077. Set the video size. This option is for video only. For the syntax of this
  16078. option, check the
  16079. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16080. Default and minimum resolution is @code{640x480}.
  16081. @item meter
  16082. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  16083. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  16084. other integer value between this range is allowed.
  16085. @item metadata
  16086. Set metadata injection. If set to @code{1}, the audio input will be segmented
  16087. into 100ms output frames, each of them containing various loudness information
  16088. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  16089. Default is @code{0}.
  16090. @item framelog
  16091. Force the frame logging level.
  16092. Available values are:
  16093. @table @samp
  16094. @item info
  16095. information logging level
  16096. @item verbose
  16097. verbose logging level
  16098. @end table
  16099. By default, the logging level is set to @var{info}. If the @option{video} or
  16100. the @option{metadata} options are set, it switches to @var{verbose}.
  16101. @item peak
  16102. Set peak mode(s).
  16103. Available modes can be cumulated (the option is a @code{flag} type). Possible
  16104. values are:
  16105. @table @samp
  16106. @item none
  16107. Disable any peak mode (default).
  16108. @item sample
  16109. Enable sample-peak mode.
  16110. Simple peak mode looking for the higher sample value. It logs a message
  16111. for sample-peak (identified by @code{SPK}).
  16112. @item true
  16113. Enable true-peak mode.
  16114. If enabled, the peak lookup is done on an over-sampled version of the input
  16115. stream for better peak accuracy. It logs a message for true-peak.
  16116. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  16117. This mode requires a build with @code{libswresample}.
  16118. @end table
  16119. @item dualmono
  16120. Treat mono input files as "dual mono". If a mono file is intended for playback
  16121. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  16122. If set to @code{true}, this option will compensate for this effect.
  16123. Multi-channel input files are not affected by this option.
  16124. @item panlaw
  16125. Set a specific pan law to be used for the measurement of dual mono files.
  16126. This parameter is optional, and has a default value of -3.01dB.
  16127. @item target
  16128. Set a specific target level (in LUFS) used as relative zero in the visualization.
  16129. This parameter is optional and has a default value of -23LUFS as specified
  16130. by EBU R128. However, material published online may prefer a level of -16LUFS
  16131. (e.g. for use with podcasts or video platforms).
  16132. @item gauge
  16133. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  16134. @code{shortterm}. By default the momentary value will be used, but in certain
  16135. scenarios it may be more useful to observe the short term value instead (e.g.
  16136. live mixing).
  16137. @item scale
  16138. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  16139. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  16140. video output, not the summary or continuous log output.
  16141. @end table
  16142. @subsection Examples
  16143. @itemize
  16144. @item
  16145. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  16146. @example
  16147. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  16148. @end example
  16149. @item
  16150. Run an analysis with @command{ffmpeg}:
  16151. @example
  16152. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  16153. @end example
  16154. @end itemize
  16155. @section interleave, ainterleave
  16156. Temporally interleave frames from several inputs.
  16157. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  16158. These filters read frames from several inputs and send the oldest
  16159. queued frame to the output.
  16160. Input streams must have well defined, monotonically increasing frame
  16161. timestamp values.
  16162. In order to submit one frame to output, these filters need to enqueue
  16163. at least one frame for each input, so they cannot work in case one
  16164. input is not yet terminated and will not receive incoming frames.
  16165. For example consider the case when one input is a @code{select} filter
  16166. which always drops input frames. The @code{interleave} filter will keep
  16167. reading from that input, but it will never be able to send new frames
  16168. to output until the input sends an end-of-stream signal.
  16169. Also, depending on inputs synchronization, the filters will drop
  16170. frames in case one input receives more frames than the other ones, and
  16171. the queue is already filled.
  16172. These filters accept the following options:
  16173. @table @option
  16174. @item nb_inputs, n
  16175. Set the number of different inputs, it is 2 by default.
  16176. @end table
  16177. @subsection Examples
  16178. @itemize
  16179. @item
  16180. Interleave frames belonging to different streams using @command{ffmpeg}:
  16181. @example
  16182. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  16183. @end example
  16184. @item
  16185. Add flickering blur effect:
  16186. @example
  16187. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  16188. @end example
  16189. @end itemize
  16190. @section metadata, ametadata
  16191. Manipulate frame metadata.
  16192. This filter accepts the following options:
  16193. @table @option
  16194. @item mode
  16195. Set mode of operation of the filter.
  16196. Can be one of the following:
  16197. @table @samp
  16198. @item select
  16199. If both @code{value} and @code{key} is set, select frames
  16200. which have such metadata. If only @code{key} is set, select
  16201. every frame that has such key in metadata.
  16202. @item add
  16203. Add new metadata @code{key} and @code{value}. If key is already available
  16204. do nothing.
  16205. @item modify
  16206. Modify value of already present key.
  16207. @item delete
  16208. If @code{value} is set, delete only keys that have such value.
  16209. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  16210. the frame.
  16211. @item print
  16212. Print key and its value if metadata was found. If @code{key} is not set print all
  16213. metadata values available in frame.
  16214. @end table
  16215. @item key
  16216. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  16217. @item value
  16218. Set metadata value which will be used. This option is mandatory for
  16219. @code{modify} and @code{add} mode.
  16220. @item function
  16221. Which function to use when comparing metadata value and @code{value}.
  16222. Can be one of following:
  16223. @table @samp
  16224. @item same_str
  16225. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  16226. @item starts_with
  16227. Values are interpreted as strings, returns true if metadata value starts with
  16228. the @code{value} option string.
  16229. @item less
  16230. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  16231. @item equal
  16232. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  16233. @item greater
  16234. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  16235. @item expr
  16236. Values are interpreted as floats, returns true if expression from option @code{expr}
  16237. evaluates to true.
  16238. @end table
  16239. @item expr
  16240. Set expression which is used when @code{function} is set to @code{expr}.
  16241. The expression is evaluated through the eval API and can contain the following
  16242. constants:
  16243. @table @option
  16244. @item VALUE1
  16245. Float representation of @code{value} from metadata key.
  16246. @item VALUE2
  16247. Float representation of @code{value} as supplied by user in @code{value} option.
  16248. @end table
  16249. @item file
  16250. If specified in @code{print} mode, output is written to the named file. Instead of
  16251. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  16252. for standard output. If @code{file} option is not set, output is written to the log
  16253. with AV_LOG_INFO loglevel.
  16254. @end table
  16255. @subsection Examples
  16256. @itemize
  16257. @item
  16258. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  16259. between 0 and 1.
  16260. @example
  16261. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  16262. @end example
  16263. @item
  16264. Print silencedetect output to file @file{metadata.txt}.
  16265. @example
  16266. silencedetect,ametadata=mode=print:file=metadata.txt
  16267. @end example
  16268. @item
  16269. Direct all metadata to a pipe with file descriptor 4.
  16270. @example
  16271. metadata=mode=print:file='pipe\:4'
  16272. @end example
  16273. @end itemize
  16274. @section perms, aperms
  16275. Set read/write permissions for the output frames.
  16276. These filters are mainly aimed at developers to test direct path in the
  16277. following filter in the filtergraph.
  16278. The filters accept the following options:
  16279. @table @option
  16280. @item mode
  16281. Select the permissions mode.
  16282. It accepts the following values:
  16283. @table @samp
  16284. @item none
  16285. Do nothing. This is the default.
  16286. @item ro
  16287. Set all the output frames read-only.
  16288. @item rw
  16289. Set all the output frames directly writable.
  16290. @item toggle
  16291. Make the frame read-only if writable, and writable if read-only.
  16292. @item random
  16293. Set each output frame read-only or writable randomly.
  16294. @end table
  16295. @item seed
  16296. Set the seed for the @var{random} mode, must be an integer included between
  16297. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16298. @code{-1}, the filter will try to use a good random seed on a best effort
  16299. basis.
  16300. @end table
  16301. Note: in case of auto-inserted filter between the permission filter and the
  16302. following one, the permission might not be received as expected in that
  16303. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16304. perms/aperms filter can avoid this problem.
  16305. @section realtime, arealtime
  16306. Slow down filtering to match real time approximately.
  16307. These filters will pause the filtering for a variable amount of time to
  16308. match the output rate with the input timestamps.
  16309. They are similar to the @option{re} option to @code{ffmpeg}.
  16310. They accept the following options:
  16311. @table @option
  16312. @item limit
  16313. Time limit for the pauses. Any pause longer than that will be considered
  16314. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16315. @item speed
  16316. Speed factor for processing. The value must be a float larger than zero.
  16317. Values larger than 1.0 will result in faster than realtime processing,
  16318. smaller will slow processing down. The @var{limit} is automatically adapted
  16319. accordingly. Default is 1.0.
  16320. A processing speed faster than what is possible without these filters cannot
  16321. be achieved.
  16322. @end table
  16323. @anchor{select}
  16324. @section select, aselect
  16325. Select frames to pass in output.
  16326. This filter accepts the following options:
  16327. @table @option
  16328. @item expr, e
  16329. Set expression, which is evaluated for each input frame.
  16330. If the expression is evaluated to zero, the frame is discarded.
  16331. If the evaluation result is negative or NaN, the frame is sent to the
  16332. first output; otherwise it is sent to the output with index
  16333. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16334. For example a value of @code{1.2} corresponds to the output with index
  16335. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16336. @item outputs, n
  16337. Set the number of outputs. The output to which to send the selected
  16338. frame is based on the result of the evaluation. Default value is 1.
  16339. @end table
  16340. The expression can contain the following constants:
  16341. @table @option
  16342. @item n
  16343. The (sequential) number of the filtered frame, starting from 0.
  16344. @item selected_n
  16345. The (sequential) number of the selected frame, starting from 0.
  16346. @item prev_selected_n
  16347. The sequential number of the last selected frame. It's NAN if undefined.
  16348. @item TB
  16349. The timebase of the input timestamps.
  16350. @item pts
  16351. The PTS (Presentation TimeStamp) of the filtered video frame,
  16352. expressed in @var{TB} units. It's NAN if undefined.
  16353. @item t
  16354. The PTS of the filtered video frame,
  16355. expressed in seconds. It's NAN if undefined.
  16356. @item prev_pts
  16357. The PTS of the previously filtered video frame. It's NAN if undefined.
  16358. @item prev_selected_pts
  16359. The PTS of the last previously filtered video frame. It's NAN if undefined.
  16360. @item prev_selected_t
  16361. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  16362. @item start_pts
  16363. The PTS of the first video frame in the video. It's NAN if undefined.
  16364. @item start_t
  16365. The time of the first video frame in the video. It's NAN if undefined.
  16366. @item pict_type @emph{(video only)}
  16367. The type of the filtered frame. It can assume one of the following
  16368. values:
  16369. @table @option
  16370. @item I
  16371. @item P
  16372. @item B
  16373. @item S
  16374. @item SI
  16375. @item SP
  16376. @item BI
  16377. @end table
  16378. @item interlace_type @emph{(video only)}
  16379. The frame interlace type. It can assume one of the following values:
  16380. @table @option
  16381. @item PROGRESSIVE
  16382. The frame is progressive (not interlaced).
  16383. @item TOPFIRST
  16384. The frame is top-field-first.
  16385. @item BOTTOMFIRST
  16386. The frame is bottom-field-first.
  16387. @end table
  16388. @item consumed_sample_n @emph{(audio only)}
  16389. the number of selected samples before the current frame
  16390. @item samples_n @emph{(audio only)}
  16391. the number of samples in the current frame
  16392. @item sample_rate @emph{(audio only)}
  16393. the input sample rate
  16394. @item key
  16395. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16396. @item pos
  16397. the position in the file of the filtered frame, -1 if the information
  16398. is not available (e.g. for synthetic video)
  16399. @item scene @emph{(video only)}
  16400. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16401. probability for the current frame to introduce a new scene, while a higher
  16402. value means the current frame is more likely to be one (see the example below)
  16403. @item concatdec_select
  16404. The concat demuxer can select only part of a concat input file by setting an
  16405. inpoint and an outpoint, but the output packets may not be entirely contained
  16406. in the selected interval. By using this variable, it is possible to skip frames
  16407. generated by the concat demuxer which are not exactly contained in the selected
  16408. interval.
  16409. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16410. and the @var{lavf.concat.duration} packet metadata values which are also
  16411. present in the decoded frames.
  16412. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16413. start_time and either the duration metadata is missing or the frame pts is less
  16414. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16415. missing.
  16416. That basically means that an input frame is selected if its pts is within the
  16417. interval set by the concat demuxer.
  16418. @end table
  16419. The default value of the select expression is "1".
  16420. @subsection Examples
  16421. @itemize
  16422. @item
  16423. Select all frames in input:
  16424. @example
  16425. select
  16426. @end example
  16427. The example above is the same as:
  16428. @example
  16429. select=1
  16430. @end example
  16431. @item
  16432. Skip all frames:
  16433. @example
  16434. select=0
  16435. @end example
  16436. @item
  16437. Select only I-frames:
  16438. @example
  16439. select='eq(pict_type\,I)'
  16440. @end example
  16441. @item
  16442. Select one frame every 100:
  16443. @example
  16444. select='not(mod(n\,100))'
  16445. @end example
  16446. @item
  16447. Select only frames contained in the 10-20 time interval:
  16448. @example
  16449. select=between(t\,10\,20)
  16450. @end example
  16451. @item
  16452. Select only I-frames contained in the 10-20 time interval:
  16453. @example
  16454. select=between(t\,10\,20)*eq(pict_type\,I)
  16455. @end example
  16456. @item
  16457. Select frames with a minimum distance of 10 seconds:
  16458. @example
  16459. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16460. @end example
  16461. @item
  16462. Use aselect to select only audio frames with samples number > 100:
  16463. @example
  16464. aselect='gt(samples_n\,100)'
  16465. @end example
  16466. @item
  16467. Create a mosaic of the first scenes:
  16468. @example
  16469. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16470. @end example
  16471. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16472. choice.
  16473. @item
  16474. Send even and odd frames to separate outputs, and compose them:
  16475. @example
  16476. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16477. @end example
  16478. @item
  16479. Select useful frames from an ffconcat file which is using inpoints and
  16480. outpoints but where the source files are not intra frame only.
  16481. @example
  16482. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16483. @end example
  16484. @end itemize
  16485. @section sendcmd, asendcmd
  16486. Send commands to filters in the filtergraph.
  16487. These filters read commands to be sent to other filters in the
  16488. filtergraph.
  16489. @code{sendcmd} must be inserted between two video filters,
  16490. @code{asendcmd} must be inserted between two audio filters, but apart
  16491. from that they act the same way.
  16492. The specification of commands can be provided in the filter arguments
  16493. with the @var{commands} option, or in a file specified by the
  16494. @var{filename} option.
  16495. These filters accept the following options:
  16496. @table @option
  16497. @item commands, c
  16498. Set the commands to be read and sent to the other filters.
  16499. @item filename, f
  16500. Set the filename of the commands to be read and sent to the other
  16501. filters.
  16502. @end table
  16503. @subsection Commands syntax
  16504. A commands description consists of a sequence of interval
  16505. specifications, comprising a list of commands to be executed when a
  16506. particular event related to that interval occurs. The occurring event
  16507. is typically the current frame time entering or leaving a given time
  16508. interval.
  16509. An interval is specified by the following syntax:
  16510. @example
  16511. @var{START}[-@var{END}] @var{COMMANDS};
  16512. @end example
  16513. The time interval is specified by the @var{START} and @var{END} times.
  16514. @var{END} is optional and defaults to the maximum time.
  16515. The current frame time is considered within the specified interval if
  16516. it is included in the interval [@var{START}, @var{END}), that is when
  16517. the time is greater or equal to @var{START} and is lesser than
  16518. @var{END}.
  16519. @var{COMMANDS} consists of a sequence of one or more command
  16520. specifications, separated by ",", relating to that interval. The
  16521. syntax of a command specification is given by:
  16522. @example
  16523. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16524. @end example
  16525. @var{FLAGS} is optional and specifies the type of events relating to
  16526. the time interval which enable sending the specified command, and must
  16527. be a non-null sequence of identifier flags separated by "+" or "|" and
  16528. enclosed between "[" and "]".
  16529. The following flags are recognized:
  16530. @table @option
  16531. @item enter
  16532. The command is sent when the current frame timestamp enters the
  16533. specified interval. In other words, the command is sent when the
  16534. previous frame timestamp was not in the given interval, and the
  16535. current is.
  16536. @item leave
  16537. The command is sent when the current frame timestamp leaves the
  16538. specified interval. In other words, the command is sent when the
  16539. previous frame timestamp was in the given interval, and the
  16540. current is not.
  16541. @end table
  16542. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16543. assumed.
  16544. @var{TARGET} specifies the target of the command, usually the name of
  16545. the filter class or a specific filter instance name.
  16546. @var{COMMAND} specifies the name of the command for the target filter.
  16547. @var{ARG} is optional and specifies the optional list of argument for
  16548. the given @var{COMMAND}.
  16549. Between one interval specification and another, whitespaces, or
  16550. sequences of characters starting with @code{#} until the end of line,
  16551. are ignored and can be used to annotate comments.
  16552. A simplified BNF description of the commands specification syntax
  16553. follows:
  16554. @example
  16555. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16556. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16557. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16558. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16559. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16560. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16561. @end example
  16562. @subsection Examples
  16563. @itemize
  16564. @item
  16565. Specify audio tempo change at second 4:
  16566. @example
  16567. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16568. @end example
  16569. @item
  16570. Target a specific filter instance:
  16571. @example
  16572. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  16573. @end example
  16574. @item
  16575. Specify a list of drawtext and hue commands in a file.
  16576. @example
  16577. # show text in the interval 5-10
  16578. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  16579. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  16580. # desaturate the image in the interval 15-20
  16581. 15.0-20.0 [enter] hue s 0,
  16582. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16583. [leave] hue s 1,
  16584. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16585. # apply an exponential saturation fade-out effect, starting from time 25
  16586. 25 [enter] hue s exp(25-t)
  16587. @end example
  16588. A filtergraph allowing to read and process the above command list
  16589. stored in a file @file{test.cmd}, can be specified with:
  16590. @example
  16591. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16592. @end example
  16593. @end itemize
  16594. @anchor{setpts}
  16595. @section setpts, asetpts
  16596. Change the PTS (presentation timestamp) of the input frames.
  16597. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16598. This filter accepts the following options:
  16599. @table @option
  16600. @item expr
  16601. The expression which is evaluated for each frame to construct its timestamp.
  16602. @end table
  16603. The expression is evaluated through the eval API and can contain the following
  16604. constants:
  16605. @table @option
  16606. @item FRAME_RATE, FR
  16607. frame rate, only defined for constant frame-rate video
  16608. @item PTS
  16609. The presentation timestamp in input
  16610. @item N
  16611. The count of the input frame for video or the number of consumed samples,
  16612. not including the current frame for audio, starting from 0.
  16613. @item NB_CONSUMED_SAMPLES
  16614. The number of consumed samples, not including the current frame (only
  16615. audio)
  16616. @item NB_SAMPLES, S
  16617. The number of samples in the current frame (only audio)
  16618. @item SAMPLE_RATE, SR
  16619. The audio sample rate.
  16620. @item STARTPTS
  16621. The PTS of the first frame.
  16622. @item STARTT
  16623. the time in seconds of the first frame
  16624. @item INTERLACED
  16625. State whether the current frame is interlaced.
  16626. @item T
  16627. the time in seconds of the current frame
  16628. @item POS
  16629. original position in the file of the frame, or undefined if undefined
  16630. for the current frame
  16631. @item PREV_INPTS
  16632. The previous input PTS.
  16633. @item PREV_INT
  16634. previous input time in seconds
  16635. @item PREV_OUTPTS
  16636. The previous output PTS.
  16637. @item PREV_OUTT
  16638. previous output time in seconds
  16639. @item RTCTIME
  16640. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16641. instead.
  16642. @item RTCSTART
  16643. The wallclock (RTC) time at the start of the movie in microseconds.
  16644. @item TB
  16645. The timebase of the input timestamps.
  16646. @end table
  16647. @subsection Examples
  16648. @itemize
  16649. @item
  16650. Start counting PTS from zero
  16651. @example
  16652. setpts=PTS-STARTPTS
  16653. @end example
  16654. @item
  16655. Apply fast motion effect:
  16656. @example
  16657. setpts=0.5*PTS
  16658. @end example
  16659. @item
  16660. Apply slow motion effect:
  16661. @example
  16662. setpts=2.0*PTS
  16663. @end example
  16664. @item
  16665. Set fixed rate of 25 frames per second:
  16666. @example
  16667. setpts=N/(25*TB)
  16668. @end example
  16669. @item
  16670. Set fixed rate 25 fps with some jitter:
  16671. @example
  16672. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16673. @end example
  16674. @item
  16675. Apply an offset of 10 seconds to the input PTS:
  16676. @example
  16677. setpts=PTS+10/TB
  16678. @end example
  16679. @item
  16680. Generate timestamps from a "live source" and rebase onto the current timebase:
  16681. @example
  16682. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16683. @end example
  16684. @item
  16685. Generate timestamps by counting samples:
  16686. @example
  16687. asetpts=N/SR/TB
  16688. @end example
  16689. @end itemize
  16690. @section setrange
  16691. Force color range for the output video frame.
  16692. The @code{setrange} filter marks the color range property for the
  16693. output frames. It does not change the input frame, but only sets the
  16694. corresponding property, which affects how the frame is treated by
  16695. following filters.
  16696. The filter accepts the following options:
  16697. @table @option
  16698. @item range
  16699. Available values are:
  16700. @table @samp
  16701. @item auto
  16702. Keep the same color range property.
  16703. @item unspecified, unknown
  16704. Set the color range as unspecified.
  16705. @item limited, tv, mpeg
  16706. Set the color range as limited.
  16707. @item full, pc, jpeg
  16708. Set the color range as full.
  16709. @end table
  16710. @end table
  16711. @section settb, asettb
  16712. Set the timebase to use for the output frames timestamps.
  16713. It is mainly useful for testing timebase configuration.
  16714. It accepts the following parameters:
  16715. @table @option
  16716. @item expr, tb
  16717. The expression which is evaluated into the output timebase.
  16718. @end table
  16719. The value for @option{tb} is an arithmetic expression representing a
  16720. rational. The expression can contain the constants "AVTB" (the default
  16721. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16722. audio only). Default value is "intb".
  16723. @subsection Examples
  16724. @itemize
  16725. @item
  16726. Set the timebase to 1/25:
  16727. @example
  16728. settb=expr=1/25
  16729. @end example
  16730. @item
  16731. Set the timebase to 1/10:
  16732. @example
  16733. settb=expr=0.1
  16734. @end example
  16735. @item
  16736. Set the timebase to 1001/1000:
  16737. @example
  16738. settb=1+0.001
  16739. @end example
  16740. @item
  16741. Set the timebase to 2*intb:
  16742. @example
  16743. settb=2*intb
  16744. @end example
  16745. @item
  16746. Set the default timebase value:
  16747. @example
  16748. settb=AVTB
  16749. @end example
  16750. @end itemize
  16751. @section showcqt
  16752. Convert input audio to a video output representing frequency spectrum
  16753. logarithmically using Brown-Puckette constant Q transform algorithm with
  16754. direct frequency domain coefficient calculation (but the transform itself
  16755. is not really constant Q, instead the Q factor is actually variable/clamped),
  16756. with musical tone scale, from E0 to D#10.
  16757. The filter accepts the following options:
  16758. @table @option
  16759. @item size, s
  16760. Specify the video size for the output. It must be even. For the syntax of this option,
  16761. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16762. Default value is @code{1920x1080}.
  16763. @item fps, rate, r
  16764. Set the output frame rate. Default value is @code{25}.
  16765. @item bar_h
  16766. Set the bargraph height. It must be even. Default value is @code{-1} which
  16767. computes the bargraph height automatically.
  16768. @item axis_h
  16769. Set the axis height. It must be even. Default value is @code{-1} which computes
  16770. the axis height automatically.
  16771. @item sono_h
  16772. Set the sonogram height. It must be even. Default value is @code{-1} which
  16773. computes the sonogram height automatically.
  16774. @item fullhd
  16775. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  16776. instead. Default value is @code{1}.
  16777. @item sono_v, volume
  16778. Specify the sonogram volume expression. It can contain variables:
  16779. @table @option
  16780. @item bar_v
  16781. the @var{bar_v} evaluated expression
  16782. @item frequency, freq, f
  16783. the frequency where it is evaluated
  16784. @item timeclamp, tc
  16785. the value of @var{timeclamp} option
  16786. @end table
  16787. and functions:
  16788. @table @option
  16789. @item a_weighting(f)
  16790. A-weighting of equal loudness
  16791. @item b_weighting(f)
  16792. B-weighting of equal loudness
  16793. @item c_weighting(f)
  16794. C-weighting of equal loudness.
  16795. @end table
  16796. Default value is @code{16}.
  16797. @item bar_v, volume2
  16798. Specify the bargraph volume expression. It can contain variables:
  16799. @table @option
  16800. @item sono_v
  16801. the @var{sono_v} evaluated expression
  16802. @item frequency, freq, f
  16803. the frequency where it is evaluated
  16804. @item timeclamp, tc
  16805. the value of @var{timeclamp} option
  16806. @end table
  16807. and functions:
  16808. @table @option
  16809. @item a_weighting(f)
  16810. A-weighting of equal loudness
  16811. @item b_weighting(f)
  16812. B-weighting of equal loudness
  16813. @item c_weighting(f)
  16814. C-weighting of equal loudness.
  16815. @end table
  16816. Default value is @code{sono_v}.
  16817. @item sono_g, gamma
  16818. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  16819. higher gamma makes the spectrum having more range. Default value is @code{3}.
  16820. Acceptable range is @code{[1, 7]}.
  16821. @item bar_g, gamma2
  16822. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  16823. @code{[1, 7]}.
  16824. @item bar_t
  16825. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  16826. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  16827. @item timeclamp, tc
  16828. Specify the transform timeclamp. At low frequency, there is trade-off between
  16829. accuracy in time domain and frequency domain. If timeclamp is lower,
  16830. event in time domain is represented more accurately (such as fast bass drum),
  16831. otherwise event in frequency domain is represented more accurately
  16832. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  16833. @item attack
  16834. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  16835. limits future samples by applying asymmetric windowing in time domain, useful
  16836. when low latency is required. Accepted range is @code{[0, 1]}.
  16837. @item basefreq
  16838. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  16839. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  16840. @item endfreq
  16841. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  16842. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  16843. @item coeffclamp
  16844. This option is deprecated and ignored.
  16845. @item tlength
  16846. Specify the transform length in time domain. Use this option to control accuracy
  16847. trade-off between time domain and frequency domain at every frequency sample.
  16848. It can contain variables:
  16849. @table @option
  16850. @item frequency, freq, f
  16851. the frequency where it is evaluated
  16852. @item timeclamp, tc
  16853. the value of @var{timeclamp} option.
  16854. @end table
  16855. Default value is @code{384*tc/(384+tc*f)}.
  16856. @item count
  16857. Specify the transform count for every video frame. Default value is @code{6}.
  16858. Acceptable range is @code{[1, 30]}.
  16859. @item fcount
  16860. Specify the transform count for every single pixel. Default value is @code{0},
  16861. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  16862. @item fontfile
  16863. Specify font file for use with freetype to draw the axis. If not specified,
  16864. use embedded font. Note that drawing with font file or embedded font is not
  16865. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  16866. option instead.
  16867. @item font
  16868. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  16869. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  16870. @item fontcolor
  16871. Specify font color expression. This is arithmetic expression that should return
  16872. integer value 0xRRGGBB. It can contain variables:
  16873. @table @option
  16874. @item frequency, freq, f
  16875. the frequency where it is evaluated
  16876. @item timeclamp, tc
  16877. the value of @var{timeclamp} option
  16878. @end table
  16879. and functions:
  16880. @table @option
  16881. @item midi(f)
  16882. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  16883. @item r(x), g(x), b(x)
  16884. red, green, and blue value of intensity x.
  16885. @end table
  16886. Default value is @code{st(0, (midi(f)-59.5)/12);
  16887. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  16888. r(1-ld(1)) + b(ld(1))}.
  16889. @item axisfile
  16890. Specify image file to draw the axis. This option override @var{fontfile} and
  16891. @var{fontcolor} option.
  16892. @item axis, text
  16893. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  16894. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  16895. Default value is @code{1}.
  16896. @item csp
  16897. Set colorspace. The accepted values are:
  16898. @table @samp
  16899. @item unspecified
  16900. Unspecified (default)
  16901. @item bt709
  16902. BT.709
  16903. @item fcc
  16904. FCC
  16905. @item bt470bg
  16906. BT.470BG or BT.601-6 625
  16907. @item smpte170m
  16908. SMPTE-170M or BT.601-6 525
  16909. @item smpte240m
  16910. SMPTE-240M
  16911. @item bt2020ncl
  16912. BT.2020 with non-constant luminance
  16913. @end table
  16914. @item cscheme
  16915. Set spectrogram color scheme. This is list of floating point values with format
  16916. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  16917. The default is @code{1|0.5|0|0|0.5|1}.
  16918. @end table
  16919. @subsection Examples
  16920. @itemize
  16921. @item
  16922. Playing audio while showing the spectrum:
  16923. @example
  16924. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  16925. @end example
  16926. @item
  16927. Same as above, but with frame rate 30 fps:
  16928. @example
  16929. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  16930. @end example
  16931. @item
  16932. Playing at 1280x720:
  16933. @example
  16934. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  16935. @end example
  16936. @item
  16937. Disable sonogram display:
  16938. @example
  16939. sono_h=0
  16940. @end example
  16941. @item
  16942. A1 and its harmonics: A1, A2, (near)E3, A3:
  16943. @example
  16944. 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),
  16945. asplit[a][out1]; [a] showcqt [out0]'
  16946. @end example
  16947. @item
  16948. Same as above, but with more accuracy in frequency domain:
  16949. @example
  16950. 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),
  16951. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  16952. @end example
  16953. @item
  16954. Custom volume:
  16955. @example
  16956. bar_v=10:sono_v=bar_v*a_weighting(f)
  16957. @end example
  16958. @item
  16959. Custom gamma, now spectrum is linear to the amplitude.
  16960. @example
  16961. bar_g=2:sono_g=2
  16962. @end example
  16963. @item
  16964. Custom tlength equation:
  16965. @example
  16966. 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)))'
  16967. @end example
  16968. @item
  16969. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  16970. @example
  16971. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  16972. @end example
  16973. @item
  16974. Custom font using fontconfig:
  16975. @example
  16976. font='Courier New,Monospace,mono|bold'
  16977. @end example
  16978. @item
  16979. Custom frequency range with custom axis using image file:
  16980. @example
  16981. axisfile=myaxis.png:basefreq=40:endfreq=10000
  16982. @end example
  16983. @end itemize
  16984. @section showfreqs
  16985. Convert input audio to video output representing the audio power spectrum.
  16986. Audio amplitude is on Y-axis while frequency is on X-axis.
  16987. The filter accepts the following options:
  16988. @table @option
  16989. @item size, s
  16990. Specify size of video. For the syntax of this option, check the
  16991. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16992. Default is @code{1024x512}.
  16993. @item mode
  16994. Set display mode.
  16995. This set how each frequency bin will be represented.
  16996. It accepts the following values:
  16997. @table @samp
  16998. @item line
  16999. @item bar
  17000. @item dot
  17001. @end table
  17002. Default is @code{bar}.
  17003. @item ascale
  17004. Set amplitude scale.
  17005. It accepts the following values:
  17006. @table @samp
  17007. @item lin
  17008. Linear scale.
  17009. @item sqrt
  17010. Square root scale.
  17011. @item cbrt
  17012. Cubic root scale.
  17013. @item log
  17014. Logarithmic scale.
  17015. @end table
  17016. Default is @code{log}.
  17017. @item fscale
  17018. Set frequency scale.
  17019. It accepts the following values:
  17020. @table @samp
  17021. @item lin
  17022. Linear scale.
  17023. @item log
  17024. Logarithmic scale.
  17025. @item rlog
  17026. Reverse logarithmic scale.
  17027. @end table
  17028. Default is @code{lin}.
  17029. @item win_size
  17030. Set window size.
  17031. It accepts the following values:
  17032. @table @samp
  17033. @item w16
  17034. @item w32
  17035. @item w64
  17036. @item w128
  17037. @item w256
  17038. @item w512
  17039. @item w1024
  17040. @item w2048
  17041. @item w4096
  17042. @item w8192
  17043. @item w16384
  17044. @item w32768
  17045. @item w65536
  17046. @end table
  17047. Default is @code{w2048}
  17048. @item win_func
  17049. Set windowing function.
  17050. It accepts the following values:
  17051. @table @samp
  17052. @item rect
  17053. @item bartlett
  17054. @item hanning
  17055. @item hamming
  17056. @item blackman
  17057. @item welch
  17058. @item flattop
  17059. @item bharris
  17060. @item bnuttall
  17061. @item bhann
  17062. @item sine
  17063. @item nuttall
  17064. @item lanczos
  17065. @item gauss
  17066. @item tukey
  17067. @item dolph
  17068. @item cauchy
  17069. @item parzen
  17070. @item poisson
  17071. @item bohman
  17072. @end table
  17073. Default is @code{hanning}.
  17074. @item overlap
  17075. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17076. which means optimal overlap for selected window function will be picked.
  17077. @item averaging
  17078. Set time averaging. Setting this to 0 will display current maximal peaks.
  17079. Default is @code{1}, which means time averaging is disabled.
  17080. @item colors
  17081. Specify list of colors separated by space or by '|' which will be used to
  17082. draw channel frequencies. Unrecognized or missing colors will be replaced
  17083. by white color.
  17084. @item cmode
  17085. Set channel display mode.
  17086. It accepts the following values:
  17087. @table @samp
  17088. @item combined
  17089. @item separate
  17090. @end table
  17091. Default is @code{combined}.
  17092. @item minamp
  17093. Set minimum amplitude used in @code{log} amplitude scaler.
  17094. @end table
  17095. @section showspatial
  17096. Convert stereo input audio to a video output, representing the spatial relationship
  17097. between two channels.
  17098. The filter accepts the following options:
  17099. @table @option
  17100. @item size, s
  17101. Specify the video size for the output. For the syntax of this option, check the
  17102. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17103. Default value is @code{512x512}.
  17104. @item win_size
  17105. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  17106. @item win_func
  17107. Set window function.
  17108. It accepts the following values:
  17109. @table @samp
  17110. @item rect
  17111. @item bartlett
  17112. @item hann
  17113. @item hanning
  17114. @item hamming
  17115. @item blackman
  17116. @item welch
  17117. @item flattop
  17118. @item bharris
  17119. @item bnuttall
  17120. @item bhann
  17121. @item sine
  17122. @item nuttall
  17123. @item lanczos
  17124. @item gauss
  17125. @item tukey
  17126. @item dolph
  17127. @item cauchy
  17128. @item parzen
  17129. @item poisson
  17130. @item bohman
  17131. @end table
  17132. Default value is @code{hann}.
  17133. @item overlap
  17134. Set ratio of overlap window. Default value is @code{0.5}.
  17135. When value is @code{1} overlap is set to recommended size for specific
  17136. window function currently used.
  17137. @end table
  17138. @anchor{showspectrum}
  17139. @section showspectrum
  17140. Convert input audio to a video output, representing the audio frequency
  17141. spectrum.
  17142. The filter accepts the following options:
  17143. @table @option
  17144. @item size, s
  17145. Specify the video size for the output. For the syntax of this option, check the
  17146. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17147. Default value is @code{640x512}.
  17148. @item slide
  17149. Specify how the spectrum should slide along the window.
  17150. It accepts the following values:
  17151. @table @samp
  17152. @item replace
  17153. the samples start again on the left when they reach the right
  17154. @item scroll
  17155. the samples scroll from right to left
  17156. @item fullframe
  17157. frames are only produced when the samples reach the right
  17158. @item rscroll
  17159. the samples scroll from left to right
  17160. @end table
  17161. Default value is @code{replace}.
  17162. @item mode
  17163. Specify display mode.
  17164. It accepts the following values:
  17165. @table @samp
  17166. @item combined
  17167. all channels are displayed in the same row
  17168. @item separate
  17169. all channels are displayed in separate rows
  17170. @end table
  17171. Default value is @samp{combined}.
  17172. @item color
  17173. Specify display color mode.
  17174. It accepts the following values:
  17175. @table @samp
  17176. @item channel
  17177. each channel is displayed in a separate color
  17178. @item intensity
  17179. each channel is displayed using the same color scheme
  17180. @item rainbow
  17181. each channel is displayed using the rainbow color scheme
  17182. @item moreland
  17183. each channel is displayed using the moreland color scheme
  17184. @item nebulae
  17185. each channel is displayed using the nebulae color scheme
  17186. @item fire
  17187. each channel is displayed using the fire color scheme
  17188. @item fiery
  17189. each channel is displayed using the fiery color scheme
  17190. @item fruit
  17191. each channel is displayed using the fruit color scheme
  17192. @item cool
  17193. each channel is displayed using the cool color scheme
  17194. @item magma
  17195. each channel is displayed using the magma color scheme
  17196. @item green
  17197. each channel is displayed using the green color scheme
  17198. @item viridis
  17199. each channel is displayed using the viridis color scheme
  17200. @item plasma
  17201. each channel is displayed using the plasma color scheme
  17202. @item cividis
  17203. each channel is displayed using the cividis color scheme
  17204. @item terrain
  17205. each channel is displayed using the terrain color scheme
  17206. @end table
  17207. Default value is @samp{channel}.
  17208. @item scale
  17209. Specify scale used for calculating intensity color values.
  17210. It accepts the following values:
  17211. @table @samp
  17212. @item lin
  17213. linear
  17214. @item sqrt
  17215. square root, default
  17216. @item cbrt
  17217. cubic root
  17218. @item log
  17219. logarithmic
  17220. @item 4thrt
  17221. 4th root
  17222. @item 5thrt
  17223. 5th root
  17224. @end table
  17225. Default value is @samp{sqrt}.
  17226. @item fscale
  17227. Specify frequency scale.
  17228. It accepts the following values:
  17229. @table @samp
  17230. @item lin
  17231. linear
  17232. @item log
  17233. logarithmic
  17234. @end table
  17235. Default value is @samp{lin}.
  17236. @item saturation
  17237. Set saturation modifier for displayed colors. Negative values provide
  17238. alternative color scheme. @code{0} is no saturation at all.
  17239. Saturation must be in [-10.0, 10.0] range.
  17240. Default value is @code{1}.
  17241. @item win_func
  17242. Set window function.
  17243. It accepts the following values:
  17244. @table @samp
  17245. @item rect
  17246. @item bartlett
  17247. @item hann
  17248. @item hanning
  17249. @item hamming
  17250. @item blackman
  17251. @item welch
  17252. @item flattop
  17253. @item bharris
  17254. @item bnuttall
  17255. @item bhann
  17256. @item sine
  17257. @item nuttall
  17258. @item lanczos
  17259. @item gauss
  17260. @item tukey
  17261. @item dolph
  17262. @item cauchy
  17263. @item parzen
  17264. @item poisson
  17265. @item bohman
  17266. @end table
  17267. Default value is @code{hann}.
  17268. @item orientation
  17269. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17270. @code{horizontal}. Default is @code{vertical}.
  17271. @item overlap
  17272. Set ratio of overlap window. Default value is @code{0}.
  17273. When value is @code{1} overlap is set to recommended size for specific
  17274. window function currently used.
  17275. @item gain
  17276. Set scale gain for calculating intensity color values.
  17277. Default value is @code{1}.
  17278. @item data
  17279. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  17280. @item rotation
  17281. Set color rotation, must be in [-1.0, 1.0] range.
  17282. Default value is @code{0}.
  17283. @item start
  17284. Set start frequency from which to display spectrogram. Default is @code{0}.
  17285. @item stop
  17286. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17287. @item fps
  17288. Set upper frame rate limit. Default is @code{auto}, unlimited.
  17289. @item legend
  17290. Draw time and frequency axes and legends. Default is disabled.
  17291. @end table
  17292. The usage is very similar to the showwaves filter; see the examples in that
  17293. section.
  17294. @subsection Examples
  17295. @itemize
  17296. @item
  17297. Large window with logarithmic color scaling:
  17298. @example
  17299. showspectrum=s=1280x480:scale=log
  17300. @end example
  17301. @item
  17302. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  17303. @example
  17304. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17305. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  17306. @end example
  17307. @end itemize
  17308. @section showspectrumpic
  17309. Convert input audio to a single video frame, representing the audio frequency
  17310. spectrum.
  17311. The filter accepts the following options:
  17312. @table @option
  17313. @item size, s
  17314. Specify the video size for the output. For the syntax of this option, check the
  17315. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17316. Default value is @code{4096x2048}.
  17317. @item mode
  17318. Specify display mode.
  17319. It accepts the following values:
  17320. @table @samp
  17321. @item combined
  17322. all channels are displayed in the same row
  17323. @item separate
  17324. all channels are displayed in separate rows
  17325. @end table
  17326. Default value is @samp{combined}.
  17327. @item color
  17328. Specify display color mode.
  17329. It accepts the following values:
  17330. @table @samp
  17331. @item channel
  17332. each channel is displayed in a separate color
  17333. @item intensity
  17334. each channel is displayed using the same color scheme
  17335. @item rainbow
  17336. each channel is displayed using the rainbow color scheme
  17337. @item moreland
  17338. each channel is displayed using the moreland color scheme
  17339. @item nebulae
  17340. each channel is displayed using the nebulae color scheme
  17341. @item fire
  17342. each channel is displayed using the fire color scheme
  17343. @item fiery
  17344. each channel is displayed using the fiery color scheme
  17345. @item fruit
  17346. each channel is displayed using the fruit color scheme
  17347. @item cool
  17348. each channel is displayed using the cool color scheme
  17349. @item magma
  17350. each channel is displayed using the magma color scheme
  17351. @item green
  17352. each channel is displayed using the green color scheme
  17353. @item viridis
  17354. each channel is displayed using the viridis color scheme
  17355. @item plasma
  17356. each channel is displayed using the plasma color scheme
  17357. @item cividis
  17358. each channel is displayed using the cividis color scheme
  17359. @item terrain
  17360. each channel is displayed using the terrain color scheme
  17361. @end table
  17362. Default value is @samp{intensity}.
  17363. @item scale
  17364. Specify scale used for calculating intensity color values.
  17365. It accepts the following values:
  17366. @table @samp
  17367. @item lin
  17368. linear
  17369. @item sqrt
  17370. square root, default
  17371. @item cbrt
  17372. cubic root
  17373. @item log
  17374. logarithmic
  17375. @item 4thrt
  17376. 4th root
  17377. @item 5thrt
  17378. 5th root
  17379. @end table
  17380. Default value is @samp{log}.
  17381. @item fscale
  17382. Specify frequency scale.
  17383. It accepts the following values:
  17384. @table @samp
  17385. @item lin
  17386. linear
  17387. @item log
  17388. logarithmic
  17389. @end table
  17390. Default value is @samp{lin}.
  17391. @item saturation
  17392. Set saturation modifier for displayed colors. Negative values provide
  17393. alternative color scheme. @code{0} is no saturation at all.
  17394. Saturation must be in [-10.0, 10.0] range.
  17395. Default value is @code{1}.
  17396. @item win_func
  17397. Set window function.
  17398. It accepts the following values:
  17399. @table @samp
  17400. @item rect
  17401. @item bartlett
  17402. @item hann
  17403. @item hanning
  17404. @item hamming
  17405. @item blackman
  17406. @item welch
  17407. @item flattop
  17408. @item bharris
  17409. @item bnuttall
  17410. @item bhann
  17411. @item sine
  17412. @item nuttall
  17413. @item lanczos
  17414. @item gauss
  17415. @item tukey
  17416. @item dolph
  17417. @item cauchy
  17418. @item parzen
  17419. @item poisson
  17420. @item bohman
  17421. @end table
  17422. Default value is @code{hann}.
  17423. @item orientation
  17424. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17425. @code{horizontal}. Default is @code{vertical}.
  17426. @item gain
  17427. Set scale gain for calculating intensity color values.
  17428. Default value is @code{1}.
  17429. @item legend
  17430. Draw time and frequency axes and legends. Default is enabled.
  17431. @item rotation
  17432. Set color rotation, must be in [-1.0, 1.0] range.
  17433. Default value is @code{0}.
  17434. @item start
  17435. Set start frequency from which to display spectrogram. Default is @code{0}.
  17436. @item stop
  17437. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17438. @end table
  17439. @subsection Examples
  17440. @itemize
  17441. @item
  17442. Extract an audio spectrogram of a whole audio track
  17443. in a 1024x1024 picture using @command{ffmpeg}:
  17444. @example
  17445. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  17446. @end example
  17447. @end itemize
  17448. @section showvolume
  17449. Convert input audio volume to a video output.
  17450. The filter accepts the following options:
  17451. @table @option
  17452. @item rate, r
  17453. Set video rate.
  17454. @item b
  17455. Set border width, allowed range is [0, 5]. Default is 1.
  17456. @item w
  17457. Set channel width, allowed range is [80, 8192]. Default is 400.
  17458. @item h
  17459. Set channel height, allowed range is [1, 900]. Default is 20.
  17460. @item f
  17461. Set fade, allowed range is [0, 1]. Default is 0.95.
  17462. @item c
  17463. Set volume color expression.
  17464. The expression can use the following variables:
  17465. @table @option
  17466. @item VOLUME
  17467. Current max volume of channel in dB.
  17468. @item PEAK
  17469. Current peak.
  17470. @item CHANNEL
  17471. Current channel number, starting from 0.
  17472. @end table
  17473. @item t
  17474. If set, displays channel names. Default is enabled.
  17475. @item v
  17476. If set, displays volume values. Default is enabled.
  17477. @item o
  17478. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  17479. default is @code{h}.
  17480. @item s
  17481. Set step size, allowed range is [0, 5]. Default is 0, which means
  17482. step is disabled.
  17483. @item p
  17484. Set background opacity, allowed range is [0, 1]. Default is 0.
  17485. @item m
  17486. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17487. default is @code{p}.
  17488. @item ds
  17489. Set display scale, can be linear: @code{lin} or log: @code{log},
  17490. default is @code{lin}.
  17491. @item dm
  17492. In second.
  17493. If set to > 0., display a line for the max level
  17494. in the previous seconds.
  17495. default is disabled: @code{0.}
  17496. @item dmc
  17497. The color of the max line. Use when @code{dm} option is set to > 0.
  17498. default is: @code{orange}
  17499. @end table
  17500. @section showwaves
  17501. Convert input audio to a video output, representing the samples waves.
  17502. The filter accepts the following options:
  17503. @table @option
  17504. @item size, s
  17505. Specify the video size for the output. For the syntax of this option, check the
  17506. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17507. Default value is @code{600x240}.
  17508. @item mode
  17509. Set display mode.
  17510. Available values are:
  17511. @table @samp
  17512. @item point
  17513. Draw a point for each sample.
  17514. @item line
  17515. Draw a vertical line for each sample.
  17516. @item p2p
  17517. Draw a point for each sample and a line between them.
  17518. @item cline
  17519. Draw a centered vertical line for each sample.
  17520. @end table
  17521. Default value is @code{point}.
  17522. @item n
  17523. Set the number of samples which are printed on the same column. A
  17524. larger value will decrease the frame rate. Must be a positive
  17525. integer. This option can be set only if the value for @var{rate}
  17526. is not explicitly specified.
  17527. @item rate, r
  17528. Set the (approximate) output frame rate. This is done by setting the
  17529. option @var{n}. Default value is "25".
  17530. @item split_channels
  17531. Set if channels should be drawn separately or overlap. Default value is 0.
  17532. @item colors
  17533. Set colors separated by '|' which are going to be used for drawing of each channel.
  17534. @item scale
  17535. Set amplitude scale.
  17536. Available values are:
  17537. @table @samp
  17538. @item lin
  17539. Linear.
  17540. @item log
  17541. Logarithmic.
  17542. @item sqrt
  17543. Square root.
  17544. @item cbrt
  17545. Cubic root.
  17546. @end table
  17547. Default is linear.
  17548. @item draw
  17549. Set the draw mode. This is mostly useful to set for high @var{n}.
  17550. Available values are:
  17551. @table @samp
  17552. @item scale
  17553. Scale pixel values for each drawn sample.
  17554. @item full
  17555. Draw every sample directly.
  17556. @end table
  17557. Default value is @code{scale}.
  17558. @end table
  17559. @subsection Examples
  17560. @itemize
  17561. @item
  17562. Output the input file audio and the corresponding video representation
  17563. at the same time:
  17564. @example
  17565. amovie=a.mp3,asplit[out0],showwaves[out1]
  17566. @end example
  17567. @item
  17568. Create a synthetic signal and show it with showwaves, forcing a
  17569. frame rate of 30 frames per second:
  17570. @example
  17571. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17572. @end example
  17573. @end itemize
  17574. @section showwavespic
  17575. Convert input audio to a single video frame, representing the samples waves.
  17576. The filter accepts the following options:
  17577. @table @option
  17578. @item size, s
  17579. Specify the video size for the output. For the syntax of this option, check the
  17580. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17581. Default value is @code{600x240}.
  17582. @item split_channels
  17583. Set if channels should be drawn separately or overlap. Default value is 0.
  17584. @item colors
  17585. Set colors separated by '|' which are going to be used for drawing of each channel.
  17586. @item scale
  17587. Set amplitude scale.
  17588. Available values are:
  17589. @table @samp
  17590. @item lin
  17591. Linear.
  17592. @item log
  17593. Logarithmic.
  17594. @item sqrt
  17595. Square root.
  17596. @item cbrt
  17597. Cubic root.
  17598. @end table
  17599. Default is linear.
  17600. @item draw
  17601. Set the draw mode.
  17602. Available values are:
  17603. @table @samp
  17604. @item scale
  17605. Scale pixel values for each drawn sample.
  17606. @item full
  17607. Draw every sample directly.
  17608. @end table
  17609. Default value is @code{scale}.
  17610. @end table
  17611. @subsection Examples
  17612. @itemize
  17613. @item
  17614. Extract a channel split representation of the wave form of a whole audio track
  17615. in a 1024x800 picture using @command{ffmpeg}:
  17616. @example
  17617. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  17618. @end example
  17619. @end itemize
  17620. @section sidedata, asidedata
  17621. Delete frame side data, or select frames based on it.
  17622. This filter accepts the following options:
  17623. @table @option
  17624. @item mode
  17625. Set mode of operation of the filter.
  17626. Can be one of the following:
  17627. @table @samp
  17628. @item select
  17629. Select every frame with side data of @code{type}.
  17630. @item delete
  17631. Delete side data of @code{type}. If @code{type} is not set, delete all side
  17632. data in the frame.
  17633. @end table
  17634. @item type
  17635. Set side data type used with all modes. Must be set for @code{select} mode. For
  17636. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  17637. in @file{libavutil/frame.h}. For example, to choose
  17638. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  17639. @end table
  17640. @section spectrumsynth
  17641. Sythesize audio from 2 input video spectrums, first input stream represents
  17642. magnitude across time and second represents phase across time.
  17643. The filter will transform from frequency domain as displayed in videos back
  17644. to time domain as presented in audio output.
  17645. This filter is primarily created for reversing processed @ref{showspectrum}
  17646. filter outputs, but can synthesize sound from other spectrograms too.
  17647. But in such case results are going to be poor if the phase data is not
  17648. available, because in such cases phase data need to be recreated, usually
  17649. it's just recreated from random noise.
  17650. For best results use gray only output (@code{channel} color mode in
  17651. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  17652. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  17653. @code{data} option. Inputs videos should generally use @code{fullframe}
  17654. slide mode as that saves resources needed for decoding video.
  17655. The filter accepts the following options:
  17656. @table @option
  17657. @item sample_rate
  17658. Specify sample rate of output audio, the sample rate of audio from which
  17659. spectrum was generated may differ.
  17660. @item channels
  17661. Set number of channels represented in input video spectrums.
  17662. @item scale
  17663. Set scale which was used when generating magnitude input spectrum.
  17664. Can be @code{lin} or @code{log}. Default is @code{log}.
  17665. @item slide
  17666. Set slide which was used when generating inputs spectrums.
  17667. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17668. Default is @code{fullframe}.
  17669. @item win_func
  17670. Set window function used for resynthesis.
  17671. @item overlap
  17672. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17673. which means optimal overlap for selected window function will be picked.
  17674. @item orientation
  17675. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17676. Default is @code{vertical}.
  17677. @end table
  17678. @subsection Examples
  17679. @itemize
  17680. @item
  17681. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17682. then resynthesize videos back to audio with spectrumsynth:
  17683. @example
  17684. 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
  17685. 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
  17686. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17687. @end example
  17688. @end itemize
  17689. @section split, asplit
  17690. Split input into several identical outputs.
  17691. @code{asplit} works with audio input, @code{split} with video.
  17692. The filter accepts a single parameter which specifies the number of outputs. If
  17693. unspecified, it defaults to 2.
  17694. @subsection Examples
  17695. @itemize
  17696. @item
  17697. Create two separate outputs from the same input:
  17698. @example
  17699. [in] split [out0][out1]
  17700. @end example
  17701. @item
  17702. To create 3 or more outputs, you need to specify the number of
  17703. outputs, like in:
  17704. @example
  17705. [in] asplit=3 [out0][out1][out2]
  17706. @end example
  17707. @item
  17708. Create two separate outputs from the same input, one cropped and
  17709. one padded:
  17710. @example
  17711. [in] split [splitout1][splitout2];
  17712. [splitout1] crop=100:100:0:0 [cropout];
  17713. [splitout2] pad=200:200:100:100 [padout];
  17714. @end example
  17715. @item
  17716. Create 5 copies of the input audio with @command{ffmpeg}:
  17717. @example
  17718. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17719. @end example
  17720. @end itemize
  17721. @section zmq, azmq
  17722. Receive commands sent through a libzmq client, and forward them to
  17723. filters in the filtergraph.
  17724. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17725. must be inserted between two video filters, @code{azmq} between two
  17726. audio filters. Both are capable to send messages to any filter type.
  17727. To enable these filters you need to install the libzmq library and
  17728. headers and configure FFmpeg with @code{--enable-libzmq}.
  17729. For more information about libzmq see:
  17730. @url{http://www.zeromq.org/}
  17731. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17732. receives messages sent through a network interface defined by the
  17733. @option{bind_address} (or the abbreviation "@option{b}") option.
  17734. Default value of this option is @file{tcp://localhost:5555}. You may
  17735. want to alter this value to your needs, but do not forget to escape any
  17736. ':' signs (see @ref{filtergraph escaping}).
  17737. The received message must be in the form:
  17738. @example
  17739. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17740. @end example
  17741. @var{TARGET} specifies the target of the command, usually the name of
  17742. the filter class or a specific filter instance name. The default
  17743. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17744. but you can override this by using the @samp{filter_name@@id} syntax
  17745. (see @ref{Filtergraph syntax}).
  17746. @var{COMMAND} specifies the name of the command for the target filter.
  17747. @var{ARG} is optional and specifies the optional argument list for the
  17748. given @var{COMMAND}.
  17749. Upon reception, the message is processed and the corresponding command
  17750. is injected into the filtergraph. Depending on the result, the filter
  17751. will send a reply to the client, adopting the format:
  17752. @example
  17753. @var{ERROR_CODE} @var{ERROR_REASON}
  17754. @var{MESSAGE}
  17755. @end example
  17756. @var{MESSAGE} is optional.
  17757. @subsection Examples
  17758. Look at @file{tools/zmqsend} for an example of a zmq client which can
  17759. be used to send commands processed by these filters.
  17760. Consider the following filtergraph generated by @command{ffplay}.
  17761. In this example the last overlay filter has an instance name. All other
  17762. filters will have default instance names.
  17763. @example
  17764. ffplay -dumpgraph 1 -f lavfi "
  17765. color=s=100x100:c=red [l];
  17766. color=s=100x100:c=blue [r];
  17767. nullsrc=s=200x100, zmq [bg];
  17768. [bg][l] overlay [bg+l];
  17769. [bg+l][r] overlay@@my=x=100 "
  17770. @end example
  17771. To change the color of the left side of the video, the following
  17772. command can be used:
  17773. @example
  17774. echo Parsed_color_0 c yellow | tools/zmqsend
  17775. @end example
  17776. To change the right side:
  17777. @example
  17778. echo Parsed_color_1 c pink | tools/zmqsend
  17779. @end example
  17780. To change the position of the right side:
  17781. @example
  17782. echo overlay@@my x 150 | tools/zmqsend
  17783. @end example
  17784. @c man end MULTIMEDIA FILTERS
  17785. @chapter Multimedia Sources
  17786. @c man begin MULTIMEDIA SOURCES
  17787. Below is a description of the currently available multimedia sources.
  17788. @section amovie
  17789. This is the same as @ref{movie} source, except it selects an audio
  17790. stream by default.
  17791. @anchor{movie}
  17792. @section movie
  17793. Read audio and/or video stream(s) from a movie container.
  17794. It accepts the following parameters:
  17795. @table @option
  17796. @item filename
  17797. The name of the resource to read (not necessarily a file; it can also be a
  17798. device or a stream accessed through some protocol).
  17799. @item format_name, f
  17800. Specifies the format assumed for the movie to read, and can be either
  17801. the name of a container or an input device. If not specified, the
  17802. format is guessed from @var{movie_name} or by probing.
  17803. @item seek_point, sp
  17804. Specifies the seek point in seconds. The frames will be output
  17805. starting from this seek point. The parameter is evaluated with
  17806. @code{av_strtod}, so the numerical value may be suffixed by an IS
  17807. postfix. The default value is "0".
  17808. @item streams, s
  17809. Specifies the streams to read. Several streams can be specified,
  17810. separated by "+". The source will then have as many outputs, in the
  17811. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  17812. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  17813. respectively the default (best suited) video and audio stream. Default
  17814. is "dv", or "da" if the filter is called as "amovie".
  17815. @item stream_index, si
  17816. Specifies the index of the video stream to read. If the value is -1,
  17817. the most suitable video stream will be automatically selected. The default
  17818. value is "-1". Deprecated. If the filter is called "amovie", it will select
  17819. audio instead of video.
  17820. @item loop
  17821. Specifies how many times to read the stream in sequence.
  17822. If the value is 0, the stream will be looped infinitely.
  17823. Default value is "1".
  17824. Note that when the movie is looped the source timestamps are not
  17825. changed, so it will generate non monotonically increasing timestamps.
  17826. @item discontinuity
  17827. Specifies the time difference between frames above which the point is
  17828. considered a timestamp discontinuity which is removed by adjusting the later
  17829. timestamps.
  17830. @end table
  17831. It allows overlaying a second video on top of the main input of
  17832. a filtergraph, as shown in this graph:
  17833. @example
  17834. input -----------> deltapts0 --> overlay --> output
  17835. ^
  17836. |
  17837. movie --> scale--> deltapts1 -------+
  17838. @end example
  17839. @subsection Examples
  17840. @itemize
  17841. @item
  17842. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  17843. on top of the input labelled "in":
  17844. @example
  17845. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17846. [in] setpts=PTS-STARTPTS [main];
  17847. [main][over] overlay=16:16 [out]
  17848. @end example
  17849. @item
  17850. Read from a video4linux2 device, and overlay it on top of the input
  17851. labelled "in":
  17852. @example
  17853. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17854. [in] setpts=PTS-STARTPTS [main];
  17855. [main][over] overlay=16:16 [out]
  17856. @end example
  17857. @item
  17858. Read the first video stream and the audio stream with id 0x81 from
  17859. dvd.vob; the video is connected to the pad named "video" and the audio is
  17860. connected to the pad named "audio":
  17861. @example
  17862. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  17863. @end example
  17864. @end itemize
  17865. @subsection Commands
  17866. Both movie and amovie support the following commands:
  17867. @table @option
  17868. @item seek
  17869. Perform seek using "av_seek_frame".
  17870. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  17871. @itemize
  17872. @item
  17873. @var{stream_index}: If stream_index is -1, a default
  17874. stream is selected, and @var{timestamp} is automatically converted
  17875. from AV_TIME_BASE units to the stream specific time_base.
  17876. @item
  17877. @var{timestamp}: Timestamp in AVStream.time_base units
  17878. or, if no stream is specified, in AV_TIME_BASE units.
  17879. @item
  17880. @var{flags}: Flags which select direction and seeking mode.
  17881. @end itemize
  17882. @item get_duration
  17883. Get movie duration in AV_TIME_BASE units.
  17884. @end table
  17885. @c man end MULTIMEDIA SOURCES