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.

22729 lines
605KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item threshold
  315. If a signal of stream rises above this level it will affect the gain
  316. reduction.
  317. By default it is 0.125. Range is between 0.00097563 and 1.
  318. @item ratio
  319. Set a ratio by which the signal is reduced. 1:2 means that if the level
  320. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  321. Default is 2. Range is between 1 and 20.
  322. @item attack
  323. Amount of milliseconds the signal has to rise above the threshold before gain
  324. reduction starts. Default is 20. Range is between 0.01 and 2000.
  325. @item release
  326. Amount of milliseconds the signal has to fall below the threshold before
  327. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  328. @item makeup
  329. Set the amount by how much signal will be amplified after processing.
  330. Default is 1. Range is from 1 to 64.
  331. @item knee
  332. Curve the sharp knee around the threshold to enter gain reduction more softly.
  333. Default is 2.82843. Range is between 1 and 8.
  334. @item link
  335. Choose if the @code{average} level between all channels of input stream
  336. or the louder(@code{maximum}) channel of input stream affects the
  337. reduction. Default is @code{average}.
  338. @item detection
  339. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  340. of @code{rms}. Default is @code{rms} which is mostly smoother.
  341. @item mix
  342. How much to use compressed signal in output. Default is 1.
  343. Range is between 0 and 1.
  344. @end table
  345. @section acontrast
  346. Simple audio dynamic range commpression/expansion filter.
  347. The filter accepts the following options:
  348. @table @option
  349. @item contrast
  350. Set contrast. Default is 33. Allowed range is between 0 and 100.
  351. @end table
  352. @section acopy
  353. Copy the input audio source unchanged to the output. This is mainly useful for
  354. testing purposes.
  355. @section acrossfade
  356. Apply cross fade from one input audio stream to another input audio stream.
  357. The cross fade is applied for specified duration near the end of first stream.
  358. The filter accepts the following options:
  359. @table @option
  360. @item nb_samples, ns
  361. Specify the number of samples for which the cross fade effect has to last.
  362. At the end of the cross fade effect the first input audio will be completely
  363. silent. Default is 44100.
  364. @item duration, d
  365. Specify the duration of the cross fade effect. See
  366. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  367. for the accepted syntax.
  368. By default the duration is determined by @var{nb_samples}.
  369. If set this option is used instead of @var{nb_samples}.
  370. @item overlap, o
  371. Should first stream end overlap with second stream start. Default is enabled.
  372. @item curve1
  373. Set curve for cross fade transition for first stream.
  374. @item curve2
  375. Set curve for cross fade transition for second stream.
  376. For description of available curve types see @ref{afade} filter description.
  377. @end table
  378. @subsection Examples
  379. @itemize
  380. @item
  381. Cross fade from one input to another:
  382. @example
  383. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  384. @end example
  385. @item
  386. Cross fade from one input to another but without overlapping:
  387. @example
  388. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  389. @end example
  390. @end itemize
  391. @section acrossover
  392. Split audio stream into several bands.
  393. This filter splits audio stream into two or more frequency ranges.
  394. Summing all streams back will give flat output.
  395. The filter accepts the following options:
  396. @table @option
  397. @item split
  398. Set split frequencies. Those must be positive and increasing.
  399. @item order
  400. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  401. Default is @var{4th}.
  402. @end table
  403. @section acrusher
  404. Reduce audio bit resolution.
  405. This filter is bit crusher with enhanced functionality. A bit crusher
  406. is used to audibly reduce number of bits an audio signal is sampled
  407. with. This doesn't change the bit depth at all, it just produces the
  408. effect. Material reduced in bit depth sounds more harsh and "digital".
  409. This filter is able to even round to continuous values instead of discrete
  410. bit depths.
  411. Additionally it has a D/C offset which results in different crushing of
  412. the lower and the upper half of the signal.
  413. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  414. Another feature of this filter is the logarithmic mode.
  415. This setting switches from linear distances between bits to logarithmic ones.
  416. The result is a much more "natural" sounding crusher which doesn't gate low
  417. signals for example. The human ear has a logarithmic perception,
  418. so this kind of crushing is much more pleasant.
  419. Logarithmic crushing is also able to get anti-aliased.
  420. The filter accepts the following options:
  421. @table @option
  422. @item level_in
  423. Set level in.
  424. @item level_out
  425. Set level out.
  426. @item bits
  427. Set bit reduction.
  428. @item mix
  429. Set mixing amount.
  430. @item mode
  431. Can be linear: @code{lin} or logarithmic: @code{log}.
  432. @item dc
  433. Set DC.
  434. @item aa
  435. Set anti-aliasing.
  436. @item samples
  437. Set sample reduction.
  438. @item lfo
  439. Enable LFO. By default disabled.
  440. @item lforange
  441. Set LFO range.
  442. @item lforate
  443. Set LFO rate.
  444. @end table
  445. @section acue
  446. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  447. filter.
  448. @section adeclick
  449. Remove impulsive noise from input audio.
  450. Samples detected as impulsive noise are replaced by interpolated samples using
  451. autoregressive modelling.
  452. @table @option
  453. @item w
  454. Set window size, in milliseconds. Allowed range is from @code{10} to
  455. @code{100}. Default value is @code{55} milliseconds.
  456. This sets size of window which will be processed at once.
  457. @item o
  458. Set window overlap, in percentage of window size. Allowed range is from
  459. @code{50} to @code{95}. Default value is @code{75} percent.
  460. Setting this to a very high value increases impulsive noise removal but makes
  461. whole process much slower.
  462. @item a
  463. Set autoregression order, in percentage of window size. Allowed range is from
  464. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  465. controls quality of interpolated samples using neighbour good samples.
  466. @item t
  467. Set threshold value. Allowed range is from @code{1} to @code{100}.
  468. Default value is @code{2}.
  469. This controls the strength of impulsive noise which is going to be removed.
  470. The lower value, the more samples will be detected as impulsive noise.
  471. @item b
  472. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  473. @code{10}. Default value is @code{2}.
  474. If any two samples deteced as noise are spaced less than this value then any
  475. sample inbetween those two samples will be also detected as noise.
  476. @item m
  477. Set overlap method.
  478. It accepts the following values:
  479. @table @option
  480. @item a
  481. Select overlap-add method. Even not interpolated samples are slightly
  482. changed with this method.
  483. @item s
  484. Select overlap-save method. Not interpolated samples remain unchanged.
  485. @end table
  486. Default value is @code{a}.
  487. @end table
  488. @section adeclip
  489. Remove clipped samples from input audio.
  490. Samples detected as clipped are replaced by interpolated samples using
  491. autoregressive modelling.
  492. @table @option
  493. @item w
  494. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  495. Default value is @code{55} milliseconds.
  496. This sets size of window which will be processed at once.
  497. @item o
  498. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  499. to @code{95}. Default value is @code{75} percent.
  500. @item a
  501. Set autoregression order, in percentage of window size. Allowed range is from
  502. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  503. quality of interpolated samples using neighbour good samples.
  504. @item t
  505. Set threshold value. Allowed range is from @code{1} to @code{100}.
  506. Default value is @code{10}. Higher values make clip detection less aggressive.
  507. @item n
  508. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  509. Default value is @code{1000}. Higher values make clip detection less aggressive.
  510. @item m
  511. Set overlap method.
  512. It accepts the following values:
  513. @table @option
  514. @item a
  515. Select overlap-add method. Even not interpolated samples are slightly changed
  516. with this method.
  517. @item s
  518. Select overlap-save method. Not interpolated samples remain unchanged.
  519. @end table
  520. Default value is @code{a}.
  521. @end table
  522. @section adelay
  523. Delay one or more audio channels.
  524. Samples in delayed channel are filled with silence.
  525. The filter accepts the following option:
  526. @table @option
  527. @item delays
  528. Set list of delays in milliseconds for each channel separated by '|'.
  529. Unused delays will be silently ignored. If number of given delays is
  530. smaller than number of channels all remaining channels will not be delayed.
  531. If you want to delay exact number of samples, append 'S' to number.
  532. @end table
  533. @subsection Examples
  534. @itemize
  535. @item
  536. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  537. the second channel (and any other channels that may be present) unchanged.
  538. @example
  539. adelay=1500|0|500
  540. @end example
  541. @item
  542. Delay second channel by 500 samples, the third channel by 700 samples and leave
  543. the first channel (and any other channels that may be present) unchanged.
  544. @example
  545. adelay=0|500S|700S
  546. @end example
  547. @end itemize
  548. @section aderivative, aintegral
  549. Compute derivative/integral of audio stream.
  550. Applying both filters one after another produces original audio.
  551. @section aecho
  552. Apply echoing to the input audio.
  553. Echoes are reflected sound and can occur naturally amongst mountains
  554. (and sometimes large buildings) when talking or shouting; digital echo
  555. effects emulate this behaviour and are often used to help fill out the
  556. sound of a single instrument or vocal. The time difference between the
  557. original signal and the reflection is the @code{delay}, and the
  558. loudness of the reflected signal is the @code{decay}.
  559. Multiple echoes can have different delays and decays.
  560. A description of the accepted parameters follows.
  561. @table @option
  562. @item in_gain
  563. Set input gain of reflected signal. Default is @code{0.6}.
  564. @item out_gain
  565. Set output gain of reflected signal. Default is @code{0.3}.
  566. @item delays
  567. Set list of time intervals in milliseconds between original signal and reflections
  568. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  569. Default is @code{1000}.
  570. @item decays
  571. Set list of loudness of reflected signals separated by '|'.
  572. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  573. Default is @code{0.5}.
  574. @end table
  575. @subsection Examples
  576. @itemize
  577. @item
  578. Make it sound as if there are twice as many instruments as are actually playing:
  579. @example
  580. aecho=0.8:0.88:60:0.4
  581. @end example
  582. @item
  583. If delay is very short, then it sound like a (metallic) robot playing music:
  584. @example
  585. aecho=0.8:0.88:6:0.4
  586. @end example
  587. @item
  588. A longer delay will sound like an open air concert in the mountains:
  589. @example
  590. aecho=0.8:0.9:1000:0.3
  591. @end example
  592. @item
  593. Same as above but with one more mountain:
  594. @example
  595. aecho=0.8:0.9:1000|1800:0.3|0.25
  596. @end example
  597. @end itemize
  598. @section aemphasis
  599. Audio emphasis filter creates or restores material directly taken from LPs or
  600. emphased CDs with different filter curves. E.g. to store music on vinyl the
  601. signal has to be altered by a filter first to even out the disadvantages of
  602. this recording medium.
  603. Once the material is played back the inverse filter has to be applied to
  604. restore the distortion of the frequency response.
  605. The filter accepts the following options:
  606. @table @option
  607. @item level_in
  608. Set input gain.
  609. @item level_out
  610. Set output gain.
  611. @item mode
  612. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  613. use @code{production} mode. Default is @code{reproduction} mode.
  614. @item type
  615. Set filter type. Selects medium. Can be one of the following:
  616. @table @option
  617. @item col
  618. select Columbia.
  619. @item emi
  620. select EMI.
  621. @item bsi
  622. select BSI (78RPM).
  623. @item riaa
  624. select RIAA.
  625. @item cd
  626. select Compact Disc (CD).
  627. @item 50fm
  628. select 50µs (FM).
  629. @item 75fm
  630. select 75µs (FM).
  631. @item 50kf
  632. select 50µs (FM-KF).
  633. @item 75kf
  634. select 75µs (FM-KF).
  635. @end table
  636. @end table
  637. @section aeval
  638. Modify an audio signal according to the specified expressions.
  639. This filter accepts one or more expressions (one for each channel),
  640. which are evaluated and used to modify a corresponding audio signal.
  641. It accepts the following parameters:
  642. @table @option
  643. @item exprs
  644. Set the '|'-separated expressions list for each separate channel. If
  645. the number of input channels is greater than the number of
  646. expressions, the last specified expression is used for the remaining
  647. output channels.
  648. @item channel_layout, c
  649. Set output channel layout. If not specified, the channel layout is
  650. specified by the number of expressions. If set to @samp{same}, it will
  651. use by default the same input channel layout.
  652. @end table
  653. Each expression in @var{exprs} can contain the following constants and functions:
  654. @table @option
  655. @item ch
  656. channel number of the current expression
  657. @item n
  658. number of the evaluated sample, starting from 0
  659. @item s
  660. sample rate
  661. @item t
  662. time of the evaluated sample expressed in seconds
  663. @item nb_in_channels
  664. @item nb_out_channels
  665. input and output number of channels
  666. @item val(CH)
  667. the value of input channel with number @var{CH}
  668. @end table
  669. Note: this filter is slow. For faster processing you should use a
  670. dedicated filter.
  671. @subsection Examples
  672. @itemize
  673. @item
  674. Half volume:
  675. @example
  676. aeval=val(ch)/2:c=same
  677. @end example
  678. @item
  679. Invert phase of the second channel:
  680. @example
  681. aeval=val(0)|-val(1)
  682. @end example
  683. @end itemize
  684. @anchor{afade}
  685. @section afade
  686. Apply fade-in/out effect to input audio.
  687. A description of the accepted parameters follows.
  688. @table @option
  689. @item type, t
  690. Specify the effect type, can be either @code{in} for fade-in, or
  691. @code{out} for a fade-out effect. Default is @code{in}.
  692. @item start_sample, ss
  693. Specify the number of the start sample for starting to apply the fade
  694. effect. Default is 0.
  695. @item nb_samples, ns
  696. Specify the number of samples for which the fade effect has to last. At
  697. the end of the fade-in effect the output audio will have the same
  698. volume as the input audio, at the end of the fade-out transition
  699. the output audio will be silence. Default is 44100.
  700. @item start_time, st
  701. Specify the start time of the fade effect. Default is 0.
  702. The value must be specified as a time duration; see
  703. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  704. for the accepted syntax.
  705. If set this option is used instead of @var{start_sample}.
  706. @item duration, d
  707. Specify the duration of the fade effect. See
  708. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  709. for the accepted syntax.
  710. At the end of the fade-in effect the output audio will have the same
  711. volume as the input audio, at the end of the fade-out transition
  712. the output audio will be silence.
  713. By default the duration is determined by @var{nb_samples}.
  714. If set this option is used instead of @var{nb_samples}.
  715. @item curve
  716. Set curve for fade transition.
  717. It accepts the following values:
  718. @table @option
  719. @item tri
  720. select triangular, linear slope (default)
  721. @item qsin
  722. select quarter of sine wave
  723. @item hsin
  724. select half of sine wave
  725. @item esin
  726. select exponential sine wave
  727. @item log
  728. select logarithmic
  729. @item ipar
  730. select inverted parabola
  731. @item qua
  732. select quadratic
  733. @item cub
  734. select cubic
  735. @item squ
  736. select square root
  737. @item cbr
  738. select cubic root
  739. @item par
  740. select parabola
  741. @item exp
  742. select exponential
  743. @item iqsin
  744. select inverted quarter of sine wave
  745. @item ihsin
  746. select inverted half of sine wave
  747. @item dese
  748. select double-exponential seat
  749. @item desi
  750. select double-exponential sigmoid
  751. @item losi
  752. select logistic sigmoid
  753. @end table
  754. @end table
  755. @subsection Examples
  756. @itemize
  757. @item
  758. Fade in first 15 seconds of audio:
  759. @example
  760. afade=t=in:ss=0:d=15
  761. @end example
  762. @item
  763. Fade out last 25 seconds of a 900 seconds audio:
  764. @example
  765. afade=t=out:st=875:d=25
  766. @end example
  767. @end itemize
  768. @section afftdn
  769. Denoise audio samples with FFT.
  770. A description of the accepted parameters follows.
  771. @table @option
  772. @item nr
  773. Set the noise reduction in dB, allowed range is 0.01 to 97.
  774. Default value is 12 dB.
  775. @item nf
  776. Set the noise floor in dB, allowed range is -80 to -20.
  777. Default value is -50 dB.
  778. @item nt
  779. Set the noise type.
  780. It accepts the following values:
  781. @table @option
  782. @item w
  783. Select white noise.
  784. @item v
  785. Select vinyl noise.
  786. @item s
  787. Select shellac noise.
  788. @item c
  789. Select custom noise, defined in @code{bn} option.
  790. Default value is white noise.
  791. @end table
  792. @item bn
  793. Set custom band noise for every one of 15 bands.
  794. Bands are separated by ' ' or '|'.
  795. @item rf
  796. Set the residual floor in dB, allowed range is -80 to -20.
  797. Default value is -38 dB.
  798. @item tn
  799. Enable noise tracking. By default is disabled.
  800. With this enabled, noise floor is automatically adjusted.
  801. @item tr
  802. Enable residual tracking. By default is disabled.
  803. @item om
  804. Set the output mode.
  805. It accepts the following values:
  806. @table @option
  807. @item i
  808. Pass input unchanged.
  809. @item o
  810. Pass noise filtered out.
  811. @item n
  812. Pass only noise.
  813. Default value is @var{o}.
  814. @end table
  815. @end table
  816. @subsection Commands
  817. This filter supports the following commands:
  818. @table @option
  819. @item sample_noise, sn
  820. Start or stop measuring noise profile.
  821. Syntax for the command is : "start" or "stop" string.
  822. After measuring noise profile is stopped it will be
  823. automatically applied in filtering.
  824. @item noise_reduction, nr
  825. Change noise reduction. Argument is single float number.
  826. Syntax for the command is : "@var{noise_reduction}"
  827. @item noise_floor, nf
  828. Change noise floor. Argument is single float number.
  829. Syntax for the command is : "@var{noise_floor}"
  830. @item output_mode, om
  831. Change output mode operation.
  832. Syntax for the command is : "i", "o" or "n" string.
  833. @end table
  834. @section afftfilt
  835. Apply arbitrary expressions to samples in frequency domain.
  836. @table @option
  837. @item real
  838. Set frequency domain real expression for each separate channel separated
  839. by '|'. Default is "re".
  840. If the number of input channels is greater than the number of
  841. expressions, the last specified expression is used for the remaining
  842. output channels.
  843. @item imag
  844. Set frequency domain imaginary expression for each separate channel
  845. separated by '|'. Default is "im".
  846. Each expression in @var{real} and @var{imag} can contain the following
  847. constants and functions:
  848. @table @option
  849. @item sr
  850. sample rate
  851. @item b
  852. current frequency bin number
  853. @item nb
  854. number of available bins
  855. @item ch
  856. channel number of the current expression
  857. @item chs
  858. number of channels
  859. @item pts
  860. current frame pts
  861. @item re
  862. current real part of frequency bin of current channel
  863. @item im
  864. current imaginary part of frequency bin of current channel
  865. @item real(b, ch)
  866. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  867. @item imag(b, ch)
  868. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  869. @end table
  870. @item win_size
  871. Set window size.
  872. It accepts the following values:
  873. @table @samp
  874. @item w16
  875. @item w32
  876. @item w64
  877. @item w128
  878. @item w256
  879. @item w512
  880. @item w1024
  881. @item w2048
  882. @item w4096
  883. @item w8192
  884. @item w16384
  885. @item w32768
  886. @item w65536
  887. @end table
  888. Default is @code{w4096}
  889. @item win_func
  890. Set window function. Default is @code{hann}.
  891. @item overlap
  892. Set window overlap. If set to 1, the recommended overlap for selected
  893. window function will be picked. Default is @code{0.75}.
  894. @end table
  895. @subsection Examples
  896. @itemize
  897. @item
  898. Leave almost only low frequencies in audio:
  899. @example
  900. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  901. @end example
  902. @end itemize
  903. @anchor{afir}
  904. @section afir
  905. Apply an arbitrary Frequency Impulse Response filter.
  906. This filter is designed for applying long FIR filters,
  907. up to 60 seconds long.
  908. It can be used as component for digital crossover filters,
  909. room equalization, cross talk cancellation, wavefield synthesis,
  910. auralization, ambiophonics and ambisonics.
  911. This filter uses second stream as FIR coefficients.
  912. If second stream holds single channel, it will be used
  913. for all input channels in first stream, otherwise
  914. number of channels in second stream must be same as
  915. number of channels in first stream.
  916. It accepts the following parameters:
  917. @table @option
  918. @item dry
  919. Set dry gain. This sets input gain.
  920. @item wet
  921. Set wet gain. This sets final output gain.
  922. @item length
  923. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  924. @item gtype
  925. Enable applying gain measured from power of IR.
  926. Set which approach to use for auto gain measurement.
  927. @table @option
  928. @item none
  929. Do not apply any gain.
  930. @item peak
  931. select peak gain, very conservative approach. This is default value.
  932. @item dc
  933. select DC gain, limited application.
  934. @item gn
  935. select gain to noise approach, this is most popular one.
  936. @end table
  937. @item irgain
  938. Set gain to be applied to IR coefficients before filtering.
  939. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  940. @item irfmt
  941. Set format of IR stream. Can be @code{mono} or @code{input}.
  942. Default is @code{input}.
  943. @item maxir
  944. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  945. Allowed range is 0.1 to 60 seconds.
  946. @item response
  947. Show IR frequency reponse, magnitude(magenta) and phase(green) and group delay(yellow) in additional video stream.
  948. By default it is disabled.
  949. @item channel
  950. Set for which IR channel to display frequency response. By default is first channel
  951. displayed. This option is used only when @var{response} is enabled.
  952. @item size
  953. Set video stream size. This option is used only when @var{response} is enabled.
  954. @item rate
  955. Set video stream frame rate. This option is used only when @var{response} is enabled.
  956. @item minp
  957. Set minimal partition size used for convolution. Default is @var{8192}.
  958. Allowed range is from @var{16} to @var{32768}.
  959. Lower values decreases latency at cost of higher CPU usage.
  960. @item maxp
  961. Set maximal partition size used for convolution. Default is @var{8192}.
  962. Allowed range is from @var{16} to @var{32768}.
  963. Lower values may increase CPU usage.
  964. @end table
  965. @subsection Examples
  966. @itemize
  967. @item
  968. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  969. @example
  970. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  971. @end example
  972. @end itemize
  973. @anchor{aformat}
  974. @section aformat
  975. Set output format constraints for the input audio. The framework will
  976. negotiate the most appropriate format to minimize conversions.
  977. It accepts the following parameters:
  978. @table @option
  979. @item sample_fmts
  980. A '|'-separated list of requested sample formats.
  981. @item sample_rates
  982. A '|'-separated list of requested sample rates.
  983. @item channel_layouts
  984. A '|'-separated list of requested channel layouts.
  985. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  986. for the required syntax.
  987. @end table
  988. If a parameter is omitted, all values are allowed.
  989. Force the output to either unsigned 8-bit or signed 16-bit stereo
  990. @example
  991. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  992. @end example
  993. @section agate
  994. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  995. processing reduces disturbing noise between useful signals.
  996. Gating is done by detecting the volume below a chosen level @var{threshold}
  997. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  998. floor is set via @var{range}. Because an exact manipulation of the signal
  999. would cause distortion of the waveform the reduction can be levelled over
  1000. time. This is done by setting @var{attack} and @var{release}.
  1001. @var{attack} determines how long the signal has to fall below the threshold
  1002. before any reduction will occur and @var{release} sets the time the signal
  1003. has to rise above the threshold to reduce the reduction again.
  1004. Shorter signals than the chosen attack time will be left untouched.
  1005. @table @option
  1006. @item level_in
  1007. Set input level before filtering.
  1008. Default is 1. Allowed range is from 0.015625 to 64.
  1009. @item range
  1010. Set the level of gain reduction when the signal is below the threshold.
  1011. Default is 0.06125. Allowed range is from 0 to 1.
  1012. @item threshold
  1013. If a signal rises above this level the gain reduction is released.
  1014. Default is 0.125. Allowed range is from 0 to 1.
  1015. @item ratio
  1016. Set a ratio by which the signal is reduced.
  1017. Default is 2. Allowed range is from 1 to 9000.
  1018. @item attack
  1019. Amount of milliseconds the signal has to rise above the threshold before gain
  1020. reduction stops.
  1021. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1022. @item release
  1023. Amount of milliseconds the signal has to fall below the threshold before the
  1024. reduction is increased again. Default is 250 milliseconds.
  1025. Allowed range is from 0.01 to 9000.
  1026. @item makeup
  1027. Set amount of amplification of signal after processing.
  1028. Default is 1. Allowed range is from 1 to 64.
  1029. @item knee
  1030. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1031. Default is 2.828427125. Allowed range is from 1 to 8.
  1032. @item detection
  1033. Choose if exact signal should be taken for detection or an RMS like one.
  1034. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1035. @item link
  1036. Choose if the average level between all channels or the louder channel affects
  1037. the reduction.
  1038. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1039. @end table
  1040. @section aiir
  1041. Apply an arbitrary Infinite Impulse Response filter.
  1042. It accepts the following parameters:
  1043. @table @option
  1044. @item z
  1045. Set numerator/zeros coefficients.
  1046. @item p
  1047. Set denominator/poles coefficients.
  1048. @item k
  1049. Set channels gains.
  1050. @item dry_gain
  1051. Set input gain.
  1052. @item wet_gain
  1053. Set output gain.
  1054. @item f
  1055. Set coefficients format.
  1056. @table @samp
  1057. @item tf
  1058. transfer function
  1059. @item zp
  1060. Z-plane zeros/poles, cartesian (default)
  1061. @item pr
  1062. Z-plane zeros/poles, polar radians
  1063. @item pd
  1064. Z-plane zeros/poles, polar degrees
  1065. @end table
  1066. @item r
  1067. Set kind of processing.
  1068. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  1069. @item e
  1070. Set filtering precision.
  1071. @table @samp
  1072. @item dbl
  1073. double-precision floating-point (default)
  1074. @item flt
  1075. single-precision floating-point
  1076. @item i32
  1077. 32-bit integers
  1078. @item i16
  1079. 16-bit integers
  1080. @end table
  1081. @item response
  1082. Show IR frequency reponse, magnitude and phase in additional video stream.
  1083. By default it is disabled.
  1084. @item channel
  1085. Set for which IR channel to display frequency response. By default is first channel
  1086. displayed. This option is used only when @var{response} is enabled.
  1087. @item size
  1088. Set video stream size. This option is used only when @var{response} is enabled.
  1089. @end table
  1090. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1091. order.
  1092. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1093. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1094. imaginary unit.
  1095. Different coefficients and gains can be provided for every channel, in such case
  1096. use '|' to separate coefficients or gains. Last provided coefficients will be
  1097. used for all remaining channels.
  1098. @subsection Examples
  1099. @itemize
  1100. @item
  1101. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  1102. @example
  1103. 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
  1104. @end example
  1105. @item
  1106. Same as above but in @code{zp} format:
  1107. @example
  1108. 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
  1109. @end example
  1110. @end itemize
  1111. @section alimiter
  1112. The limiter prevents an input signal from rising over a desired threshold.
  1113. This limiter uses lookahead technology to prevent your signal from distorting.
  1114. It means that there is a small delay after the signal is processed. Keep in mind
  1115. that the delay it produces is the attack time you set.
  1116. The filter accepts the following options:
  1117. @table @option
  1118. @item level_in
  1119. Set input gain. Default is 1.
  1120. @item level_out
  1121. Set output gain. Default is 1.
  1122. @item limit
  1123. Don't let signals above this level pass the limiter. Default is 1.
  1124. @item attack
  1125. The limiter will reach its attenuation level in this amount of time in
  1126. milliseconds. Default is 5 milliseconds.
  1127. @item release
  1128. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1129. Default is 50 milliseconds.
  1130. @item asc
  1131. When gain reduction is always needed ASC takes care of releasing to an
  1132. average reduction level rather than reaching a reduction of 0 in the release
  1133. time.
  1134. @item asc_level
  1135. Select how much the release time is affected by ASC, 0 means nearly no changes
  1136. in release time while 1 produces higher release times.
  1137. @item level
  1138. Auto level output signal. Default is enabled.
  1139. This normalizes audio back to 0dB if enabled.
  1140. @end table
  1141. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1142. with @ref{aresample} before applying this filter.
  1143. @section allpass
  1144. Apply a two-pole all-pass filter with central frequency (in Hz)
  1145. @var{frequency}, and filter-width @var{width}.
  1146. An all-pass filter changes the audio's frequency to phase relationship
  1147. without changing its frequency to amplitude relationship.
  1148. The filter accepts the following options:
  1149. @table @option
  1150. @item frequency, f
  1151. Set frequency in Hz.
  1152. @item width_type, t
  1153. Set method to specify band-width of filter.
  1154. @table @option
  1155. @item h
  1156. Hz
  1157. @item q
  1158. Q-Factor
  1159. @item o
  1160. octave
  1161. @item s
  1162. slope
  1163. @item k
  1164. kHz
  1165. @end table
  1166. @item width, w
  1167. Specify the band-width of a filter in width_type units.
  1168. @item channels, c
  1169. Specify which channels to filter, by default all available are filtered.
  1170. @end table
  1171. @subsection Commands
  1172. This filter supports the following commands:
  1173. @table @option
  1174. @item frequency, f
  1175. Change allpass frequency.
  1176. Syntax for the command is : "@var{frequency}"
  1177. @item width_type, t
  1178. Change allpass width_type.
  1179. Syntax for the command is : "@var{width_type}"
  1180. @item width, w
  1181. Change allpass width.
  1182. Syntax for the command is : "@var{width}"
  1183. @end table
  1184. @section aloop
  1185. Loop audio samples.
  1186. The filter accepts the following options:
  1187. @table @option
  1188. @item loop
  1189. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1190. Default is 0.
  1191. @item size
  1192. Set maximal number of samples. Default is 0.
  1193. @item start
  1194. Set first sample of loop. Default is 0.
  1195. @end table
  1196. @anchor{amerge}
  1197. @section amerge
  1198. Merge two or more audio streams into a single multi-channel stream.
  1199. The filter accepts the following options:
  1200. @table @option
  1201. @item inputs
  1202. Set the number of inputs. Default is 2.
  1203. @end table
  1204. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1205. the channel layout of the output will be set accordingly and the channels
  1206. will be reordered as necessary. If the channel layouts of the inputs are not
  1207. disjoint, the output will have all the channels of the first input then all
  1208. the channels of the second input, in that order, and the channel layout of
  1209. the output will be the default value corresponding to the total number of
  1210. channels.
  1211. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1212. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1213. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1214. first input, b1 is the first channel of the second input).
  1215. On the other hand, if both input are in stereo, the output channels will be
  1216. in the default order: a1, a2, b1, b2, and the channel layout will be
  1217. arbitrarily set to 4.0, which may or may not be the expected value.
  1218. All inputs must have the same sample rate, and format.
  1219. If inputs do not have the same duration, the output will stop with the
  1220. shortest.
  1221. @subsection Examples
  1222. @itemize
  1223. @item
  1224. Merge two mono files into a stereo stream:
  1225. @example
  1226. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1227. @end example
  1228. @item
  1229. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1230. @example
  1231. 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
  1232. @end example
  1233. @end itemize
  1234. @section amix
  1235. Mixes multiple audio inputs into a single output.
  1236. Note that this filter only supports float samples (the @var{amerge}
  1237. and @var{pan} audio filters support many formats). If the @var{amix}
  1238. input has integer samples then @ref{aresample} will be automatically
  1239. inserted to perform the conversion to float samples.
  1240. For example
  1241. @example
  1242. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1243. @end example
  1244. will mix 3 input audio streams to a single output with the same duration as the
  1245. first input and a dropout transition time of 3 seconds.
  1246. It accepts the following parameters:
  1247. @table @option
  1248. @item inputs
  1249. The number of inputs. If unspecified, it defaults to 2.
  1250. @item duration
  1251. How to determine the end-of-stream.
  1252. @table @option
  1253. @item longest
  1254. The duration of the longest input. (default)
  1255. @item shortest
  1256. The duration of the shortest input.
  1257. @item first
  1258. The duration of the first input.
  1259. @end table
  1260. @item dropout_transition
  1261. The transition time, in seconds, for volume renormalization when an input
  1262. stream ends. The default value is 2 seconds.
  1263. @item weights
  1264. Specify weight of each input audio stream as sequence.
  1265. Each weight is separated by space. By default all inputs have same weight.
  1266. @end table
  1267. @section amultiply
  1268. Multiply first audio stream with second audio stream and store result
  1269. in output audio stream. Multiplication is done by multiplying each
  1270. sample from first stream with sample at same position from second stream.
  1271. With this element-wise multiplication one can create amplitude fades and
  1272. amplitude modulations.
  1273. @section anequalizer
  1274. High-order parametric multiband equalizer for each channel.
  1275. It accepts the following parameters:
  1276. @table @option
  1277. @item params
  1278. This option string is in format:
  1279. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1280. Each equalizer band is separated by '|'.
  1281. @table @option
  1282. @item chn
  1283. Set channel number to which equalization will be applied.
  1284. If input doesn't have that channel the entry is ignored.
  1285. @item f
  1286. Set central frequency for band.
  1287. If input doesn't have that frequency the entry is ignored.
  1288. @item w
  1289. Set band width in hertz.
  1290. @item g
  1291. Set band gain in dB.
  1292. @item t
  1293. Set filter type for band, optional, can be:
  1294. @table @samp
  1295. @item 0
  1296. Butterworth, this is default.
  1297. @item 1
  1298. Chebyshev type 1.
  1299. @item 2
  1300. Chebyshev type 2.
  1301. @end table
  1302. @end table
  1303. @item curves
  1304. With this option activated frequency response of anequalizer is displayed
  1305. in video stream.
  1306. @item size
  1307. Set video stream size. Only useful if curves option is activated.
  1308. @item mgain
  1309. Set max gain that will be displayed. Only useful if curves option is activated.
  1310. Setting this to a reasonable value makes it possible to display gain which is derived from
  1311. neighbour bands which are too close to each other and thus produce higher gain
  1312. when both are activated.
  1313. @item fscale
  1314. Set frequency scale used to draw frequency response in video output.
  1315. Can be linear or logarithmic. Default is logarithmic.
  1316. @item colors
  1317. Set color for each channel curve which is going to be displayed in video stream.
  1318. This is list of color names separated by space or by '|'.
  1319. Unrecognised or missing colors will be replaced by white color.
  1320. @end table
  1321. @subsection Examples
  1322. @itemize
  1323. @item
  1324. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1325. for first 2 channels using Chebyshev type 1 filter:
  1326. @example
  1327. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1328. @end example
  1329. @end itemize
  1330. @subsection Commands
  1331. This filter supports the following commands:
  1332. @table @option
  1333. @item change
  1334. Alter existing filter parameters.
  1335. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1336. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1337. error is returned.
  1338. @var{freq} set new frequency parameter.
  1339. @var{width} set new width parameter in herz.
  1340. @var{gain} set new gain parameter in dB.
  1341. Full filter invocation with asendcmd may look like this:
  1342. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1343. @end table
  1344. @section anull
  1345. Pass the audio source unchanged to the output.
  1346. @section apad
  1347. Pad the end of an audio stream with silence.
  1348. This can be used together with @command{ffmpeg} @option{-shortest} to
  1349. extend audio streams to the same length as the video stream.
  1350. A description of the accepted options follows.
  1351. @table @option
  1352. @item packet_size
  1353. Set silence packet size. Default value is 4096.
  1354. @item pad_len
  1355. Set the number of samples of silence to add to the end. After the
  1356. value is reached, the stream is terminated. This option is mutually
  1357. exclusive with @option{whole_len}.
  1358. @item whole_len
  1359. Set the minimum total number of samples in the output audio stream. If
  1360. the value is longer than the input audio length, silence is added to
  1361. the end, until the value is reached. This option is mutually exclusive
  1362. with @option{pad_len}.
  1363. @item pad_dur
  1364. Specify the duration of samples of silence to add. See
  1365. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1366. for the accepted syntax. Used only if set to non-zero value.
  1367. @item whole_dur
  1368. Specify the minimum total duration in the output audio stream. See
  1369. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1370. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1371. the input audio length, silence is added to the end, until the value is reached.
  1372. This option is mutually exclusive with @option{pad_dur}
  1373. @end table
  1374. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1375. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1376. the input stream indefinitely.
  1377. @subsection Examples
  1378. @itemize
  1379. @item
  1380. Add 1024 samples of silence to the end of the input:
  1381. @example
  1382. apad=pad_len=1024
  1383. @end example
  1384. @item
  1385. Make sure the audio output will contain at least 10000 samples, pad
  1386. the input with silence if required:
  1387. @example
  1388. apad=whole_len=10000
  1389. @end example
  1390. @item
  1391. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1392. video stream will always result the shortest and will be converted
  1393. until the end in the output file when using the @option{shortest}
  1394. option:
  1395. @example
  1396. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1397. @end example
  1398. @end itemize
  1399. @section aphaser
  1400. Add a phasing effect to the input audio.
  1401. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1402. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1403. A description of the accepted parameters follows.
  1404. @table @option
  1405. @item in_gain
  1406. Set input gain. Default is 0.4.
  1407. @item out_gain
  1408. Set output gain. Default is 0.74
  1409. @item delay
  1410. Set delay in milliseconds. Default is 3.0.
  1411. @item decay
  1412. Set decay. Default is 0.4.
  1413. @item speed
  1414. Set modulation speed in Hz. Default is 0.5.
  1415. @item type
  1416. Set modulation type. Default is triangular.
  1417. It accepts the following values:
  1418. @table @samp
  1419. @item triangular, t
  1420. @item sinusoidal, s
  1421. @end table
  1422. @end table
  1423. @section apulsator
  1424. Audio pulsator is something between an autopanner and a tremolo.
  1425. But it can produce funny stereo effects as well. Pulsator changes the volume
  1426. of the left and right channel based on a LFO (low frequency oscillator) with
  1427. different waveforms and shifted phases.
  1428. This filter have the ability to define an offset between left and right
  1429. channel. An offset of 0 means that both LFO shapes match each other.
  1430. The left and right channel are altered equally - a conventional tremolo.
  1431. An offset of 50% means that the shape of the right channel is exactly shifted
  1432. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1433. an autopanner. At 1 both curves match again. Every setting in between moves the
  1434. phase shift gapless between all stages and produces some "bypassing" sounds with
  1435. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1436. the 0.5) the faster the signal passes from the left to the right speaker.
  1437. The filter accepts the following options:
  1438. @table @option
  1439. @item level_in
  1440. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1441. @item level_out
  1442. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1443. @item mode
  1444. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1445. sawup or sawdown. Default is sine.
  1446. @item amount
  1447. Set modulation. Define how much of original signal is affected by the LFO.
  1448. @item offset_l
  1449. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1450. @item offset_r
  1451. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1452. @item width
  1453. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1454. @item timing
  1455. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1456. @item bpm
  1457. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1458. is set to bpm.
  1459. @item ms
  1460. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1461. is set to ms.
  1462. @item hz
  1463. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1464. if timing is set to hz.
  1465. @end table
  1466. @anchor{aresample}
  1467. @section aresample
  1468. Resample the input audio to the specified parameters, using the
  1469. libswresample library. If none are specified then the filter will
  1470. automatically convert between its input and output.
  1471. This filter is also able to stretch/squeeze the audio data to make it match
  1472. the timestamps or to inject silence / cut out audio to make it match the
  1473. timestamps, do a combination of both or do neither.
  1474. The filter accepts the syntax
  1475. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1476. expresses a sample rate and @var{resampler_options} is a list of
  1477. @var{key}=@var{value} pairs, separated by ":". See the
  1478. @ref{Resampler Options,,"Resampler Options" section in the
  1479. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1480. for the complete list of supported options.
  1481. @subsection Examples
  1482. @itemize
  1483. @item
  1484. Resample the input audio to 44100Hz:
  1485. @example
  1486. aresample=44100
  1487. @end example
  1488. @item
  1489. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1490. samples per second compensation:
  1491. @example
  1492. aresample=async=1000
  1493. @end example
  1494. @end itemize
  1495. @section areverse
  1496. Reverse an audio clip.
  1497. Warning: This filter requires memory to buffer the entire clip, so trimming
  1498. is suggested.
  1499. @subsection Examples
  1500. @itemize
  1501. @item
  1502. Take the first 5 seconds of a clip, and reverse it.
  1503. @example
  1504. atrim=end=5,areverse
  1505. @end example
  1506. @end itemize
  1507. @section asetnsamples
  1508. Set the number of samples per each output audio frame.
  1509. The last output packet may contain a different number of samples, as
  1510. the filter will flush all the remaining samples when the input audio
  1511. signals its end.
  1512. The filter accepts the following options:
  1513. @table @option
  1514. @item nb_out_samples, n
  1515. Set the number of frames per each output audio frame. The number is
  1516. intended as the number of samples @emph{per each channel}.
  1517. Default value is 1024.
  1518. @item pad, p
  1519. If set to 1, the filter will pad the last audio frame with zeroes, so
  1520. that the last frame will contain the same number of samples as the
  1521. previous ones. Default value is 1.
  1522. @end table
  1523. For example, to set the number of per-frame samples to 1234 and
  1524. disable padding for the last frame, use:
  1525. @example
  1526. asetnsamples=n=1234:p=0
  1527. @end example
  1528. @section asetrate
  1529. Set the sample rate without altering the PCM data.
  1530. This will result in a change of speed and pitch.
  1531. The filter accepts the following options:
  1532. @table @option
  1533. @item sample_rate, r
  1534. Set the output sample rate. Default is 44100 Hz.
  1535. @end table
  1536. @section ashowinfo
  1537. Show a line containing various information for each input audio frame.
  1538. The input audio is not modified.
  1539. The shown line contains a sequence of key/value pairs of the form
  1540. @var{key}:@var{value}.
  1541. The following values are shown in the output:
  1542. @table @option
  1543. @item n
  1544. The (sequential) number of the input frame, starting from 0.
  1545. @item pts
  1546. The presentation timestamp of the input frame, in time base units; the time base
  1547. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1548. @item pts_time
  1549. The presentation timestamp of the input frame in seconds.
  1550. @item pos
  1551. position of the frame in the input stream, -1 if this information in
  1552. unavailable and/or meaningless (for example in case of synthetic audio)
  1553. @item fmt
  1554. The sample format.
  1555. @item chlayout
  1556. The channel layout.
  1557. @item rate
  1558. The sample rate for the audio frame.
  1559. @item nb_samples
  1560. The number of samples (per channel) in the frame.
  1561. @item checksum
  1562. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1563. audio, the data is treated as if all the planes were concatenated.
  1564. @item plane_checksums
  1565. A list of Adler-32 checksums for each data plane.
  1566. @end table
  1567. @anchor{astats}
  1568. @section astats
  1569. Display time domain statistical information about the audio channels.
  1570. Statistics are calculated and displayed for each audio channel and,
  1571. where applicable, an overall figure is also given.
  1572. It accepts the following option:
  1573. @table @option
  1574. @item length
  1575. Short window length in seconds, used for peak and trough RMS measurement.
  1576. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1577. @item metadata
  1578. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1579. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1580. disabled.
  1581. Available keys for each channel are:
  1582. DC_offset
  1583. Min_level
  1584. Max_level
  1585. Min_difference
  1586. Max_difference
  1587. Mean_difference
  1588. RMS_difference
  1589. Peak_level
  1590. RMS_peak
  1591. RMS_trough
  1592. Crest_factor
  1593. Flat_factor
  1594. Peak_count
  1595. Bit_depth
  1596. Dynamic_range
  1597. Zero_crossings
  1598. Zero_crossings_rate
  1599. and for Overall:
  1600. DC_offset
  1601. Min_level
  1602. Max_level
  1603. Min_difference
  1604. Max_difference
  1605. Mean_difference
  1606. RMS_difference
  1607. Peak_level
  1608. RMS_level
  1609. RMS_peak
  1610. RMS_trough
  1611. Flat_factor
  1612. Peak_count
  1613. Bit_depth
  1614. Number_of_samples
  1615. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1616. this @code{lavfi.astats.Overall.Peak_count}.
  1617. For description what each key means read below.
  1618. @item reset
  1619. Set number of frame after which stats are going to be recalculated.
  1620. Default is disabled.
  1621. @end table
  1622. A description of each shown parameter follows:
  1623. @table @option
  1624. @item DC offset
  1625. Mean amplitude displacement from zero.
  1626. @item Min level
  1627. Minimal sample level.
  1628. @item Max level
  1629. Maximal sample level.
  1630. @item Min difference
  1631. Minimal difference between two consecutive samples.
  1632. @item Max difference
  1633. Maximal difference between two consecutive samples.
  1634. @item Mean difference
  1635. Mean difference between two consecutive samples.
  1636. The average of each difference between two consecutive samples.
  1637. @item RMS difference
  1638. Root Mean Square difference between two consecutive samples.
  1639. @item Peak level dB
  1640. @item RMS level dB
  1641. Standard peak and RMS level measured in dBFS.
  1642. @item RMS peak dB
  1643. @item RMS trough dB
  1644. Peak and trough values for RMS level measured over a short window.
  1645. @item Crest factor
  1646. Standard ratio of peak to RMS level (note: not in dB).
  1647. @item Flat factor
  1648. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1649. (i.e. either @var{Min level} or @var{Max level}).
  1650. @item Peak count
  1651. Number of occasions (not the number of samples) that the signal attained either
  1652. @var{Min level} or @var{Max level}.
  1653. @item Bit depth
  1654. Overall bit depth of audio. Number of bits used for each sample.
  1655. @item Dynamic range
  1656. Measured dynamic range of audio in dB.
  1657. @item Zero crossings
  1658. Number of points where the waveform crosses the zero level axis.
  1659. @item Zero crossings rate
  1660. Rate of Zero crossings and number of audio samples.
  1661. @end table
  1662. @section atempo
  1663. Adjust audio tempo.
  1664. The filter accepts exactly one parameter, the audio tempo. If not
  1665. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1666. be in the [0.5, 100.0] range.
  1667. Note that tempo greater than 2 will skip some samples rather than
  1668. blend them in. If for any reason this is a concern it is always
  1669. possible to daisy-chain several instances of atempo to achieve the
  1670. desired product tempo.
  1671. @subsection Examples
  1672. @itemize
  1673. @item
  1674. Slow down audio to 80% tempo:
  1675. @example
  1676. atempo=0.8
  1677. @end example
  1678. @item
  1679. To speed up audio to 300% tempo:
  1680. @example
  1681. atempo=3
  1682. @end example
  1683. @item
  1684. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1685. @example
  1686. atempo=sqrt(3),atempo=sqrt(3)
  1687. @end example
  1688. @end itemize
  1689. @section atrim
  1690. Trim the input so that the output contains one continuous subpart of the input.
  1691. It accepts the following parameters:
  1692. @table @option
  1693. @item start
  1694. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1695. sample with the timestamp @var{start} will be the first sample in the output.
  1696. @item end
  1697. Specify time of the first audio sample that will be dropped, i.e. the
  1698. audio sample immediately preceding the one with the timestamp @var{end} will be
  1699. the last sample in the output.
  1700. @item start_pts
  1701. Same as @var{start}, except this option sets the start timestamp in samples
  1702. instead of seconds.
  1703. @item end_pts
  1704. Same as @var{end}, except this option sets the end timestamp in samples instead
  1705. of seconds.
  1706. @item duration
  1707. The maximum duration of the output in seconds.
  1708. @item start_sample
  1709. The number of the first sample that should be output.
  1710. @item end_sample
  1711. The number of the first sample that should be dropped.
  1712. @end table
  1713. @option{start}, @option{end}, and @option{duration} are expressed as time
  1714. duration specifications; see
  1715. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1716. Note that the first two sets of the start/end options and the @option{duration}
  1717. option look at the frame timestamp, while the _sample options simply count the
  1718. samples that pass through the filter. So start/end_pts and start/end_sample will
  1719. give different results when the timestamps are wrong, inexact or do not start at
  1720. zero. Also note that this filter does not modify the timestamps. If you wish
  1721. to have the output timestamps start at zero, insert the asetpts filter after the
  1722. atrim filter.
  1723. If multiple start or end options are set, this filter tries to be greedy and
  1724. keep all samples that match at least one of the specified constraints. To keep
  1725. only the part that matches all the constraints at once, chain multiple atrim
  1726. filters.
  1727. The defaults are such that all the input is kept. So it is possible to set e.g.
  1728. just the end values to keep everything before the specified time.
  1729. Examples:
  1730. @itemize
  1731. @item
  1732. Drop everything except the second minute of input:
  1733. @example
  1734. ffmpeg -i INPUT -af atrim=60:120
  1735. @end example
  1736. @item
  1737. Keep only the first 1000 samples:
  1738. @example
  1739. ffmpeg -i INPUT -af atrim=end_sample=1000
  1740. @end example
  1741. @end itemize
  1742. @section bandpass
  1743. Apply a two-pole Butterworth band-pass filter with central
  1744. frequency @var{frequency}, and (3dB-point) band-width width.
  1745. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1746. instead of the default: constant 0dB peak gain.
  1747. The filter roll off at 6dB per octave (20dB per decade).
  1748. The filter accepts the following options:
  1749. @table @option
  1750. @item frequency, f
  1751. Set the filter's central frequency. Default is @code{3000}.
  1752. @item csg
  1753. Constant skirt gain if set to 1. Defaults to 0.
  1754. @item width_type, t
  1755. Set method to specify band-width of filter.
  1756. @table @option
  1757. @item h
  1758. Hz
  1759. @item q
  1760. Q-Factor
  1761. @item o
  1762. octave
  1763. @item s
  1764. slope
  1765. @item k
  1766. kHz
  1767. @end table
  1768. @item width, w
  1769. Specify the band-width of a filter in width_type units.
  1770. @item channels, c
  1771. Specify which channels to filter, by default all available are filtered.
  1772. @end table
  1773. @subsection Commands
  1774. This filter supports the following commands:
  1775. @table @option
  1776. @item frequency, f
  1777. Change bandpass frequency.
  1778. Syntax for the command is : "@var{frequency}"
  1779. @item width_type, t
  1780. Change bandpass width_type.
  1781. Syntax for the command is : "@var{width_type}"
  1782. @item width, w
  1783. Change bandpass width.
  1784. Syntax for the command is : "@var{width}"
  1785. @end table
  1786. @section bandreject
  1787. Apply a two-pole Butterworth band-reject filter with central
  1788. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1789. The filter roll off at 6dB per octave (20dB per decade).
  1790. The filter accepts the following options:
  1791. @table @option
  1792. @item frequency, f
  1793. Set the filter's central frequency. Default is @code{3000}.
  1794. @item width_type, t
  1795. Set method to specify band-width of filter.
  1796. @table @option
  1797. @item h
  1798. Hz
  1799. @item q
  1800. Q-Factor
  1801. @item o
  1802. octave
  1803. @item s
  1804. slope
  1805. @item k
  1806. kHz
  1807. @end table
  1808. @item width, w
  1809. Specify the band-width of a filter in width_type units.
  1810. @item channels, c
  1811. Specify which channels to filter, by default all available are filtered.
  1812. @end table
  1813. @subsection Commands
  1814. This filter supports the following commands:
  1815. @table @option
  1816. @item frequency, f
  1817. Change bandreject frequency.
  1818. Syntax for the command is : "@var{frequency}"
  1819. @item width_type, t
  1820. Change bandreject width_type.
  1821. Syntax for the command is : "@var{width_type}"
  1822. @item width, w
  1823. Change bandreject width.
  1824. Syntax for the command is : "@var{width}"
  1825. @end table
  1826. @section bass, lowshelf
  1827. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1828. shelving filter with a response similar to that of a standard
  1829. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1830. The filter accepts the following options:
  1831. @table @option
  1832. @item gain, g
  1833. Give the gain at 0 Hz. Its useful range is about -20
  1834. (for a large cut) to +20 (for a large boost).
  1835. Beware of clipping when using a positive gain.
  1836. @item frequency, f
  1837. Set the filter's central frequency and so can be used
  1838. to extend or reduce the frequency range to be boosted or cut.
  1839. The default value is @code{100} Hz.
  1840. @item width_type, t
  1841. Set method to specify band-width of filter.
  1842. @table @option
  1843. @item h
  1844. Hz
  1845. @item q
  1846. Q-Factor
  1847. @item o
  1848. octave
  1849. @item s
  1850. slope
  1851. @item k
  1852. kHz
  1853. @end table
  1854. @item width, w
  1855. Determine how steep is the filter's shelf transition.
  1856. @item channels, c
  1857. Specify which channels to filter, by default all available are filtered.
  1858. @end table
  1859. @subsection Commands
  1860. This filter supports the following commands:
  1861. @table @option
  1862. @item frequency, f
  1863. Change bass frequency.
  1864. Syntax for the command is : "@var{frequency}"
  1865. @item width_type, t
  1866. Change bass width_type.
  1867. Syntax for the command is : "@var{width_type}"
  1868. @item width, w
  1869. Change bass width.
  1870. Syntax for the command is : "@var{width}"
  1871. @item gain, g
  1872. Change bass gain.
  1873. Syntax for the command is : "@var{gain}"
  1874. @end table
  1875. @section biquad
  1876. Apply a biquad IIR filter with the given coefficients.
  1877. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1878. are the numerator and denominator coefficients respectively.
  1879. and @var{channels}, @var{c} specify which channels to filter, by default all
  1880. available are filtered.
  1881. @subsection Commands
  1882. This filter supports the following commands:
  1883. @table @option
  1884. @item a0
  1885. @item a1
  1886. @item a2
  1887. @item b0
  1888. @item b1
  1889. @item b2
  1890. Change biquad parameter.
  1891. Syntax for the command is : "@var{value}"
  1892. @end table
  1893. @section bs2b
  1894. Bauer stereo to binaural transformation, which improves headphone listening of
  1895. stereo audio records.
  1896. To enable compilation of this filter you need to configure FFmpeg with
  1897. @code{--enable-libbs2b}.
  1898. It accepts the following parameters:
  1899. @table @option
  1900. @item profile
  1901. Pre-defined crossfeed level.
  1902. @table @option
  1903. @item default
  1904. Default level (fcut=700, feed=50).
  1905. @item cmoy
  1906. Chu Moy circuit (fcut=700, feed=60).
  1907. @item jmeier
  1908. Jan Meier circuit (fcut=650, feed=95).
  1909. @end table
  1910. @item fcut
  1911. Cut frequency (in Hz).
  1912. @item feed
  1913. Feed level (in Hz).
  1914. @end table
  1915. @section channelmap
  1916. Remap input channels to new locations.
  1917. It accepts the following parameters:
  1918. @table @option
  1919. @item map
  1920. Map channels from input to output. The argument is a '|'-separated list of
  1921. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1922. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1923. channel (e.g. FL for front left) or its index in the input channel layout.
  1924. @var{out_channel} is the name of the output channel or its index in the output
  1925. channel layout. If @var{out_channel} is not given then it is implicitly an
  1926. index, starting with zero and increasing by one for each mapping.
  1927. @item channel_layout
  1928. The channel layout of the output stream.
  1929. @end table
  1930. If no mapping is present, the filter will implicitly map input channels to
  1931. output channels, preserving indices.
  1932. @subsection Examples
  1933. @itemize
  1934. @item
  1935. For example, assuming a 5.1+downmix input MOV file,
  1936. @example
  1937. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1938. @end example
  1939. will create an output WAV file tagged as stereo from the downmix channels of
  1940. the input.
  1941. @item
  1942. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1943. @example
  1944. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1945. @end example
  1946. @end itemize
  1947. @section channelsplit
  1948. Split each channel from an input audio stream into a separate output stream.
  1949. It accepts the following parameters:
  1950. @table @option
  1951. @item channel_layout
  1952. The channel layout of the input stream. The default is "stereo".
  1953. @item channels
  1954. A channel layout describing the channels to be extracted as separate output streams
  1955. or "all" to extract each input channel as a separate stream. The default is "all".
  1956. Choosing channels not present in channel layout in the input will result in an error.
  1957. @end table
  1958. @subsection Examples
  1959. @itemize
  1960. @item
  1961. For example, assuming a stereo input MP3 file,
  1962. @example
  1963. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1964. @end example
  1965. will create an output Matroska file with two audio streams, one containing only
  1966. the left channel and the other the right channel.
  1967. @item
  1968. Split a 5.1 WAV file into per-channel files:
  1969. @example
  1970. ffmpeg -i in.wav -filter_complex
  1971. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1972. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1973. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1974. side_right.wav
  1975. @end example
  1976. @item
  1977. Extract only LFE from a 5.1 WAV file:
  1978. @example
  1979. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1980. -map '[LFE]' lfe.wav
  1981. @end example
  1982. @end itemize
  1983. @section chorus
  1984. Add a chorus effect to the audio.
  1985. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1986. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1987. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1988. The modulation depth defines the range the modulated delay is played before or after
  1989. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1990. sound tuned around the original one, like in a chorus where some vocals are slightly
  1991. off key.
  1992. It accepts the following parameters:
  1993. @table @option
  1994. @item in_gain
  1995. Set input gain. Default is 0.4.
  1996. @item out_gain
  1997. Set output gain. Default is 0.4.
  1998. @item delays
  1999. Set delays. A typical delay is around 40ms to 60ms.
  2000. @item decays
  2001. Set decays.
  2002. @item speeds
  2003. Set speeds.
  2004. @item depths
  2005. Set depths.
  2006. @end table
  2007. @subsection Examples
  2008. @itemize
  2009. @item
  2010. A single delay:
  2011. @example
  2012. chorus=0.7:0.9:55:0.4:0.25:2
  2013. @end example
  2014. @item
  2015. Two delays:
  2016. @example
  2017. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2018. @end example
  2019. @item
  2020. Fuller sounding chorus with three delays:
  2021. @example
  2022. 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
  2023. @end example
  2024. @end itemize
  2025. @section compand
  2026. Compress or expand the audio's dynamic range.
  2027. It accepts the following parameters:
  2028. @table @option
  2029. @item attacks
  2030. @item decays
  2031. A list of times in seconds for each channel over which the instantaneous level
  2032. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2033. increase of volume and @var{decays} refers to decrease of volume. For most
  2034. situations, the attack time (response to the audio getting louder) should be
  2035. shorter than the decay time, because the human ear is more sensitive to sudden
  2036. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2037. a typical value for decay is 0.8 seconds.
  2038. If specified number of attacks & decays is lower than number of channels, the last
  2039. set attack/decay will be used for all remaining channels.
  2040. @item points
  2041. A list of points for the transfer function, specified in dB relative to the
  2042. maximum possible signal amplitude. Each key points list must be defined using
  2043. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2044. @code{x0/y0 x1/y1 x2/y2 ....}
  2045. The input values must be in strictly increasing order but the transfer function
  2046. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2047. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2048. function are @code{-70/-70|-60/-20|1/0}.
  2049. @item soft-knee
  2050. Set the curve radius in dB for all joints. It defaults to 0.01.
  2051. @item gain
  2052. Set the additional gain in dB to be applied at all points on the transfer
  2053. function. This allows for easy adjustment of the overall gain.
  2054. It defaults to 0.
  2055. @item volume
  2056. Set an initial volume, in dB, to be assumed for each channel when filtering
  2057. starts. This permits the user to supply a nominal level initially, so that, for
  2058. example, a very large gain is not applied to initial signal levels before the
  2059. companding has begun to operate. A typical value for audio which is initially
  2060. quiet is -90 dB. It defaults to 0.
  2061. @item delay
  2062. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2063. delayed before being fed to the volume adjuster. Specifying a delay
  2064. approximately equal to the attack/decay times allows the filter to effectively
  2065. operate in predictive rather than reactive mode. It defaults to 0.
  2066. @end table
  2067. @subsection Examples
  2068. @itemize
  2069. @item
  2070. Make music with both quiet and loud passages suitable for listening to in a
  2071. noisy environment:
  2072. @example
  2073. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2074. @end example
  2075. Another example for audio with whisper and explosion parts:
  2076. @example
  2077. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2078. @end example
  2079. @item
  2080. A noise gate for when the noise is at a lower level than the signal:
  2081. @example
  2082. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2083. @end example
  2084. @item
  2085. Here is another noise gate, this time for when the noise is at a higher level
  2086. than the signal (making it, in some ways, similar to squelch):
  2087. @example
  2088. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2089. @end example
  2090. @item
  2091. 2:1 compression starting at -6dB:
  2092. @example
  2093. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2094. @end example
  2095. @item
  2096. 2:1 compression starting at -9dB:
  2097. @example
  2098. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2099. @end example
  2100. @item
  2101. 2:1 compression starting at -12dB:
  2102. @example
  2103. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2104. @end example
  2105. @item
  2106. 2:1 compression starting at -18dB:
  2107. @example
  2108. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2109. @end example
  2110. @item
  2111. 3:1 compression starting at -15dB:
  2112. @example
  2113. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2114. @end example
  2115. @item
  2116. Compressor/Gate:
  2117. @example
  2118. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2119. @end example
  2120. @item
  2121. Expander:
  2122. @example
  2123. 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
  2124. @end example
  2125. @item
  2126. Hard limiter at -6dB:
  2127. @example
  2128. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2129. @end example
  2130. @item
  2131. Hard limiter at -12dB:
  2132. @example
  2133. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2134. @end example
  2135. @item
  2136. Hard noise gate at -35 dB:
  2137. @example
  2138. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2139. @end example
  2140. @item
  2141. Soft limiter:
  2142. @example
  2143. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2144. @end example
  2145. @end itemize
  2146. @section compensationdelay
  2147. Compensation Delay Line is a metric based delay to compensate differing
  2148. positions of microphones or speakers.
  2149. For example, you have recorded guitar with two microphones placed in
  2150. different location. Because the front of sound wave has fixed speed in
  2151. normal conditions, the phasing of microphones can vary and depends on
  2152. their location and interposition. The best sound mix can be achieved when
  2153. these microphones are in phase (synchronized). Note that distance of
  2154. ~30 cm between microphones makes one microphone to capture signal in
  2155. antiphase to another microphone. That makes the final mix sounding moody.
  2156. This filter helps to solve phasing problems by adding different delays
  2157. to each microphone track and make them synchronized.
  2158. The best result can be reached when you take one track as base and
  2159. synchronize other tracks one by one with it.
  2160. Remember that synchronization/delay tolerance depends on sample rate, too.
  2161. Higher sample rates will give more tolerance.
  2162. It accepts the following parameters:
  2163. @table @option
  2164. @item mm
  2165. Set millimeters distance. This is compensation distance for fine tuning.
  2166. Default is 0.
  2167. @item cm
  2168. Set cm distance. This is compensation distance for tightening distance setup.
  2169. Default is 0.
  2170. @item m
  2171. Set meters distance. This is compensation distance for hard distance setup.
  2172. Default is 0.
  2173. @item dry
  2174. Set dry amount. Amount of unprocessed (dry) signal.
  2175. Default is 0.
  2176. @item wet
  2177. Set wet amount. Amount of processed (wet) signal.
  2178. Default is 1.
  2179. @item temp
  2180. Set temperature degree in Celsius. This is the temperature of the environment.
  2181. Default is 20.
  2182. @end table
  2183. @section crossfeed
  2184. Apply headphone crossfeed filter.
  2185. Crossfeed is the process of blending the left and right channels of stereo
  2186. audio recording.
  2187. It is mainly used to reduce extreme stereo separation of low frequencies.
  2188. The intent is to produce more speaker like sound to the listener.
  2189. The filter accepts the following options:
  2190. @table @option
  2191. @item strength
  2192. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2193. This sets gain of low shelf filter for side part of stereo image.
  2194. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2195. @item range
  2196. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2197. This sets cut off frequency of low shelf filter. Default is cut off near
  2198. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2199. @item level_in
  2200. Set input gain. Default is 0.9.
  2201. @item level_out
  2202. Set output gain. Default is 1.
  2203. @end table
  2204. @section crystalizer
  2205. Simple algorithm to expand audio dynamic range.
  2206. The filter accepts the following options:
  2207. @table @option
  2208. @item i
  2209. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2210. (unchanged sound) to 10.0 (maximum effect).
  2211. @item c
  2212. Enable clipping. By default is enabled.
  2213. @end table
  2214. @section dcshift
  2215. Apply a DC shift to the audio.
  2216. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2217. in the recording chain) from the audio. The effect of a DC offset is reduced
  2218. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2219. a signal has a DC offset.
  2220. @table @option
  2221. @item shift
  2222. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2223. the audio.
  2224. @item limitergain
  2225. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2226. used to prevent clipping.
  2227. @end table
  2228. @section drmeter
  2229. Measure audio dynamic range.
  2230. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2231. is found in transition material. And anything less that 8 have very poor dynamics
  2232. and is very compressed.
  2233. The filter accepts the following options:
  2234. @table @option
  2235. @item length
  2236. Set window length in seconds used to split audio into segments of equal length.
  2237. Default is 3 seconds.
  2238. @end table
  2239. @section dynaudnorm
  2240. Dynamic Audio Normalizer.
  2241. This filter applies a certain amount of gain to the input audio in order
  2242. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2243. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2244. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2245. This allows for applying extra gain to the "quiet" sections of the audio
  2246. while avoiding distortions or clipping the "loud" sections. In other words:
  2247. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2248. sections, in the sense that the volume of each section is brought to the
  2249. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2250. this goal *without* applying "dynamic range compressing". It will retain 100%
  2251. of the dynamic range *within* each section of the audio file.
  2252. @table @option
  2253. @item f
  2254. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2255. Default is 500 milliseconds.
  2256. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2257. referred to as frames. This is required, because a peak magnitude has no
  2258. meaning for just a single sample value. Instead, we need to determine the
  2259. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2260. normalizer would simply use the peak magnitude of the complete file, the
  2261. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2262. frame. The length of a frame is specified in milliseconds. By default, the
  2263. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2264. been found to give good results with most files.
  2265. Note that the exact frame length, in number of samples, will be determined
  2266. automatically, based on the sampling rate of the individual input audio file.
  2267. @item g
  2268. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2269. number. Default is 31.
  2270. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2271. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2272. is specified in frames, centered around the current frame. For the sake of
  2273. simplicity, this must be an odd number. Consequently, the default value of 31
  2274. takes into account the current frame, as well as the 15 preceding frames and
  2275. the 15 subsequent frames. Using a larger window results in a stronger
  2276. smoothing effect and thus in less gain variation, i.e. slower gain
  2277. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2278. effect and thus in more gain variation, i.e. faster gain adaptation.
  2279. In other words, the more you increase this value, the more the Dynamic Audio
  2280. Normalizer will behave like a "traditional" normalization filter. On the
  2281. contrary, the more you decrease this value, the more the Dynamic Audio
  2282. Normalizer will behave like a dynamic range compressor.
  2283. @item p
  2284. Set the target peak value. This specifies the highest permissible magnitude
  2285. level for the normalized audio input. This filter will try to approach the
  2286. target peak magnitude as closely as possible, but at the same time it also
  2287. makes sure that the normalized signal will never exceed the peak magnitude.
  2288. A frame's maximum local gain factor is imposed directly by the target peak
  2289. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2290. It is not recommended to go above this value.
  2291. @item m
  2292. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2293. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2294. factor for each input frame, i.e. the maximum gain factor that does not
  2295. result in clipping or distortion. The maximum gain factor is determined by
  2296. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2297. additionally bounds the frame's maximum gain factor by a predetermined
  2298. (global) maximum gain factor. This is done in order to avoid excessive gain
  2299. factors in "silent" or almost silent frames. By default, the maximum gain
  2300. factor is 10.0, For most inputs the default value should be sufficient and
  2301. it usually is not recommended to increase this value. Though, for input
  2302. with an extremely low overall volume level, it may be necessary to allow even
  2303. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2304. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2305. Instead, a "sigmoid" threshold function will be applied. This way, the
  2306. gain factors will smoothly approach the threshold value, but never exceed that
  2307. value.
  2308. @item r
  2309. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2310. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2311. This means that the maximum local gain factor for each frame is defined
  2312. (only) by the frame's highest magnitude sample. This way, the samples can
  2313. be amplified as much as possible without exceeding the maximum signal
  2314. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2315. Normalizer can also take into account the frame's root mean square,
  2316. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2317. determine the power of a time-varying signal. It is therefore considered
  2318. that the RMS is a better approximation of the "perceived loudness" than
  2319. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2320. frames to a constant RMS value, a uniform "perceived loudness" can be
  2321. established. If a target RMS value has been specified, a frame's local gain
  2322. factor is defined as the factor that would result in exactly that RMS value.
  2323. Note, however, that the maximum local gain factor is still restricted by the
  2324. frame's highest magnitude sample, in order to prevent clipping.
  2325. @item n
  2326. Enable channels coupling. By default is enabled.
  2327. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2328. amount. This means the same gain factor will be applied to all channels, i.e.
  2329. the maximum possible gain factor is determined by the "loudest" channel.
  2330. However, in some recordings, it may happen that the volume of the different
  2331. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2332. In this case, this option can be used to disable the channel coupling. This way,
  2333. the gain factor will be determined independently for each channel, depending
  2334. only on the individual channel's highest magnitude sample. This allows for
  2335. harmonizing the volume of the different channels.
  2336. @item c
  2337. Enable DC bias correction. By default is disabled.
  2338. An audio signal (in the time domain) is a sequence of sample values.
  2339. In the Dynamic Audio Normalizer these sample values are represented in the
  2340. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2341. audio signal, or "waveform", should be centered around the zero point.
  2342. That means if we calculate the mean value of all samples in a file, or in a
  2343. single frame, then the result should be 0.0 or at least very close to that
  2344. value. If, however, there is a significant deviation of the mean value from
  2345. 0.0, in either positive or negative direction, this is referred to as a
  2346. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2347. Audio Normalizer provides optional DC bias correction.
  2348. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2349. the mean value, or "DC correction" offset, of each input frame and subtract
  2350. that value from all of the frame's sample values which ensures those samples
  2351. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2352. boundaries, the DC correction offset values will be interpolated smoothly
  2353. between neighbouring frames.
  2354. @item b
  2355. Enable alternative boundary mode. By default is disabled.
  2356. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2357. around each frame. This includes the preceding frames as well as the
  2358. subsequent frames. However, for the "boundary" frames, located at the very
  2359. beginning and at the very end of the audio file, not all neighbouring
  2360. frames are available. In particular, for the first few frames in the audio
  2361. file, the preceding frames are not known. And, similarly, for the last few
  2362. frames in the audio file, the subsequent frames are not known. Thus, the
  2363. question arises which gain factors should be assumed for the missing frames
  2364. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2365. to deal with this situation. The default boundary mode assumes a gain factor
  2366. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2367. "fade out" at the beginning and at the end of the input, respectively.
  2368. @item s
  2369. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2370. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2371. compression. This means that signal peaks will not be pruned and thus the
  2372. full dynamic range will be retained within each local neighbourhood. However,
  2373. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2374. normalization algorithm with a more "traditional" compression.
  2375. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2376. (thresholding) function. If (and only if) the compression feature is enabled,
  2377. all input frames will be processed by a soft knee thresholding function prior
  2378. to the actual normalization process. Put simply, the thresholding function is
  2379. going to prune all samples whose magnitude exceeds a certain threshold value.
  2380. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2381. value. Instead, the threshold value will be adjusted for each individual
  2382. frame.
  2383. In general, smaller parameters result in stronger compression, and vice versa.
  2384. Values below 3.0 are not recommended, because audible distortion may appear.
  2385. @end table
  2386. @section earwax
  2387. Make audio easier to listen to on headphones.
  2388. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2389. so that when listened to on headphones the stereo image is moved from
  2390. inside your head (standard for headphones) to outside and in front of
  2391. the listener (standard for speakers).
  2392. Ported from SoX.
  2393. @section equalizer
  2394. Apply a two-pole peaking equalisation (EQ) filter. With this
  2395. filter, the signal-level at and around a selected frequency can
  2396. be increased or decreased, whilst (unlike bandpass and bandreject
  2397. filters) that at all other frequencies is unchanged.
  2398. In order to produce complex equalisation curves, this filter can
  2399. be given several times, each with a different central frequency.
  2400. The filter accepts the following options:
  2401. @table @option
  2402. @item frequency, f
  2403. Set the filter's central frequency in Hz.
  2404. @item width_type, t
  2405. Set method to specify band-width of filter.
  2406. @table @option
  2407. @item h
  2408. Hz
  2409. @item q
  2410. Q-Factor
  2411. @item o
  2412. octave
  2413. @item s
  2414. slope
  2415. @item k
  2416. kHz
  2417. @end table
  2418. @item width, w
  2419. Specify the band-width of a filter in width_type units.
  2420. @item gain, g
  2421. Set the required gain or attenuation in dB.
  2422. Beware of clipping when using a positive gain.
  2423. @item channels, c
  2424. Specify which channels to filter, by default all available are filtered.
  2425. @end table
  2426. @subsection Examples
  2427. @itemize
  2428. @item
  2429. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2430. @example
  2431. equalizer=f=1000:t=h:width=200:g=-10
  2432. @end example
  2433. @item
  2434. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2435. @example
  2436. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2437. @end example
  2438. @end itemize
  2439. @subsection Commands
  2440. This filter supports the following commands:
  2441. @table @option
  2442. @item frequency, f
  2443. Change equalizer frequency.
  2444. Syntax for the command is : "@var{frequency}"
  2445. @item width_type, t
  2446. Change equalizer width_type.
  2447. Syntax for the command is : "@var{width_type}"
  2448. @item width, w
  2449. Change equalizer width.
  2450. Syntax for the command is : "@var{width}"
  2451. @item gain, g
  2452. Change equalizer gain.
  2453. Syntax for the command is : "@var{gain}"
  2454. @end table
  2455. @section extrastereo
  2456. Linearly increases the difference between left and right channels which
  2457. adds some sort of "live" effect to playback.
  2458. The filter accepts the following options:
  2459. @table @option
  2460. @item m
  2461. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2462. (average of both channels), with 1.0 sound will be unchanged, with
  2463. -1.0 left and right channels will be swapped.
  2464. @item c
  2465. Enable clipping. By default is enabled.
  2466. @end table
  2467. @section firequalizer
  2468. Apply FIR Equalization using arbitrary frequency response.
  2469. The filter accepts the following option:
  2470. @table @option
  2471. @item gain
  2472. Set gain curve equation (in dB). The expression can contain variables:
  2473. @table @option
  2474. @item f
  2475. the evaluated frequency
  2476. @item sr
  2477. sample rate
  2478. @item ch
  2479. channel number, set to 0 when multichannels evaluation is disabled
  2480. @item chid
  2481. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2482. multichannels evaluation is disabled
  2483. @item chs
  2484. number of channels
  2485. @item chlayout
  2486. channel_layout, see libavutil/channel_layout.h
  2487. @end table
  2488. and functions:
  2489. @table @option
  2490. @item gain_interpolate(f)
  2491. interpolate gain on frequency f based on gain_entry
  2492. @item cubic_interpolate(f)
  2493. same as gain_interpolate, but smoother
  2494. @end table
  2495. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2496. @item gain_entry
  2497. Set gain entry for gain_interpolate function. The expression can
  2498. contain functions:
  2499. @table @option
  2500. @item entry(f, g)
  2501. store gain entry at frequency f with value g
  2502. @end table
  2503. This option is also available as command.
  2504. @item delay
  2505. Set filter delay in seconds. Higher value means more accurate.
  2506. Default is @code{0.01}.
  2507. @item accuracy
  2508. Set filter accuracy in Hz. Lower value means more accurate.
  2509. Default is @code{5}.
  2510. @item wfunc
  2511. Set window function. Acceptable values are:
  2512. @table @option
  2513. @item rectangular
  2514. rectangular window, useful when gain curve is already smooth
  2515. @item hann
  2516. hann window (default)
  2517. @item hamming
  2518. hamming window
  2519. @item blackman
  2520. blackman window
  2521. @item nuttall3
  2522. 3-terms continuous 1st derivative nuttall window
  2523. @item mnuttall3
  2524. minimum 3-terms discontinuous nuttall window
  2525. @item nuttall
  2526. 4-terms continuous 1st derivative nuttall window
  2527. @item bnuttall
  2528. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2529. @item bharris
  2530. blackman-harris window
  2531. @item tukey
  2532. tukey window
  2533. @end table
  2534. @item fixed
  2535. If enabled, use fixed number of audio samples. This improves speed when
  2536. filtering with large delay. Default is disabled.
  2537. @item multi
  2538. Enable multichannels evaluation on gain. Default is disabled.
  2539. @item zero_phase
  2540. Enable zero phase mode by subtracting timestamp to compensate delay.
  2541. Default is disabled.
  2542. @item scale
  2543. Set scale used by gain. Acceptable values are:
  2544. @table @option
  2545. @item linlin
  2546. linear frequency, linear gain
  2547. @item linlog
  2548. linear frequency, logarithmic (in dB) gain (default)
  2549. @item loglin
  2550. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2551. @item loglog
  2552. logarithmic frequency, logarithmic gain
  2553. @end table
  2554. @item dumpfile
  2555. Set file for dumping, suitable for gnuplot.
  2556. @item dumpscale
  2557. Set scale for dumpfile. Acceptable values are same with scale option.
  2558. Default is linlog.
  2559. @item fft2
  2560. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2561. Default is disabled.
  2562. @item min_phase
  2563. Enable minimum phase impulse response. Default is disabled.
  2564. @end table
  2565. @subsection Examples
  2566. @itemize
  2567. @item
  2568. lowpass at 1000 Hz:
  2569. @example
  2570. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2571. @end example
  2572. @item
  2573. lowpass at 1000 Hz with gain_entry:
  2574. @example
  2575. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2576. @end example
  2577. @item
  2578. custom equalization:
  2579. @example
  2580. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2581. @end example
  2582. @item
  2583. higher delay with zero phase to compensate delay:
  2584. @example
  2585. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2586. @end example
  2587. @item
  2588. lowpass on left channel, highpass on right channel:
  2589. @example
  2590. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2591. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2592. @end example
  2593. @end itemize
  2594. @section flanger
  2595. Apply a flanging effect to the audio.
  2596. The filter accepts the following options:
  2597. @table @option
  2598. @item delay
  2599. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2600. @item depth
  2601. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2602. @item regen
  2603. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2604. Default value is 0.
  2605. @item width
  2606. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2607. Default value is 71.
  2608. @item speed
  2609. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2610. @item shape
  2611. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2612. Default value is @var{sinusoidal}.
  2613. @item phase
  2614. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2615. Default value is 25.
  2616. @item interp
  2617. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2618. Default is @var{linear}.
  2619. @end table
  2620. @section haas
  2621. Apply Haas effect to audio.
  2622. Note that this makes most sense to apply on mono signals.
  2623. With this filter applied to mono signals it give some directionality and
  2624. stretches its stereo image.
  2625. The filter accepts the following options:
  2626. @table @option
  2627. @item level_in
  2628. Set input level. By default is @var{1}, or 0dB
  2629. @item level_out
  2630. Set output level. By default is @var{1}, or 0dB.
  2631. @item side_gain
  2632. Set gain applied to side part of signal. By default is @var{1}.
  2633. @item middle_source
  2634. Set kind of middle source. Can be one of the following:
  2635. @table @samp
  2636. @item left
  2637. Pick left channel.
  2638. @item right
  2639. Pick right channel.
  2640. @item mid
  2641. Pick middle part signal of stereo image.
  2642. @item side
  2643. Pick side part signal of stereo image.
  2644. @end table
  2645. @item middle_phase
  2646. Change middle phase. By default is disabled.
  2647. @item left_delay
  2648. Set left channel delay. By default is @var{2.05} milliseconds.
  2649. @item left_balance
  2650. Set left channel balance. By default is @var{-1}.
  2651. @item left_gain
  2652. Set left channel gain. By default is @var{1}.
  2653. @item left_phase
  2654. Change left phase. By default is disabled.
  2655. @item right_delay
  2656. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2657. @item right_balance
  2658. Set right channel balance. By default is @var{1}.
  2659. @item right_gain
  2660. Set right channel gain. By default is @var{1}.
  2661. @item right_phase
  2662. Change right phase. By default is enabled.
  2663. @end table
  2664. @section hdcd
  2665. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2666. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2667. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2668. of HDCD, and detects the Transient Filter flag.
  2669. @example
  2670. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2671. @end example
  2672. When using the filter with wav, note the default encoding for wav is 16-bit,
  2673. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2674. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2675. @example
  2676. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2677. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2678. @end example
  2679. The filter accepts the following options:
  2680. @table @option
  2681. @item disable_autoconvert
  2682. Disable any automatic format conversion or resampling in the filter graph.
  2683. @item process_stereo
  2684. Process the stereo channels together. If target_gain does not match between
  2685. channels, consider it invalid and use the last valid target_gain.
  2686. @item cdt_ms
  2687. Set the code detect timer period in ms.
  2688. @item force_pe
  2689. Always extend peaks above -3dBFS even if PE isn't signaled.
  2690. @item analyze_mode
  2691. Replace audio with a solid tone and adjust the amplitude to signal some
  2692. specific aspect of the decoding process. The output file can be loaded in
  2693. an audio editor alongside the original to aid analysis.
  2694. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2695. Modes are:
  2696. @table @samp
  2697. @item 0, off
  2698. Disabled
  2699. @item 1, lle
  2700. Gain adjustment level at each sample
  2701. @item 2, pe
  2702. Samples where peak extend occurs
  2703. @item 3, cdt
  2704. Samples where the code detect timer is active
  2705. @item 4, tgm
  2706. Samples where the target gain does not match between channels
  2707. @end table
  2708. @end table
  2709. @section headphone
  2710. Apply head-related transfer functions (HRTFs) to create virtual
  2711. loudspeakers around the user for binaural listening via headphones.
  2712. The HRIRs are provided via additional streams, for each channel
  2713. one stereo input stream is needed.
  2714. The filter accepts the following options:
  2715. @table @option
  2716. @item map
  2717. Set mapping of input streams for convolution.
  2718. The argument is a '|'-separated list of channel names in order as they
  2719. are given as additional stream inputs for filter.
  2720. This also specify number of input streams. Number of input streams
  2721. must be not less than number of channels in first stream plus one.
  2722. @item gain
  2723. Set gain applied to audio. Value is in dB. Default is 0.
  2724. @item type
  2725. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2726. processing audio in time domain which is slow.
  2727. @var{freq} is processing audio in frequency domain which is fast.
  2728. Default is @var{freq}.
  2729. @item lfe
  2730. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2731. @item size
  2732. Set size of frame in number of samples which will be processed at once.
  2733. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2734. @item hrir
  2735. Set format of hrir stream.
  2736. Default value is @var{stereo}. Alternative value is @var{multich}.
  2737. If value is set to @var{stereo}, number of additional streams should
  2738. be greater or equal to number of input channels in first input stream.
  2739. Also each additional stream should have stereo number of channels.
  2740. If value is set to @var{multich}, number of additional streams should
  2741. be exactly one. Also number of input channels of additional stream
  2742. should be equal or greater than twice number of channels of first input
  2743. stream.
  2744. @end table
  2745. @subsection Examples
  2746. @itemize
  2747. @item
  2748. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2749. each amovie filter use stereo file with IR coefficients as input.
  2750. The files give coefficients for each position of virtual loudspeaker:
  2751. @example
  2752. ffmpeg -i input.wav -lavfi-complex "amovie=azi_270_ele_0_DFC.wav[sr],amovie=azi_90_ele_0_DFC.wav[sl],amovie=azi_225_ele_0_DFC.wav[br],amovie=azi_135_ele_0_DFC.wav[bl],amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe],amovie=azi_35_ele_0_DFC.wav[fl],amovie=azi_325_ele_0_DFC.wav[fr],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2753. output.wav
  2754. @end example
  2755. @item
  2756. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2757. but now in @var{multich} @var{hrir} format.
  2758. @example
  2759. ffmpeg -i input.wav -lavfi-complex "amovie=minp.wav[hrirs],[a:0][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  2760. output.wav
  2761. @end example
  2762. @end itemize
  2763. @section highpass
  2764. Apply a high-pass filter with 3dB point frequency.
  2765. The filter can be either single-pole, or double-pole (the default).
  2766. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2767. The filter accepts the following options:
  2768. @table @option
  2769. @item frequency, f
  2770. Set frequency in Hz. Default is 3000.
  2771. @item poles, p
  2772. Set number of poles. Default is 2.
  2773. @item width_type, t
  2774. Set method to specify band-width of filter.
  2775. @table @option
  2776. @item h
  2777. Hz
  2778. @item q
  2779. Q-Factor
  2780. @item o
  2781. octave
  2782. @item s
  2783. slope
  2784. @item k
  2785. kHz
  2786. @end table
  2787. @item width, w
  2788. Specify the band-width of a filter in width_type units.
  2789. Applies only to double-pole filter.
  2790. The default is 0.707q and gives a Butterworth response.
  2791. @item channels, c
  2792. Specify which channels to filter, by default all available are filtered.
  2793. @end table
  2794. @subsection Commands
  2795. This filter supports the following commands:
  2796. @table @option
  2797. @item frequency, f
  2798. Change highpass frequency.
  2799. Syntax for the command is : "@var{frequency}"
  2800. @item width_type, t
  2801. Change highpass width_type.
  2802. Syntax for the command is : "@var{width_type}"
  2803. @item width, w
  2804. Change highpass width.
  2805. Syntax for the command is : "@var{width}"
  2806. @end table
  2807. @section join
  2808. Join multiple input streams into one multi-channel stream.
  2809. It accepts the following parameters:
  2810. @table @option
  2811. @item inputs
  2812. The number of input streams. It defaults to 2.
  2813. @item channel_layout
  2814. The desired output channel layout. It defaults to stereo.
  2815. @item map
  2816. Map channels from inputs to output. The argument is a '|'-separated list of
  2817. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2818. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2819. can be either the name of the input channel (e.g. FL for front left) or its
  2820. index in the specified input stream. @var{out_channel} is the name of the output
  2821. channel.
  2822. @end table
  2823. The filter will attempt to guess the mappings when they are not specified
  2824. explicitly. It does so by first trying to find an unused matching input channel
  2825. and if that fails it picks the first unused input channel.
  2826. Join 3 inputs (with properly set channel layouts):
  2827. @example
  2828. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2829. @end example
  2830. Build a 5.1 output from 6 single-channel streams:
  2831. @example
  2832. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2833. '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'
  2834. out
  2835. @end example
  2836. @section ladspa
  2837. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2838. To enable compilation of this filter you need to configure FFmpeg with
  2839. @code{--enable-ladspa}.
  2840. @table @option
  2841. @item file, f
  2842. Specifies the name of LADSPA plugin library to load. If the environment
  2843. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2844. each one of the directories specified by the colon separated list in
  2845. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2846. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2847. @file{/usr/lib/ladspa/}.
  2848. @item plugin, p
  2849. Specifies the plugin within the library. Some libraries contain only
  2850. one plugin, but others contain many of them. If this is not set filter
  2851. will list all available plugins within the specified library.
  2852. @item controls, c
  2853. Set the '|' separated list of controls which are zero or more floating point
  2854. values that determine the behavior of the loaded plugin (for example delay,
  2855. threshold or gain).
  2856. Controls need to be defined using the following syntax:
  2857. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2858. @var{valuei} is the value set on the @var{i}-th control.
  2859. Alternatively they can be also defined using the following syntax:
  2860. @var{value0}|@var{value1}|@var{value2}|..., where
  2861. @var{valuei} is the value set on the @var{i}-th control.
  2862. If @option{controls} is set to @code{help}, all available controls and
  2863. their valid ranges are printed.
  2864. @item sample_rate, s
  2865. Specify the sample rate, default to 44100. Only used if plugin have
  2866. zero inputs.
  2867. @item nb_samples, n
  2868. Set the number of samples per channel per each output frame, default
  2869. is 1024. Only used if plugin have zero inputs.
  2870. @item duration, d
  2871. Set the minimum duration of the sourced audio. See
  2872. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2873. for the accepted syntax.
  2874. Note that the resulting duration may be greater than the specified duration,
  2875. as the generated audio is always cut at the end of a complete frame.
  2876. If not specified, or the expressed duration is negative, the audio is
  2877. supposed to be generated forever.
  2878. Only used if plugin have zero inputs.
  2879. @end table
  2880. @subsection Examples
  2881. @itemize
  2882. @item
  2883. List all available plugins within amp (LADSPA example plugin) library:
  2884. @example
  2885. ladspa=file=amp
  2886. @end example
  2887. @item
  2888. List all available controls and their valid ranges for @code{vcf_notch}
  2889. plugin from @code{VCF} library:
  2890. @example
  2891. ladspa=f=vcf:p=vcf_notch:c=help
  2892. @end example
  2893. @item
  2894. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2895. plugin library:
  2896. @example
  2897. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2898. @end example
  2899. @item
  2900. Add reverberation to the audio using TAP-plugins
  2901. (Tom's Audio Processing plugins):
  2902. @example
  2903. ladspa=file=tap_reverb:tap_reverb
  2904. @end example
  2905. @item
  2906. Generate white noise, with 0.2 amplitude:
  2907. @example
  2908. ladspa=file=cmt:noise_source_white:c=c0=.2
  2909. @end example
  2910. @item
  2911. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2912. @code{C* Audio Plugin Suite} (CAPS) library:
  2913. @example
  2914. ladspa=file=caps:Click:c=c1=20'
  2915. @end example
  2916. @item
  2917. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2918. @example
  2919. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2920. @end example
  2921. @item
  2922. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2923. @code{SWH Plugins} collection:
  2924. @example
  2925. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2926. @end example
  2927. @item
  2928. Attenuate low frequencies using Multiband EQ from Steve Harris
  2929. @code{SWH Plugins} collection:
  2930. @example
  2931. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2932. @end example
  2933. @item
  2934. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2935. (CAPS) library:
  2936. @example
  2937. ladspa=caps:Narrower
  2938. @end example
  2939. @item
  2940. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2941. @example
  2942. ladspa=caps:White:.2
  2943. @end example
  2944. @item
  2945. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2946. @example
  2947. ladspa=caps:Fractal:c=c1=1
  2948. @end example
  2949. @item
  2950. Dynamic volume normalization using @code{VLevel} plugin:
  2951. @example
  2952. ladspa=vlevel-ladspa:vlevel_mono
  2953. @end example
  2954. @end itemize
  2955. @subsection Commands
  2956. This filter supports the following commands:
  2957. @table @option
  2958. @item cN
  2959. Modify the @var{N}-th control value.
  2960. If the specified value is not valid, it is ignored and prior one is kept.
  2961. @end table
  2962. @section loudnorm
  2963. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2964. Support for both single pass (livestreams, files) and double pass (files) modes.
  2965. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2966. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2967. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2968. The filter accepts the following options:
  2969. @table @option
  2970. @item I, i
  2971. Set integrated loudness target.
  2972. Range is -70.0 - -5.0. Default value is -24.0.
  2973. @item LRA, lra
  2974. Set loudness range target.
  2975. Range is 1.0 - 20.0. Default value is 7.0.
  2976. @item TP, tp
  2977. Set maximum true peak.
  2978. Range is -9.0 - +0.0. Default value is -2.0.
  2979. @item measured_I, measured_i
  2980. Measured IL of input file.
  2981. Range is -99.0 - +0.0.
  2982. @item measured_LRA, measured_lra
  2983. Measured LRA of input file.
  2984. Range is 0.0 - 99.0.
  2985. @item measured_TP, measured_tp
  2986. Measured true peak of input file.
  2987. Range is -99.0 - +99.0.
  2988. @item measured_thresh
  2989. Measured threshold of input file.
  2990. Range is -99.0 - +0.0.
  2991. @item offset
  2992. Set offset gain. Gain is applied before the true-peak limiter.
  2993. Range is -99.0 - +99.0. Default is +0.0.
  2994. @item linear
  2995. Normalize linearly if possible.
  2996. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2997. to be specified in order to use this mode.
  2998. Options are true or false. Default is true.
  2999. @item dual_mono
  3000. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3001. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3002. If set to @code{true}, this option will compensate for this effect.
  3003. Multi-channel input files are not affected by this option.
  3004. Options are true or false. Default is false.
  3005. @item print_format
  3006. Set print format for stats. Options are summary, json, or none.
  3007. Default value is none.
  3008. @end table
  3009. @section lowpass
  3010. Apply a low-pass filter with 3dB point frequency.
  3011. The filter can be either single-pole or double-pole (the default).
  3012. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3013. The filter accepts the following options:
  3014. @table @option
  3015. @item frequency, f
  3016. Set frequency in Hz. Default is 500.
  3017. @item poles, p
  3018. Set number of poles. Default is 2.
  3019. @item width_type, t
  3020. Set method to specify band-width of filter.
  3021. @table @option
  3022. @item h
  3023. Hz
  3024. @item q
  3025. Q-Factor
  3026. @item o
  3027. octave
  3028. @item s
  3029. slope
  3030. @item k
  3031. kHz
  3032. @end table
  3033. @item width, w
  3034. Specify the band-width of a filter in width_type units.
  3035. Applies only to double-pole filter.
  3036. The default is 0.707q and gives a Butterworth response.
  3037. @item channels, c
  3038. Specify which channels to filter, by default all available are filtered.
  3039. @end table
  3040. @subsection Examples
  3041. @itemize
  3042. @item
  3043. Lowpass only LFE channel, it LFE is not present it does nothing:
  3044. @example
  3045. lowpass=c=LFE
  3046. @end example
  3047. @end itemize
  3048. @subsection Commands
  3049. This filter supports the following commands:
  3050. @table @option
  3051. @item frequency, f
  3052. Change lowpass frequency.
  3053. Syntax for the command is : "@var{frequency}"
  3054. @item width_type, t
  3055. Change lowpass width_type.
  3056. Syntax for the command is : "@var{width_type}"
  3057. @item width, w
  3058. Change lowpass width.
  3059. Syntax for the command is : "@var{width}"
  3060. @end table
  3061. @section lv2
  3062. Load a LV2 (LADSPA Version 2) plugin.
  3063. To enable compilation of this filter you need to configure FFmpeg with
  3064. @code{--enable-lv2}.
  3065. @table @option
  3066. @item plugin, p
  3067. Specifies the plugin URI. You may need to escape ':'.
  3068. @item controls, c
  3069. Set the '|' separated list of controls which are zero or more floating point
  3070. values that determine the behavior of the loaded plugin (for example delay,
  3071. threshold or gain).
  3072. If @option{controls} is set to @code{help}, all available controls and
  3073. their valid ranges are printed.
  3074. @item sample_rate, s
  3075. Specify the sample rate, default to 44100. Only used if plugin have
  3076. zero inputs.
  3077. @item nb_samples, n
  3078. Set the number of samples per channel per each output frame, default
  3079. is 1024. Only used if plugin have zero inputs.
  3080. @item duration, d
  3081. Set the minimum duration of the sourced audio. See
  3082. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3083. for the accepted syntax.
  3084. Note that the resulting duration may be greater than the specified duration,
  3085. as the generated audio is always cut at the end of a complete frame.
  3086. If not specified, or the expressed duration is negative, the audio is
  3087. supposed to be generated forever.
  3088. Only used if plugin have zero inputs.
  3089. @end table
  3090. @subsection Examples
  3091. @itemize
  3092. @item
  3093. Apply bass enhancer plugin from Calf:
  3094. @example
  3095. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3096. @end example
  3097. @item
  3098. Apply vinyl plugin from Calf:
  3099. @example
  3100. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3101. @end example
  3102. @item
  3103. Apply bit crusher plugin from ArtyFX:
  3104. @example
  3105. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3106. @end example
  3107. @end itemize
  3108. @section mcompand
  3109. Multiband Compress or expand the audio's dynamic range.
  3110. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3111. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3112. response when absent compander action.
  3113. It accepts the following parameters:
  3114. @table @option
  3115. @item args
  3116. This option syntax is:
  3117. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3118. For explanation of each item refer to compand filter documentation.
  3119. @end table
  3120. @anchor{pan}
  3121. @section pan
  3122. Mix channels with specific gain levels. The filter accepts the output
  3123. channel layout followed by a set of channels definitions.
  3124. This filter is also designed to efficiently remap the channels of an audio
  3125. stream.
  3126. The filter accepts parameters of the form:
  3127. "@var{l}|@var{outdef}|@var{outdef}|..."
  3128. @table @option
  3129. @item l
  3130. output channel layout or number of channels
  3131. @item outdef
  3132. output channel specification, of the form:
  3133. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3134. @item out_name
  3135. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3136. number (c0, c1, etc.)
  3137. @item gain
  3138. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3139. @item in_name
  3140. input channel to use, see out_name for details; it is not possible to mix
  3141. named and numbered input channels
  3142. @end table
  3143. If the `=' in a channel specification is replaced by `<', then the gains for
  3144. that specification will be renormalized so that the total is 1, thus
  3145. avoiding clipping noise.
  3146. @subsection Mixing examples
  3147. For example, if you want to down-mix from stereo to mono, but with a bigger
  3148. factor for the left channel:
  3149. @example
  3150. pan=1c|c0=0.9*c0+0.1*c1
  3151. @end example
  3152. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3153. 7-channels surround:
  3154. @example
  3155. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3156. @end example
  3157. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3158. that should be preferred (see "-ac" option) unless you have very specific
  3159. needs.
  3160. @subsection Remapping examples
  3161. The channel remapping will be effective if, and only if:
  3162. @itemize
  3163. @item gain coefficients are zeroes or ones,
  3164. @item only one input per channel output,
  3165. @end itemize
  3166. If all these conditions are satisfied, the filter will notify the user ("Pure
  3167. channel mapping detected"), and use an optimized and lossless method to do the
  3168. remapping.
  3169. For example, if you have a 5.1 source and want a stereo audio stream by
  3170. dropping the extra channels:
  3171. @example
  3172. pan="stereo| c0=FL | c1=FR"
  3173. @end example
  3174. Given the same source, you can also switch front left and front right channels
  3175. and keep the input channel layout:
  3176. @example
  3177. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3178. @end example
  3179. If the input is a stereo audio stream, you can mute the front left channel (and
  3180. still keep the stereo channel layout) with:
  3181. @example
  3182. pan="stereo|c1=c1"
  3183. @end example
  3184. Still with a stereo audio stream input, you can copy the right channel in both
  3185. front left and right:
  3186. @example
  3187. pan="stereo| c0=FR | c1=FR"
  3188. @end example
  3189. @section replaygain
  3190. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3191. outputs it unchanged.
  3192. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3193. @section resample
  3194. Convert the audio sample format, sample rate and channel layout. It is
  3195. not meant to be used directly.
  3196. @section rubberband
  3197. Apply time-stretching and pitch-shifting with librubberband.
  3198. To enable compilation of this filter, you need to configure FFmpeg with
  3199. @code{--enable-librubberband}.
  3200. The filter accepts the following options:
  3201. @table @option
  3202. @item tempo
  3203. Set tempo scale factor.
  3204. @item pitch
  3205. Set pitch scale factor.
  3206. @item transients
  3207. Set transients detector.
  3208. Possible values are:
  3209. @table @var
  3210. @item crisp
  3211. @item mixed
  3212. @item smooth
  3213. @end table
  3214. @item detector
  3215. Set detector.
  3216. Possible values are:
  3217. @table @var
  3218. @item compound
  3219. @item percussive
  3220. @item soft
  3221. @end table
  3222. @item phase
  3223. Set phase.
  3224. Possible values are:
  3225. @table @var
  3226. @item laminar
  3227. @item independent
  3228. @end table
  3229. @item window
  3230. Set processing window size.
  3231. Possible values are:
  3232. @table @var
  3233. @item standard
  3234. @item short
  3235. @item long
  3236. @end table
  3237. @item smoothing
  3238. Set smoothing.
  3239. Possible values are:
  3240. @table @var
  3241. @item off
  3242. @item on
  3243. @end table
  3244. @item formant
  3245. Enable formant preservation when shift pitching.
  3246. Possible values are:
  3247. @table @var
  3248. @item shifted
  3249. @item preserved
  3250. @end table
  3251. @item pitchq
  3252. Set pitch quality.
  3253. Possible values are:
  3254. @table @var
  3255. @item quality
  3256. @item speed
  3257. @item consistency
  3258. @end table
  3259. @item channels
  3260. Set channels.
  3261. Possible values are:
  3262. @table @var
  3263. @item apart
  3264. @item together
  3265. @end table
  3266. @end table
  3267. @section sidechaincompress
  3268. This filter acts like normal compressor but has the ability to compress
  3269. detected signal using second input signal.
  3270. It needs two input streams and returns one output stream.
  3271. First input stream will be processed depending on second stream signal.
  3272. The filtered signal then can be filtered with other filters in later stages of
  3273. processing. See @ref{pan} and @ref{amerge} filter.
  3274. The filter accepts the following options:
  3275. @table @option
  3276. @item level_in
  3277. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3278. @item threshold
  3279. If a signal of second stream raises above this level it will affect the gain
  3280. reduction of first stream.
  3281. By default is 0.125. Range is between 0.00097563 and 1.
  3282. @item ratio
  3283. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3284. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3285. Default is 2. Range is between 1 and 20.
  3286. @item attack
  3287. Amount of milliseconds the signal has to rise above the threshold before gain
  3288. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3289. @item release
  3290. Amount of milliseconds the signal has to fall below the threshold before
  3291. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3292. @item makeup
  3293. Set the amount by how much signal will be amplified after processing.
  3294. Default is 1. Range is from 1 to 64.
  3295. @item knee
  3296. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3297. Default is 2.82843. Range is between 1 and 8.
  3298. @item link
  3299. Choose if the @code{average} level between all channels of side-chain stream
  3300. or the louder(@code{maximum}) channel of side-chain stream affects the
  3301. reduction. Default is @code{average}.
  3302. @item detection
  3303. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3304. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3305. @item level_sc
  3306. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3307. @item mix
  3308. How much to use compressed signal in output. Default is 1.
  3309. Range is between 0 and 1.
  3310. @end table
  3311. @subsection Examples
  3312. @itemize
  3313. @item
  3314. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3315. depending on the signal of 2nd input and later compressed signal to be
  3316. merged with 2nd input:
  3317. @example
  3318. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3319. @end example
  3320. @end itemize
  3321. @section sidechaingate
  3322. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3323. filter the detected signal before sending it to the gain reduction stage.
  3324. Normally a gate uses the full range signal to detect a level above the
  3325. threshold.
  3326. For example: If you cut all lower frequencies from your sidechain signal
  3327. the gate will decrease the volume of your track only if not enough highs
  3328. appear. With this technique you are able to reduce the resonation of a
  3329. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3330. guitar.
  3331. It needs two input streams and returns one output stream.
  3332. First input stream will be processed depending on second stream signal.
  3333. The filter accepts the following options:
  3334. @table @option
  3335. @item level_in
  3336. Set input level before filtering.
  3337. Default is 1. Allowed range is from 0.015625 to 64.
  3338. @item range
  3339. Set the level of gain reduction when the signal is below the threshold.
  3340. Default is 0.06125. Allowed range is from 0 to 1.
  3341. @item threshold
  3342. If a signal rises above this level the gain reduction is released.
  3343. Default is 0.125. Allowed range is from 0 to 1.
  3344. @item ratio
  3345. Set a ratio about which the signal is reduced.
  3346. Default is 2. Allowed range is from 1 to 9000.
  3347. @item attack
  3348. Amount of milliseconds the signal has to rise above the threshold before gain
  3349. reduction stops.
  3350. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3351. @item release
  3352. Amount of milliseconds the signal has to fall below the threshold before the
  3353. reduction is increased again. Default is 250 milliseconds.
  3354. Allowed range is from 0.01 to 9000.
  3355. @item makeup
  3356. Set amount of amplification of signal after processing.
  3357. Default is 1. Allowed range is from 1 to 64.
  3358. @item knee
  3359. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3360. Default is 2.828427125. Allowed range is from 1 to 8.
  3361. @item detection
  3362. Choose if exact signal should be taken for detection or an RMS like one.
  3363. Default is rms. Can be peak or rms.
  3364. @item link
  3365. Choose if the average level between all channels or the louder channel affects
  3366. the reduction.
  3367. Default is average. Can be average or maximum.
  3368. @item level_sc
  3369. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3370. @end table
  3371. @section silencedetect
  3372. Detect silence in an audio stream.
  3373. This filter logs a message when it detects that the input audio volume is less
  3374. or equal to a noise tolerance value for a duration greater or equal to the
  3375. minimum detected noise duration.
  3376. The printed times and duration are expressed in seconds.
  3377. The filter accepts the following options:
  3378. @table @option
  3379. @item noise, n
  3380. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3381. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3382. @item duration, d
  3383. Set silence duration until notification (default is 2 seconds).
  3384. @item mono, m
  3385. Process each channel separately, instead of combined. By default is disabled.
  3386. @end table
  3387. @subsection Examples
  3388. @itemize
  3389. @item
  3390. Detect 5 seconds of silence with -50dB noise tolerance:
  3391. @example
  3392. silencedetect=n=-50dB:d=5
  3393. @end example
  3394. @item
  3395. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3396. tolerance in @file{silence.mp3}:
  3397. @example
  3398. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3399. @end example
  3400. @end itemize
  3401. @section silenceremove
  3402. Remove silence from the beginning, middle or end of the audio.
  3403. The filter accepts the following options:
  3404. @table @option
  3405. @item start_periods
  3406. This value is used to indicate if audio should be trimmed at beginning of
  3407. the audio. A value of zero indicates no silence should be trimmed from the
  3408. beginning. When specifying a non-zero value, it trims audio up until it
  3409. finds non-silence. Normally, when trimming silence from beginning of audio
  3410. the @var{start_periods} will be @code{1} but it can be increased to higher
  3411. values to trim all audio up to specific count of non-silence periods.
  3412. Default value is @code{0}.
  3413. @item start_duration
  3414. Specify the amount of time that non-silence must be detected before it stops
  3415. trimming audio. By increasing the duration, bursts of noises can be treated
  3416. as silence and trimmed off. Default value is @code{0}.
  3417. @item start_threshold
  3418. This indicates what sample value should be treated as silence. For digital
  3419. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3420. you may wish to increase the value to account for background noise.
  3421. Can be specified in dB (in case "dB" is appended to the specified value)
  3422. or amplitude ratio. Default value is @code{0}.
  3423. @item start_silence
  3424. Specify max duration of silence at beginning that will be kept after
  3425. trimming. Default is 0, which is equal to trimming all samples detected
  3426. as silence.
  3427. @item start_mode
  3428. Specify mode of detection of silence end in start of multi-channel audio.
  3429. Can be @var{any} or @var{all}. Default is @var{any}.
  3430. With @var{any}, any sample that is detected as non-silence will cause
  3431. stopped trimming of silence.
  3432. With @var{all}, only if all channels are detected as non-silence will cause
  3433. stopped trimming of silence.
  3434. @item stop_periods
  3435. Set the count for trimming silence from the end of audio.
  3436. To remove silence from the middle of a file, specify a @var{stop_periods}
  3437. that is negative. This value is then treated as a positive value and is
  3438. used to indicate the effect should restart processing as specified by
  3439. @var{start_periods}, making it suitable for removing periods of silence
  3440. in the middle of the audio.
  3441. Default value is @code{0}.
  3442. @item stop_duration
  3443. Specify a duration of silence that must exist before audio is not copied any
  3444. more. By specifying a higher duration, silence that is wanted can be left in
  3445. the audio.
  3446. Default value is @code{0}.
  3447. @item stop_threshold
  3448. This is the same as @option{start_threshold} but for trimming silence from
  3449. the end of audio.
  3450. Can be specified in dB (in case "dB" is appended to the specified value)
  3451. or amplitude ratio. Default value is @code{0}.
  3452. @item stop_silence
  3453. Specify max duration of silence at end that will be kept after
  3454. trimming. Default is 0, which is equal to trimming all samples detected
  3455. as silence.
  3456. @item stop_mode
  3457. Specify mode of detection of silence start in end of multi-channel audio.
  3458. Can be @var{any} or @var{all}. Default is @var{any}.
  3459. With @var{any}, any sample that is detected as non-silence will cause
  3460. stopped trimming of silence.
  3461. With @var{all}, only if all channels are detected as non-silence will cause
  3462. stopped trimming of silence.
  3463. @item detection
  3464. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3465. and works better with digital silence which is exactly 0.
  3466. Default value is @code{rms}.
  3467. @item window
  3468. Set duration in number of seconds used to calculate size of window in number
  3469. of samples for detecting silence.
  3470. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3471. @end table
  3472. @subsection Examples
  3473. @itemize
  3474. @item
  3475. The following example shows how this filter can be used to start a recording
  3476. that does not contain the delay at the start which usually occurs between
  3477. pressing the record button and the start of the performance:
  3478. @example
  3479. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3480. @end example
  3481. @item
  3482. Trim all silence encountered from beginning to end where there is more than 1
  3483. second of silence in audio:
  3484. @example
  3485. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3486. @end example
  3487. @end itemize
  3488. @section sofalizer
  3489. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3490. loudspeakers around the user for binaural listening via headphones (audio
  3491. formats up to 9 channels supported).
  3492. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3493. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3494. Austrian Academy of Sciences.
  3495. To enable compilation of this filter you need to configure FFmpeg with
  3496. @code{--enable-libmysofa}.
  3497. The filter accepts the following options:
  3498. @table @option
  3499. @item sofa
  3500. Set the SOFA file used for rendering.
  3501. @item gain
  3502. Set gain applied to audio. Value is in dB. Default is 0.
  3503. @item rotation
  3504. Set rotation of virtual loudspeakers in deg. Default is 0.
  3505. @item elevation
  3506. Set elevation of virtual speakers in deg. Default is 0.
  3507. @item radius
  3508. Set distance in meters between loudspeakers and the listener with near-field
  3509. HRTFs. Default is 1.
  3510. @item type
  3511. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3512. processing audio in time domain which is slow.
  3513. @var{freq} is processing audio in frequency domain which is fast.
  3514. Default is @var{freq}.
  3515. @item speakers
  3516. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3517. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3518. Each virtual loudspeaker is described with short channel name following with
  3519. azimuth and elevation in degrees.
  3520. Each virtual loudspeaker description is separated by '|'.
  3521. For example to override front left and front right channel positions use:
  3522. 'speakers=FL 45 15|FR 345 15'.
  3523. Descriptions with unrecognised channel names are ignored.
  3524. @item lfegain
  3525. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3526. @item framesize
  3527. Set custom frame size in number of samples. Default is 1024.
  3528. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3529. is set to @var{freq}.
  3530. @item normalize
  3531. Should all IRs be normalized upon importing SOFA file.
  3532. By default is enabled.
  3533. @item interpolate
  3534. Should nearest IRs be interpolated with neighbor IRs if exact position
  3535. does not match. By default is disabled.
  3536. @item minphase
  3537. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3538. @item anglestep
  3539. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3540. @item radstep
  3541. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3542. @end table
  3543. @subsection Examples
  3544. @itemize
  3545. @item
  3546. Using ClubFritz6 sofa file:
  3547. @example
  3548. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3549. @end example
  3550. @item
  3551. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3552. @example
  3553. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3554. @end example
  3555. @item
  3556. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3557. and also with custom gain:
  3558. @example
  3559. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3560. @end example
  3561. @end itemize
  3562. @section stereotools
  3563. This filter has some handy utilities to manage stereo signals, for converting
  3564. M/S stereo recordings to L/R signal while having control over the parameters
  3565. or spreading the stereo image of master track.
  3566. The filter accepts the following options:
  3567. @table @option
  3568. @item level_in
  3569. Set input level before filtering for both channels. Defaults is 1.
  3570. Allowed range is from 0.015625 to 64.
  3571. @item level_out
  3572. Set output level after filtering for both channels. Defaults is 1.
  3573. Allowed range is from 0.015625 to 64.
  3574. @item balance_in
  3575. Set input balance between both channels. Default is 0.
  3576. Allowed range is from -1 to 1.
  3577. @item balance_out
  3578. Set output balance between both channels. Default is 0.
  3579. Allowed range is from -1 to 1.
  3580. @item softclip
  3581. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3582. clipping. Disabled by default.
  3583. @item mutel
  3584. Mute the left channel. Disabled by default.
  3585. @item muter
  3586. Mute the right channel. Disabled by default.
  3587. @item phasel
  3588. Change the phase of the left channel. Disabled by default.
  3589. @item phaser
  3590. Change the phase of the right channel. Disabled by default.
  3591. @item mode
  3592. Set stereo mode. Available values are:
  3593. @table @samp
  3594. @item lr>lr
  3595. Left/Right to Left/Right, this is default.
  3596. @item lr>ms
  3597. Left/Right to Mid/Side.
  3598. @item ms>lr
  3599. Mid/Side to Left/Right.
  3600. @item lr>ll
  3601. Left/Right to Left/Left.
  3602. @item lr>rr
  3603. Left/Right to Right/Right.
  3604. @item lr>l+r
  3605. Left/Right to Left + Right.
  3606. @item lr>rl
  3607. Left/Right to Right/Left.
  3608. @item ms>ll
  3609. Mid/Side to Left/Left.
  3610. @item ms>rr
  3611. Mid/Side to Right/Right.
  3612. @end table
  3613. @item slev
  3614. Set level of side signal. Default is 1.
  3615. Allowed range is from 0.015625 to 64.
  3616. @item sbal
  3617. Set balance of side signal. Default is 0.
  3618. Allowed range is from -1 to 1.
  3619. @item mlev
  3620. Set level of the middle signal. Default is 1.
  3621. Allowed range is from 0.015625 to 64.
  3622. @item mpan
  3623. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3624. @item base
  3625. Set stereo base between mono and inversed channels. Default is 0.
  3626. Allowed range is from -1 to 1.
  3627. @item delay
  3628. Set delay in milliseconds how much to delay left from right channel and
  3629. vice versa. Default is 0. Allowed range is from -20 to 20.
  3630. @item sclevel
  3631. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3632. @item phase
  3633. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3634. @item bmode_in, bmode_out
  3635. Set balance mode for balance_in/balance_out option.
  3636. Can be one of the following:
  3637. @table @samp
  3638. @item balance
  3639. Classic balance mode. Attenuate one channel at time.
  3640. Gain is raised up to 1.
  3641. @item amplitude
  3642. Similar as classic mode above but gain is raised up to 2.
  3643. @item power
  3644. Equal power distribution, from -6dB to +6dB range.
  3645. @end table
  3646. @end table
  3647. @subsection Examples
  3648. @itemize
  3649. @item
  3650. Apply karaoke like effect:
  3651. @example
  3652. stereotools=mlev=0.015625
  3653. @end example
  3654. @item
  3655. Convert M/S signal to L/R:
  3656. @example
  3657. "stereotools=mode=ms>lr"
  3658. @end example
  3659. @end itemize
  3660. @section stereowiden
  3661. This filter enhance the stereo effect by suppressing signal common to both
  3662. channels and by delaying the signal of left into right and vice versa,
  3663. thereby widening the stereo effect.
  3664. The filter accepts the following options:
  3665. @table @option
  3666. @item delay
  3667. Time in milliseconds of the delay of left signal into right and vice versa.
  3668. Default is 20 milliseconds.
  3669. @item feedback
  3670. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3671. effect of left signal in right output and vice versa which gives widening
  3672. effect. Default is 0.3.
  3673. @item crossfeed
  3674. Cross feed of left into right with inverted phase. This helps in suppressing
  3675. the mono. If the value is 1 it will cancel all the signal common to both
  3676. channels. Default is 0.3.
  3677. @item drymix
  3678. Set level of input signal of original channel. Default is 0.8.
  3679. @end table
  3680. @section superequalizer
  3681. Apply 18 band equalizer.
  3682. The filter accepts the following options:
  3683. @table @option
  3684. @item 1b
  3685. Set 65Hz band gain.
  3686. @item 2b
  3687. Set 92Hz band gain.
  3688. @item 3b
  3689. Set 131Hz band gain.
  3690. @item 4b
  3691. Set 185Hz band gain.
  3692. @item 5b
  3693. Set 262Hz band gain.
  3694. @item 6b
  3695. Set 370Hz band gain.
  3696. @item 7b
  3697. Set 523Hz band gain.
  3698. @item 8b
  3699. Set 740Hz band gain.
  3700. @item 9b
  3701. Set 1047Hz band gain.
  3702. @item 10b
  3703. Set 1480Hz band gain.
  3704. @item 11b
  3705. Set 2093Hz band gain.
  3706. @item 12b
  3707. Set 2960Hz band gain.
  3708. @item 13b
  3709. Set 4186Hz band gain.
  3710. @item 14b
  3711. Set 5920Hz band gain.
  3712. @item 15b
  3713. Set 8372Hz band gain.
  3714. @item 16b
  3715. Set 11840Hz band gain.
  3716. @item 17b
  3717. Set 16744Hz band gain.
  3718. @item 18b
  3719. Set 20000Hz band gain.
  3720. @end table
  3721. @section surround
  3722. Apply audio surround upmix filter.
  3723. This filter allows to produce multichannel output from audio stream.
  3724. The filter accepts the following options:
  3725. @table @option
  3726. @item chl_out
  3727. Set output channel layout. By default, this is @var{5.1}.
  3728. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3729. for the required syntax.
  3730. @item chl_in
  3731. Set input channel layout. By default, this is @var{stereo}.
  3732. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3733. for the required syntax.
  3734. @item level_in
  3735. Set input volume level. By default, this is @var{1}.
  3736. @item level_out
  3737. Set output volume level. By default, this is @var{1}.
  3738. @item lfe
  3739. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3740. @item lfe_low
  3741. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3742. @item lfe_high
  3743. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3744. @item fc_in
  3745. Set front center input volume. By default, this is @var{1}.
  3746. @item fc_out
  3747. Set front center output volume. By default, this is @var{1}.
  3748. @item lfe_in
  3749. Set LFE input volume. By default, this is @var{1}.
  3750. @item lfe_out
  3751. Set LFE output volume. By default, this is @var{1}.
  3752. @end table
  3753. @section treble, highshelf
  3754. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3755. shelving filter with a response similar to that of a standard
  3756. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3757. The filter accepts the following options:
  3758. @table @option
  3759. @item gain, g
  3760. Give the gain at whichever is the lower of ~22 kHz and the
  3761. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3762. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3763. @item frequency, f
  3764. Set the filter's central frequency and so can be used
  3765. to extend or reduce the frequency range to be boosted or cut.
  3766. The default value is @code{3000} Hz.
  3767. @item width_type, t
  3768. Set method to specify band-width of filter.
  3769. @table @option
  3770. @item h
  3771. Hz
  3772. @item q
  3773. Q-Factor
  3774. @item o
  3775. octave
  3776. @item s
  3777. slope
  3778. @item k
  3779. kHz
  3780. @end table
  3781. @item width, w
  3782. Determine how steep is the filter's shelf transition.
  3783. @item channels, c
  3784. Specify which channels to filter, by default all available are filtered.
  3785. @end table
  3786. @subsection Commands
  3787. This filter supports the following commands:
  3788. @table @option
  3789. @item frequency, f
  3790. Change treble frequency.
  3791. Syntax for the command is : "@var{frequency}"
  3792. @item width_type, t
  3793. Change treble width_type.
  3794. Syntax for the command is : "@var{width_type}"
  3795. @item width, w
  3796. Change treble width.
  3797. Syntax for the command is : "@var{width}"
  3798. @item gain, g
  3799. Change treble gain.
  3800. Syntax for the command is : "@var{gain}"
  3801. @end table
  3802. @section tremolo
  3803. Sinusoidal amplitude modulation.
  3804. The filter accepts the following options:
  3805. @table @option
  3806. @item f
  3807. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3808. (20 Hz or lower) will result in a tremolo effect.
  3809. This filter may also be used as a ring modulator by specifying
  3810. a modulation frequency higher than 20 Hz.
  3811. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3812. @item d
  3813. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3814. Default value is 0.5.
  3815. @end table
  3816. @section vibrato
  3817. Sinusoidal phase modulation.
  3818. The filter accepts the following options:
  3819. @table @option
  3820. @item f
  3821. Modulation frequency in Hertz.
  3822. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3823. @item d
  3824. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3825. Default value is 0.5.
  3826. @end table
  3827. @section volume
  3828. Adjust the input audio volume.
  3829. It accepts the following parameters:
  3830. @table @option
  3831. @item volume
  3832. Set audio volume expression.
  3833. Output values are clipped to the maximum value.
  3834. The output audio volume is given by the relation:
  3835. @example
  3836. @var{output_volume} = @var{volume} * @var{input_volume}
  3837. @end example
  3838. The default value for @var{volume} is "1.0".
  3839. @item precision
  3840. This parameter represents the mathematical precision.
  3841. It determines which input sample formats will be allowed, which affects the
  3842. precision of the volume scaling.
  3843. @table @option
  3844. @item fixed
  3845. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3846. @item float
  3847. 32-bit floating-point; this limits input sample format to FLT. (default)
  3848. @item double
  3849. 64-bit floating-point; this limits input sample format to DBL.
  3850. @end table
  3851. @item replaygain
  3852. Choose the behaviour on encountering ReplayGain side data in input frames.
  3853. @table @option
  3854. @item drop
  3855. Remove ReplayGain side data, ignoring its contents (the default).
  3856. @item ignore
  3857. Ignore ReplayGain side data, but leave it in the frame.
  3858. @item track
  3859. Prefer the track gain, if present.
  3860. @item album
  3861. Prefer the album gain, if present.
  3862. @end table
  3863. @item replaygain_preamp
  3864. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3865. Default value for @var{replaygain_preamp} is 0.0.
  3866. @item eval
  3867. Set when the volume expression is evaluated.
  3868. It accepts the following values:
  3869. @table @samp
  3870. @item once
  3871. only evaluate expression once during the filter initialization, or
  3872. when the @samp{volume} command is sent
  3873. @item frame
  3874. evaluate expression for each incoming frame
  3875. @end table
  3876. Default value is @samp{once}.
  3877. @end table
  3878. The volume expression can contain the following parameters.
  3879. @table @option
  3880. @item n
  3881. frame number (starting at zero)
  3882. @item nb_channels
  3883. number of channels
  3884. @item nb_consumed_samples
  3885. number of samples consumed by the filter
  3886. @item nb_samples
  3887. number of samples in the current frame
  3888. @item pos
  3889. original frame position in the file
  3890. @item pts
  3891. frame PTS
  3892. @item sample_rate
  3893. sample rate
  3894. @item startpts
  3895. PTS at start of stream
  3896. @item startt
  3897. time at start of stream
  3898. @item t
  3899. frame time
  3900. @item tb
  3901. timestamp timebase
  3902. @item volume
  3903. last set volume value
  3904. @end table
  3905. Note that when @option{eval} is set to @samp{once} only the
  3906. @var{sample_rate} and @var{tb} variables are available, all other
  3907. variables will evaluate to NAN.
  3908. @subsection Commands
  3909. This filter supports the following commands:
  3910. @table @option
  3911. @item volume
  3912. Modify the volume expression.
  3913. The command accepts the same syntax of the corresponding option.
  3914. If the specified expression is not valid, it is kept at its current
  3915. value.
  3916. @item replaygain_noclip
  3917. Prevent clipping by limiting the gain applied.
  3918. Default value for @var{replaygain_noclip} is 1.
  3919. @end table
  3920. @subsection Examples
  3921. @itemize
  3922. @item
  3923. Halve the input audio volume:
  3924. @example
  3925. volume=volume=0.5
  3926. volume=volume=1/2
  3927. volume=volume=-6.0206dB
  3928. @end example
  3929. In all the above example the named key for @option{volume} can be
  3930. omitted, for example like in:
  3931. @example
  3932. volume=0.5
  3933. @end example
  3934. @item
  3935. Increase input audio power by 6 decibels using fixed-point precision:
  3936. @example
  3937. volume=volume=6dB:precision=fixed
  3938. @end example
  3939. @item
  3940. Fade volume after time 10 with an annihilation period of 5 seconds:
  3941. @example
  3942. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3943. @end example
  3944. @end itemize
  3945. @section volumedetect
  3946. Detect the volume of the input video.
  3947. The filter has no parameters. The input is not modified. Statistics about
  3948. the volume will be printed in the log when the input stream end is reached.
  3949. In particular it will show the mean volume (root mean square), maximum
  3950. volume (on a per-sample basis), and the beginning of a histogram of the
  3951. registered volume values (from the maximum value to a cumulated 1/1000 of
  3952. the samples).
  3953. All volumes are in decibels relative to the maximum PCM value.
  3954. @subsection Examples
  3955. Here is an excerpt of the output:
  3956. @example
  3957. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3958. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3959. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3960. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3961. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3962. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3963. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3964. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3965. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3966. @end example
  3967. It means that:
  3968. @itemize
  3969. @item
  3970. The mean square energy is approximately -27 dB, or 10^-2.7.
  3971. @item
  3972. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3973. @item
  3974. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3975. @end itemize
  3976. In other words, raising the volume by +4 dB does not cause any clipping,
  3977. raising it by +5 dB causes clipping for 6 samples, etc.
  3978. @c man end AUDIO FILTERS
  3979. @chapter Audio Sources
  3980. @c man begin AUDIO SOURCES
  3981. Below is a description of the currently available audio sources.
  3982. @section abuffer
  3983. Buffer audio frames, and make them available to the filter chain.
  3984. This source is mainly intended for a programmatic use, in particular
  3985. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3986. It accepts the following parameters:
  3987. @table @option
  3988. @item time_base
  3989. The timebase which will be used for timestamps of submitted frames. It must be
  3990. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3991. @item sample_rate
  3992. The sample rate of the incoming audio buffers.
  3993. @item sample_fmt
  3994. The sample format of the incoming audio buffers.
  3995. Either a sample format name or its corresponding integer representation from
  3996. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3997. @item channel_layout
  3998. The channel layout of the incoming audio buffers.
  3999. Either a channel layout name from channel_layout_map in
  4000. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4001. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4002. @item channels
  4003. The number of channels of the incoming audio buffers.
  4004. If both @var{channels} and @var{channel_layout} are specified, then they
  4005. must be consistent.
  4006. @end table
  4007. @subsection Examples
  4008. @example
  4009. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4010. @end example
  4011. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4012. Since the sample format with name "s16p" corresponds to the number
  4013. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4014. equivalent to:
  4015. @example
  4016. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4017. @end example
  4018. @section aevalsrc
  4019. Generate an audio signal specified by an expression.
  4020. This source accepts in input one or more expressions (one for each
  4021. channel), which are evaluated and used to generate a corresponding
  4022. audio signal.
  4023. This source accepts the following options:
  4024. @table @option
  4025. @item exprs
  4026. Set the '|'-separated expressions list for each separate channel. In case the
  4027. @option{channel_layout} option is not specified, the selected channel layout
  4028. depends on the number of provided expressions. Otherwise the last
  4029. specified expression is applied to the remaining output channels.
  4030. @item channel_layout, c
  4031. Set the channel layout. The number of channels in the specified layout
  4032. must be equal to the number of specified expressions.
  4033. @item duration, d
  4034. Set the minimum duration of the sourced audio. See
  4035. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4036. for the accepted syntax.
  4037. Note that the resulting duration may be greater than the specified
  4038. duration, as the generated audio is always cut at the end of a
  4039. complete frame.
  4040. If not specified, or the expressed duration is negative, the audio is
  4041. supposed to be generated forever.
  4042. @item nb_samples, n
  4043. Set the number of samples per channel per each output frame,
  4044. default to 1024.
  4045. @item sample_rate, s
  4046. Specify the sample rate, default to 44100.
  4047. @end table
  4048. Each expression in @var{exprs} can contain the following constants:
  4049. @table @option
  4050. @item n
  4051. number of the evaluated sample, starting from 0
  4052. @item t
  4053. time of the evaluated sample expressed in seconds, starting from 0
  4054. @item s
  4055. sample rate
  4056. @end table
  4057. @subsection Examples
  4058. @itemize
  4059. @item
  4060. Generate silence:
  4061. @example
  4062. aevalsrc=0
  4063. @end example
  4064. @item
  4065. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4066. 8000 Hz:
  4067. @example
  4068. aevalsrc="sin(440*2*PI*t):s=8000"
  4069. @end example
  4070. @item
  4071. Generate a two channels signal, specify the channel layout (Front
  4072. Center + Back Center) explicitly:
  4073. @example
  4074. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4075. @end example
  4076. @item
  4077. Generate white noise:
  4078. @example
  4079. aevalsrc="-2+random(0)"
  4080. @end example
  4081. @item
  4082. Generate an amplitude modulated signal:
  4083. @example
  4084. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4085. @end example
  4086. @item
  4087. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4088. @example
  4089. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4090. @end example
  4091. @end itemize
  4092. @section anullsrc
  4093. The null audio source, return unprocessed audio frames. It is mainly useful
  4094. as a template and to be employed in analysis / debugging tools, or as
  4095. the source for filters which ignore the input data (for example the sox
  4096. synth filter).
  4097. This source accepts the following options:
  4098. @table @option
  4099. @item channel_layout, cl
  4100. Specifies the channel layout, and can be either an integer or a string
  4101. representing a channel layout. The default value of @var{channel_layout}
  4102. is "stereo".
  4103. Check the channel_layout_map definition in
  4104. @file{libavutil/channel_layout.c} for the mapping between strings and
  4105. channel layout values.
  4106. @item sample_rate, r
  4107. Specifies the sample rate, and defaults to 44100.
  4108. @item nb_samples, n
  4109. Set the number of samples per requested frames.
  4110. @end table
  4111. @subsection Examples
  4112. @itemize
  4113. @item
  4114. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4115. @example
  4116. anullsrc=r=48000:cl=4
  4117. @end example
  4118. @item
  4119. Do the same operation with a more obvious syntax:
  4120. @example
  4121. anullsrc=r=48000:cl=mono
  4122. @end example
  4123. @end itemize
  4124. All the parameters need to be explicitly defined.
  4125. @section flite
  4126. Synthesize a voice utterance using the libflite library.
  4127. To enable compilation of this filter you need to configure FFmpeg with
  4128. @code{--enable-libflite}.
  4129. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4130. The filter accepts the following options:
  4131. @table @option
  4132. @item list_voices
  4133. If set to 1, list the names of the available voices and exit
  4134. immediately. Default value is 0.
  4135. @item nb_samples, n
  4136. Set the maximum number of samples per frame. Default value is 512.
  4137. @item textfile
  4138. Set the filename containing the text to speak.
  4139. @item text
  4140. Set the text to speak.
  4141. @item voice, v
  4142. Set the voice to use for the speech synthesis. Default value is
  4143. @code{kal}. See also the @var{list_voices} option.
  4144. @end table
  4145. @subsection Examples
  4146. @itemize
  4147. @item
  4148. Read from file @file{speech.txt}, and synthesize the text using the
  4149. standard flite voice:
  4150. @example
  4151. flite=textfile=speech.txt
  4152. @end example
  4153. @item
  4154. Read the specified text selecting the @code{slt} voice:
  4155. @example
  4156. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4157. @end example
  4158. @item
  4159. Input text to ffmpeg:
  4160. @example
  4161. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4162. @end example
  4163. @item
  4164. Make @file{ffplay} speak the specified text, using @code{flite} and
  4165. the @code{lavfi} device:
  4166. @example
  4167. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4168. @end example
  4169. @end itemize
  4170. For more information about libflite, check:
  4171. @url{http://www.festvox.org/flite/}
  4172. @section anoisesrc
  4173. Generate a noise audio signal.
  4174. The filter accepts the following options:
  4175. @table @option
  4176. @item sample_rate, r
  4177. Specify the sample rate. Default value is 48000 Hz.
  4178. @item amplitude, a
  4179. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4180. is 1.0.
  4181. @item duration, d
  4182. Specify the duration of the generated audio stream. Not specifying this option
  4183. results in noise with an infinite length.
  4184. @item color, colour, c
  4185. Specify the color of noise. Available noise colors are white, pink, brown,
  4186. blue and violet. Default color is white.
  4187. @item seed, s
  4188. Specify a value used to seed the PRNG.
  4189. @item nb_samples, n
  4190. Set the number of samples per each output frame, default is 1024.
  4191. @end table
  4192. @subsection Examples
  4193. @itemize
  4194. @item
  4195. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4196. @example
  4197. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4198. @end example
  4199. @end itemize
  4200. @section hilbert
  4201. Generate odd-tap Hilbert transform FIR coefficients.
  4202. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4203. the signal by 90 degrees.
  4204. This is used in many matrix coding schemes and for analytic signal generation.
  4205. The process is often written as a multiplication by i (or j), the imaginary unit.
  4206. The filter accepts the following options:
  4207. @table @option
  4208. @item sample_rate, s
  4209. Set sample rate, default is 44100.
  4210. @item taps, t
  4211. Set length of FIR filter, default is 22051.
  4212. @item nb_samples, n
  4213. Set number of samples per each frame.
  4214. @item win_func, w
  4215. Set window function to be used when generating FIR coefficients.
  4216. @end table
  4217. @section sinc
  4218. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4219. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4220. The filter accepts the following options:
  4221. @table @option
  4222. @item sample_rate, r
  4223. Set sample rate, default is 44100.
  4224. @item nb_samples, n
  4225. Set number of samples per each frame. Default is 1024.
  4226. @item hp
  4227. Set high-pass frequency. Default is 0.
  4228. @item lp
  4229. Set low-pass frequency. Default is 0.
  4230. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4231. is higher than 0 then filter will create band-pass filter coefficients,
  4232. otherwise band-reject filter coefficients.
  4233. @item phase
  4234. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4235. @item beta
  4236. Set Kaiser window beta.
  4237. @item att
  4238. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4239. @item round
  4240. Enable rounding, by default is disabled.
  4241. @item hptaps
  4242. Set number of taps for high-pass filter.
  4243. @item lptaps
  4244. Set number of taps for low-pass filter.
  4245. @end table
  4246. @section sine
  4247. Generate an audio signal made of a sine wave with amplitude 1/8.
  4248. The audio signal is bit-exact.
  4249. The filter accepts the following options:
  4250. @table @option
  4251. @item frequency, f
  4252. Set the carrier frequency. Default is 440 Hz.
  4253. @item beep_factor, b
  4254. Enable a periodic beep every second with frequency @var{beep_factor} times
  4255. the carrier frequency. Default is 0, meaning the beep is disabled.
  4256. @item sample_rate, r
  4257. Specify the sample rate, default is 44100.
  4258. @item duration, d
  4259. Specify the duration of the generated audio stream.
  4260. @item samples_per_frame
  4261. Set the number of samples per output frame.
  4262. The expression can contain the following constants:
  4263. @table @option
  4264. @item n
  4265. The (sequential) number of the output audio frame, starting from 0.
  4266. @item pts
  4267. The PTS (Presentation TimeStamp) of the output audio frame,
  4268. expressed in @var{TB} units.
  4269. @item t
  4270. The PTS of the output audio frame, expressed in seconds.
  4271. @item TB
  4272. The timebase of the output audio frames.
  4273. @end table
  4274. Default is @code{1024}.
  4275. @end table
  4276. @subsection Examples
  4277. @itemize
  4278. @item
  4279. Generate a simple 440 Hz sine wave:
  4280. @example
  4281. sine
  4282. @end example
  4283. @item
  4284. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4285. @example
  4286. sine=220:4:d=5
  4287. sine=f=220:b=4:d=5
  4288. sine=frequency=220:beep_factor=4:duration=5
  4289. @end example
  4290. @item
  4291. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4292. pattern:
  4293. @example
  4294. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4295. @end example
  4296. @end itemize
  4297. @c man end AUDIO SOURCES
  4298. @chapter Audio Sinks
  4299. @c man begin AUDIO SINKS
  4300. Below is a description of the currently available audio sinks.
  4301. @section abuffersink
  4302. Buffer audio frames, and make them available to the end of filter chain.
  4303. This sink is mainly intended for programmatic use, in particular
  4304. through the interface defined in @file{libavfilter/buffersink.h}
  4305. or the options system.
  4306. It accepts a pointer to an AVABufferSinkContext structure, which
  4307. defines the incoming buffers' formats, to be passed as the opaque
  4308. parameter to @code{avfilter_init_filter} for initialization.
  4309. @section anullsink
  4310. Null audio sink; do absolutely nothing with the input audio. It is
  4311. mainly useful as a template and for use in analysis / debugging
  4312. tools.
  4313. @c man end AUDIO SINKS
  4314. @chapter Video Filters
  4315. @c man begin VIDEO FILTERS
  4316. When you configure your FFmpeg build, you can disable any of the
  4317. existing filters using @code{--disable-filters}.
  4318. The configure output will show the video filters included in your
  4319. build.
  4320. Below is a description of the currently available video filters.
  4321. @section alphaextract
  4322. Extract the alpha component from the input as a grayscale video. This
  4323. is especially useful with the @var{alphamerge} filter.
  4324. @section alphamerge
  4325. Add or replace the alpha component of the primary input with the
  4326. grayscale value of a second input. This is intended for use with
  4327. @var{alphaextract} to allow the transmission or storage of frame
  4328. sequences that have alpha in a format that doesn't support an alpha
  4329. channel.
  4330. For example, to reconstruct full frames from a normal YUV-encoded video
  4331. and a separate video created with @var{alphaextract}, you might use:
  4332. @example
  4333. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4334. @end example
  4335. Since this filter is designed for reconstruction, it operates on frame
  4336. sequences without considering timestamps, and terminates when either
  4337. input reaches end of stream. This will cause problems if your encoding
  4338. pipeline drops frames. If you're trying to apply an image as an
  4339. overlay to a video stream, consider the @var{overlay} filter instead.
  4340. @section amplify
  4341. Amplify differences between current pixel and pixels of adjacent frames in
  4342. same pixel location.
  4343. This filter accepts the following options:
  4344. @table @option
  4345. @item radius
  4346. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4347. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4348. @item factor
  4349. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4350. @item threshold
  4351. Set threshold for difference amplification. Any differrence greater or equal to
  4352. this value will not alter source pixel. Default is 10.
  4353. Allowed range is from 0 to 65535.
  4354. @item low
  4355. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4356. This option controls maximum possible value that will decrease source pixel value.
  4357. @item high
  4358. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4359. This option controls maximum possible value that will increase source pixel value.
  4360. @item planes
  4361. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4362. @end table
  4363. @section ass
  4364. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4365. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4366. Substation Alpha) subtitles files.
  4367. This filter accepts the following option in addition to the common options from
  4368. the @ref{subtitles} filter:
  4369. @table @option
  4370. @item shaping
  4371. Set the shaping engine
  4372. Available values are:
  4373. @table @samp
  4374. @item auto
  4375. The default libass shaping engine, which is the best available.
  4376. @item simple
  4377. Fast, font-agnostic shaper that can do only substitutions
  4378. @item complex
  4379. Slower shaper using OpenType for substitutions and positioning
  4380. @end table
  4381. The default is @code{auto}.
  4382. @end table
  4383. @section atadenoise
  4384. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4385. The filter accepts the following options:
  4386. @table @option
  4387. @item 0a
  4388. Set threshold A for 1st plane. Default is 0.02.
  4389. Valid range is 0 to 0.3.
  4390. @item 0b
  4391. Set threshold B for 1st plane. Default is 0.04.
  4392. Valid range is 0 to 5.
  4393. @item 1a
  4394. Set threshold A for 2nd plane. Default is 0.02.
  4395. Valid range is 0 to 0.3.
  4396. @item 1b
  4397. Set threshold B for 2nd plane. Default is 0.04.
  4398. Valid range is 0 to 5.
  4399. @item 2a
  4400. Set threshold A for 3rd plane. Default is 0.02.
  4401. Valid range is 0 to 0.3.
  4402. @item 2b
  4403. Set threshold B for 3rd plane. Default is 0.04.
  4404. Valid range is 0 to 5.
  4405. Threshold A is designed to react on abrupt changes in the input signal and
  4406. threshold B is designed to react on continuous changes in the input signal.
  4407. @item s
  4408. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4409. number in range [5, 129].
  4410. @item p
  4411. Set what planes of frame filter will use for averaging. Default is all.
  4412. @end table
  4413. @section avgblur
  4414. Apply average blur filter.
  4415. The filter accepts the following options:
  4416. @table @option
  4417. @item sizeX
  4418. Set horizontal radius size.
  4419. @item planes
  4420. Set which planes to filter. By default all planes are filtered.
  4421. @item sizeY
  4422. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4423. Default is @code{0}.
  4424. @end table
  4425. @section bbox
  4426. Compute the bounding box for the non-black pixels in the input frame
  4427. luminance plane.
  4428. This filter computes the bounding box containing all the pixels with a
  4429. luminance value greater than the minimum allowed value.
  4430. The parameters describing the bounding box are printed on the filter
  4431. log.
  4432. The filter accepts the following option:
  4433. @table @option
  4434. @item min_val
  4435. Set the minimal luminance value. Default is @code{16}.
  4436. @end table
  4437. @section bitplanenoise
  4438. Show and measure bit plane noise.
  4439. The filter accepts the following options:
  4440. @table @option
  4441. @item bitplane
  4442. Set which plane to analyze. Default is @code{1}.
  4443. @item filter
  4444. Filter out noisy pixels from @code{bitplane} set above.
  4445. Default is disabled.
  4446. @end table
  4447. @section blackdetect
  4448. Detect video intervals that are (almost) completely black. Can be
  4449. useful to detect chapter transitions, commercials, or invalid
  4450. recordings. Output lines contains the time for the start, end and
  4451. duration of the detected black interval expressed in seconds.
  4452. In order to display the output lines, you need to set the loglevel at
  4453. least to the AV_LOG_INFO value.
  4454. The filter accepts the following options:
  4455. @table @option
  4456. @item black_min_duration, d
  4457. Set the minimum detected black duration expressed in seconds. It must
  4458. be a non-negative floating point number.
  4459. Default value is 2.0.
  4460. @item picture_black_ratio_th, pic_th
  4461. Set the threshold for considering a picture "black".
  4462. Express the minimum value for the ratio:
  4463. @example
  4464. @var{nb_black_pixels} / @var{nb_pixels}
  4465. @end example
  4466. for which a picture is considered black.
  4467. Default value is 0.98.
  4468. @item pixel_black_th, pix_th
  4469. Set the threshold for considering a pixel "black".
  4470. The threshold expresses the maximum pixel luminance value for which a
  4471. pixel is considered "black". The provided value is scaled according to
  4472. the following equation:
  4473. @example
  4474. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4475. @end example
  4476. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4477. the input video format, the range is [0-255] for YUV full-range
  4478. formats and [16-235] for YUV non full-range formats.
  4479. Default value is 0.10.
  4480. @end table
  4481. The following example sets the maximum pixel threshold to the minimum
  4482. value, and detects only black intervals of 2 or more seconds:
  4483. @example
  4484. blackdetect=d=2:pix_th=0.00
  4485. @end example
  4486. @section blackframe
  4487. Detect frames that are (almost) completely black. Can be useful to
  4488. detect chapter transitions or commercials. Output lines consist of
  4489. the frame number of the detected frame, the percentage of blackness,
  4490. the position in the file if known or -1 and the timestamp in seconds.
  4491. In order to display the output lines, you need to set the loglevel at
  4492. least to the AV_LOG_INFO value.
  4493. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4494. The value represents the percentage of pixels in the picture that
  4495. are below the threshold value.
  4496. It accepts the following parameters:
  4497. @table @option
  4498. @item amount
  4499. The percentage of the pixels that have to be below the threshold; it defaults to
  4500. @code{98}.
  4501. @item threshold, thresh
  4502. The threshold below which a pixel value is considered black; it defaults to
  4503. @code{32}.
  4504. @end table
  4505. @section blend, tblend
  4506. Blend two video frames into each other.
  4507. The @code{blend} filter takes two input streams and outputs one
  4508. stream, the first input is the "top" layer and second input is
  4509. "bottom" layer. By default, the output terminates when the longest input terminates.
  4510. The @code{tblend} (time blend) filter takes two consecutive frames
  4511. from one single stream, and outputs the result obtained by blending
  4512. the new frame on top of the old frame.
  4513. A description of the accepted options follows.
  4514. @table @option
  4515. @item c0_mode
  4516. @item c1_mode
  4517. @item c2_mode
  4518. @item c3_mode
  4519. @item all_mode
  4520. Set blend mode for specific pixel component or all pixel components in case
  4521. of @var{all_mode}. Default value is @code{normal}.
  4522. Available values for component modes are:
  4523. @table @samp
  4524. @item addition
  4525. @item grainmerge
  4526. @item and
  4527. @item average
  4528. @item burn
  4529. @item darken
  4530. @item difference
  4531. @item grainextract
  4532. @item divide
  4533. @item dodge
  4534. @item freeze
  4535. @item exclusion
  4536. @item extremity
  4537. @item glow
  4538. @item hardlight
  4539. @item hardmix
  4540. @item heat
  4541. @item lighten
  4542. @item linearlight
  4543. @item multiply
  4544. @item multiply128
  4545. @item negation
  4546. @item normal
  4547. @item or
  4548. @item overlay
  4549. @item phoenix
  4550. @item pinlight
  4551. @item reflect
  4552. @item screen
  4553. @item softlight
  4554. @item subtract
  4555. @item vividlight
  4556. @item xor
  4557. @end table
  4558. @item c0_opacity
  4559. @item c1_opacity
  4560. @item c2_opacity
  4561. @item c3_opacity
  4562. @item all_opacity
  4563. Set blend opacity for specific pixel component or all pixel components in case
  4564. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4565. @item c0_expr
  4566. @item c1_expr
  4567. @item c2_expr
  4568. @item c3_expr
  4569. @item all_expr
  4570. Set blend expression for specific pixel component or all pixel components in case
  4571. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4572. The expressions can use the following variables:
  4573. @table @option
  4574. @item N
  4575. The sequential number of the filtered frame, starting from @code{0}.
  4576. @item X
  4577. @item Y
  4578. the coordinates of the current sample
  4579. @item W
  4580. @item H
  4581. the width and height of currently filtered plane
  4582. @item SW
  4583. @item SH
  4584. Width and height scale for the plane being filtered. It is the
  4585. ratio between the dimensions of the current plane to the luma plane,
  4586. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4587. the luma plane and @code{0.5,0.5} for the chroma planes.
  4588. @item T
  4589. Time of the current frame, expressed in seconds.
  4590. @item TOP, A
  4591. Value of pixel component at current location for first video frame (top layer).
  4592. @item BOTTOM, B
  4593. Value of pixel component at current location for second video frame (bottom layer).
  4594. @end table
  4595. @end table
  4596. The @code{blend} filter also supports the @ref{framesync} options.
  4597. @subsection Examples
  4598. @itemize
  4599. @item
  4600. Apply transition from bottom layer to top layer in first 10 seconds:
  4601. @example
  4602. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4603. @end example
  4604. @item
  4605. Apply linear horizontal transition from top layer to bottom layer:
  4606. @example
  4607. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4608. @end example
  4609. @item
  4610. Apply 1x1 checkerboard effect:
  4611. @example
  4612. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4613. @end example
  4614. @item
  4615. Apply uncover left effect:
  4616. @example
  4617. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4618. @end example
  4619. @item
  4620. Apply uncover down effect:
  4621. @example
  4622. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4623. @end example
  4624. @item
  4625. Apply uncover up-left effect:
  4626. @example
  4627. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4628. @end example
  4629. @item
  4630. Split diagonally video and shows top and bottom layer on each side:
  4631. @example
  4632. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4633. @end example
  4634. @item
  4635. Display differences between the current and the previous frame:
  4636. @example
  4637. tblend=all_mode=grainextract
  4638. @end example
  4639. @end itemize
  4640. @section bm3d
  4641. Denoise frames using Block-Matching 3D algorithm.
  4642. The filter accepts the following options.
  4643. @table @option
  4644. @item sigma
  4645. Set denoising strength. Default value is 1.
  4646. Allowed range is from 0 to 999.9.
  4647. The denoising algorith is very sensitive to sigma, so adjust it
  4648. according to the source.
  4649. @item block
  4650. Set local patch size. This sets dimensions in 2D.
  4651. @item bstep
  4652. Set sliding step for processing blocks. Default value is 4.
  4653. Allowed range is from 1 to 64.
  4654. Smaller values allows processing more reference blocks and is slower.
  4655. @item group
  4656. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4657. When set to 1, no block matching is done. Larger values allows more blocks
  4658. in single group.
  4659. Allowed range is from 1 to 256.
  4660. @item range
  4661. Set radius for search block matching. Default is 9.
  4662. Allowed range is from 1 to INT32_MAX.
  4663. @item mstep
  4664. Set step between two search locations for block matching. Default is 1.
  4665. Allowed range is from 1 to 64. Smaller is slower.
  4666. @item thmse
  4667. Set threshold of mean square error for block matching. Valid range is 0 to
  4668. INT32_MAX.
  4669. @item hdthr
  4670. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4671. Larger values results in stronger hard-thresholding filtering in frequency
  4672. domain.
  4673. @item estim
  4674. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4675. Default is @code{basic}.
  4676. @item ref
  4677. If enabled, filter will use 2nd stream for block matching.
  4678. Default is disabled for @code{basic} value of @var{estim} option,
  4679. and always enabled if value of @var{estim} is @code{final}.
  4680. @item planes
  4681. Set planes to filter. Default is all available except alpha.
  4682. @end table
  4683. @subsection Examples
  4684. @itemize
  4685. @item
  4686. Basic filtering with bm3d:
  4687. @example
  4688. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4689. @end example
  4690. @item
  4691. Same as above, but filtering only luma:
  4692. @example
  4693. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4694. @end example
  4695. @item
  4696. Same as above, but with both estimation modes:
  4697. @example
  4698. 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
  4699. @end example
  4700. @item
  4701. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4702. @example
  4703. 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
  4704. @end example
  4705. @end itemize
  4706. @section boxblur
  4707. Apply a boxblur algorithm to the input video.
  4708. It accepts the following parameters:
  4709. @table @option
  4710. @item luma_radius, lr
  4711. @item luma_power, lp
  4712. @item chroma_radius, cr
  4713. @item chroma_power, cp
  4714. @item alpha_radius, ar
  4715. @item alpha_power, ap
  4716. @end table
  4717. A description of the accepted options follows.
  4718. @table @option
  4719. @item luma_radius, lr
  4720. @item chroma_radius, cr
  4721. @item alpha_radius, ar
  4722. Set an expression for the box radius in pixels used for blurring the
  4723. corresponding input plane.
  4724. The radius value must be a non-negative number, and must not be
  4725. greater than the value of the expression @code{min(w,h)/2} for the
  4726. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4727. planes.
  4728. Default value for @option{luma_radius} is "2". If not specified,
  4729. @option{chroma_radius} and @option{alpha_radius} default to the
  4730. corresponding value set for @option{luma_radius}.
  4731. The expressions can contain the following constants:
  4732. @table @option
  4733. @item w
  4734. @item h
  4735. The input width and height in pixels.
  4736. @item cw
  4737. @item ch
  4738. The input chroma image width and height in pixels.
  4739. @item hsub
  4740. @item vsub
  4741. The horizontal and vertical chroma subsample values. For example, for the
  4742. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4743. @end table
  4744. @item luma_power, lp
  4745. @item chroma_power, cp
  4746. @item alpha_power, ap
  4747. Specify how many times the boxblur filter is applied to the
  4748. corresponding plane.
  4749. Default value for @option{luma_power} is 2. If not specified,
  4750. @option{chroma_power} and @option{alpha_power} default to the
  4751. corresponding value set for @option{luma_power}.
  4752. A value of 0 will disable the effect.
  4753. @end table
  4754. @subsection Examples
  4755. @itemize
  4756. @item
  4757. Apply a boxblur filter with the luma, chroma, and alpha radii
  4758. set to 2:
  4759. @example
  4760. boxblur=luma_radius=2:luma_power=1
  4761. boxblur=2:1
  4762. @end example
  4763. @item
  4764. Set the luma radius to 2, and alpha and chroma radius to 0:
  4765. @example
  4766. boxblur=2:1:cr=0:ar=0
  4767. @end example
  4768. @item
  4769. Set the luma and chroma radii to a fraction of the video dimension:
  4770. @example
  4771. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4772. @end example
  4773. @end itemize
  4774. @section bwdif
  4775. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4776. Deinterlacing Filter").
  4777. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4778. interpolation algorithms.
  4779. It accepts the following parameters:
  4780. @table @option
  4781. @item mode
  4782. The interlacing mode to adopt. It accepts one of the following values:
  4783. @table @option
  4784. @item 0, send_frame
  4785. Output one frame for each frame.
  4786. @item 1, send_field
  4787. Output one frame for each field.
  4788. @end table
  4789. The default value is @code{send_field}.
  4790. @item parity
  4791. The picture field parity assumed for the input interlaced video. It accepts one
  4792. of the following values:
  4793. @table @option
  4794. @item 0, tff
  4795. Assume the top field is first.
  4796. @item 1, bff
  4797. Assume the bottom field is first.
  4798. @item -1, auto
  4799. Enable automatic detection of field parity.
  4800. @end table
  4801. The default value is @code{auto}.
  4802. If the interlacing is unknown or the decoder does not export this information,
  4803. top field first will be assumed.
  4804. @item deint
  4805. Specify which frames to deinterlace. Accept one of the following
  4806. values:
  4807. @table @option
  4808. @item 0, all
  4809. Deinterlace all frames.
  4810. @item 1, interlaced
  4811. Only deinterlace frames marked as interlaced.
  4812. @end table
  4813. The default value is @code{all}.
  4814. @end table
  4815. @section chromahold
  4816. Remove all color information for all colors except for certain one.
  4817. The filter accepts the following options:
  4818. @table @option
  4819. @item color
  4820. The color which will not be replaced with neutral chroma.
  4821. @item similarity
  4822. Similarity percentage with the above color.
  4823. 0.01 matches only the exact key color, while 1.0 matches everything.
  4824. @item yuv
  4825. Signals that the color passed is already in YUV instead of RGB.
  4826. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4827. This can be used to pass exact YUV values as hexadecimal numbers.
  4828. @end table
  4829. @section chromakey
  4830. YUV colorspace color/chroma keying.
  4831. The filter accepts the following options:
  4832. @table @option
  4833. @item color
  4834. The color which will be replaced with transparency.
  4835. @item similarity
  4836. Similarity percentage with the key color.
  4837. 0.01 matches only the exact key color, while 1.0 matches everything.
  4838. @item blend
  4839. Blend percentage.
  4840. 0.0 makes pixels either fully transparent, or not transparent at all.
  4841. Higher values result in semi-transparent pixels, with a higher transparency
  4842. the more similar the pixels color is to the key color.
  4843. @item yuv
  4844. Signals that the color passed is already in YUV instead of RGB.
  4845. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4846. This can be used to pass exact YUV values as hexadecimal numbers.
  4847. @end table
  4848. @subsection Examples
  4849. @itemize
  4850. @item
  4851. Make every green pixel in the input image transparent:
  4852. @example
  4853. ffmpeg -i input.png -vf chromakey=green out.png
  4854. @end example
  4855. @item
  4856. Overlay a greenscreen-video on top of a static black background.
  4857. @example
  4858. 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
  4859. @end example
  4860. @end itemize
  4861. @section chromashift
  4862. Shift chroma pixels horizontally and/or vertically.
  4863. The filter accepts the following options:
  4864. @table @option
  4865. @item cbh
  4866. Set amount to shift chroma-blue horizontally.
  4867. @item cbv
  4868. Set amount to shift chroma-blue vertically.
  4869. @item crh
  4870. Set amount to shift chroma-red horizontally.
  4871. @item crv
  4872. Set amount to shift chroma-red vertically.
  4873. @item edge
  4874. Set edge mode, can be @var{smear}, default, or @var{warp}.
  4875. @end table
  4876. @section ciescope
  4877. Display CIE color diagram with pixels overlaid onto it.
  4878. The filter accepts the following options:
  4879. @table @option
  4880. @item system
  4881. Set color system.
  4882. @table @samp
  4883. @item ntsc, 470m
  4884. @item ebu, 470bg
  4885. @item smpte
  4886. @item 240m
  4887. @item apple
  4888. @item widergb
  4889. @item cie1931
  4890. @item rec709, hdtv
  4891. @item uhdtv, rec2020
  4892. @end table
  4893. @item cie
  4894. Set CIE system.
  4895. @table @samp
  4896. @item xyy
  4897. @item ucs
  4898. @item luv
  4899. @end table
  4900. @item gamuts
  4901. Set what gamuts to draw.
  4902. See @code{system} option for available values.
  4903. @item size, s
  4904. Set ciescope size, by default set to 512.
  4905. @item intensity, i
  4906. Set intensity used to map input pixel values to CIE diagram.
  4907. @item contrast
  4908. Set contrast used to draw tongue colors that are out of active color system gamut.
  4909. @item corrgamma
  4910. Correct gamma displayed on scope, by default enabled.
  4911. @item showwhite
  4912. Show white point on CIE diagram, by default disabled.
  4913. @item gamma
  4914. Set input gamma. Used only with XYZ input color space.
  4915. @end table
  4916. @section codecview
  4917. Visualize information exported by some codecs.
  4918. Some codecs can export information through frames using side-data or other
  4919. means. For example, some MPEG based codecs export motion vectors through the
  4920. @var{export_mvs} flag in the codec @option{flags2} option.
  4921. The filter accepts the following option:
  4922. @table @option
  4923. @item mv
  4924. Set motion vectors to visualize.
  4925. Available flags for @var{mv} are:
  4926. @table @samp
  4927. @item pf
  4928. forward predicted MVs of P-frames
  4929. @item bf
  4930. forward predicted MVs of B-frames
  4931. @item bb
  4932. backward predicted MVs of B-frames
  4933. @end table
  4934. @item qp
  4935. Display quantization parameters using the chroma planes.
  4936. @item mv_type, mvt
  4937. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4938. Available flags for @var{mv_type} are:
  4939. @table @samp
  4940. @item fp
  4941. forward predicted MVs
  4942. @item bp
  4943. backward predicted MVs
  4944. @end table
  4945. @item frame_type, ft
  4946. Set frame type to visualize motion vectors of.
  4947. Available flags for @var{frame_type} are:
  4948. @table @samp
  4949. @item if
  4950. intra-coded frames (I-frames)
  4951. @item pf
  4952. predicted frames (P-frames)
  4953. @item bf
  4954. bi-directionally predicted frames (B-frames)
  4955. @end table
  4956. @end table
  4957. @subsection Examples
  4958. @itemize
  4959. @item
  4960. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4961. @example
  4962. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4963. @end example
  4964. @item
  4965. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4966. @example
  4967. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4968. @end example
  4969. @end itemize
  4970. @section colorbalance
  4971. Modify intensity of primary colors (red, green and blue) of input frames.
  4972. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4973. regions for the red-cyan, green-magenta or blue-yellow balance.
  4974. A positive adjustment value shifts the balance towards the primary color, a negative
  4975. value towards the complementary color.
  4976. The filter accepts the following options:
  4977. @table @option
  4978. @item rs
  4979. @item gs
  4980. @item bs
  4981. Adjust red, green and blue shadows (darkest pixels).
  4982. @item rm
  4983. @item gm
  4984. @item bm
  4985. Adjust red, green and blue midtones (medium pixels).
  4986. @item rh
  4987. @item gh
  4988. @item bh
  4989. Adjust red, green and blue highlights (brightest pixels).
  4990. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4991. @end table
  4992. @subsection Examples
  4993. @itemize
  4994. @item
  4995. Add red color cast to shadows:
  4996. @example
  4997. colorbalance=rs=.3
  4998. @end example
  4999. @end itemize
  5000. @section colorkey
  5001. RGB colorspace color keying.
  5002. The filter accepts the following options:
  5003. @table @option
  5004. @item color
  5005. The color which will be replaced with transparency.
  5006. @item similarity
  5007. Similarity percentage with the key color.
  5008. 0.01 matches only the exact key color, while 1.0 matches everything.
  5009. @item blend
  5010. Blend percentage.
  5011. 0.0 makes pixels either fully transparent, or not transparent at all.
  5012. Higher values result in semi-transparent pixels, with a higher transparency
  5013. the more similar the pixels color is to the key color.
  5014. @end table
  5015. @subsection Examples
  5016. @itemize
  5017. @item
  5018. Make every green pixel in the input image transparent:
  5019. @example
  5020. ffmpeg -i input.png -vf colorkey=green out.png
  5021. @end example
  5022. @item
  5023. Overlay a greenscreen-video on top of a static background image.
  5024. @example
  5025. 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
  5026. @end example
  5027. @end itemize
  5028. @section colorlevels
  5029. Adjust video input frames using levels.
  5030. The filter accepts the following options:
  5031. @table @option
  5032. @item rimin
  5033. @item gimin
  5034. @item bimin
  5035. @item aimin
  5036. Adjust red, green, blue and alpha input black point.
  5037. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5038. @item rimax
  5039. @item gimax
  5040. @item bimax
  5041. @item aimax
  5042. Adjust red, green, blue and alpha input white point.
  5043. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5044. Input levels are used to lighten highlights (bright tones), darken shadows
  5045. (dark tones), change the balance of bright and dark tones.
  5046. @item romin
  5047. @item gomin
  5048. @item bomin
  5049. @item aomin
  5050. Adjust red, green, blue and alpha output black point.
  5051. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5052. @item romax
  5053. @item gomax
  5054. @item bomax
  5055. @item aomax
  5056. Adjust red, green, blue and alpha output white point.
  5057. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5058. Output levels allows manual selection of a constrained output level range.
  5059. @end table
  5060. @subsection Examples
  5061. @itemize
  5062. @item
  5063. Make video output darker:
  5064. @example
  5065. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5066. @end example
  5067. @item
  5068. Increase contrast:
  5069. @example
  5070. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5071. @end example
  5072. @item
  5073. Make video output lighter:
  5074. @example
  5075. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5076. @end example
  5077. @item
  5078. Increase brightness:
  5079. @example
  5080. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5081. @end example
  5082. @end itemize
  5083. @section colorchannelmixer
  5084. Adjust video input frames by re-mixing color channels.
  5085. This filter modifies a color channel by adding the values associated to
  5086. the other channels of the same pixels. For example if the value to
  5087. modify is red, the output value will be:
  5088. @example
  5089. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5090. @end example
  5091. The filter accepts the following options:
  5092. @table @option
  5093. @item rr
  5094. @item rg
  5095. @item rb
  5096. @item ra
  5097. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5098. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5099. @item gr
  5100. @item gg
  5101. @item gb
  5102. @item ga
  5103. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5104. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5105. @item br
  5106. @item bg
  5107. @item bb
  5108. @item ba
  5109. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5110. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5111. @item ar
  5112. @item ag
  5113. @item ab
  5114. @item aa
  5115. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5116. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5117. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5118. @end table
  5119. @subsection Examples
  5120. @itemize
  5121. @item
  5122. Convert source to grayscale:
  5123. @example
  5124. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5125. @end example
  5126. @item
  5127. Simulate sepia tones:
  5128. @example
  5129. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5130. @end example
  5131. @end itemize
  5132. @section colormatrix
  5133. Convert color matrix.
  5134. The filter accepts the following options:
  5135. @table @option
  5136. @item src
  5137. @item dst
  5138. Specify the source and destination color matrix. Both values must be
  5139. specified.
  5140. The accepted values are:
  5141. @table @samp
  5142. @item bt709
  5143. BT.709
  5144. @item fcc
  5145. FCC
  5146. @item bt601
  5147. BT.601
  5148. @item bt470
  5149. BT.470
  5150. @item bt470bg
  5151. BT.470BG
  5152. @item smpte170m
  5153. SMPTE-170M
  5154. @item smpte240m
  5155. SMPTE-240M
  5156. @item bt2020
  5157. BT.2020
  5158. @end table
  5159. @end table
  5160. For example to convert from BT.601 to SMPTE-240M, use the command:
  5161. @example
  5162. colormatrix=bt601:smpte240m
  5163. @end example
  5164. @section colorspace
  5165. Convert colorspace, transfer characteristics or color primaries.
  5166. Input video needs to have an even size.
  5167. The filter accepts the following options:
  5168. @table @option
  5169. @anchor{all}
  5170. @item all
  5171. Specify all color properties at once.
  5172. The accepted values are:
  5173. @table @samp
  5174. @item bt470m
  5175. BT.470M
  5176. @item bt470bg
  5177. BT.470BG
  5178. @item bt601-6-525
  5179. BT.601-6 525
  5180. @item bt601-6-625
  5181. BT.601-6 625
  5182. @item bt709
  5183. BT.709
  5184. @item smpte170m
  5185. SMPTE-170M
  5186. @item smpte240m
  5187. SMPTE-240M
  5188. @item bt2020
  5189. BT.2020
  5190. @end table
  5191. @anchor{space}
  5192. @item space
  5193. Specify output colorspace.
  5194. The accepted values are:
  5195. @table @samp
  5196. @item bt709
  5197. BT.709
  5198. @item fcc
  5199. FCC
  5200. @item bt470bg
  5201. BT.470BG or BT.601-6 625
  5202. @item smpte170m
  5203. SMPTE-170M or BT.601-6 525
  5204. @item smpte240m
  5205. SMPTE-240M
  5206. @item ycgco
  5207. YCgCo
  5208. @item bt2020ncl
  5209. BT.2020 with non-constant luminance
  5210. @end table
  5211. @anchor{trc}
  5212. @item trc
  5213. Specify output transfer characteristics.
  5214. The accepted values are:
  5215. @table @samp
  5216. @item bt709
  5217. BT.709
  5218. @item bt470m
  5219. BT.470M
  5220. @item bt470bg
  5221. BT.470BG
  5222. @item gamma22
  5223. Constant gamma of 2.2
  5224. @item gamma28
  5225. Constant gamma of 2.8
  5226. @item smpte170m
  5227. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5228. @item smpte240m
  5229. SMPTE-240M
  5230. @item srgb
  5231. SRGB
  5232. @item iec61966-2-1
  5233. iec61966-2-1
  5234. @item iec61966-2-4
  5235. iec61966-2-4
  5236. @item xvycc
  5237. xvycc
  5238. @item bt2020-10
  5239. BT.2020 for 10-bits content
  5240. @item bt2020-12
  5241. BT.2020 for 12-bits content
  5242. @end table
  5243. @anchor{primaries}
  5244. @item primaries
  5245. Specify output color primaries.
  5246. The accepted values are:
  5247. @table @samp
  5248. @item bt709
  5249. BT.709
  5250. @item bt470m
  5251. BT.470M
  5252. @item bt470bg
  5253. BT.470BG or BT.601-6 625
  5254. @item smpte170m
  5255. SMPTE-170M or BT.601-6 525
  5256. @item smpte240m
  5257. SMPTE-240M
  5258. @item film
  5259. film
  5260. @item smpte431
  5261. SMPTE-431
  5262. @item smpte432
  5263. SMPTE-432
  5264. @item bt2020
  5265. BT.2020
  5266. @item jedec-p22
  5267. JEDEC P22 phosphors
  5268. @end table
  5269. @anchor{range}
  5270. @item range
  5271. Specify output color range.
  5272. The accepted values are:
  5273. @table @samp
  5274. @item tv
  5275. TV (restricted) range
  5276. @item mpeg
  5277. MPEG (restricted) range
  5278. @item pc
  5279. PC (full) range
  5280. @item jpeg
  5281. JPEG (full) range
  5282. @end table
  5283. @item format
  5284. Specify output color format.
  5285. The accepted values are:
  5286. @table @samp
  5287. @item yuv420p
  5288. YUV 4:2:0 planar 8-bits
  5289. @item yuv420p10
  5290. YUV 4:2:0 planar 10-bits
  5291. @item yuv420p12
  5292. YUV 4:2:0 planar 12-bits
  5293. @item yuv422p
  5294. YUV 4:2:2 planar 8-bits
  5295. @item yuv422p10
  5296. YUV 4:2:2 planar 10-bits
  5297. @item yuv422p12
  5298. YUV 4:2:2 planar 12-bits
  5299. @item yuv444p
  5300. YUV 4:4:4 planar 8-bits
  5301. @item yuv444p10
  5302. YUV 4:4:4 planar 10-bits
  5303. @item yuv444p12
  5304. YUV 4:4:4 planar 12-bits
  5305. @end table
  5306. @item fast
  5307. Do a fast conversion, which skips gamma/primary correction. This will take
  5308. significantly less CPU, but will be mathematically incorrect. To get output
  5309. compatible with that produced by the colormatrix filter, use fast=1.
  5310. @item dither
  5311. Specify dithering mode.
  5312. The accepted values are:
  5313. @table @samp
  5314. @item none
  5315. No dithering
  5316. @item fsb
  5317. Floyd-Steinberg dithering
  5318. @end table
  5319. @item wpadapt
  5320. Whitepoint adaptation mode.
  5321. The accepted values are:
  5322. @table @samp
  5323. @item bradford
  5324. Bradford whitepoint adaptation
  5325. @item vonkries
  5326. von Kries whitepoint adaptation
  5327. @item identity
  5328. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5329. @end table
  5330. @item iall
  5331. Override all input properties at once. Same accepted values as @ref{all}.
  5332. @item ispace
  5333. Override input colorspace. Same accepted values as @ref{space}.
  5334. @item iprimaries
  5335. Override input color primaries. Same accepted values as @ref{primaries}.
  5336. @item itrc
  5337. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5338. @item irange
  5339. Override input color range. Same accepted values as @ref{range}.
  5340. @end table
  5341. The filter converts the transfer characteristics, color space and color
  5342. primaries to the specified user values. The output value, if not specified,
  5343. is set to a default value based on the "all" property. If that property is
  5344. also not specified, the filter will log an error. The output color range and
  5345. format default to the same value as the input color range and format. The
  5346. input transfer characteristics, color space, color primaries and color range
  5347. should be set on the input data. If any of these are missing, the filter will
  5348. log an error and no conversion will take place.
  5349. For example to convert the input to SMPTE-240M, use the command:
  5350. @example
  5351. colorspace=smpte240m
  5352. @end example
  5353. @section convolution
  5354. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5355. The filter accepts the following options:
  5356. @table @option
  5357. @item 0m
  5358. @item 1m
  5359. @item 2m
  5360. @item 3m
  5361. Set matrix for each plane.
  5362. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5363. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5364. @item 0rdiv
  5365. @item 1rdiv
  5366. @item 2rdiv
  5367. @item 3rdiv
  5368. Set multiplier for calculated value for each plane.
  5369. If unset or 0, it will be sum of all matrix elements.
  5370. @item 0bias
  5371. @item 1bias
  5372. @item 2bias
  5373. @item 3bias
  5374. Set bias for each plane. This value is added to the result of the multiplication.
  5375. Useful for making the overall image brighter or darker. Default is 0.0.
  5376. @item 0mode
  5377. @item 1mode
  5378. @item 2mode
  5379. @item 3mode
  5380. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5381. Default is @var{square}.
  5382. @end table
  5383. @subsection Examples
  5384. @itemize
  5385. @item
  5386. Apply sharpen:
  5387. @example
  5388. 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"
  5389. @end example
  5390. @item
  5391. Apply blur:
  5392. @example
  5393. 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"
  5394. @end example
  5395. @item
  5396. Apply edge enhance:
  5397. @example
  5398. 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"
  5399. @end example
  5400. @item
  5401. Apply edge detect:
  5402. @example
  5403. 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"
  5404. @end example
  5405. @item
  5406. Apply laplacian edge detector which includes diagonals:
  5407. @example
  5408. 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"
  5409. @end example
  5410. @item
  5411. Apply emboss:
  5412. @example
  5413. 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"
  5414. @end example
  5415. @end itemize
  5416. @section convolve
  5417. Apply 2D convolution of video stream in frequency domain using second stream
  5418. as impulse.
  5419. The filter accepts the following options:
  5420. @table @option
  5421. @item planes
  5422. Set which planes to process.
  5423. @item impulse
  5424. Set which impulse video frames will be processed, can be @var{first}
  5425. or @var{all}. Default is @var{all}.
  5426. @end table
  5427. The @code{convolve} filter also supports the @ref{framesync} options.
  5428. @section copy
  5429. Copy the input video source unchanged to the output. This is mainly useful for
  5430. testing purposes.
  5431. @anchor{coreimage}
  5432. @section coreimage
  5433. Video filtering on GPU using Apple's CoreImage API on OSX.
  5434. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5435. processed by video hardware. However, software-based OpenGL implementations
  5436. exist which means there is no guarantee for hardware processing. It depends on
  5437. the respective OSX.
  5438. There are many filters and image generators provided by Apple that come with a
  5439. large variety of options. The filter has to be referenced by its name along
  5440. with its options.
  5441. The coreimage filter accepts the following options:
  5442. @table @option
  5443. @item list_filters
  5444. List all available filters and generators along with all their respective
  5445. options as well as possible minimum and maximum values along with the default
  5446. values.
  5447. @example
  5448. list_filters=true
  5449. @end example
  5450. @item filter
  5451. Specify all filters by their respective name and options.
  5452. Use @var{list_filters} to determine all valid filter names and options.
  5453. Numerical options are specified by a float value and are automatically clamped
  5454. to their respective value range. Vector and color options have to be specified
  5455. by a list of space separated float values. Character escaping has to be done.
  5456. A special option name @code{default} is available to use default options for a
  5457. filter.
  5458. It is required to specify either @code{default} or at least one of the filter options.
  5459. All omitted options are used with their default values.
  5460. The syntax of the filter string is as follows:
  5461. @example
  5462. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5463. @end example
  5464. @item output_rect
  5465. Specify a rectangle where the output of the filter chain is copied into the
  5466. input image. It is given by a list of space separated float values:
  5467. @example
  5468. output_rect=x\ y\ width\ height
  5469. @end example
  5470. If not given, the output rectangle equals the dimensions of the input image.
  5471. The output rectangle is automatically cropped at the borders of the input
  5472. image. Negative values are valid for each component.
  5473. @example
  5474. output_rect=25\ 25\ 100\ 100
  5475. @end example
  5476. @end table
  5477. Several filters can be chained for successive processing without GPU-HOST
  5478. transfers allowing for fast processing of complex filter chains.
  5479. Currently, only filters with zero (generators) or exactly one (filters) input
  5480. image and one output image are supported. Also, transition filters are not yet
  5481. usable as intended.
  5482. Some filters generate output images with additional padding depending on the
  5483. respective filter kernel. The padding is automatically removed to ensure the
  5484. filter output has the same size as the input image.
  5485. For image generators, the size of the output image is determined by the
  5486. previous output image of the filter chain or the input image of the whole
  5487. filterchain, respectively. The generators do not use the pixel information of
  5488. this image to generate their output. However, the generated output is
  5489. blended onto this image, resulting in partial or complete coverage of the
  5490. output image.
  5491. The @ref{coreimagesrc} video source can be used for generating input images
  5492. which are directly fed into the filter chain. By using it, providing input
  5493. images by another video source or an input video is not required.
  5494. @subsection Examples
  5495. @itemize
  5496. @item
  5497. List all filters available:
  5498. @example
  5499. coreimage=list_filters=true
  5500. @end example
  5501. @item
  5502. Use the CIBoxBlur filter with default options to blur an image:
  5503. @example
  5504. coreimage=filter=CIBoxBlur@@default
  5505. @end example
  5506. @item
  5507. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5508. its center at 100x100 and a radius of 50 pixels:
  5509. @example
  5510. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5511. @end example
  5512. @item
  5513. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5514. given as complete and escaped command-line for Apple's standard bash shell:
  5515. @example
  5516. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5517. @end example
  5518. @end itemize
  5519. @section crop
  5520. Crop the input video to given dimensions.
  5521. It accepts the following parameters:
  5522. @table @option
  5523. @item w, out_w
  5524. The width of the output video. It defaults to @code{iw}.
  5525. This expression is evaluated only once during the filter
  5526. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5527. @item h, out_h
  5528. The height of the output video. It defaults to @code{ih}.
  5529. This expression is evaluated only once during the filter
  5530. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5531. @item x
  5532. The horizontal position, in the input video, of the left edge of the output
  5533. video. It defaults to @code{(in_w-out_w)/2}.
  5534. This expression is evaluated per-frame.
  5535. @item y
  5536. The vertical position, in the input video, of the top edge of the output video.
  5537. It defaults to @code{(in_h-out_h)/2}.
  5538. This expression is evaluated per-frame.
  5539. @item keep_aspect
  5540. If set to 1 will force the output display aspect ratio
  5541. to be the same of the input, by changing the output sample aspect
  5542. ratio. It defaults to 0.
  5543. @item exact
  5544. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5545. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5546. It defaults to 0.
  5547. @end table
  5548. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5549. expressions containing the following constants:
  5550. @table @option
  5551. @item x
  5552. @item y
  5553. The computed values for @var{x} and @var{y}. They are evaluated for
  5554. each new frame.
  5555. @item in_w
  5556. @item in_h
  5557. The input width and height.
  5558. @item iw
  5559. @item ih
  5560. These are the same as @var{in_w} and @var{in_h}.
  5561. @item out_w
  5562. @item out_h
  5563. The output (cropped) width and height.
  5564. @item ow
  5565. @item oh
  5566. These are the same as @var{out_w} and @var{out_h}.
  5567. @item a
  5568. same as @var{iw} / @var{ih}
  5569. @item sar
  5570. input sample aspect ratio
  5571. @item dar
  5572. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5573. @item hsub
  5574. @item vsub
  5575. horizontal and vertical chroma subsample values. For example for the
  5576. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5577. @item n
  5578. The number of the input frame, starting from 0.
  5579. @item pos
  5580. the position in the file of the input frame, NAN if unknown
  5581. @item t
  5582. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5583. @end table
  5584. The expression for @var{out_w} may depend on the value of @var{out_h},
  5585. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5586. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5587. evaluated after @var{out_w} and @var{out_h}.
  5588. The @var{x} and @var{y} parameters specify the expressions for the
  5589. position of the top-left corner of the output (non-cropped) area. They
  5590. are evaluated for each frame. If the evaluated value is not valid, it
  5591. is approximated to the nearest valid value.
  5592. The expression for @var{x} may depend on @var{y}, and the expression
  5593. for @var{y} may depend on @var{x}.
  5594. @subsection Examples
  5595. @itemize
  5596. @item
  5597. Crop area with size 100x100 at position (12,34).
  5598. @example
  5599. crop=100:100:12:34
  5600. @end example
  5601. Using named options, the example above becomes:
  5602. @example
  5603. crop=w=100:h=100:x=12:y=34
  5604. @end example
  5605. @item
  5606. Crop the central input area with size 100x100:
  5607. @example
  5608. crop=100:100
  5609. @end example
  5610. @item
  5611. Crop the central input area with size 2/3 of the input video:
  5612. @example
  5613. crop=2/3*in_w:2/3*in_h
  5614. @end example
  5615. @item
  5616. Crop the input video central square:
  5617. @example
  5618. crop=out_w=in_h
  5619. crop=in_h
  5620. @end example
  5621. @item
  5622. Delimit the rectangle with the top-left corner placed at position
  5623. 100:100 and the right-bottom corner corresponding to the right-bottom
  5624. corner of the input image.
  5625. @example
  5626. crop=in_w-100:in_h-100:100:100
  5627. @end example
  5628. @item
  5629. Crop 10 pixels from the left and right borders, and 20 pixels from
  5630. the top and bottom borders
  5631. @example
  5632. crop=in_w-2*10:in_h-2*20
  5633. @end example
  5634. @item
  5635. Keep only the bottom right quarter of the input image:
  5636. @example
  5637. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5638. @end example
  5639. @item
  5640. Crop height for getting Greek harmony:
  5641. @example
  5642. crop=in_w:1/PHI*in_w
  5643. @end example
  5644. @item
  5645. Apply trembling effect:
  5646. @example
  5647. 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)
  5648. @end example
  5649. @item
  5650. Apply erratic camera effect depending on timestamp:
  5651. @example
  5652. 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)"
  5653. @end example
  5654. @item
  5655. Set x depending on the value of y:
  5656. @example
  5657. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5658. @end example
  5659. @end itemize
  5660. @subsection Commands
  5661. This filter supports the following commands:
  5662. @table @option
  5663. @item w, out_w
  5664. @item h, out_h
  5665. @item x
  5666. @item y
  5667. Set width/height of the output video and the horizontal/vertical position
  5668. in the input video.
  5669. The command accepts the same syntax of the corresponding option.
  5670. If the specified expression is not valid, it is kept at its current
  5671. value.
  5672. @end table
  5673. @section cropdetect
  5674. Auto-detect the crop size.
  5675. It calculates the necessary cropping parameters and prints the
  5676. recommended parameters via the logging system. The detected dimensions
  5677. correspond to the non-black area of the input video.
  5678. It accepts the following parameters:
  5679. @table @option
  5680. @item limit
  5681. Set higher black value threshold, which can be optionally specified
  5682. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5683. value greater to the set value is considered non-black. It defaults to 24.
  5684. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5685. on the bitdepth of the pixel format.
  5686. @item round
  5687. The value which the width/height should be divisible by. It defaults to
  5688. 16. The offset is automatically adjusted to center the video. Use 2 to
  5689. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5690. encoding to most video codecs.
  5691. @item reset_count, reset
  5692. Set the counter that determines after how many frames cropdetect will
  5693. reset the previously detected largest video area and start over to
  5694. detect the current optimal crop area. Default value is 0.
  5695. This can be useful when channel logos distort the video area. 0
  5696. indicates 'never reset', and returns the largest area encountered during
  5697. playback.
  5698. @end table
  5699. @anchor{cue}
  5700. @section cue
  5701. Delay video filtering until a given wallclock timestamp. The filter first
  5702. passes on @option{preroll} amount of frames, then it buffers at most
  5703. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5704. it forwards the buffered frames and also any subsequent frames coming in its
  5705. input.
  5706. The filter can be used synchronize the output of multiple ffmpeg processes for
  5707. realtime output devices like decklink. By putting the delay in the filtering
  5708. chain and pre-buffering frames the process can pass on data to output almost
  5709. immediately after the target wallclock timestamp is reached.
  5710. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5711. some use cases.
  5712. @table @option
  5713. @item cue
  5714. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5715. @item preroll
  5716. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5717. @item buffer
  5718. The maximum duration of content to buffer before waiting for the cue expressed
  5719. in seconds. Default is 0.
  5720. @end table
  5721. @anchor{curves}
  5722. @section curves
  5723. Apply color adjustments using curves.
  5724. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5725. component (red, green and blue) has its values defined by @var{N} key points
  5726. tied from each other using a smooth curve. The x-axis represents the pixel
  5727. values from the input frame, and the y-axis the new pixel values to be set for
  5728. the output frame.
  5729. By default, a component curve is defined by the two points @var{(0;0)} and
  5730. @var{(1;1)}. This creates a straight line where each original pixel value is
  5731. "adjusted" to its own value, which means no change to the image.
  5732. The filter allows you to redefine these two points and add some more. A new
  5733. curve (using a natural cubic spline interpolation) will be define to pass
  5734. smoothly through all these new coordinates. The new defined points needs to be
  5735. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5736. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5737. the vector spaces, the values will be clipped accordingly.
  5738. The filter accepts the following options:
  5739. @table @option
  5740. @item preset
  5741. Select one of the available color presets. This option can be used in addition
  5742. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5743. options takes priority on the preset values.
  5744. Available presets are:
  5745. @table @samp
  5746. @item none
  5747. @item color_negative
  5748. @item cross_process
  5749. @item darker
  5750. @item increase_contrast
  5751. @item lighter
  5752. @item linear_contrast
  5753. @item medium_contrast
  5754. @item negative
  5755. @item strong_contrast
  5756. @item vintage
  5757. @end table
  5758. Default is @code{none}.
  5759. @item master, m
  5760. Set the master key points. These points will define a second pass mapping. It
  5761. is sometimes called a "luminance" or "value" mapping. It can be used with
  5762. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5763. post-processing LUT.
  5764. @item red, r
  5765. Set the key points for the red component.
  5766. @item green, g
  5767. Set the key points for the green component.
  5768. @item blue, b
  5769. Set the key points for the blue component.
  5770. @item all
  5771. Set the key points for all components (not including master).
  5772. Can be used in addition to the other key points component
  5773. options. In this case, the unset component(s) will fallback on this
  5774. @option{all} setting.
  5775. @item psfile
  5776. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5777. @item plot
  5778. Save Gnuplot script of the curves in specified file.
  5779. @end table
  5780. To avoid some filtergraph syntax conflicts, each key points list need to be
  5781. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5782. @subsection Examples
  5783. @itemize
  5784. @item
  5785. Increase slightly the middle level of blue:
  5786. @example
  5787. curves=blue='0/0 0.5/0.58 1/1'
  5788. @end example
  5789. @item
  5790. Vintage effect:
  5791. @example
  5792. 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'
  5793. @end example
  5794. Here we obtain the following coordinates for each components:
  5795. @table @var
  5796. @item red
  5797. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5798. @item green
  5799. @code{(0;0) (0.50;0.48) (1;1)}
  5800. @item blue
  5801. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5802. @end table
  5803. @item
  5804. The previous example can also be achieved with the associated built-in preset:
  5805. @example
  5806. curves=preset=vintage
  5807. @end example
  5808. @item
  5809. Or simply:
  5810. @example
  5811. curves=vintage
  5812. @end example
  5813. @item
  5814. Use a Photoshop preset and redefine the points of the green component:
  5815. @example
  5816. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5817. @end example
  5818. @item
  5819. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5820. and @command{gnuplot}:
  5821. @example
  5822. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5823. gnuplot -p /tmp/curves.plt
  5824. @end example
  5825. @end itemize
  5826. @section datascope
  5827. Video data analysis filter.
  5828. This filter shows hexadecimal pixel values of part of video.
  5829. The filter accepts the following options:
  5830. @table @option
  5831. @item size, s
  5832. Set output video size.
  5833. @item x
  5834. Set x offset from where to pick pixels.
  5835. @item y
  5836. Set y offset from where to pick pixels.
  5837. @item mode
  5838. Set scope mode, can be one of the following:
  5839. @table @samp
  5840. @item mono
  5841. Draw hexadecimal pixel values with white color on black background.
  5842. @item color
  5843. Draw hexadecimal pixel values with input video pixel color on black
  5844. background.
  5845. @item color2
  5846. Draw hexadecimal pixel values on color background picked from input video,
  5847. the text color is picked in such way so its always visible.
  5848. @end table
  5849. @item axis
  5850. Draw rows and columns numbers on left and top of video.
  5851. @item opacity
  5852. Set background opacity.
  5853. @end table
  5854. @section dctdnoiz
  5855. Denoise frames using 2D DCT (frequency domain filtering).
  5856. This filter is not designed for real time.
  5857. The filter accepts the following options:
  5858. @table @option
  5859. @item sigma, s
  5860. Set the noise sigma constant.
  5861. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5862. coefficient (absolute value) below this threshold with be dropped.
  5863. If you need a more advanced filtering, see @option{expr}.
  5864. Default is @code{0}.
  5865. @item overlap
  5866. Set number overlapping pixels for each block. Since the filter can be slow, you
  5867. may want to reduce this value, at the cost of a less effective filter and the
  5868. risk of various artefacts.
  5869. If the overlapping value doesn't permit processing the whole input width or
  5870. height, a warning will be displayed and according borders won't be denoised.
  5871. Default value is @var{blocksize}-1, which is the best possible setting.
  5872. @item expr, e
  5873. Set the coefficient factor expression.
  5874. For each coefficient of a DCT block, this expression will be evaluated as a
  5875. multiplier value for the coefficient.
  5876. If this is option is set, the @option{sigma} option will be ignored.
  5877. The absolute value of the coefficient can be accessed through the @var{c}
  5878. variable.
  5879. @item n
  5880. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5881. @var{blocksize}, which is the width and height of the processed blocks.
  5882. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5883. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5884. on the speed processing. Also, a larger block size does not necessarily means a
  5885. better de-noising.
  5886. @end table
  5887. @subsection Examples
  5888. Apply a denoise with a @option{sigma} of @code{4.5}:
  5889. @example
  5890. dctdnoiz=4.5
  5891. @end example
  5892. The same operation can be achieved using the expression system:
  5893. @example
  5894. dctdnoiz=e='gte(c, 4.5*3)'
  5895. @end example
  5896. Violent denoise using a block size of @code{16x16}:
  5897. @example
  5898. dctdnoiz=15:n=4
  5899. @end example
  5900. @section deband
  5901. Remove banding artifacts from input video.
  5902. It works by replacing banded pixels with average value of referenced pixels.
  5903. The filter accepts the following options:
  5904. @table @option
  5905. @item 1thr
  5906. @item 2thr
  5907. @item 3thr
  5908. @item 4thr
  5909. Set banding detection threshold for each plane. Default is 0.02.
  5910. Valid range is 0.00003 to 0.5.
  5911. If difference between current pixel and reference pixel is less than threshold,
  5912. it will be considered as banded.
  5913. @item range, r
  5914. Banding detection range in pixels. Default is 16. If positive, random number
  5915. in range 0 to set value will be used. If negative, exact absolute value
  5916. will be used.
  5917. The range defines square of four pixels around current pixel.
  5918. @item direction, d
  5919. Set direction in radians from which four pixel will be compared. If positive,
  5920. random direction from 0 to set direction will be picked. If negative, exact of
  5921. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5922. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5923. column.
  5924. @item blur, b
  5925. If enabled, current pixel is compared with average value of all four
  5926. surrounding pixels. The default is enabled. If disabled current pixel is
  5927. compared with all four surrounding pixels. The pixel is considered banded
  5928. if only all four differences with surrounding pixels are less than threshold.
  5929. @item coupling, c
  5930. If enabled, current pixel is changed if and only if all pixel components are banded,
  5931. e.g. banding detection threshold is triggered for all color components.
  5932. The default is disabled.
  5933. @end table
  5934. @section deblock
  5935. Remove blocking artifacts from input video.
  5936. The filter accepts the following options:
  5937. @table @option
  5938. @item filter
  5939. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  5940. This controls what kind of deblocking is applied.
  5941. @item block
  5942. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  5943. @item alpha
  5944. @item beta
  5945. @item gamma
  5946. @item delta
  5947. Set blocking detection thresholds. Allowed range is 0 to 1.
  5948. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  5949. Using higher threshold gives more deblocking strength.
  5950. Setting @var{alpha} controls threshold detection at exact edge of block.
  5951. Remaining options controls threshold detection near the edge. Each one for
  5952. below/above or left/right. Setting any of those to @var{0} disables
  5953. deblocking.
  5954. @item planes
  5955. Set planes to filter. Default is to filter all available planes.
  5956. @end table
  5957. @subsection Examples
  5958. @itemize
  5959. @item
  5960. Deblock using weak filter and block size of 4 pixels.
  5961. @example
  5962. deblock=filter=weak:block=4
  5963. @end example
  5964. @item
  5965. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  5966. deblocking more edges.
  5967. @example
  5968. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  5969. @end example
  5970. @item
  5971. Similar as above, but filter only first plane.
  5972. @example
  5973. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  5974. @end example
  5975. @item
  5976. Similar as above, but filter only second and third plane.
  5977. @example
  5978. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  5979. @end example
  5980. @end itemize
  5981. @anchor{decimate}
  5982. @section decimate
  5983. Drop duplicated frames at regular intervals.
  5984. The filter accepts the following options:
  5985. @table @option
  5986. @item cycle
  5987. Set the number of frames from which one will be dropped. Setting this to
  5988. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5989. Default is @code{5}.
  5990. @item dupthresh
  5991. Set the threshold for duplicate detection. If the difference metric for a frame
  5992. is less than or equal to this value, then it is declared as duplicate. Default
  5993. is @code{1.1}
  5994. @item scthresh
  5995. Set scene change threshold. Default is @code{15}.
  5996. @item blockx
  5997. @item blocky
  5998. Set the size of the x and y-axis blocks used during metric calculations.
  5999. Larger blocks give better noise suppression, but also give worse detection of
  6000. small movements. Must be a power of two. Default is @code{32}.
  6001. @item ppsrc
  6002. Mark main input as a pre-processed input and activate clean source input
  6003. stream. This allows the input to be pre-processed with various filters to help
  6004. the metrics calculation while keeping the frame selection lossless. When set to
  6005. @code{1}, the first stream is for the pre-processed input, and the second
  6006. stream is the clean source from where the kept frames are chosen. Default is
  6007. @code{0}.
  6008. @item chroma
  6009. Set whether or not chroma is considered in the metric calculations. Default is
  6010. @code{1}.
  6011. @end table
  6012. @section deconvolve
  6013. Apply 2D deconvolution of video stream in frequency domain using second stream
  6014. as impulse.
  6015. The filter accepts the following options:
  6016. @table @option
  6017. @item planes
  6018. Set which planes to process.
  6019. @item impulse
  6020. Set which impulse video frames will be processed, can be @var{first}
  6021. or @var{all}. Default is @var{all}.
  6022. @item noise
  6023. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6024. and height are not same and not power of 2 or if stream prior to convolving
  6025. had noise.
  6026. @end table
  6027. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6028. @section dedot
  6029. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6030. It accepts the following options:
  6031. @table @option
  6032. @item m
  6033. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6034. @var{rainbows} for cross-color reduction.
  6035. @item lt
  6036. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6037. @item tl
  6038. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6039. @item tc
  6040. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6041. @item ct
  6042. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6043. @end table
  6044. @section deflate
  6045. Apply deflate effect to the video.
  6046. This filter replaces the pixel by the local(3x3) average by taking into account
  6047. only values lower than the pixel.
  6048. It accepts the following options:
  6049. @table @option
  6050. @item threshold0
  6051. @item threshold1
  6052. @item threshold2
  6053. @item threshold3
  6054. Limit the maximum change for each plane, default is 65535.
  6055. If 0, plane will remain unchanged.
  6056. @end table
  6057. @section deflicker
  6058. Remove temporal frame luminance variations.
  6059. It accepts the following options:
  6060. @table @option
  6061. @item size, s
  6062. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6063. @item mode, m
  6064. Set averaging mode to smooth temporal luminance variations.
  6065. Available values are:
  6066. @table @samp
  6067. @item am
  6068. Arithmetic mean
  6069. @item gm
  6070. Geometric mean
  6071. @item hm
  6072. Harmonic mean
  6073. @item qm
  6074. Quadratic mean
  6075. @item cm
  6076. Cubic mean
  6077. @item pm
  6078. Power mean
  6079. @item median
  6080. Median
  6081. @end table
  6082. @item bypass
  6083. Do not actually modify frame. Useful when one only wants metadata.
  6084. @end table
  6085. @section dejudder
  6086. Remove judder produced by partially interlaced telecined content.
  6087. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6088. source was partially telecined content then the output of @code{pullup,dejudder}
  6089. will have a variable frame rate. May change the recorded frame rate of the
  6090. container. Aside from that change, this filter will not affect constant frame
  6091. rate video.
  6092. The option available in this filter is:
  6093. @table @option
  6094. @item cycle
  6095. Specify the length of the window over which the judder repeats.
  6096. Accepts any integer greater than 1. Useful values are:
  6097. @table @samp
  6098. @item 4
  6099. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6100. @item 5
  6101. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6102. @item 20
  6103. If a mixture of the two.
  6104. @end table
  6105. The default is @samp{4}.
  6106. @end table
  6107. @section delogo
  6108. Suppress a TV station logo by a simple interpolation of the surrounding
  6109. pixels. Just set a rectangle covering the logo and watch it disappear
  6110. (and sometimes something even uglier appear - your mileage may vary).
  6111. It accepts the following parameters:
  6112. @table @option
  6113. @item x
  6114. @item y
  6115. Specify the top left corner coordinates of the logo. They must be
  6116. specified.
  6117. @item w
  6118. @item h
  6119. Specify the width and height of the logo to clear. They must be
  6120. specified.
  6121. @item band, t
  6122. Specify the thickness of the fuzzy edge of the rectangle (added to
  6123. @var{w} and @var{h}). The default value is 1. This option is
  6124. deprecated, setting higher values should no longer be necessary and
  6125. is not recommended.
  6126. @item show
  6127. When set to 1, a green rectangle is drawn on the screen to simplify
  6128. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6129. The default value is 0.
  6130. The rectangle is drawn on the outermost pixels which will be (partly)
  6131. replaced with interpolated values. The values of the next pixels
  6132. immediately outside this rectangle in each direction will be used to
  6133. compute the interpolated pixel values inside the rectangle.
  6134. @end table
  6135. @subsection Examples
  6136. @itemize
  6137. @item
  6138. Set a rectangle covering the area with top left corner coordinates 0,0
  6139. and size 100x77, and a band of size 10:
  6140. @example
  6141. delogo=x=0:y=0:w=100:h=77:band=10
  6142. @end example
  6143. @end itemize
  6144. @section deshake
  6145. Attempt to fix small changes in horizontal and/or vertical shift. This
  6146. filter helps remove camera shake from hand-holding a camera, bumping a
  6147. tripod, moving on a vehicle, etc.
  6148. The filter accepts the following options:
  6149. @table @option
  6150. @item x
  6151. @item y
  6152. @item w
  6153. @item h
  6154. Specify a rectangular area where to limit the search for motion
  6155. vectors.
  6156. If desired the search for motion vectors can be limited to a
  6157. rectangular area of the frame defined by its top left corner, width
  6158. and height. These parameters have the same meaning as the drawbox
  6159. filter which can be used to visualise the position of the bounding
  6160. box.
  6161. This is useful when simultaneous movement of subjects within the frame
  6162. might be confused for camera motion by the motion vector search.
  6163. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6164. then the full frame is used. This allows later options to be set
  6165. without specifying the bounding box for the motion vector search.
  6166. Default - search the whole frame.
  6167. @item rx
  6168. @item ry
  6169. Specify the maximum extent of movement in x and y directions in the
  6170. range 0-64 pixels. Default 16.
  6171. @item edge
  6172. Specify how to generate pixels to fill blanks at the edge of the
  6173. frame. Available values are:
  6174. @table @samp
  6175. @item blank, 0
  6176. Fill zeroes at blank locations
  6177. @item original, 1
  6178. Original image at blank locations
  6179. @item clamp, 2
  6180. Extruded edge value at blank locations
  6181. @item mirror, 3
  6182. Mirrored edge at blank locations
  6183. @end table
  6184. Default value is @samp{mirror}.
  6185. @item blocksize
  6186. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6187. default 8.
  6188. @item contrast
  6189. Specify the contrast threshold for blocks. Only blocks with more than
  6190. the specified contrast (difference between darkest and lightest
  6191. pixels) will be considered. Range 1-255, default 125.
  6192. @item search
  6193. Specify the search strategy. Available values are:
  6194. @table @samp
  6195. @item exhaustive, 0
  6196. Set exhaustive search
  6197. @item less, 1
  6198. Set less exhaustive search.
  6199. @end table
  6200. Default value is @samp{exhaustive}.
  6201. @item filename
  6202. If set then a detailed log of the motion search is written to the
  6203. specified file.
  6204. @end table
  6205. @section despill
  6206. Remove unwanted contamination of foreground colors, caused by reflected color of
  6207. greenscreen or bluescreen.
  6208. This filter accepts the following options:
  6209. @table @option
  6210. @item type
  6211. Set what type of despill to use.
  6212. @item mix
  6213. Set how spillmap will be generated.
  6214. @item expand
  6215. Set how much to get rid of still remaining spill.
  6216. @item red
  6217. Controls amount of red in spill area.
  6218. @item green
  6219. Controls amount of green in spill area.
  6220. Should be -1 for greenscreen.
  6221. @item blue
  6222. Controls amount of blue in spill area.
  6223. Should be -1 for bluescreen.
  6224. @item brightness
  6225. Controls brightness of spill area, preserving colors.
  6226. @item alpha
  6227. Modify alpha from generated spillmap.
  6228. @end table
  6229. @section detelecine
  6230. Apply an exact inverse of the telecine operation. It requires a predefined
  6231. pattern specified using the pattern option which must be the same as that passed
  6232. to the telecine filter.
  6233. This filter accepts the following options:
  6234. @table @option
  6235. @item first_field
  6236. @table @samp
  6237. @item top, t
  6238. top field first
  6239. @item bottom, b
  6240. bottom field first
  6241. The default value is @code{top}.
  6242. @end table
  6243. @item pattern
  6244. A string of numbers representing the pulldown pattern you wish to apply.
  6245. The default value is @code{23}.
  6246. @item start_frame
  6247. A number representing position of the first frame with respect to the telecine
  6248. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6249. @end table
  6250. @section dilation
  6251. Apply dilation effect to the video.
  6252. This filter replaces the pixel by the local(3x3) maximum.
  6253. It accepts the following options:
  6254. @table @option
  6255. @item threshold0
  6256. @item threshold1
  6257. @item threshold2
  6258. @item threshold3
  6259. Limit the maximum change for each plane, default is 65535.
  6260. If 0, plane will remain unchanged.
  6261. @item coordinates
  6262. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6263. pixels are used.
  6264. Flags to local 3x3 coordinates maps like this:
  6265. 1 2 3
  6266. 4 5
  6267. 6 7 8
  6268. @end table
  6269. @section displace
  6270. Displace pixels as indicated by second and third input stream.
  6271. It takes three input streams and outputs one stream, the first input is the
  6272. source, and second and third input are displacement maps.
  6273. The second input specifies how much to displace pixels along the
  6274. x-axis, while the third input specifies how much to displace pixels
  6275. along the y-axis.
  6276. If one of displacement map streams terminates, last frame from that
  6277. displacement map will be used.
  6278. Note that once generated, displacements maps can be reused over and over again.
  6279. A description of the accepted options follows.
  6280. @table @option
  6281. @item edge
  6282. Set displace behavior for pixels that are out of range.
  6283. Available values are:
  6284. @table @samp
  6285. @item blank
  6286. Missing pixels are replaced by black pixels.
  6287. @item smear
  6288. Adjacent pixels will spread out to replace missing pixels.
  6289. @item wrap
  6290. Out of range pixels are wrapped so they point to pixels of other side.
  6291. @item mirror
  6292. Out of range pixels will be replaced with mirrored pixels.
  6293. @end table
  6294. Default is @samp{smear}.
  6295. @end table
  6296. @subsection Examples
  6297. @itemize
  6298. @item
  6299. Add ripple effect to rgb input of video size hd720:
  6300. @example
  6301. 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
  6302. @end example
  6303. @item
  6304. Add wave effect to rgb input of video size hd720:
  6305. @example
  6306. 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
  6307. @end example
  6308. @end itemize
  6309. @section drawbox
  6310. Draw a colored box on the input image.
  6311. It accepts the following parameters:
  6312. @table @option
  6313. @item x
  6314. @item y
  6315. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6316. @item width, w
  6317. @item height, h
  6318. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6319. the input width and height. It defaults to 0.
  6320. @item color, c
  6321. Specify the color of the box to write. For the general syntax of this option,
  6322. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6323. value @code{invert} is used, the box edge color is the same as the
  6324. video with inverted luma.
  6325. @item thickness, t
  6326. The expression which sets the thickness of the box edge.
  6327. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6328. See below for the list of accepted constants.
  6329. @item replace
  6330. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6331. will overwrite the video's color and alpha pixels.
  6332. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6333. @end table
  6334. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6335. following constants:
  6336. @table @option
  6337. @item dar
  6338. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6339. @item hsub
  6340. @item vsub
  6341. horizontal and vertical chroma subsample values. For example for the
  6342. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6343. @item in_h, ih
  6344. @item in_w, iw
  6345. The input width and height.
  6346. @item sar
  6347. The input sample aspect ratio.
  6348. @item x
  6349. @item y
  6350. The x and y offset coordinates where the box is drawn.
  6351. @item w
  6352. @item h
  6353. The width and height of the drawn box.
  6354. @item t
  6355. The thickness of the drawn box.
  6356. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6357. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6358. @end table
  6359. @subsection Examples
  6360. @itemize
  6361. @item
  6362. Draw a black box around the edge of the input image:
  6363. @example
  6364. drawbox
  6365. @end example
  6366. @item
  6367. Draw a box with color red and an opacity of 50%:
  6368. @example
  6369. drawbox=10:20:200:60:red@@0.5
  6370. @end example
  6371. The previous example can be specified as:
  6372. @example
  6373. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6374. @end example
  6375. @item
  6376. Fill the box with pink color:
  6377. @example
  6378. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6379. @end example
  6380. @item
  6381. Draw a 2-pixel red 2.40:1 mask:
  6382. @example
  6383. 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
  6384. @end example
  6385. @end itemize
  6386. @section drawgrid
  6387. Draw a grid on the input image.
  6388. It accepts the following parameters:
  6389. @table @option
  6390. @item x
  6391. @item y
  6392. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6393. @item width, w
  6394. @item height, h
  6395. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6396. input width and height, respectively, minus @code{thickness}, so image gets
  6397. framed. Default to 0.
  6398. @item color, c
  6399. Specify the color of the grid. For the general syntax of this option,
  6400. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6401. value @code{invert} is used, the grid color is the same as the
  6402. video with inverted luma.
  6403. @item thickness, t
  6404. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6405. See below for the list of accepted constants.
  6406. @item replace
  6407. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6408. will overwrite the video's color and alpha pixels.
  6409. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6410. @end table
  6411. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6412. following constants:
  6413. @table @option
  6414. @item dar
  6415. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6416. @item hsub
  6417. @item vsub
  6418. horizontal and vertical chroma subsample values. For example for the
  6419. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6420. @item in_h, ih
  6421. @item in_w, iw
  6422. The input grid cell width and height.
  6423. @item sar
  6424. The input sample aspect ratio.
  6425. @item x
  6426. @item y
  6427. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6428. @item w
  6429. @item h
  6430. The width and height of the drawn cell.
  6431. @item t
  6432. The thickness of the drawn cell.
  6433. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6434. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6435. @end table
  6436. @subsection Examples
  6437. @itemize
  6438. @item
  6439. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6440. @example
  6441. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6442. @end example
  6443. @item
  6444. Draw a white 3x3 grid with an opacity of 50%:
  6445. @example
  6446. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6447. @end example
  6448. @end itemize
  6449. @anchor{drawtext}
  6450. @section drawtext
  6451. Draw a text string or text from a specified file on top of a video, using the
  6452. libfreetype library.
  6453. To enable compilation of this filter, you need to configure FFmpeg with
  6454. @code{--enable-libfreetype}.
  6455. To enable default font fallback and the @var{font} option you need to
  6456. configure FFmpeg with @code{--enable-libfontconfig}.
  6457. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6458. @code{--enable-libfribidi}.
  6459. @subsection Syntax
  6460. It accepts the following parameters:
  6461. @table @option
  6462. @item box
  6463. Used to draw a box around text using the background color.
  6464. The value must be either 1 (enable) or 0 (disable).
  6465. The default value of @var{box} is 0.
  6466. @item boxborderw
  6467. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6468. The default value of @var{boxborderw} is 0.
  6469. @item boxcolor
  6470. The color to be used for drawing box around text. For the syntax of this
  6471. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6472. The default value of @var{boxcolor} is "white".
  6473. @item line_spacing
  6474. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6475. The default value of @var{line_spacing} is 0.
  6476. @item borderw
  6477. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6478. The default value of @var{borderw} is 0.
  6479. @item bordercolor
  6480. Set the color to be used for drawing border around text. For the syntax of this
  6481. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6482. The default value of @var{bordercolor} is "black".
  6483. @item expansion
  6484. Select how the @var{text} is expanded. Can be either @code{none},
  6485. @code{strftime} (deprecated) or
  6486. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6487. below for details.
  6488. @item basetime
  6489. Set a start time for the count. Value is in microseconds. Only applied
  6490. in the deprecated strftime expansion mode. To emulate in normal expansion
  6491. mode use the @code{pts} function, supplying the start time (in seconds)
  6492. as the second argument.
  6493. @item fix_bounds
  6494. If true, check and fix text coords to avoid clipping.
  6495. @item fontcolor
  6496. The color to be used for drawing fonts. For the syntax of this option, check
  6497. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6498. The default value of @var{fontcolor} is "black".
  6499. @item fontcolor_expr
  6500. String which is expanded the same way as @var{text} to obtain dynamic
  6501. @var{fontcolor} value. By default this option has empty value and is not
  6502. processed. When this option is set, it overrides @var{fontcolor} option.
  6503. @item font
  6504. The font family to be used for drawing text. By default Sans.
  6505. @item fontfile
  6506. The font file to be used for drawing text. The path must be included.
  6507. This parameter is mandatory if the fontconfig support is disabled.
  6508. @item alpha
  6509. Draw the text applying alpha blending. The value can
  6510. be a number between 0.0 and 1.0.
  6511. The expression accepts the same variables @var{x, y} as well.
  6512. The default value is 1.
  6513. Please see @var{fontcolor_expr}.
  6514. @item fontsize
  6515. The font size to be used for drawing text.
  6516. The default value of @var{fontsize} is 16.
  6517. @item text_shaping
  6518. If set to 1, attempt to shape the text (for example, reverse the order of
  6519. right-to-left text and join Arabic characters) before drawing it.
  6520. Otherwise, just draw the text exactly as given.
  6521. By default 1 (if supported).
  6522. @item ft_load_flags
  6523. The flags to be used for loading the fonts.
  6524. The flags map the corresponding flags supported by libfreetype, and are
  6525. a combination of the following values:
  6526. @table @var
  6527. @item default
  6528. @item no_scale
  6529. @item no_hinting
  6530. @item render
  6531. @item no_bitmap
  6532. @item vertical_layout
  6533. @item force_autohint
  6534. @item crop_bitmap
  6535. @item pedantic
  6536. @item ignore_global_advance_width
  6537. @item no_recurse
  6538. @item ignore_transform
  6539. @item monochrome
  6540. @item linear_design
  6541. @item no_autohint
  6542. @end table
  6543. Default value is "default".
  6544. For more information consult the documentation for the FT_LOAD_*
  6545. libfreetype flags.
  6546. @item shadowcolor
  6547. The color to be used for drawing a shadow behind the drawn text. For the
  6548. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6549. ffmpeg-utils manual,ffmpeg-utils}.
  6550. The default value of @var{shadowcolor} is "black".
  6551. @item shadowx
  6552. @item shadowy
  6553. The x and y offsets for the text shadow position with respect to the
  6554. position of the text. They can be either positive or negative
  6555. values. The default value for both is "0".
  6556. @item start_number
  6557. The starting frame number for the n/frame_num variable. The default value
  6558. is "0".
  6559. @item tabsize
  6560. The size in number of spaces to use for rendering the tab.
  6561. Default value is 4.
  6562. @item timecode
  6563. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6564. format. It can be used with or without text parameter. @var{timecode_rate}
  6565. option must be specified.
  6566. @item timecode_rate, rate, r
  6567. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6568. integer. Minimum value is "1".
  6569. Drop-frame timecode is supported for frame rates 30 & 60.
  6570. @item tc24hmax
  6571. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6572. Default is 0 (disabled).
  6573. @item text
  6574. The text string to be drawn. The text must be a sequence of UTF-8
  6575. encoded characters.
  6576. This parameter is mandatory if no file is specified with the parameter
  6577. @var{textfile}.
  6578. @item textfile
  6579. A text file containing text to be drawn. The text must be a sequence
  6580. of UTF-8 encoded characters.
  6581. This parameter is mandatory if no text string is specified with the
  6582. parameter @var{text}.
  6583. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6584. @item reload
  6585. If set to 1, the @var{textfile} will be reloaded before each frame.
  6586. Be sure to update it atomically, or it may be read partially, or even fail.
  6587. @item x
  6588. @item y
  6589. The expressions which specify the offsets where text will be drawn
  6590. within the video frame. They are relative to the top/left border of the
  6591. output image.
  6592. The default value of @var{x} and @var{y} is "0".
  6593. See below for the list of accepted constants and functions.
  6594. @end table
  6595. The parameters for @var{x} and @var{y} are expressions containing the
  6596. following constants and functions:
  6597. @table @option
  6598. @item dar
  6599. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6600. @item hsub
  6601. @item vsub
  6602. horizontal and vertical chroma subsample values. For example for the
  6603. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6604. @item line_h, lh
  6605. the height of each text line
  6606. @item main_h, h, H
  6607. the input height
  6608. @item main_w, w, W
  6609. the input width
  6610. @item max_glyph_a, ascent
  6611. the maximum distance from the baseline to the highest/upper grid
  6612. coordinate used to place a glyph outline point, for all the rendered
  6613. glyphs.
  6614. It is a positive value, due to the grid's orientation with the Y axis
  6615. upwards.
  6616. @item max_glyph_d, descent
  6617. the maximum distance from the baseline to the lowest grid coordinate
  6618. used to place a glyph outline point, for all the rendered glyphs.
  6619. This is a negative value, due to the grid's orientation, with the Y axis
  6620. upwards.
  6621. @item max_glyph_h
  6622. maximum glyph height, that is the maximum height for all the glyphs
  6623. contained in the rendered text, it is equivalent to @var{ascent} -
  6624. @var{descent}.
  6625. @item max_glyph_w
  6626. maximum glyph width, that is the maximum width for all the glyphs
  6627. contained in the rendered text
  6628. @item n
  6629. the number of input frame, starting from 0
  6630. @item rand(min, max)
  6631. return a random number included between @var{min} and @var{max}
  6632. @item sar
  6633. The input sample aspect ratio.
  6634. @item t
  6635. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6636. @item text_h, th
  6637. the height of the rendered text
  6638. @item text_w, tw
  6639. the width of the rendered text
  6640. @item x
  6641. @item y
  6642. the x and y offset coordinates where the text is drawn.
  6643. These parameters allow the @var{x} and @var{y} expressions to refer
  6644. each other, so you can for example specify @code{y=x/dar}.
  6645. @end table
  6646. @anchor{drawtext_expansion}
  6647. @subsection Text expansion
  6648. If @option{expansion} is set to @code{strftime},
  6649. the filter recognizes strftime() sequences in the provided text and
  6650. expands them accordingly. Check the documentation of strftime(). This
  6651. feature is deprecated.
  6652. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6653. If @option{expansion} is set to @code{normal} (which is the default),
  6654. the following expansion mechanism is used.
  6655. The backslash character @samp{\}, followed by any character, always expands to
  6656. the second character.
  6657. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6658. braces is a function name, possibly followed by arguments separated by ':'.
  6659. If the arguments contain special characters or delimiters (':' or '@}'),
  6660. they should be escaped.
  6661. Note that they probably must also be escaped as the value for the
  6662. @option{text} option in the filter argument string and as the filter
  6663. argument in the filtergraph description, and possibly also for the shell,
  6664. that makes up to four levels of escaping; using a text file avoids these
  6665. problems.
  6666. The following functions are available:
  6667. @table @command
  6668. @item expr, e
  6669. The expression evaluation result.
  6670. It must take one argument specifying the expression to be evaluated,
  6671. which accepts the same constants and functions as the @var{x} and
  6672. @var{y} values. Note that not all constants should be used, for
  6673. example the text size is not known when evaluating the expression, so
  6674. the constants @var{text_w} and @var{text_h} will have an undefined
  6675. value.
  6676. @item expr_int_format, eif
  6677. Evaluate the expression's value and output as formatted integer.
  6678. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6679. The second argument specifies the output format. Allowed values are @samp{x},
  6680. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6681. @code{printf} function.
  6682. The third parameter is optional and sets the number of positions taken by the output.
  6683. It can be used to add padding with zeros from the left.
  6684. @item gmtime
  6685. The time at which the filter is running, expressed in UTC.
  6686. It can accept an argument: a strftime() format string.
  6687. @item localtime
  6688. The time at which the filter is running, expressed in the local time zone.
  6689. It can accept an argument: a strftime() format string.
  6690. @item metadata
  6691. Frame metadata. Takes one or two arguments.
  6692. The first argument is mandatory and specifies the metadata key.
  6693. The second argument is optional and specifies a default value, used when the
  6694. metadata key is not found or empty.
  6695. @item n, frame_num
  6696. The frame number, starting from 0.
  6697. @item pict_type
  6698. A 1 character description of the current picture type.
  6699. @item pts
  6700. The timestamp of the current frame.
  6701. It can take up to three arguments.
  6702. The first argument is the format of the timestamp; it defaults to @code{flt}
  6703. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6704. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6705. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6706. @code{localtime} stands for the timestamp of the frame formatted as
  6707. local time zone time.
  6708. The second argument is an offset added to the timestamp.
  6709. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6710. supplied to present the hour part of the formatted timestamp in 24h format
  6711. (00-23).
  6712. If the format is set to @code{localtime} or @code{gmtime},
  6713. a third argument may be supplied: a strftime() format string.
  6714. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6715. @end table
  6716. @subsection Examples
  6717. @itemize
  6718. @item
  6719. Draw "Test Text" with font FreeSerif, using the default values for the
  6720. optional parameters.
  6721. @example
  6722. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6723. @end example
  6724. @item
  6725. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6726. and y=50 (counting from the top-left corner of the screen), text is
  6727. yellow with a red box around it. Both the text and the box have an
  6728. opacity of 20%.
  6729. @example
  6730. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6731. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6732. @end example
  6733. Note that the double quotes are not necessary if spaces are not used
  6734. within the parameter list.
  6735. @item
  6736. Show the text at the center of the video frame:
  6737. @example
  6738. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6739. @end example
  6740. @item
  6741. Show the text at a random position, switching to a new position every 30 seconds:
  6742. @example
  6743. 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)"
  6744. @end example
  6745. @item
  6746. Show a text line sliding from right to left in the last row of the video
  6747. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6748. with no newlines.
  6749. @example
  6750. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6751. @end example
  6752. @item
  6753. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6754. @example
  6755. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6756. @end example
  6757. @item
  6758. Draw a single green letter "g", at the center of the input video.
  6759. The glyph baseline is placed at half screen height.
  6760. @example
  6761. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6762. @end example
  6763. @item
  6764. Show text for 1 second every 3 seconds:
  6765. @example
  6766. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6767. @end example
  6768. @item
  6769. Use fontconfig to set the font. Note that the colons need to be escaped.
  6770. @example
  6771. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6772. @end example
  6773. @item
  6774. Print the date of a real-time encoding (see strftime(3)):
  6775. @example
  6776. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6777. @end example
  6778. @item
  6779. Show text fading in and out (appearing/disappearing):
  6780. @example
  6781. #!/bin/sh
  6782. DS=1.0 # display start
  6783. DE=10.0 # display end
  6784. FID=1.5 # fade in duration
  6785. FOD=5 # fade out duration
  6786. 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 @}"
  6787. @end example
  6788. @item
  6789. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6790. and the @option{fontsize} value are included in the @option{y} offset.
  6791. @example
  6792. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6793. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6794. @end example
  6795. @end itemize
  6796. For more information about libfreetype, check:
  6797. @url{http://www.freetype.org/}.
  6798. For more information about fontconfig, check:
  6799. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6800. For more information about libfribidi, check:
  6801. @url{http://fribidi.org/}.
  6802. @section edgedetect
  6803. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6804. The filter accepts the following options:
  6805. @table @option
  6806. @item low
  6807. @item high
  6808. Set low and high threshold values used by the Canny thresholding
  6809. algorithm.
  6810. The high threshold selects the "strong" edge pixels, which are then
  6811. connected through 8-connectivity with the "weak" edge pixels selected
  6812. by the low threshold.
  6813. @var{low} and @var{high} threshold values must be chosen in the range
  6814. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6815. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6816. is @code{50/255}.
  6817. @item mode
  6818. Define the drawing mode.
  6819. @table @samp
  6820. @item wires
  6821. Draw white/gray wires on black background.
  6822. @item colormix
  6823. Mix the colors to create a paint/cartoon effect.
  6824. @item canny
  6825. Apply Canny edge detector on all selected planes.
  6826. @end table
  6827. Default value is @var{wires}.
  6828. @item planes
  6829. Select planes for filtering. By default all available planes are filtered.
  6830. @end table
  6831. @subsection Examples
  6832. @itemize
  6833. @item
  6834. Standard edge detection with custom values for the hysteresis thresholding:
  6835. @example
  6836. edgedetect=low=0.1:high=0.4
  6837. @end example
  6838. @item
  6839. Painting effect without thresholding:
  6840. @example
  6841. edgedetect=mode=colormix:high=0
  6842. @end example
  6843. @end itemize
  6844. @section eq
  6845. Set brightness, contrast, saturation and approximate gamma adjustment.
  6846. The filter accepts the following options:
  6847. @table @option
  6848. @item contrast
  6849. Set the contrast expression. The value must be a float value in range
  6850. @code{-2.0} to @code{2.0}. The default value is "1".
  6851. @item brightness
  6852. Set the brightness expression. The value must be a float value in
  6853. range @code{-1.0} to @code{1.0}. The default value is "0".
  6854. @item saturation
  6855. Set the saturation expression. The value must be a float in
  6856. range @code{0.0} to @code{3.0}. The default value is "1".
  6857. @item gamma
  6858. Set the gamma expression. The value must be a float in range
  6859. @code{0.1} to @code{10.0}. The default value is "1".
  6860. @item gamma_r
  6861. Set the gamma expression for red. The value must be a float in
  6862. range @code{0.1} to @code{10.0}. The default value is "1".
  6863. @item gamma_g
  6864. Set the gamma expression for green. The value must be a float in range
  6865. @code{0.1} to @code{10.0}. The default value is "1".
  6866. @item gamma_b
  6867. Set the gamma expression for blue. The value must be a float in range
  6868. @code{0.1} to @code{10.0}. The default value is "1".
  6869. @item gamma_weight
  6870. Set the gamma weight expression. It can be used to reduce the effect
  6871. of a high gamma value on bright image areas, e.g. keep them from
  6872. getting overamplified and just plain white. The value must be a float
  6873. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6874. gamma correction all the way down while @code{1.0} leaves it at its
  6875. full strength. Default is "1".
  6876. @item eval
  6877. Set when the expressions for brightness, contrast, saturation and
  6878. gamma expressions are evaluated.
  6879. It accepts the following values:
  6880. @table @samp
  6881. @item init
  6882. only evaluate expressions once during the filter initialization or
  6883. when a command is processed
  6884. @item frame
  6885. evaluate expressions for each incoming frame
  6886. @end table
  6887. Default value is @samp{init}.
  6888. @end table
  6889. The expressions accept the following parameters:
  6890. @table @option
  6891. @item n
  6892. frame count of the input frame starting from 0
  6893. @item pos
  6894. byte position of the corresponding packet in the input file, NAN if
  6895. unspecified
  6896. @item r
  6897. frame rate of the input video, NAN if the input frame rate is unknown
  6898. @item t
  6899. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6900. @end table
  6901. @subsection Commands
  6902. The filter supports the following commands:
  6903. @table @option
  6904. @item contrast
  6905. Set the contrast expression.
  6906. @item brightness
  6907. Set the brightness expression.
  6908. @item saturation
  6909. Set the saturation expression.
  6910. @item gamma
  6911. Set the gamma expression.
  6912. @item gamma_r
  6913. Set the gamma_r expression.
  6914. @item gamma_g
  6915. Set gamma_g expression.
  6916. @item gamma_b
  6917. Set gamma_b expression.
  6918. @item gamma_weight
  6919. Set gamma_weight expression.
  6920. The command accepts the same syntax of the corresponding option.
  6921. If the specified expression is not valid, it is kept at its current
  6922. value.
  6923. @end table
  6924. @section erosion
  6925. Apply erosion effect to the video.
  6926. This filter replaces the pixel by the local(3x3) minimum.
  6927. It accepts the following options:
  6928. @table @option
  6929. @item threshold0
  6930. @item threshold1
  6931. @item threshold2
  6932. @item threshold3
  6933. Limit the maximum change for each plane, default is 65535.
  6934. If 0, plane will remain unchanged.
  6935. @item coordinates
  6936. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6937. pixels are used.
  6938. Flags to local 3x3 coordinates maps like this:
  6939. 1 2 3
  6940. 4 5
  6941. 6 7 8
  6942. @end table
  6943. @section extractplanes
  6944. Extract color channel components from input video stream into
  6945. separate grayscale video streams.
  6946. The filter accepts the following option:
  6947. @table @option
  6948. @item planes
  6949. Set plane(s) to extract.
  6950. Available values for planes are:
  6951. @table @samp
  6952. @item y
  6953. @item u
  6954. @item v
  6955. @item a
  6956. @item r
  6957. @item g
  6958. @item b
  6959. @end table
  6960. Choosing planes not available in the input will result in an error.
  6961. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6962. with @code{y}, @code{u}, @code{v} planes at same time.
  6963. @end table
  6964. @subsection Examples
  6965. @itemize
  6966. @item
  6967. Extract luma, u and v color channel component from input video frame
  6968. into 3 grayscale outputs:
  6969. @example
  6970. 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
  6971. @end example
  6972. @end itemize
  6973. @section elbg
  6974. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6975. For each input image, the filter will compute the optimal mapping from
  6976. the input to the output given the codebook length, that is the number
  6977. of distinct output colors.
  6978. This filter accepts the following options.
  6979. @table @option
  6980. @item codebook_length, l
  6981. Set codebook length. The value must be a positive integer, and
  6982. represents the number of distinct output colors. Default value is 256.
  6983. @item nb_steps, n
  6984. Set the maximum number of iterations to apply for computing the optimal
  6985. mapping. The higher the value the better the result and the higher the
  6986. computation time. Default value is 1.
  6987. @item seed, s
  6988. Set a random seed, must be an integer included between 0 and
  6989. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6990. will try to use a good random seed on a best effort basis.
  6991. @item pal8
  6992. Set pal8 output pixel format. This option does not work with codebook
  6993. length greater than 256.
  6994. @end table
  6995. @section entropy
  6996. Measure graylevel entropy in histogram of color channels of video frames.
  6997. It accepts the following parameters:
  6998. @table @option
  6999. @item mode
  7000. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7001. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7002. between neighbour histogram values.
  7003. @end table
  7004. @section fade
  7005. Apply a fade-in/out effect to the input video.
  7006. It accepts the following parameters:
  7007. @table @option
  7008. @item type, t
  7009. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7010. effect.
  7011. Default is @code{in}.
  7012. @item start_frame, s
  7013. Specify the number of the frame to start applying the fade
  7014. effect at. Default is 0.
  7015. @item nb_frames, n
  7016. The number of frames that the fade effect lasts. At the end of the
  7017. fade-in effect, the output video will have the same intensity as the input video.
  7018. At the end of the fade-out transition, the output video will be filled with the
  7019. selected @option{color}.
  7020. Default is 25.
  7021. @item alpha
  7022. If set to 1, fade only alpha channel, if one exists on the input.
  7023. Default value is 0.
  7024. @item start_time, st
  7025. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7026. effect. If both start_frame and start_time are specified, the fade will start at
  7027. whichever comes last. Default is 0.
  7028. @item duration, d
  7029. The number of seconds for which the fade effect has to last. At the end of the
  7030. fade-in effect the output video will have the same intensity as the input video,
  7031. at the end of the fade-out transition the output video will be filled with the
  7032. selected @option{color}.
  7033. If both duration and nb_frames are specified, duration is used. Default is 0
  7034. (nb_frames is used by default).
  7035. @item color, c
  7036. Specify the color of the fade. Default is "black".
  7037. @end table
  7038. @subsection Examples
  7039. @itemize
  7040. @item
  7041. Fade in the first 30 frames of video:
  7042. @example
  7043. fade=in:0:30
  7044. @end example
  7045. The command above is equivalent to:
  7046. @example
  7047. fade=t=in:s=0:n=30
  7048. @end example
  7049. @item
  7050. Fade out the last 45 frames of a 200-frame video:
  7051. @example
  7052. fade=out:155:45
  7053. fade=type=out:start_frame=155:nb_frames=45
  7054. @end example
  7055. @item
  7056. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7057. @example
  7058. fade=in:0:25, fade=out:975:25
  7059. @end example
  7060. @item
  7061. Make the first 5 frames yellow, then fade in from frame 5-24:
  7062. @example
  7063. fade=in:5:20:color=yellow
  7064. @end example
  7065. @item
  7066. Fade in alpha over first 25 frames of video:
  7067. @example
  7068. fade=in:0:25:alpha=1
  7069. @end example
  7070. @item
  7071. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7072. @example
  7073. fade=t=in:st=5.5:d=0.5
  7074. @end example
  7075. @end itemize
  7076. @section fftfilt
  7077. Apply arbitrary expressions to samples in frequency domain
  7078. @table @option
  7079. @item dc_Y
  7080. Adjust the dc value (gain) of the luma plane of the image. The filter
  7081. accepts an integer value in range @code{0} to @code{1000}. The default
  7082. value is set to @code{0}.
  7083. @item dc_U
  7084. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7085. filter accepts an integer value in range @code{0} to @code{1000}. The
  7086. default value is set to @code{0}.
  7087. @item dc_V
  7088. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7089. filter accepts an integer value in range @code{0} to @code{1000}. The
  7090. default value is set to @code{0}.
  7091. @item weight_Y
  7092. Set the frequency domain weight expression for the luma plane.
  7093. @item weight_U
  7094. Set the frequency domain weight expression for the 1st chroma plane.
  7095. @item weight_V
  7096. Set the frequency domain weight expression for the 2nd chroma plane.
  7097. @item eval
  7098. Set when the expressions are evaluated.
  7099. It accepts the following values:
  7100. @table @samp
  7101. @item init
  7102. Only evaluate expressions once during the filter initialization.
  7103. @item frame
  7104. Evaluate expressions for each incoming frame.
  7105. @end table
  7106. Default value is @samp{init}.
  7107. The filter accepts the following variables:
  7108. @item X
  7109. @item Y
  7110. The coordinates of the current sample.
  7111. @item W
  7112. @item H
  7113. The width and height of the image.
  7114. @item N
  7115. The number of input frame, starting from 0.
  7116. @end table
  7117. @subsection Examples
  7118. @itemize
  7119. @item
  7120. High-pass:
  7121. @example
  7122. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7123. @end example
  7124. @item
  7125. Low-pass:
  7126. @example
  7127. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7128. @end example
  7129. @item
  7130. Sharpen:
  7131. @example
  7132. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7133. @end example
  7134. @item
  7135. Blur:
  7136. @example
  7137. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7138. @end example
  7139. @end itemize
  7140. @section fftdnoiz
  7141. Denoise frames using 3D FFT (frequency domain filtering).
  7142. The filter accepts the following options:
  7143. @table @option
  7144. @item sigma
  7145. Set the noise sigma constant. This sets denoising strength.
  7146. Default value is 1. Allowed range is from 0 to 30.
  7147. Using very high sigma with low overlap may give blocking artifacts.
  7148. @item amount
  7149. Set amount of denoising. By default all detected noise is reduced.
  7150. Default value is 1. Allowed range is from 0 to 1.
  7151. @item block
  7152. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7153. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7154. block size in pixels is 2^4 which is 16.
  7155. @item overlap
  7156. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7157. @item prev
  7158. Set number of previous frames to use for denoising. By default is set to 0.
  7159. @item next
  7160. Set number of next frames to to use for denoising. By default is set to 0.
  7161. @item planes
  7162. Set planes which will be filtered, by default are all available filtered
  7163. except alpha.
  7164. @end table
  7165. @section field
  7166. Extract a single field from an interlaced image using stride
  7167. arithmetic to avoid wasting CPU time. The output frames are marked as
  7168. non-interlaced.
  7169. The filter accepts the following options:
  7170. @table @option
  7171. @item type
  7172. Specify whether to extract the top (if the value is @code{0} or
  7173. @code{top}) or the bottom field (if the value is @code{1} or
  7174. @code{bottom}).
  7175. @end table
  7176. @section fieldhint
  7177. Create new frames by copying the top and bottom fields from surrounding frames
  7178. supplied as numbers by the hint file.
  7179. @table @option
  7180. @item hint
  7181. Set file containing hints: absolute/relative frame numbers.
  7182. There must be one line for each frame in a clip. Each line must contain two
  7183. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7184. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7185. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7186. for @code{relative} mode. First number tells from which frame to pick up top
  7187. field and second number tells from which frame to pick up bottom field.
  7188. If optionally followed by @code{+} output frame will be marked as interlaced,
  7189. else if followed by @code{-} output frame will be marked as progressive, else
  7190. it will be marked same as input frame.
  7191. If line starts with @code{#} or @code{;} that line is skipped.
  7192. @item mode
  7193. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7194. @end table
  7195. Example of first several lines of @code{hint} file for @code{relative} mode:
  7196. @example
  7197. 0,0 - # first frame
  7198. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7199. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7200. 1,0 -
  7201. 0,0 -
  7202. 0,0 -
  7203. 1,0 -
  7204. 1,0 -
  7205. 1,0 -
  7206. 0,0 -
  7207. 0,0 -
  7208. 1,0 -
  7209. 1,0 -
  7210. 1,0 -
  7211. 0,0 -
  7212. @end example
  7213. @section fieldmatch
  7214. Field matching filter for inverse telecine. It is meant to reconstruct the
  7215. progressive frames from a telecined stream. The filter does not drop duplicated
  7216. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7217. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7218. The separation of the field matching and the decimation is notably motivated by
  7219. the possibility of inserting a de-interlacing filter fallback between the two.
  7220. If the source has mixed telecined and real interlaced content,
  7221. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7222. But these remaining combed frames will be marked as interlaced, and thus can be
  7223. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7224. In addition to the various configuration options, @code{fieldmatch} can take an
  7225. optional second stream, activated through the @option{ppsrc} option. If
  7226. enabled, the frames reconstruction will be based on the fields and frames from
  7227. this second stream. This allows the first input to be pre-processed in order to
  7228. help the various algorithms of the filter, while keeping the output lossless
  7229. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7230. or brightness/contrast adjustments can help.
  7231. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7232. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7233. which @code{fieldmatch} is based on. While the semantic and usage are very
  7234. close, some behaviour and options names can differ.
  7235. The @ref{decimate} filter currently only works for constant frame rate input.
  7236. If your input has mixed telecined (30fps) and progressive content with a lower
  7237. framerate like 24fps use the following filterchain to produce the necessary cfr
  7238. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7239. The filter accepts the following options:
  7240. @table @option
  7241. @item order
  7242. Specify the assumed field order of the input stream. Available values are:
  7243. @table @samp
  7244. @item auto
  7245. Auto detect parity (use FFmpeg's internal parity value).
  7246. @item bff
  7247. Assume bottom field first.
  7248. @item tff
  7249. Assume top field first.
  7250. @end table
  7251. Note that it is sometimes recommended not to trust the parity announced by the
  7252. stream.
  7253. Default value is @var{auto}.
  7254. @item mode
  7255. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7256. sense that it won't risk creating jerkiness due to duplicate frames when
  7257. possible, but if there are bad edits or blended fields it will end up
  7258. outputting combed frames when a good match might actually exist. On the other
  7259. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7260. but will almost always find a good frame if there is one. The other values are
  7261. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7262. jerkiness and creating duplicate frames versus finding good matches in sections
  7263. with bad edits, orphaned fields, blended fields, etc.
  7264. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7265. Available values are:
  7266. @table @samp
  7267. @item pc
  7268. 2-way matching (p/c)
  7269. @item pc_n
  7270. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7271. @item pc_u
  7272. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7273. @item pc_n_ub
  7274. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7275. still combed (p/c + n + u/b)
  7276. @item pcn
  7277. 3-way matching (p/c/n)
  7278. @item pcn_ub
  7279. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7280. detected as combed (p/c/n + u/b)
  7281. @end table
  7282. The parenthesis at the end indicate the matches that would be used for that
  7283. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7284. @var{top}).
  7285. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7286. the slowest.
  7287. Default value is @var{pc_n}.
  7288. @item ppsrc
  7289. Mark the main input stream as a pre-processed input, and enable the secondary
  7290. input stream as the clean source to pick the fields from. See the filter
  7291. introduction for more details. It is similar to the @option{clip2} feature from
  7292. VFM/TFM.
  7293. Default value is @code{0} (disabled).
  7294. @item field
  7295. Set the field to match from. It is recommended to set this to the same value as
  7296. @option{order} unless you experience matching failures with that setting. In
  7297. certain circumstances changing the field that is used to match from can have a
  7298. large impact on matching performance. Available values are:
  7299. @table @samp
  7300. @item auto
  7301. Automatic (same value as @option{order}).
  7302. @item bottom
  7303. Match from the bottom field.
  7304. @item top
  7305. Match from the top field.
  7306. @end table
  7307. Default value is @var{auto}.
  7308. @item mchroma
  7309. Set whether or not chroma is included during the match comparisons. In most
  7310. cases it is recommended to leave this enabled. You should set this to @code{0}
  7311. only if your clip has bad chroma problems such as heavy rainbowing or other
  7312. artifacts. Setting this to @code{0} could also be used to speed things up at
  7313. the cost of some accuracy.
  7314. Default value is @code{1}.
  7315. @item y0
  7316. @item y1
  7317. These define an exclusion band which excludes the lines between @option{y0} and
  7318. @option{y1} from being included in the field matching decision. An exclusion
  7319. band can be used to ignore subtitles, a logo, or other things that may
  7320. interfere with the matching. @option{y0} sets the starting scan line and
  7321. @option{y1} sets the ending line; all lines in between @option{y0} and
  7322. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7323. @option{y0} and @option{y1} to the same value will disable the feature.
  7324. @option{y0} and @option{y1} defaults to @code{0}.
  7325. @item scthresh
  7326. Set the scene change detection threshold as a percentage of maximum change on
  7327. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7328. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7329. @option{scthresh} is @code{[0.0, 100.0]}.
  7330. Default value is @code{12.0}.
  7331. @item combmatch
  7332. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7333. account the combed scores of matches when deciding what match to use as the
  7334. final match. Available values are:
  7335. @table @samp
  7336. @item none
  7337. No final matching based on combed scores.
  7338. @item sc
  7339. Combed scores are only used when a scene change is detected.
  7340. @item full
  7341. Use combed scores all the time.
  7342. @end table
  7343. Default is @var{sc}.
  7344. @item combdbg
  7345. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7346. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7347. Available values are:
  7348. @table @samp
  7349. @item none
  7350. No forced calculation.
  7351. @item pcn
  7352. Force p/c/n calculations.
  7353. @item pcnub
  7354. Force p/c/n/u/b calculations.
  7355. @end table
  7356. Default value is @var{none}.
  7357. @item cthresh
  7358. This is the area combing threshold used for combed frame detection. This
  7359. essentially controls how "strong" or "visible" combing must be to be detected.
  7360. Larger values mean combing must be more visible and smaller values mean combing
  7361. can be less visible or strong and still be detected. Valid settings are from
  7362. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7363. be detected as combed). This is basically a pixel difference value. A good
  7364. range is @code{[8, 12]}.
  7365. Default value is @code{9}.
  7366. @item chroma
  7367. Sets whether or not chroma is considered in the combed frame decision. Only
  7368. disable this if your source has chroma problems (rainbowing, etc.) that are
  7369. causing problems for the combed frame detection with chroma enabled. Actually,
  7370. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7371. where there is chroma only combing in the source.
  7372. Default value is @code{0}.
  7373. @item blockx
  7374. @item blocky
  7375. Respectively set the x-axis and y-axis size of the window used during combed
  7376. frame detection. This has to do with the size of the area in which
  7377. @option{combpel} pixels are required to be detected as combed for a frame to be
  7378. declared combed. See the @option{combpel} parameter description for more info.
  7379. Possible values are any number that is a power of 2 starting at 4 and going up
  7380. to 512.
  7381. Default value is @code{16}.
  7382. @item combpel
  7383. The number of combed pixels inside any of the @option{blocky} by
  7384. @option{blockx} size blocks on the frame for the frame to be detected as
  7385. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7386. setting controls "how much" combing there must be in any localized area (a
  7387. window defined by the @option{blockx} and @option{blocky} settings) on the
  7388. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7389. which point no frames will ever be detected as combed). This setting is known
  7390. as @option{MI} in TFM/VFM vocabulary.
  7391. Default value is @code{80}.
  7392. @end table
  7393. @anchor{p/c/n/u/b meaning}
  7394. @subsection p/c/n/u/b meaning
  7395. @subsubsection p/c/n
  7396. We assume the following telecined stream:
  7397. @example
  7398. Top fields: 1 2 2 3 4
  7399. Bottom fields: 1 2 3 4 4
  7400. @end example
  7401. The numbers correspond to the progressive frame the fields relate to. Here, the
  7402. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7403. When @code{fieldmatch} is configured to run a matching from bottom
  7404. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7405. @example
  7406. Input stream:
  7407. T 1 2 2 3 4
  7408. B 1 2 3 4 4 <-- matching reference
  7409. Matches: c c n n c
  7410. Output stream:
  7411. T 1 2 3 4 4
  7412. B 1 2 3 4 4
  7413. @end example
  7414. As a result of the field matching, we can see that some frames get duplicated.
  7415. To perform a complete inverse telecine, you need to rely on a decimation filter
  7416. after this operation. See for instance the @ref{decimate} filter.
  7417. The same operation now matching from top fields (@option{field}=@var{top})
  7418. looks like this:
  7419. @example
  7420. Input stream:
  7421. T 1 2 2 3 4 <-- matching reference
  7422. B 1 2 3 4 4
  7423. Matches: c c p p c
  7424. Output stream:
  7425. T 1 2 2 3 4
  7426. B 1 2 2 3 4
  7427. @end example
  7428. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7429. basically, they refer to the frame and field of the opposite parity:
  7430. @itemize
  7431. @item @var{p} matches the field of the opposite parity in the previous frame
  7432. @item @var{c} matches the field of the opposite parity in the current frame
  7433. @item @var{n} matches the field of the opposite parity in the next frame
  7434. @end itemize
  7435. @subsubsection u/b
  7436. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7437. from the opposite parity flag. In the following examples, we assume that we are
  7438. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7439. 'x' is placed above and below each matched fields.
  7440. With bottom matching (@option{field}=@var{bottom}):
  7441. @example
  7442. Match: c p n b u
  7443. x x x x x
  7444. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7445. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7446. x x x x x
  7447. Output frames:
  7448. 2 1 2 2 2
  7449. 2 2 2 1 3
  7450. @end example
  7451. With top matching (@option{field}=@var{top}):
  7452. @example
  7453. Match: c p n b u
  7454. x x x x x
  7455. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7456. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7457. x x x x x
  7458. Output frames:
  7459. 2 2 2 1 2
  7460. 2 1 3 2 2
  7461. @end example
  7462. @subsection Examples
  7463. Simple IVTC of a top field first telecined stream:
  7464. @example
  7465. fieldmatch=order=tff:combmatch=none, decimate
  7466. @end example
  7467. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7468. @example
  7469. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7470. @end example
  7471. @section fieldorder
  7472. Transform the field order of the input video.
  7473. It accepts the following parameters:
  7474. @table @option
  7475. @item order
  7476. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7477. for bottom field first.
  7478. @end table
  7479. The default value is @samp{tff}.
  7480. The transformation is done by shifting the picture content up or down
  7481. by one line, and filling the remaining line with appropriate picture content.
  7482. This method is consistent with most broadcast field order converters.
  7483. If the input video is not flagged as being interlaced, or it is already
  7484. flagged as being of the required output field order, then this filter does
  7485. not alter the incoming video.
  7486. It is very useful when converting to or from PAL DV material,
  7487. which is bottom field first.
  7488. For example:
  7489. @example
  7490. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7491. @end example
  7492. @section fifo, afifo
  7493. Buffer input images and send them when they are requested.
  7494. It is mainly useful when auto-inserted by the libavfilter
  7495. framework.
  7496. It does not take parameters.
  7497. @section fillborders
  7498. Fill borders of the input video, without changing video stream dimensions.
  7499. Sometimes video can have garbage at the four edges and you may not want to
  7500. crop video input to keep size multiple of some number.
  7501. This filter accepts the following options:
  7502. @table @option
  7503. @item left
  7504. Number of pixels to fill from left border.
  7505. @item right
  7506. Number of pixels to fill from right border.
  7507. @item top
  7508. Number of pixels to fill from top border.
  7509. @item bottom
  7510. Number of pixels to fill from bottom border.
  7511. @item mode
  7512. Set fill mode.
  7513. It accepts the following values:
  7514. @table @samp
  7515. @item smear
  7516. fill pixels using outermost pixels
  7517. @item mirror
  7518. fill pixels using mirroring
  7519. @item fixed
  7520. fill pixels with constant value
  7521. @end table
  7522. Default is @var{smear}.
  7523. @item color
  7524. Set color for pixels in fixed mode. Default is @var{black}.
  7525. @end table
  7526. @section find_rect
  7527. Find a rectangular object
  7528. It accepts the following options:
  7529. @table @option
  7530. @item object
  7531. Filepath of the object image, needs to be in gray8.
  7532. @item threshold
  7533. Detection threshold, default is 0.5.
  7534. @item mipmaps
  7535. Number of mipmaps, default is 3.
  7536. @item xmin, ymin, xmax, ymax
  7537. Specifies the rectangle in which to search.
  7538. @end table
  7539. @subsection Examples
  7540. @itemize
  7541. @item
  7542. Generate a representative palette of a given video using @command{ffmpeg}:
  7543. @example
  7544. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7545. @end example
  7546. @end itemize
  7547. @section cover_rect
  7548. Cover a rectangular object
  7549. It accepts the following options:
  7550. @table @option
  7551. @item cover
  7552. Filepath of the optional cover image, needs to be in yuv420.
  7553. @item mode
  7554. Set covering mode.
  7555. It accepts the following values:
  7556. @table @samp
  7557. @item cover
  7558. cover it by the supplied image
  7559. @item blur
  7560. cover it by interpolating the surrounding pixels
  7561. @end table
  7562. Default value is @var{blur}.
  7563. @end table
  7564. @subsection Examples
  7565. @itemize
  7566. @item
  7567. Generate a representative palette of a given video using @command{ffmpeg}:
  7568. @example
  7569. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7570. @end example
  7571. @end itemize
  7572. @section floodfill
  7573. Flood area with values of same pixel components with another values.
  7574. It accepts the following options:
  7575. @table @option
  7576. @item x
  7577. Set pixel x coordinate.
  7578. @item y
  7579. Set pixel y coordinate.
  7580. @item s0
  7581. Set source #0 component value.
  7582. @item s1
  7583. Set source #1 component value.
  7584. @item s2
  7585. Set source #2 component value.
  7586. @item s3
  7587. Set source #3 component value.
  7588. @item d0
  7589. Set destination #0 component value.
  7590. @item d1
  7591. Set destination #1 component value.
  7592. @item d2
  7593. Set destination #2 component value.
  7594. @item d3
  7595. Set destination #3 component value.
  7596. @end table
  7597. @anchor{format}
  7598. @section format
  7599. Convert the input video to one of the specified pixel formats.
  7600. Libavfilter will try to pick one that is suitable as input to
  7601. the next filter.
  7602. It accepts the following parameters:
  7603. @table @option
  7604. @item pix_fmts
  7605. A '|'-separated list of pixel format names, such as
  7606. "pix_fmts=yuv420p|monow|rgb24".
  7607. @end table
  7608. @subsection Examples
  7609. @itemize
  7610. @item
  7611. Convert the input video to the @var{yuv420p} format
  7612. @example
  7613. format=pix_fmts=yuv420p
  7614. @end example
  7615. Convert the input video to any of the formats in the list
  7616. @example
  7617. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7618. @end example
  7619. @end itemize
  7620. @anchor{fps}
  7621. @section fps
  7622. Convert the video to specified constant frame rate by duplicating or dropping
  7623. frames as necessary.
  7624. It accepts the following parameters:
  7625. @table @option
  7626. @item fps
  7627. The desired output frame rate. The default is @code{25}.
  7628. @item start_time
  7629. Assume the first PTS should be the given value, in seconds. This allows for
  7630. padding/trimming at the start of stream. By default, no assumption is made
  7631. about the first frame's expected PTS, so no padding or trimming is done.
  7632. For example, this could be set to 0 to pad the beginning with duplicates of
  7633. the first frame if a video stream starts after the audio stream or to trim any
  7634. frames with a negative PTS.
  7635. @item round
  7636. Timestamp (PTS) rounding method.
  7637. Possible values are:
  7638. @table @option
  7639. @item zero
  7640. round towards 0
  7641. @item inf
  7642. round away from 0
  7643. @item down
  7644. round towards -infinity
  7645. @item up
  7646. round towards +infinity
  7647. @item near
  7648. round to nearest
  7649. @end table
  7650. The default is @code{near}.
  7651. @item eof_action
  7652. Action performed when reading the last frame.
  7653. Possible values are:
  7654. @table @option
  7655. @item round
  7656. Use same timestamp rounding method as used for other frames.
  7657. @item pass
  7658. Pass through last frame if input duration has not been reached yet.
  7659. @end table
  7660. The default is @code{round}.
  7661. @end table
  7662. Alternatively, the options can be specified as a flat string:
  7663. @var{fps}[:@var{start_time}[:@var{round}]].
  7664. See also the @ref{setpts} filter.
  7665. @subsection Examples
  7666. @itemize
  7667. @item
  7668. A typical usage in order to set the fps to 25:
  7669. @example
  7670. fps=fps=25
  7671. @end example
  7672. @item
  7673. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7674. @example
  7675. fps=fps=film:round=near
  7676. @end example
  7677. @end itemize
  7678. @section framepack
  7679. Pack two different video streams into a stereoscopic video, setting proper
  7680. metadata on supported codecs. The two views should have the same size and
  7681. framerate and processing will stop when the shorter video ends. Please note
  7682. that you may conveniently adjust view properties with the @ref{scale} and
  7683. @ref{fps} filters.
  7684. It accepts the following parameters:
  7685. @table @option
  7686. @item format
  7687. The desired packing format. Supported values are:
  7688. @table @option
  7689. @item sbs
  7690. The views are next to each other (default).
  7691. @item tab
  7692. The views are on top of each other.
  7693. @item lines
  7694. The views are packed by line.
  7695. @item columns
  7696. The views are packed by column.
  7697. @item frameseq
  7698. The views are temporally interleaved.
  7699. @end table
  7700. @end table
  7701. Some examples:
  7702. @example
  7703. # Convert left and right views into a frame-sequential video
  7704. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7705. # Convert views into a side-by-side video with the same output resolution as the input
  7706. 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
  7707. @end example
  7708. @section framerate
  7709. Change the frame rate by interpolating new video output frames from the source
  7710. frames.
  7711. This filter is not designed to function correctly with interlaced media. If
  7712. you wish to change the frame rate of interlaced media then you are required
  7713. to deinterlace before this filter and re-interlace after this filter.
  7714. A description of the accepted options follows.
  7715. @table @option
  7716. @item fps
  7717. Specify the output frames per second. This option can also be specified
  7718. as a value alone. The default is @code{50}.
  7719. @item interp_start
  7720. Specify the start of a range where the output frame will be created as a
  7721. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7722. the default is @code{15}.
  7723. @item interp_end
  7724. Specify the end of a range where the output frame will be created as a
  7725. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7726. the default is @code{240}.
  7727. @item scene
  7728. Specify the level at which a scene change is detected as a value between
  7729. 0 and 100 to indicate a new scene; a low value reflects a low
  7730. probability for the current frame to introduce a new scene, while a higher
  7731. value means the current frame is more likely to be one.
  7732. The default is @code{8.2}.
  7733. @item flags
  7734. Specify flags influencing the filter process.
  7735. Available value for @var{flags} is:
  7736. @table @option
  7737. @item scene_change_detect, scd
  7738. Enable scene change detection using the value of the option @var{scene}.
  7739. This flag is enabled by default.
  7740. @end table
  7741. @end table
  7742. @section framestep
  7743. Select one frame every N-th frame.
  7744. This filter accepts the following option:
  7745. @table @option
  7746. @item step
  7747. Select frame after every @code{step} frames.
  7748. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7749. @end table
  7750. @section freezedetect
  7751. Detect frozen video.
  7752. This filter logs a message and sets frame metadata when it detects that the
  7753. input video has no significant change in content during a specified duration.
  7754. Video freeze detection calculates the mean average absolute difference of all
  7755. the components of video frames and compares it to a noise floor.
  7756. The printed times and duration are expressed in seconds. The
  7757. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  7758. whose timestamp equals or exceeds the detection duration and it contains the
  7759. timestamp of the first frame of the freeze. The
  7760. @code{lavfi.freezedetect.freeze_duration} and
  7761. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  7762. after the freeze.
  7763. The filter accepts the following options:
  7764. @table @option
  7765. @item noise, n
  7766. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  7767. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  7768. 0.001.
  7769. @item duration, d
  7770. Set freeze duration until notification (default is 2 seconds).
  7771. @end table
  7772. @anchor{frei0r}
  7773. @section frei0r
  7774. Apply a frei0r effect to the input video.
  7775. To enable the compilation of this filter, you need to install the frei0r
  7776. header and configure FFmpeg with @code{--enable-frei0r}.
  7777. It accepts the following parameters:
  7778. @table @option
  7779. @item filter_name
  7780. The name of the frei0r effect to load. If the environment variable
  7781. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7782. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7783. Otherwise, the standard frei0r paths are searched, in this order:
  7784. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7785. @file{/usr/lib/frei0r-1/}.
  7786. @item filter_params
  7787. A '|'-separated list of parameters to pass to the frei0r effect.
  7788. @end table
  7789. A frei0r effect parameter can be a boolean (its value is either
  7790. "y" or "n"), a double, a color (specified as
  7791. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7792. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7793. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7794. a position (specified as @var{X}/@var{Y}, where
  7795. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7796. The number and types of parameters depend on the loaded effect. If an
  7797. effect parameter is not specified, the default value is set.
  7798. @subsection Examples
  7799. @itemize
  7800. @item
  7801. Apply the distort0r effect, setting the first two double parameters:
  7802. @example
  7803. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7804. @end example
  7805. @item
  7806. Apply the colordistance effect, taking a color as the first parameter:
  7807. @example
  7808. frei0r=colordistance:0.2/0.3/0.4
  7809. frei0r=colordistance:violet
  7810. frei0r=colordistance:0x112233
  7811. @end example
  7812. @item
  7813. Apply the perspective effect, specifying the top left and top right image
  7814. positions:
  7815. @example
  7816. frei0r=perspective:0.2/0.2|0.8/0.2
  7817. @end example
  7818. @end itemize
  7819. For more information, see
  7820. @url{http://frei0r.dyne.org}
  7821. @section fspp
  7822. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7823. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7824. processing filter, one of them is performed once per block, not per pixel.
  7825. This allows for much higher speed.
  7826. The filter accepts the following options:
  7827. @table @option
  7828. @item quality
  7829. Set quality. This option defines the number of levels for averaging. It accepts
  7830. an integer in the range 4-5. Default value is @code{4}.
  7831. @item qp
  7832. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7833. If not set, the filter will use the QP from the video stream (if available).
  7834. @item strength
  7835. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7836. more details but also more artifacts, while higher values make the image smoother
  7837. but also blurrier. Default value is @code{0} − PSNR optimal.
  7838. @item use_bframe_qp
  7839. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7840. option may cause flicker since the B-Frames have often larger QP. Default is
  7841. @code{0} (not enabled).
  7842. @end table
  7843. @section gblur
  7844. Apply Gaussian blur filter.
  7845. The filter accepts the following options:
  7846. @table @option
  7847. @item sigma
  7848. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7849. @item steps
  7850. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7851. @item planes
  7852. Set which planes to filter. By default all planes are filtered.
  7853. @item sigmaV
  7854. Set vertical sigma, if negative it will be same as @code{sigma}.
  7855. Default is @code{-1}.
  7856. @end table
  7857. @section geq
  7858. Apply generic equation to each pixel.
  7859. The filter accepts the following options:
  7860. @table @option
  7861. @item lum_expr, lum
  7862. Set the luminance expression.
  7863. @item cb_expr, cb
  7864. Set the chrominance blue expression.
  7865. @item cr_expr, cr
  7866. Set the chrominance red expression.
  7867. @item alpha_expr, a
  7868. Set the alpha expression.
  7869. @item red_expr, r
  7870. Set the red expression.
  7871. @item green_expr, g
  7872. Set the green expression.
  7873. @item blue_expr, b
  7874. Set the blue expression.
  7875. @end table
  7876. The colorspace is selected according to the specified options. If one
  7877. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7878. options is specified, the filter will automatically select a YCbCr
  7879. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7880. @option{blue_expr} options is specified, it will select an RGB
  7881. colorspace.
  7882. If one of the chrominance expression is not defined, it falls back on the other
  7883. one. If no alpha expression is specified it will evaluate to opaque value.
  7884. If none of chrominance expressions are specified, they will evaluate
  7885. to the luminance expression.
  7886. The expressions can use the following variables and functions:
  7887. @table @option
  7888. @item N
  7889. The sequential number of the filtered frame, starting from @code{0}.
  7890. @item X
  7891. @item Y
  7892. The coordinates of the current sample.
  7893. @item W
  7894. @item H
  7895. The width and height of the image.
  7896. @item SW
  7897. @item SH
  7898. Width and height scale depending on the currently filtered plane. It is the
  7899. ratio between the corresponding luma plane number of pixels and the current
  7900. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7901. @code{0.5,0.5} for chroma planes.
  7902. @item T
  7903. Time of the current frame, expressed in seconds.
  7904. @item p(x, y)
  7905. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7906. plane.
  7907. @item lum(x, y)
  7908. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7909. plane.
  7910. @item cb(x, y)
  7911. Return the value of the pixel at location (@var{x},@var{y}) of the
  7912. blue-difference chroma plane. Return 0 if there is no such plane.
  7913. @item cr(x, y)
  7914. Return the value of the pixel at location (@var{x},@var{y}) of the
  7915. red-difference chroma plane. Return 0 if there is no such plane.
  7916. @item r(x, y)
  7917. @item g(x, y)
  7918. @item b(x, y)
  7919. Return the value of the pixel at location (@var{x},@var{y}) of the
  7920. red/green/blue component. Return 0 if there is no such component.
  7921. @item alpha(x, y)
  7922. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7923. plane. Return 0 if there is no such plane.
  7924. @end table
  7925. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7926. automatically clipped to the closer edge.
  7927. @subsection Examples
  7928. @itemize
  7929. @item
  7930. Flip the image horizontally:
  7931. @example
  7932. geq=p(W-X\,Y)
  7933. @end example
  7934. @item
  7935. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7936. wavelength of 100 pixels:
  7937. @example
  7938. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7939. @end example
  7940. @item
  7941. Generate a fancy enigmatic moving light:
  7942. @example
  7943. 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
  7944. @end example
  7945. @item
  7946. Generate a quick emboss effect:
  7947. @example
  7948. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7949. @end example
  7950. @item
  7951. Modify RGB components depending on pixel position:
  7952. @example
  7953. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7954. @end example
  7955. @item
  7956. Create a radial gradient that is the same size as the input (also see
  7957. the @ref{vignette} filter):
  7958. @example
  7959. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7960. @end example
  7961. @end itemize
  7962. @section gradfun
  7963. Fix the banding artifacts that are sometimes introduced into nearly flat
  7964. regions by truncation to 8-bit color depth.
  7965. Interpolate the gradients that should go where the bands are, and
  7966. dither them.
  7967. It is designed for playback only. Do not use it prior to
  7968. lossy compression, because compression tends to lose the dither and
  7969. bring back the bands.
  7970. It accepts the following parameters:
  7971. @table @option
  7972. @item strength
  7973. The maximum amount by which the filter will change any one pixel. This is also
  7974. the threshold for detecting nearly flat regions. Acceptable values range from
  7975. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7976. valid range.
  7977. @item radius
  7978. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7979. gradients, but also prevents the filter from modifying the pixels near detailed
  7980. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7981. values will be clipped to the valid range.
  7982. @end table
  7983. Alternatively, the options can be specified as a flat string:
  7984. @var{strength}[:@var{radius}]
  7985. @subsection Examples
  7986. @itemize
  7987. @item
  7988. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7989. @example
  7990. gradfun=3.5:8
  7991. @end example
  7992. @item
  7993. Specify radius, omitting the strength (which will fall-back to the default
  7994. value):
  7995. @example
  7996. gradfun=radius=8
  7997. @end example
  7998. @end itemize
  7999. @section graphmonitor, agraphmonitor
  8000. Show various filtergraph stats.
  8001. With this filter one can debug complete filtergraph.
  8002. Especially issues with links filling with queued frames.
  8003. The filter accepts the following options:
  8004. @table @option
  8005. @item size, s
  8006. Set video output size. Default is @var{hd720}.
  8007. @item opacity, o
  8008. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8009. @item mode, m
  8010. Set output mode, can be @var{fulll} or @var{compact}.
  8011. In @var{compact} mode only filters with some queued frames have displayed stats.
  8012. @item flags, f
  8013. Set flags which enable which stats are shown in video.
  8014. Available values for flags are:
  8015. @table @samp
  8016. @item queue
  8017. Display number of queued frames in each link.
  8018. @item frame_count_in
  8019. Display number of frames taken from filter.
  8020. @item frame_count_out
  8021. Display number of frames given out from filter.
  8022. @item pts
  8023. Display current filtered frame pts.
  8024. @item time
  8025. Display current filtered frame time.
  8026. @item timebase
  8027. Display time base for filter link.
  8028. @item format
  8029. Display used format for filter link.
  8030. @item size
  8031. Display video size or number of audio channels in case of audio used by filter link.
  8032. @item rate
  8033. Display video frame rate or sample rate in case of audio used by filter link.
  8034. @end table
  8035. @item rate, r
  8036. Set upper limit for video rate of output stream, Default value is @var{25}.
  8037. This guarantee that output video frame rate will not be higher than this value.
  8038. @end table
  8039. @section greyedge
  8040. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8041. and corrects the scene colors accordingly.
  8042. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8043. The filter accepts the following options:
  8044. @table @option
  8045. @item difford
  8046. The order of differentiation to be applied on the scene. Must be chosen in the range
  8047. [0,2] and default value is 1.
  8048. @item minknorm
  8049. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8050. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8051. max value instead of calculating Minkowski distance.
  8052. @item sigma
  8053. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8054. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8055. can't be euqal to 0 if @var{difford} is greater than 0.
  8056. @end table
  8057. @subsection Examples
  8058. @itemize
  8059. @item
  8060. Grey Edge:
  8061. @example
  8062. greyedge=difford=1:minknorm=5:sigma=2
  8063. @end example
  8064. @item
  8065. Max Edge:
  8066. @example
  8067. greyedge=difford=1:minknorm=0:sigma=2
  8068. @end example
  8069. @end itemize
  8070. @anchor{haldclut}
  8071. @section haldclut
  8072. Apply a Hald CLUT to a video stream.
  8073. First input is the video stream to process, and second one is the Hald CLUT.
  8074. The Hald CLUT input can be a simple picture or a complete video stream.
  8075. The filter accepts the following options:
  8076. @table @option
  8077. @item shortest
  8078. Force termination when the shortest input terminates. Default is @code{0}.
  8079. @item repeatlast
  8080. Continue applying the last CLUT after the end of the stream. A value of
  8081. @code{0} disable the filter after the last frame of the CLUT is reached.
  8082. Default is @code{1}.
  8083. @end table
  8084. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8085. filters share the same internals).
  8086. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8087. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8088. @subsection Workflow examples
  8089. @subsubsection Hald CLUT video stream
  8090. Generate an identity Hald CLUT stream altered with various effects:
  8091. @example
  8092. 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
  8093. @end example
  8094. Note: make sure you use a lossless codec.
  8095. Then use it with @code{haldclut} to apply it on some random stream:
  8096. @example
  8097. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8098. @end example
  8099. The Hald CLUT will be applied to the 10 first seconds (duration of
  8100. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8101. to the remaining frames of the @code{mandelbrot} stream.
  8102. @subsubsection Hald CLUT with preview
  8103. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8104. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8105. biggest possible square starting at the top left of the picture. The remaining
  8106. padding pixels (bottom or right) will be ignored. This area can be used to add
  8107. a preview of the Hald CLUT.
  8108. Typically, the following generated Hald CLUT will be supported by the
  8109. @code{haldclut} filter:
  8110. @example
  8111. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8112. pad=iw+320 [padded_clut];
  8113. smptebars=s=320x256, split [a][b];
  8114. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8115. [main][b] overlay=W-320" -frames:v 1 clut.png
  8116. @end example
  8117. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8118. bars are displayed on the right-top, and below the same color bars processed by
  8119. the color changes.
  8120. Then, the effect of this Hald CLUT can be visualized with:
  8121. @example
  8122. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8123. @end example
  8124. @section hflip
  8125. Flip the input video horizontally.
  8126. For example, to horizontally flip the input video with @command{ffmpeg}:
  8127. @example
  8128. ffmpeg -i in.avi -vf "hflip" out.avi
  8129. @end example
  8130. @section histeq
  8131. This filter applies a global color histogram equalization on a
  8132. per-frame basis.
  8133. It can be used to correct video that has a compressed range of pixel
  8134. intensities. The filter redistributes the pixel intensities to
  8135. equalize their distribution across the intensity range. It may be
  8136. viewed as an "automatically adjusting contrast filter". This filter is
  8137. useful only for correcting degraded or poorly captured source
  8138. video.
  8139. The filter accepts the following options:
  8140. @table @option
  8141. @item strength
  8142. Determine the amount of equalization to be applied. As the strength
  8143. is reduced, the distribution of pixel intensities more-and-more
  8144. approaches that of the input frame. The value must be a float number
  8145. in the range [0,1] and defaults to 0.200.
  8146. @item intensity
  8147. Set the maximum intensity that can generated and scale the output
  8148. values appropriately. The strength should be set as desired and then
  8149. the intensity can be limited if needed to avoid washing-out. The value
  8150. must be a float number in the range [0,1] and defaults to 0.210.
  8151. @item antibanding
  8152. Set the antibanding level. If enabled the filter will randomly vary
  8153. the luminance of output pixels by a small amount to avoid banding of
  8154. the histogram. Possible values are @code{none}, @code{weak} or
  8155. @code{strong}. It defaults to @code{none}.
  8156. @end table
  8157. @section histogram
  8158. Compute and draw a color distribution histogram for the input video.
  8159. The computed histogram is a representation of the color component
  8160. distribution in an image.
  8161. Standard histogram displays the color components distribution in an image.
  8162. Displays color graph for each color component. Shows distribution of
  8163. the Y, U, V, A or R, G, B components, depending on input format, in the
  8164. current frame. Below each graph a color component scale meter is shown.
  8165. The filter accepts the following options:
  8166. @table @option
  8167. @item level_height
  8168. Set height of level. Default value is @code{200}.
  8169. Allowed range is [50, 2048].
  8170. @item scale_height
  8171. Set height of color scale. Default value is @code{12}.
  8172. Allowed range is [0, 40].
  8173. @item display_mode
  8174. Set display mode.
  8175. It accepts the following values:
  8176. @table @samp
  8177. @item stack
  8178. Per color component graphs are placed below each other.
  8179. @item parade
  8180. Per color component graphs are placed side by side.
  8181. @item overlay
  8182. Presents information identical to that in the @code{parade}, except
  8183. that the graphs representing color components are superimposed directly
  8184. over one another.
  8185. @end table
  8186. Default is @code{stack}.
  8187. @item levels_mode
  8188. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8189. Default is @code{linear}.
  8190. @item components
  8191. Set what color components to display.
  8192. Default is @code{7}.
  8193. @item fgopacity
  8194. Set foreground opacity. Default is @code{0.7}.
  8195. @item bgopacity
  8196. Set background opacity. Default is @code{0.5}.
  8197. @end table
  8198. @subsection Examples
  8199. @itemize
  8200. @item
  8201. Calculate and draw histogram:
  8202. @example
  8203. ffplay -i input -vf histogram
  8204. @end example
  8205. @end itemize
  8206. @anchor{hqdn3d}
  8207. @section hqdn3d
  8208. This is a high precision/quality 3d denoise filter. It aims to reduce
  8209. image noise, producing smooth images and making still images really
  8210. still. It should enhance compressibility.
  8211. It accepts the following optional parameters:
  8212. @table @option
  8213. @item luma_spatial
  8214. A non-negative floating point number which specifies spatial luma strength.
  8215. It defaults to 4.0.
  8216. @item chroma_spatial
  8217. A non-negative floating point number which specifies spatial chroma strength.
  8218. It defaults to 3.0*@var{luma_spatial}/4.0.
  8219. @item luma_tmp
  8220. A floating point number which specifies luma temporal strength. It defaults to
  8221. 6.0*@var{luma_spatial}/4.0.
  8222. @item chroma_tmp
  8223. A floating point number which specifies chroma temporal strength. It defaults to
  8224. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8225. @end table
  8226. @anchor{hwdownload}
  8227. @section hwdownload
  8228. Download hardware frames to system memory.
  8229. The input must be in hardware frames, and the output a non-hardware format.
  8230. Not all formats will be supported on the output - it may be necessary to insert
  8231. an additional @option{format} filter immediately following in the graph to get
  8232. the output in a supported format.
  8233. @section hwmap
  8234. Map hardware frames to system memory or to another device.
  8235. This filter has several different modes of operation; which one is used depends
  8236. on the input and output formats:
  8237. @itemize
  8238. @item
  8239. Hardware frame input, normal frame output
  8240. Map the input frames to system memory and pass them to the output. If the
  8241. original hardware frame is later required (for example, after overlaying
  8242. something else on part of it), the @option{hwmap} filter can be used again
  8243. in the next mode to retrieve it.
  8244. @item
  8245. Normal frame input, hardware frame output
  8246. If the input is actually a software-mapped hardware frame, then unmap it -
  8247. that is, return the original hardware frame.
  8248. Otherwise, a device must be provided. Create new hardware surfaces on that
  8249. device for the output, then map them back to the software format at the input
  8250. and give those frames to the preceding filter. This will then act like the
  8251. @option{hwupload} filter, but may be able to avoid an additional copy when
  8252. the input is already in a compatible format.
  8253. @item
  8254. Hardware frame input and output
  8255. A device must be supplied for the output, either directly or with the
  8256. @option{derive_device} option. The input and output devices must be of
  8257. different types and compatible - the exact meaning of this is
  8258. system-dependent, but typically it means that they must refer to the same
  8259. underlying hardware context (for example, refer to the same graphics card).
  8260. If the input frames were originally created on the output device, then unmap
  8261. to retrieve the original frames.
  8262. Otherwise, map the frames to the output device - create new hardware frames
  8263. on the output corresponding to the frames on the input.
  8264. @end itemize
  8265. The following additional parameters are accepted:
  8266. @table @option
  8267. @item mode
  8268. Set the frame mapping mode. Some combination of:
  8269. @table @var
  8270. @item read
  8271. The mapped frame should be readable.
  8272. @item write
  8273. The mapped frame should be writeable.
  8274. @item overwrite
  8275. The mapping will always overwrite the entire frame.
  8276. This may improve performance in some cases, as the original contents of the
  8277. frame need not be loaded.
  8278. @item direct
  8279. The mapping must not involve any copying.
  8280. Indirect mappings to copies of frames are created in some cases where either
  8281. direct mapping is not possible or it would have unexpected properties.
  8282. Setting this flag ensures that the mapping is direct and will fail if that is
  8283. not possible.
  8284. @end table
  8285. Defaults to @var{read+write} if not specified.
  8286. @item derive_device @var{type}
  8287. Rather than using the device supplied at initialisation, instead derive a new
  8288. device of type @var{type} from the device the input frames exist on.
  8289. @item reverse
  8290. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8291. and map them back to the source. This may be necessary in some cases where
  8292. a mapping in one direction is required but only the opposite direction is
  8293. supported by the devices being used.
  8294. This option is dangerous - it may break the preceding filter in undefined
  8295. ways if there are any additional constraints on that filter's output.
  8296. Do not use it without fully understanding the implications of its use.
  8297. @end table
  8298. @anchor{hwupload}
  8299. @section hwupload
  8300. Upload system memory frames to hardware surfaces.
  8301. The device to upload to must be supplied when the filter is initialised. If
  8302. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8303. option.
  8304. @anchor{hwupload_cuda}
  8305. @section hwupload_cuda
  8306. Upload system memory frames to a CUDA device.
  8307. It accepts the following optional parameters:
  8308. @table @option
  8309. @item device
  8310. The number of the CUDA device to use
  8311. @end table
  8312. @section hqx
  8313. Apply a high-quality magnification filter designed for pixel art. This filter
  8314. was originally created by Maxim Stepin.
  8315. It accepts the following option:
  8316. @table @option
  8317. @item n
  8318. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8319. @code{hq3x} and @code{4} for @code{hq4x}.
  8320. Default is @code{3}.
  8321. @end table
  8322. @section hstack
  8323. Stack input videos horizontally.
  8324. All streams must be of same pixel format and of same height.
  8325. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8326. to create same output.
  8327. The filter accept the following option:
  8328. @table @option
  8329. @item inputs
  8330. Set number of input streams. Default is 2.
  8331. @item shortest
  8332. If set to 1, force the output to terminate when the shortest input
  8333. terminates. Default value is 0.
  8334. @end table
  8335. @section hue
  8336. Modify the hue and/or the saturation of the input.
  8337. It accepts the following parameters:
  8338. @table @option
  8339. @item h
  8340. Specify the hue angle as a number of degrees. It accepts an expression,
  8341. and defaults to "0".
  8342. @item s
  8343. Specify the saturation in the [-10,10] range. It accepts an expression and
  8344. defaults to "1".
  8345. @item H
  8346. Specify the hue angle as a number of radians. It accepts an
  8347. expression, and defaults to "0".
  8348. @item b
  8349. Specify the brightness in the [-10,10] range. It accepts an expression and
  8350. defaults to "0".
  8351. @end table
  8352. @option{h} and @option{H} are mutually exclusive, and can't be
  8353. specified at the same time.
  8354. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8355. expressions containing the following constants:
  8356. @table @option
  8357. @item n
  8358. frame count of the input frame starting from 0
  8359. @item pts
  8360. presentation timestamp of the input frame expressed in time base units
  8361. @item r
  8362. frame rate of the input video, NAN if the input frame rate is unknown
  8363. @item t
  8364. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8365. @item tb
  8366. time base of the input video
  8367. @end table
  8368. @subsection Examples
  8369. @itemize
  8370. @item
  8371. Set the hue to 90 degrees and the saturation to 1.0:
  8372. @example
  8373. hue=h=90:s=1
  8374. @end example
  8375. @item
  8376. Same command but expressing the hue in radians:
  8377. @example
  8378. hue=H=PI/2:s=1
  8379. @end example
  8380. @item
  8381. Rotate hue and make the saturation swing between 0
  8382. and 2 over a period of 1 second:
  8383. @example
  8384. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8385. @end example
  8386. @item
  8387. Apply a 3 seconds saturation fade-in effect starting at 0:
  8388. @example
  8389. hue="s=min(t/3\,1)"
  8390. @end example
  8391. The general fade-in expression can be written as:
  8392. @example
  8393. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8394. @end example
  8395. @item
  8396. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8397. @example
  8398. hue="s=max(0\, min(1\, (8-t)/3))"
  8399. @end example
  8400. The general fade-out expression can be written as:
  8401. @example
  8402. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8403. @end example
  8404. @end itemize
  8405. @subsection Commands
  8406. This filter supports the following commands:
  8407. @table @option
  8408. @item b
  8409. @item s
  8410. @item h
  8411. @item H
  8412. Modify the hue and/or the saturation and/or brightness of the input video.
  8413. The command accepts the same syntax of the corresponding option.
  8414. If the specified expression is not valid, it is kept at its current
  8415. value.
  8416. @end table
  8417. @section hysteresis
  8418. Grow first stream into second stream by connecting components.
  8419. This makes it possible to build more robust edge masks.
  8420. This filter accepts the following options:
  8421. @table @option
  8422. @item planes
  8423. Set which planes will be processed as bitmap, unprocessed planes will be
  8424. copied from first stream.
  8425. By default value 0xf, all planes will be processed.
  8426. @item threshold
  8427. Set threshold which is used in filtering. If pixel component value is higher than
  8428. this value filter algorithm for connecting components is activated.
  8429. By default value is 0.
  8430. @end table
  8431. @section idet
  8432. Detect video interlacing type.
  8433. This filter tries to detect if the input frames are interlaced, progressive,
  8434. top or bottom field first. It will also try to detect fields that are
  8435. repeated between adjacent frames (a sign of telecine).
  8436. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8437. Multiple frame detection incorporates the classification history of previous frames.
  8438. The filter will log these metadata values:
  8439. @table @option
  8440. @item single.current_frame
  8441. Detected type of current frame using single-frame detection. One of:
  8442. ``tff'' (top field first), ``bff'' (bottom field first),
  8443. ``progressive'', or ``undetermined''
  8444. @item single.tff
  8445. Cumulative number of frames detected as top field first using single-frame detection.
  8446. @item multiple.tff
  8447. Cumulative number of frames detected as top field first using multiple-frame detection.
  8448. @item single.bff
  8449. Cumulative number of frames detected as bottom field first using single-frame detection.
  8450. @item multiple.current_frame
  8451. Detected type of current frame using multiple-frame detection. One of:
  8452. ``tff'' (top field first), ``bff'' (bottom field first),
  8453. ``progressive'', or ``undetermined''
  8454. @item multiple.bff
  8455. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8456. @item single.progressive
  8457. Cumulative number of frames detected as progressive using single-frame detection.
  8458. @item multiple.progressive
  8459. Cumulative number of frames detected as progressive using multiple-frame detection.
  8460. @item single.undetermined
  8461. Cumulative number of frames that could not be classified using single-frame detection.
  8462. @item multiple.undetermined
  8463. Cumulative number of frames that could not be classified using multiple-frame detection.
  8464. @item repeated.current_frame
  8465. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8466. @item repeated.neither
  8467. Cumulative number of frames with no repeated field.
  8468. @item repeated.top
  8469. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8470. @item repeated.bottom
  8471. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8472. @end table
  8473. The filter accepts the following options:
  8474. @table @option
  8475. @item intl_thres
  8476. Set interlacing threshold.
  8477. @item prog_thres
  8478. Set progressive threshold.
  8479. @item rep_thres
  8480. Threshold for repeated field detection.
  8481. @item half_life
  8482. Number of frames after which a given frame's contribution to the
  8483. statistics is halved (i.e., it contributes only 0.5 to its
  8484. classification). The default of 0 means that all frames seen are given
  8485. full weight of 1.0 forever.
  8486. @item analyze_interlaced_flag
  8487. When this is not 0 then idet will use the specified number of frames to determine
  8488. if the interlaced flag is accurate, it will not count undetermined frames.
  8489. If the flag is found to be accurate it will be used without any further
  8490. computations, if it is found to be inaccurate it will be cleared without any
  8491. further computations. This allows inserting the idet filter as a low computational
  8492. method to clean up the interlaced flag
  8493. @end table
  8494. @section il
  8495. Deinterleave or interleave fields.
  8496. This filter allows one to process interlaced images fields without
  8497. deinterlacing them. Deinterleaving splits the input frame into 2
  8498. fields (so called half pictures). Odd lines are moved to the top
  8499. half of the output image, even lines to the bottom half.
  8500. You can process (filter) them independently and then re-interleave them.
  8501. The filter accepts the following options:
  8502. @table @option
  8503. @item luma_mode, l
  8504. @item chroma_mode, c
  8505. @item alpha_mode, a
  8506. Available values for @var{luma_mode}, @var{chroma_mode} and
  8507. @var{alpha_mode} are:
  8508. @table @samp
  8509. @item none
  8510. Do nothing.
  8511. @item deinterleave, d
  8512. Deinterleave fields, placing one above the other.
  8513. @item interleave, i
  8514. Interleave fields. Reverse the effect of deinterleaving.
  8515. @end table
  8516. Default value is @code{none}.
  8517. @item luma_swap, ls
  8518. @item chroma_swap, cs
  8519. @item alpha_swap, as
  8520. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8521. @end table
  8522. @section inflate
  8523. Apply inflate effect to the video.
  8524. This filter replaces the pixel by the local(3x3) average by taking into account
  8525. only values higher than the pixel.
  8526. It accepts the following options:
  8527. @table @option
  8528. @item threshold0
  8529. @item threshold1
  8530. @item threshold2
  8531. @item threshold3
  8532. Limit the maximum change for each plane, default is 65535.
  8533. If 0, plane will remain unchanged.
  8534. @end table
  8535. @section interlace
  8536. Simple interlacing filter from progressive contents. This interleaves upper (or
  8537. lower) lines from odd frames with lower (or upper) lines from even frames,
  8538. halving the frame rate and preserving image height.
  8539. @example
  8540. Original Original New Frame
  8541. Frame 'j' Frame 'j+1' (tff)
  8542. ========== =========== ==================
  8543. Line 0 --------------------> Frame 'j' Line 0
  8544. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8545. Line 2 ---------------------> Frame 'j' Line 2
  8546. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8547. ... ... ...
  8548. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8549. @end example
  8550. It accepts the following optional parameters:
  8551. @table @option
  8552. @item scan
  8553. This determines whether the interlaced frame is taken from the even
  8554. (tff - default) or odd (bff) lines of the progressive frame.
  8555. @item lowpass
  8556. Vertical lowpass filter to avoid twitter interlacing and
  8557. reduce moire patterns.
  8558. @table @samp
  8559. @item 0, off
  8560. Disable vertical lowpass filter
  8561. @item 1, linear
  8562. Enable linear filter (default)
  8563. @item 2, complex
  8564. Enable complex filter. This will slightly less reduce twitter and moire
  8565. but better retain detail and subjective sharpness impression.
  8566. @end table
  8567. @end table
  8568. @section kerndeint
  8569. Deinterlace input video by applying Donald Graft's adaptive kernel
  8570. deinterling. Work on interlaced parts of a video to produce
  8571. progressive frames.
  8572. The description of the accepted parameters follows.
  8573. @table @option
  8574. @item thresh
  8575. Set the threshold which affects the filter's tolerance when
  8576. determining if a pixel line must be processed. It must be an integer
  8577. in the range [0,255] and defaults to 10. A value of 0 will result in
  8578. applying the process on every pixels.
  8579. @item map
  8580. Paint pixels exceeding the threshold value to white if set to 1.
  8581. Default is 0.
  8582. @item order
  8583. Set the fields order. Swap fields if set to 1, leave fields alone if
  8584. 0. Default is 0.
  8585. @item sharp
  8586. Enable additional sharpening if set to 1. Default is 0.
  8587. @item twoway
  8588. Enable twoway sharpening if set to 1. Default is 0.
  8589. @end table
  8590. @subsection Examples
  8591. @itemize
  8592. @item
  8593. Apply default values:
  8594. @example
  8595. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8596. @end example
  8597. @item
  8598. Enable additional sharpening:
  8599. @example
  8600. kerndeint=sharp=1
  8601. @end example
  8602. @item
  8603. Paint processed pixels in white:
  8604. @example
  8605. kerndeint=map=1
  8606. @end example
  8607. @end itemize
  8608. @section lenscorrection
  8609. Correct radial lens distortion
  8610. This filter can be used to correct for radial distortion as can result from the use
  8611. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8612. one can use tools available for example as part of opencv or simply trial-and-error.
  8613. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8614. and extract the k1 and k2 coefficients from the resulting matrix.
  8615. Note that effectively the same filter is available in the open-source tools Krita and
  8616. Digikam from the KDE project.
  8617. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8618. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8619. brightness distribution, so you may want to use both filters together in certain
  8620. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8621. be applied before or after lens correction.
  8622. @subsection Options
  8623. The filter accepts the following options:
  8624. @table @option
  8625. @item cx
  8626. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8627. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8628. width. Default is 0.5.
  8629. @item cy
  8630. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8631. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8632. height. Default is 0.5.
  8633. @item k1
  8634. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8635. no correction. Default is 0.
  8636. @item k2
  8637. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8638. 0 means no correction. Default is 0.
  8639. @end table
  8640. The formula that generates the correction is:
  8641. @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)
  8642. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8643. distances from the focal point in the source and target images, respectively.
  8644. @section lensfun
  8645. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8646. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8647. to apply the lens correction. The filter will load the lensfun database and
  8648. query it to find the corresponding camera and lens entries in the database. As
  8649. long as these entries can be found with the given options, the filter can
  8650. perform corrections on frames. Note that incomplete strings will result in the
  8651. filter choosing the best match with the given options, and the filter will
  8652. output the chosen camera and lens models (logged with level "info"). You must
  8653. provide the make, camera model, and lens model as they are required.
  8654. The filter accepts the following options:
  8655. @table @option
  8656. @item make
  8657. The make of the camera (for example, "Canon"). This option is required.
  8658. @item model
  8659. The model of the camera (for example, "Canon EOS 100D"). This option is
  8660. required.
  8661. @item lens_model
  8662. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8663. option is required.
  8664. @item mode
  8665. The type of correction to apply. The following values are valid options:
  8666. @table @samp
  8667. @item vignetting
  8668. Enables fixing lens vignetting.
  8669. @item geometry
  8670. Enables fixing lens geometry. This is the default.
  8671. @item subpixel
  8672. Enables fixing chromatic aberrations.
  8673. @item vig_geo
  8674. Enables fixing lens vignetting and lens geometry.
  8675. @item vig_subpixel
  8676. Enables fixing lens vignetting and chromatic aberrations.
  8677. @item distortion
  8678. Enables fixing both lens geometry and chromatic aberrations.
  8679. @item all
  8680. Enables all possible corrections.
  8681. @end table
  8682. @item focal_length
  8683. The focal length of the image/video (zoom; expected constant for video). For
  8684. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8685. range should be chosen when using that lens. Default 18.
  8686. @item aperture
  8687. The aperture of the image/video (expected constant for video). Note that
  8688. aperture is only used for vignetting correction. Default 3.5.
  8689. @item focus_distance
  8690. The focus distance of the image/video (expected constant for video). Note that
  8691. focus distance is only used for vignetting and only slightly affects the
  8692. vignetting correction process. If unknown, leave it at the default value (which
  8693. is 1000).
  8694. @item target_geometry
  8695. The target geometry of the output image/video. The following values are valid
  8696. options:
  8697. @table @samp
  8698. @item rectilinear (default)
  8699. @item fisheye
  8700. @item panoramic
  8701. @item equirectangular
  8702. @item fisheye_orthographic
  8703. @item fisheye_stereographic
  8704. @item fisheye_equisolid
  8705. @item fisheye_thoby
  8706. @end table
  8707. @item reverse
  8708. Apply the reverse of image correction (instead of correcting distortion, apply
  8709. it).
  8710. @item interpolation
  8711. The type of interpolation used when correcting distortion. The following values
  8712. are valid options:
  8713. @table @samp
  8714. @item nearest
  8715. @item linear (default)
  8716. @item lanczos
  8717. @end table
  8718. @end table
  8719. @subsection Examples
  8720. @itemize
  8721. @item
  8722. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  8723. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  8724. aperture of "8.0".
  8725. @example
  8726. 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
  8727. @end example
  8728. @item
  8729. Apply the same as before, but only for the first 5 seconds of video.
  8730. @example
  8731. 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
  8732. @end example
  8733. @end itemize
  8734. @section libvmaf
  8735. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8736. score between two input videos.
  8737. The obtained VMAF score is printed through the logging system.
  8738. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8739. After installing the library it can be enabled using:
  8740. @code{./configure --enable-libvmaf --enable-version3}.
  8741. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8742. The filter has following options:
  8743. @table @option
  8744. @item model_path
  8745. Set the model path which is to be used for SVM.
  8746. Default value: @code{"vmaf_v0.6.1.pkl"}
  8747. @item log_path
  8748. Set the file path to be used to store logs.
  8749. @item log_fmt
  8750. Set the format of the log file (xml or json).
  8751. @item enable_transform
  8752. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  8753. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  8754. Default value: @code{false}
  8755. @item phone_model
  8756. Invokes the phone model which will generate VMAF scores higher than in the
  8757. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8758. @item psnr
  8759. Enables computing psnr along with vmaf.
  8760. @item ssim
  8761. Enables computing ssim along with vmaf.
  8762. @item ms_ssim
  8763. Enables computing ms_ssim along with vmaf.
  8764. @item pool
  8765. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8766. @item n_threads
  8767. Set number of threads to be used when computing vmaf.
  8768. @item n_subsample
  8769. Set interval for frame subsampling used when computing vmaf.
  8770. @item enable_conf_interval
  8771. Enables confidence interval.
  8772. @end table
  8773. This filter also supports the @ref{framesync} options.
  8774. On the below examples the input file @file{main.mpg} being processed is
  8775. compared with the reference file @file{ref.mpg}.
  8776. @example
  8777. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8778. @end example
  8779. Example with options:
  8780. @example
  8781. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  8782. @end example
  8783. @section limiter
  8784. Limits the pixel components values to the specified range [min, max].
  8785. The filter accepts the following options:
  8786. @table @option
  8787. @item min
  8788. Lower bound. Defaults to the lowest allowed value for the input.
  8789. @item max
  8790. Upper bound. Defaults to the highest allowed value for the input.
  8791. @item planes
  8792. Specify which planes will be processed. Defaults to all available.
  8793. @end table
  8794. @section loop
  8795. Loop video frames.
  8796. The filter accepts the following options:
  8797. @table @option
  8798. @item loop
  8799. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8800. Default is 0.
  8801. @item size
  8802. Set maximal size in number of frames. Default is 0.
  8803. @item start
  8804. Set first frame of loop. Default is 0.
  8805. @end table
  8806. @subsection Examples
  8807. @itemize
  8808. @item
  8809. Loop single first frame infinitely:
  8810. @example
  8811. loop=loop=-1:size=1:start=0
  8812. @end example
  8813. @item
  8814. Loop single first frame 10 times:
  8815. @example
  8816. loop=loop=10:size=1:start=0
  8817. @end example
  8818. @item
  8819. Loop 10 first frames 5 times:
  8820. @example
  8821. loop=loop=5:size=10:start=0
  8822. @end example
  8823. @end itemize
  8824. @section lut1d
  8825. Apply a 1D LUT to an input video.
  8826. The filter accepts the following options:
  8827. @table @option
  8828. @item file
  8829. Set the 1D LUT file name.
  8830. Currently supported formats:
  8831. @table @samp
  8832. @item cube
  8833. Iridas
  8834. @end table
  8835. @item interp
  8836. Select interpolation mode.
  8837. Available values are:
  8838. @table @samp
  8839. @item nearest
  8840. Use values from the nearest defined point.
  8841. @item linear
  8842. Interpolate values using the linear interpolation.
  8843. @item cosine
  8844. Interpolate values using the cosine interpolation.
  8845. @item cubic
  8846. Interpolate values using the cubic interpolation.
  8847. @item spline
  8848. Interpolate values using the spline interpolation.
  8849. @end table
  8850. @end table
  8851. @anchor{lut3d}
  8852. @section lut3d
  8853. Apply a 3D LUT to an input video.
  8854. The filter accepts the following options:
  8855. @table @option
  8856. @item file
  8857. Set the 3D LUT file name.
  8858. Currently supported formats:
  8859. @table @samp
  8860. @item 3dl
  8861. AfterEffects
  8862. @item cube
  8863. Iridas
  8864. @item dat
  8865. DaVinci
  8866. @item m3d
  8867. Pandora
  8868. @end table
  8869. @item interp
  8870. Select interpolation mode.
  8871. Available values are:
  8872. @table @samp
  8873. @item nearest
  8874. Use values from the nearest defined point.
  8875. @item trilinear
  8876. Interpolate values using the 8 points defining a cube.
  8877. @item tetrahedral
  8878. Interpolate values using a tetrahedron.
  8879. @end table
  8880. @end table
  8881. This filter also supports the @ref{framesync} options.
  8882. @section lumakey
  8883. Turn certain luma values into transparency.
  8884. The filter accepts the following options:
  8885. @table @option
  8886. @item threshold
  8887. Set the luma which will be used as base for transparency.
  8888. Default value is @code{0}.
  8889. @item tolerance
  8890. Set the range of luma values to be keyed out.
  8891. Default value is @code{0}.
  8892. @item softness
  8893. Set the range of softness. Default value is @code{0}.
  8894. Use this to control gradual transition from zero to full transparency.
  8895. @end table
  8896. @section lut, lutrgb, lutyuv
  8897. Compute a look-up table for binding each pixel component input value
  8898. to an output value, and apply it to the input video.
  8899. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8900. to an RGB input video.
  8901. These filters accept the following parameters:
  8902. @table @option
  8903. @item c0
  8904. set first pixel component expression
  8905. @item c1
  8906. set second pixel component expression
  8907. @item c2
  8908. set third pixel component expression
  8909. @item c3
  8910. set fourth pixel component expression, corresponds to the alpha component
  8911. @item r
  8912. set red component expression
  8913. @item g
  8914. set green component expression
  8915. @item b
  8916. set blue component expression
  8917. @item a
  8918. alpha component expression
  8919. @item y
  8920. set Y/luminance component expression
  8921. @item u
  8922. set U/Cb component expression
  8923. @item v
  8924. set V/Cr component expression
  8925. @end table
  8926. Each of them specifies the expression to use for computing the lookup table for
  8927. the corresponding pixel component values.
  8928. The exact component associated to each of the @var{c*} options depends on the
  8929. format in input.
  8930. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8931. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8932. The expressions can contain the following constants and functions:
  8933. @table @option
  8934. @item w
  8935. @item h
  8936. The input width and height.
  8937. @item val
  8938. The input value for the pixel component.
  8939. @item clipval
  8940. The input value, clipped to the @var{minval}-@var{maxval} range.
  8941. @item maxval
  8942. The maximum value for the pixel component.
  8943. @item minval
  8944. The minimum value for the pixel component.
  8945. @item negval
  8946. The negated value for the pixel component value, clipped to the
  8947. @var{minval}-@var{maxval} range; it corresponds to the expression
  8948. "maxval-clipval+minval".
  8949. @item clip(val)
  8950. The computed value in @var{val}, clipped to the
  8951. @var{minval}-@var{maxval} range.
  8952. @item gammaval(gamma)
  8953. The computed gamma correction value of the pixel component value,
  8954. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8955. expression
  8956. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8957. @end table
  8958. All expressions default to "val".
  8959. @subsection Examples
  8960. @itemize
  8961. @item
  8962. Negate input video:
  8963. @example
  8964. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8965. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8966. @end example
  8967. The above is the same as:
  8968. @example
  8969. lutrgb="r=negval:g=negval:b=negval"
  8970. lutyuv="y=negval:u=negval:v=negval"
  8971. @end example
  8972. @item
  8973. Negate luminance:
  8974. @example
  8975. lutyuv=y=negval
  8976. @end example
  8977. @item
  8978. Remove chroma components, turning the video into a graytone image:
  8979. @example
  8980. lutyuv="u=128:v=128"
  8981. @end example
  8982. @item
  8983. Apply a luma burning effect:
  8984. @example
  8985. lutyuv="y=2*val"
  8986. @end example
  8987. @item
  8988. Remove green and blue components:
  8989. @example
  8990. lutrgb="g=0:b=0"
  8991. @end example
  8992. @item
  8993. Set a constant alpha channel value on input:
  8994. @example
  8995. format=rgba,lutrgb=a="maxval-minval/2"
  8996. @end example
  8997. @item
  8998. Correct luminance gamma by a factor of 0.5:
  8999. @example
  9000. lutyuv=y=gammaval(0.5)
  9001. @end example
  9002. @item
  9003. Discard least significant bits of luma:
  9004. @example
  9005. lutyuv=y='bitand(val, 128+64+32)'
  9006. @end example
  9007. @item
  9008. Technicolor like effect:
  9009. @example
  9010. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9011. @end example
  9012. @end itemize
  9013. @section lut2, tlut2
  9014. The @code{lut2} filter takes two input streams and outputs one
  9015. stream.
  9016. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9017. from one single stream.
  9018. This filter accepts the following parameters:
  9019. @table @option
  9020. @item c0
  9021. set first pixel component expression
  9022. @item c1
  9023. set second pixel component expression
  9024. @item c2
  9025. set third pixel component expression
  9026. @item c3
  9027. set fourth pixel component expression, corresponds to the alpha component
  9028. @item d
  9029. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9030. which means bit depth is automatically picked from first input format.
  9031. @end table
  9032. Each of them specifies the expression to use for computing the lookup table for
  9033. the corresponding pixel component values.
  9034. The exact component associated to each of the @var{c*} options depends on the
  9035. format in inputs.
  9036. The expressions can contain the following constants:
  9037. @table @option
  9038. @item w
  9039. @item h
  9040. The input width and height.
  9041. @item x
  9042. The first input value for the pixel component.
  9043. @item y
  9044. The second input value for the pixel component.
  9045. @item bdx
  9046. The first input video bit depth.
  9047. @item bdy
  9048. The second input video bit depth.
  9049. @end table
  9050. All expressions default to "x".
  9051. @subsection Examples
  9052. @itemize
  9053. @item
  9054. Highlight differences between two RGB video streams:
  9055. @example
  9056. 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)'
  9057. @end example
  9058. @item
  9059. Highlight differences between two YUV video streams:
  9060. @example
  9061. 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)'
  9062. @end example
  9063. @item
  9064. Show max difference between two video streams:
  9065. @example
  9066. 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)))'
  9067. @end example
  9068. @end itemize
  9069. @section maskedclamp
  9070. Clamp the first input stream with the second input and third input stream.
  9071. Returns the value of first stream to be between second input
  9072. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9073. This filter accepts the following options:
  9074. @table @option
  9075. @item undershoot
  9076. Default value is @code{0}.
  9077. @item overshoot
  9078. Default value is @code{0}.
  9079. @item planes
  9080. Set which planes will be processed as bitmap, unprocessed planes will be
  9081. copied from first stream.
  9082. By default value 0xf, all planes will be processed.
  9083. @end table
  9084. @section maskedmerge
  9085. Merge the first input stream with the second input stream using per pixel
  9086. weights in the third input stream.
  9087. A value of 0 in the third stream pixel component means that pixel component
  9088. from first stream is returned unchanged, while maximum value (eg. 255 for
  9089. 8-bit videos) means that pixel component from second stream is returned
  9090. unchanged. Intermediate values define the amount of merging between both
  9091. input stream's pixel components.
  9092. This filter accepts the following options:
  9093. @table @option
  9094. @item planes
  9095. Set which planes will be processed as bitmap, unprocessed planes will be
  9096. copied from first stream.
  9097. By default value 0xf, all planes will be processed.
  9098. @end table
  9099. @section mcdeint
  9100. Apply motion-compensation deinterlacing.
  9101. It needs one field per frame as input and must thus be used together
  9102. with yadif=1/3 or equivalent.
  9103. This filter accepts the following options:
  9104. @table @option
  9105. @item mode
  9106. Set the deinterlacing mode.
  9107. It accepts one of the following values:
  9108. @table @samp
  9109. @item fast
  9110. @item medium
  9111. @item slow
  9112. use iterative motion estimation
  9113. @item extra_slow
  9114. like @samp{slow}, but use multiple reference frames.
  9115. @end table
  9116. Default value is @samp{fast}.
  9117. @item parity
  9118. Set the picture field parity assumed for the input video. It must be
  9119. one of the following values:
  9120. @table @samp
  9121. @item 0, tff
  9122. assume top field first
  9123. @item 1, bff
  9124. assume bottom field first
  9125. @end table
  9126. Default value is @samp{bff}.
  9127. @item qp
  9128. Set per-block quantization parameter (QP) used by the internal
  9129. encoder.
  9130. Higher values should result in a smoother motion vector field but less
  9131. optimal individual vectors. Default value is 1.
  9132. @end table
  9133. @section mergeplanes
  9134. Merge color channel components from several video streams.
  9135. The filter accepts up to 4 input streams, and merge selected input
  9136. planes to the output video.
  9137. This filter accepts the following options:
  9138. @table @option
  9139. @item mapping
  9140. Set input to output plane mapping. Default is @code{0}.
  9141. The mappings is specified as a bitmap. It should be specified as a
  9142. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9143. mapping for the first plane of the output stream. 'A' sets the number of
  9144. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9145. corresponding input to use (from 0 to 3). The rest of the mappings is
  9146. similar, 'Bb' describes the mapping for the output stream second
  9147. plane, 'Cc' describes the mapping for the output stream third plane and
  9148. 'Dd' describes the mapping for the output stream fourth plane.
  9149. @item format
  9150. Set output pixel format. Default is @code{yuva444p}.
  9151. @end table
  9152. @subsection Examples
  9153. @itemize
  9154. @item
  9155. Merge three gray video streams of same width and height into single video stream:
  9156. @example
  9157. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9158. @end example
  9159. @item
  9160. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9161. @example
  9162. [a0][a1]mergeplanes=0x00010210:yuva444p
  9163. @end example
  9164. @item
  9165. Swap Y and A plane in yuva444p stream:
  9166. @example
  9167. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9168. @end example
  9169. @item
  9170. Swap U and V plane in yuv420p stream:
  9171. @example
  9172. format=yuv420p,mergeplanes=0x000201:yuv420p
  9173. @end example
  9174. @item
  9175. Cast a rgb24 clip to yuv444p:
  9176. @example
  9177. format=rgb24,mergeplanes=0x000102:yuv444p
  9178. @end example
  9179. @end itemize
  9180. @section mestimate
  9181. Estimate and export motion vectors using block matching algorithms.
  9182. Motion vectors are stored in frame side data to be used by other filters.
  9183. This filter accepts the following options:
  9184. @table @option
  9185. @item method
  9186. Specify the motion estimation method. Accepts one of the following values:
  9187. @table @samp
  9188. @item esa
  9189. Exhaustive search algorithm.
  9190. @item tss
  9191. Three step search algorithm.
  9192. @item tdls
  9193. Two dimensional logarithmic search algorithm.
  9194. @item ntss
  9195. New three step search algorithm.
  9196. @item fss
  9197. Four step search algorithm.
  9198. @item ds
  9199. Diamond search algorithm.
  9200. @item hexbs
  9201. Hexagon-based search algorithm.
  9202. @item epzs
  9203. Enhanced predictive zonal search algorithm.
  9204. @item umh
  9205. Uneven multi-hexagon search algorithm.
  9206. @end table
  9207. Default value is @samp{esa}.
  9208. @item mb_size
  9209. Macroblock size. Default @code{16}.
  9210. @item search_param
  9211. Search parameter. Default @code{7}.
  9212. @end table
  9213. @section midequalizer
  9214. Apply Midway Image Equalization effect using two video streams.
  9215. Midway Image Equalization adjusts a pair of images to have the same
  9216. histogram, while maintaining their dynamics as much as possible. It's
  9217. useful for e.g. matching exposures from a pair of stereo cameras.
  9218. This filter has two inputs and one output, which must be of same pixel format, but
  9219. may be of different sizes. The output of filter is first input adjusted with
  9220. midway histogram of both inputs.
  9221. This filter accepts the following option:
  9222. @table @option
  9223. @item planes
  9224. Set which planes to process. Default is @code{15}, which is all available planes.
  9225. @end table
  9226. @section minterpolate
  9227. Convert the video to specified frame rate using motion interpolation.
  9228. This filter accepts the following options:
  9229. @table @option
  9230. @item fps
  9231. 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}.
  9232. @item mi_mode
  9233. Motion interpolation mode. Following values are accepted:
  9234. @table @samp
  9235. @item dup
  9236. Duplicate previous or next frame for interpolating new ones.
  9237. @item blend
  9238. Blend source frames. Interpolated frame is mean of previous and next frames.
  9239. @item mci
  9240. Motion compensated interpolation. Following options are effective when this mode is selected:
  9241. @table @samp
  9242. @item mc_mode
  9243. Motion compensation mode. Following values are accepted:
  9244. @table @samp
  9245. @item obmc
  9246. Overlapped block motion compensation.
  9247. @item aobmc
  9248. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9249. @end table
  9250. Default mode is @samp{obmc}.
  9251. @item me_mode
  9252. Motion estimation mode. Following values are accepted:
  9253. @table @samp
  9254. @item bidir
  9255. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9256. @item bilat
  9257. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9258. @end table
  9259. Default mode is @samp{bilat}.
  9260. @item me
  9261. The algorithm to be used for motion estimation. Following values are accepted:
  9262. @table @samp
  9263. @item esa
  9264. Exhaustive search algorithm.
  9265. @item tss
  9266. Three step search algorithm.
  9267. @item tdls
  9268. Two dimensional logarithmic search algorithm.
  9269. @item ntss
  9270. New three step search algorithm.
  9271. @item fss
  9272. Four step search algorithm.
  9273. @item ds
  9274. Diamond search algorithm.
  9275. @item hexbs
  9276. Hexagon-based search algorithm.
  9277. @item epzs
  9278. Enhanced predictive zonal search algorithm.
  9279. @item umh
  9280. Uneven multi-hexagon search algorithm.
  9281. @end table
  9282. Default algorithm is @samp{epzs}.
  9283. @item mb_size
  9284. Macroblock size. Default @code{16}.
  9285. @item search_param
  9286. Motion estimation search parameter. Default @code{32}.
  9287. @item vsbmc
  9288. 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).
  9289. @end table
  9290. @end table
  9291. @item scd
  9292. 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:
  9293. @table @samp
  9294. @item none
  9295. Disable scene change detection.
  9296. @item fdiff
  9297. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9298. @end table
  9299. Default method is @samp{fdiff}.
  9300. @item scd_threshold
  9301. Scene change detection threshold. Default is @code{5.0}.
  9302. @end table
  9303. @section mix
  9304. Mix several video input streams into one video stream.
  9305. A description of the accepted options follows.
  9306. @table @option
  9307. @item nb_inputs
  9308. The number of inputs. If unspecified, it defaults to 2.
  9309. @item weights
  9310. Specify weight of each input video stream as sequence.
  9311. Each weight is separated by space. If number of weights
  9312. is smaller than number of @var{frames} last specified
  9313. weight will be used for all remaining unset weights.
  9314. @item scale
  9315. Specify scale, if it is set it will be multiplied with sum
  9316. of each weight multiplied with pixel values to give final destination
  9317. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9318. @item duration
  9319. Specify how end of stream is determined.
  9320. @table @samp
  9321. @item longest
  9322. The duration of the longest input. (default)
  9323. @item shortest
  9324. The duration of the shortest input.
  9325. @item first
  9326. The duration of the first input.
  9327. @end table
  9328. @end table
  9329. @section mpdecimate
  9330. Drop frames that do not differ greatly from the previous frame in
  9331. order to reduce frame rate.
  9332. The main use of this filter is for very-low-bitrate encoding
  9333. (e.g. streaming over dialup modem), but it could in theory be used for
  9334. fixing movies that were inverse-telecined incorrectly.
  9335. A description of the accepted options follows.
  9336. @table @option
  9337. @item max
  9338. Set the maximum number of consecutive frames which can be dropped (if
  9339. positive), or the minimum interval between dropped frames (if
  9340. negative). If the value is 0, the frame is dropped disregarding the
  9341. number of previous sequentially dropped frames.
  9342. Default value is 0.
  9343. @item hi
  9344. @item lo
  9345. @item frac
  9346. Set the dropping threshold values.
  9347. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9348. represent actual pixel value differences, so a threshold of 64
  9349. corresponds to 1 unit of difference for each pixel, or the same spread
  9350. out differently over the block.
  9351. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9352. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9353. meaning the whole image) differ by more than a threshold of @option{lo}.
  9354. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9355. 64*5, and default value for @option{frac} is 0.33.
  9356. @end table
  9357. @section negate
  9358. Negate (invert) the input video.
  9359. It accepts the following option:
  9360. @table @option
  9361. @item negate_alpha
  9362. With value 1, it negates the alpha component, if present. Default value is 0.
  9363. @end table
  9364. @anchor{nlmeans}
  9365. @section nlmeans
  9366. Denoise frames using Non-Local Means algorithm.
  9367. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9368. context similarity is defined by comparing their surrounding patches of size
  9369. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9370. around the pixel.
  9371. Note that the research area defines centers for patches, which means some
  9372. patches will be made of pixels outside that research area.
  9373. The filter accepts the following options.
  9374. @table @option
  9375. @item s
  9376. Set denoising strength.
  9377. @item p
  9378. Set patch size.
  9379. @item pc
  9380. Same as @option{p} but for chroma planes.
  9381. The default value is @var{0} and means automatic.
  9382. @item r
  9383. Set research size.
  9384. @item rc
  9385. Same as @option{r} but for chroma planes.
  9386. The default value is @var{0} and means automatic.
  9387. @end table
  9388. @section nnedi
  9389. Deinterlace video using neural network edge directed interpolation.
  9390. This filter accepts the following options:
  9391. @table @option
  9392. @item weights
  9393. Mandatory option, without binary file filter can not work.
  9394. Currently file can be found here:
  9395. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9396. @item deint
  9397. Set which frames to deinterlace, by default it is @code{all}.
  9398. Can be @code{all} or @code{interlaced}.
  9399. @item field
  9400. Set mode of operation.
  9401. Can be one of the following:
  9402. @table @samp
  9403. @item af
  9404. Use frame flags, both fields.
  9405. @item a
  9406. Use frame flags, single field.
  9407. @item t
  9408. Use top field only.
  9409. @item b
  9410. Use bottom field only.
  9411. @item tf
  9412. Use both fields, top first.
  9413. @item bf
  9414. Use both fields, bottom first.
  9415. @end table
  9416. @item planes
  9417. Set which planes to process, by default filter process all frames.
  9418. @item nsize
  9419. Set size of local neighborhood around each pixel, used by the predictor neural
  9420. network.
  9421. Can be one of the following:
  9422. @table @samp
  9423. @item s8x6
  9424. @item s16x6
  9425. @item s32x6
  9426. @item s48x6
  9427. @item s8x4
  9428. @item s16x4
  9429. @item s32x4
  9430. @end table
  9431. @item nns
  9432. Set the number of neurons in predictor neural network.
  9433. Can be one of the following:
  9434. @table @samp
  9435. @item n16
  9436. @item n32
  9437. @item n64
  9438. @item n128
  9439. @item n256
  9440. @end table
  9441. @item qual
  9442. Controls the number of different neural network predictions that are blended
  9443. together to compute the final output value. Can be @code{fast}, default or
  9444. @code{slow}.
  9445. @item etype
  9446. Set which set of weights to use in the predictor.
  9447. Can be one of the following:
  9448. @table @samp
  9449. @item a
  9450. weights trained to minimize absolute error
  9451. @item s
  9452. weights trained to minimize squared error
  9453. @end table
  9454. @item pscrn
  9455. Controls whether or not the prescreener neural network is used to decide
  9456. which pixels should be processed by the predictor neural network and which
  9457. can be handled by simple cubic interpolation.
  9458. The prescreener is trained to know whether cubic interpolation will be
  9459. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9460. The computational complexity of the prescreener nn is much less than that of
  9461. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9462. using the prescreener generally results in much faster processing.
  9463. The prescreener is pretty accurate, so the difference between using it and not
  9464. using it is almost always unnoticeable.
  9465. Can be one of the following:
  9466. @table @samp
  9467. @item none
  9468. @item original
  9469. @item new
  9470. @end table
  9471. Default is @code{new}.
  9472. @item fapprox
  9473. Set various debugging flags.
  9474. @end table
  9475. @section noformat
  9476. Force libavfilter not to use any of the specified pixel formats for the
  9477. input to the next filter.
  9478. It accepts the following parameters:
  9479. @table @option
  9480. @item pix_fmts
  9481. A '|'-separated list of pixel format names, such as
  9482. pix_fmts=yuv420p|monow|rgb24".
  9483. @end table
  9484. @subsection Examples
  9485. @itemize
  9486. @item
  9487. Force libavfilter to use a format different from @var{yuv420p} for the
  9488. input to the vflip filter:
  9489. @example
  9490. noformat=pix_fmts=yuv420p,vflip
  9491. @end example
  9492. @item
  9493. Convert the input video to any of the formats not contained in the list:
  9494. @example
  9495. noformat=yuv420p|yuv444p|yuv410p
  9496. @end example
  9497. @end itemize
  9498. @section noise
  9499. Add noise on video input frame.
  9500. The filter accepts the following options:
  9501. @table @option
  9502. @item all_seed
  9503. @item c0_seed
  9504. @item c1_seed
  9505. @item c2_seed
  9506. @item c3_seed
  9507. Set noise seed for specific pixel component or all pixel components in case
  9508. of @var{all_seed}. Default value is @code{123457}.
  9509. @item all_strength, alls
  9510. @item c0_strength, c0s
  9511. @item c1_strength, c1s
  9512. @item c2_strength, c2s
  9513. @item c3_strength, c3s
  9514. Set noise strength for specific pixel component or all pixel components in case
  9515. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9516. @item all_flags, allf
  9517. @item c0_flags, c0f
  9518. @item c1_flags, c1f
  9519. @item c2_flags, c2f
  9520. @item c3_flags, c3f
  9521. Set pixel component flags or set flags for all components if @var{all_flags}.
  9522. Available values for component flags are:
  9523. @table @samp
  9524. @item a
  9525. averaged temporal noise (smoother)
  9526. @item p
  9527. mix random noise with a (semi)regular pattern
  9528. @item t
  9529. temporal noise (noise pattern changes between frames)
  9530. @item u
  9531. uniform noise (gaussian otherwise)
  9532. @end table
  9533. @end table
  9534. @subsection Examples
  9535. Add temporal and uniform noise to input video:
  9536. @example
  9537. noise=alls=20:allf=t+u
  9538. @end example
  9539. @section normalize
  9540. Normalize RGB video (aka histogram stretching, contrast stretching).
  9541. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9542. For each channel of each frame, the filter computes the input range and maps
  9543. it linearly to the user-specified output range. The output range defaults
  9544. to the full dynamic range from pure black to pure white.
  9545. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9546. changes in brightness) caused when small dark or bright objects enter or leave
  9547. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9548. video camera, and, like a video camera, it may cause a period of over- or
  9549. under-exposure of the video.
  9550. The R,G,B channels can be normalized independently, which may cause some
  9551. color shifting, or linked together as a single channel, which prevents
  9552. color shifting. Linked normalization preserves hue. Independent normalization
  9553. does not, so it can be used to remove some color casts. Independent and linked
  9554. normalization can be combined in any ratio.
  9555. The normalize filter accepts the following options:
  9556. @table @option
  9557. @item blackpt
  9558. @item whitept
  9559. Colors which define the output range. The minimum input value is mapped to
  9560. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9561. The defaults are black and white respectively. Specifying white for
  9562. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9563. normalized video. Shades of grey can be used to reduce the dynamic range
  9564. (contrast). Specifying saturated colors here can create some interesting
  9565. effects.
  9566. @item smoothing
  9567. The number of previous frames to use for temporal smoothing. The input range
  9568. of each channel is smoothed using a rolling average over the current frame
  9569. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9570. smoothing).
  9571. @item independence
  9572. Controls the ratio of independent (color shifting) channel normalization to
  9573. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9574. independent. Defaults to 1.0 (fully independent).
  9575. @item strength
  9576. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9577. expensive no-op. Defaults to 1.0 (full strength).
  9578. @end table
  9579. @subsection Examples
  9580. Stretch video contrast to use the full dynamic range, with no temporal
  9581. smoothing; may flicker depending on the source content:
  9582. @example
  9583. normalize=blackpt=black:whitept=white:smoothing=0
  9584. @end example
  9585. As above, but with 50 frames of temporal smoothing; flicker should be
  9586. reduced, depending on the source content:
  9587. @example
  9588. normalize=blackpt=black:whitept=white:smoothing=50
  9589. @end example
  9590. As above, but with hue-preserving linked channel normalization:
  9591. @example
  9592. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9593. @end example
  9594. As above, but with half strength:
  9595. @example
  9596. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9597. @end example
  9598. Map the darkest input color to red, the brightest input color to cyan:
  9599. @example
  9600. normalize=blackpt=red:whitept=cyan
  9601. @end example
  9602. @section null
  9603. Pass the video source unchanged to the output.
  9604. @section ocr
  9605. Optical Character Recognition
  9606. This filter uses Tesseract for optical character recognition. To enable
  9607. compilation of this filter, you need to configure FFmpeg with
  9608. @code{--enable-libtesseract}.
  9609. It accepts the following options:
  9610. @table @option
  9611. @item datapath
  9612. Set datapath to tesseract data. Default is to use whatever was
  9613. set at installation.
  9614. @item language
  9615. Set language, default is "eng".
  9616. @item whitelist
  9617. Set character whitelist.
  9618. @item blacklist
  9619. Set character blacklist.
  9620. @end table
  9621. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9622. @section ocv
  9623. Apply a video transform using libopencv.
  9624. To enable this filter, install the libopencv library and headers and
  9625. configure FFmpeg with @code{--enable-libopencv}.
  9626. It accepts the following parameters:
  9627. @table @option
  9628. @item filter_name
  9629. The name of the libopencv filter to apply.
  9630. @item filter_params
  9631. The parameters to pass to the libopencv filter. If not specified, the default
  9632. values are assumed.
  9633. @end table
  9634. Refer to the official libopencv documentation for more precise
  9635. information:
  9636. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9637. Several libopencv filters are supported; see the following subsections.
  9638. @anchor{dilate}
  9639. @subsection dilate
  9640. Dilate an image by using a specific structuring element.
  9641. It corresponds to the libopencv function @code{cvDilate}.
  9642. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9643. @var{struct_el} represents a structuring element, and has the syntax:
  9644. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9645. @var{cols} and @var{rows} represent the number of columns and rows of
  9646. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9647. point, and @var{shape} the shape for the structuring element. @var{shape}
  9648. must be "rect", "cross", "ellipse", or "custom".
  9649. If the value for @var{shape} is "custom", it must be followed by a
  9650. string of the form "=@var{filename}". The file with name
  9651. @var{filename} is assumed to represent a binary image, with each
  9652. printable character corresponding to a bright pixel. When a custom
  9653. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9654. or columns and rows of the read file are assumed instead.
  9655. The default value for @var{struct_el} is "3x3+0x0/rect".
  9656. @var{nb_iterations} specifies the number of times the transform is
  9657. applied to the image, and defaults to 1.
  9658. Some examples:
  9659. @example
  9660. # Use the default values
  9661. ocv=dilate
  9662. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9663. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9664. # Read the shape from the file diamond.shape, iterating two times.
  9665. # The file diamond.shape may contain a pattern of characters like this
  9666. # *
  9667. # ***
  9668. # *****
  9669. # ***
  9670. # *
  9671. # The specified columns and rows are ignored
  9672. # but the anchor point coordinates are not
  9673. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9674. @end example
  9675. @subsection erode
  9676. Erode an image by using a specific structuring element.
  9677. It corresponds to the libopencv function @code{cvErode}.
  9678. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9679. with the same syntax and semantics as the @ref{dilate} filter.
  9680. @subsection smooth
  9681. Smooth the input video.
  9682. The filter takes the following parameters:
  9683. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9684. @var{type} is the type of smooth filter to apply, and must be one of
  9685. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9686. or "bilateral". The default value is "gaussian".
  9687. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9688. depend on the smooth type. @var{param1} and
  9689. @var{param2} accept integer positive values or 0. @var{param3} and
  9690. @var{param4} accept floating point values.
  9691. The default value for @var{param1} is 3. The default value for the
  9692. other parameters is 0.
  9693. These parameters correspond to the parameters assigned to the
  9694. libopencv function @code{cvSmooth}.
  9695. @section oscilloscope
  9696. 2D Video Oscilloscope.
  9697. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9698. It accepts the following parameters:
  9699. @table @option
  9700. @item x
  9701. Set scope center x position.
  9702. @item y
  9703. Set scope center y position.
  9704. @item s
  9705. Set scope size, relative to frame diagonal.
  9706. @item t
  9707. Set scope tilt/rotation.
  9708. @item o
  9709. Set trace opacity.
  9710. @item tx
  9711. Set trace center x position.
  9712. @item ty
  9713. Set trace center y position.
  9714. @item tw
  9715. Set trace width, relative to width of frame.
  9716. @item th
  9717. Set trace height, relative to height of frame.
  9718. @item c
  9719. Set which components to trace. By default it traces first three components.
  9720. @item g
  9721. Draw trace grid. By default is enabled.
  9722. @item st
  9723. Draw some statistics. By default is enabled.
  9724. @item sc
  9725. Draw scope. By default is enabled.
  9726. @end table
  9727. @subsection Examples
  9728. @itemize
  9729. @item
  9730. Inspect full first row of video frame.
  9731. @example
  9732. oscilloscope=x=0.5:y=0:s=1
  9733. @end example
  9734. @item
  9735. Inspect full last row of video frame.
  9736. @example
  9737. oscilloscope=x=0.5:y=1:s=1
  9738. @end example
  9739. @item
  9740. Inspect full 5th line of video frame of height 1080.
  9741. @example
  9742. oscilloscope=x=0.5:y=5/1080:s=1
  9743. @end example
  9744. @item
  9745. Inspect full last column of video frame.
  9746. @example
  9747. oscilloscope=x=1:y=0.5:s=1:t=1
  9748. @end example
  9749. @end itemize
  9750. @anchor{overlay}
  9751. @section overlay
  9752. Overlay one video on top of another.
  9753. It takes two inputs and has one output. The first input is the "main"
  9754. video on which the second input is overlaid.
  9755. It accepts the following parameters:
  9756. A description of the accepted options follows.
  9757. @table @option
  9758. @item x
  9759. @item y
  9760. Set the expression for the x and y coordinates of the overlaid video
  9761. on the main video. Default value is "0" for both expressions. In case
  9762. the expression is invalid, it is set to a huge value (meaning that the
  9763. overlay will not be displayed within the output visible area).
  9764. @item eof_action
  9765. See @ref{framesync}.
  9766. @item eval
  9767. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9768. It accepts the following values:
  9769. @table @samp
  9770. @item init
  9771. only evaluate expressions once during the filter initialization or
  9772. when a command is processed
  9773. @item frame
  9774. evaluate expressions for each incoming frame
  9775. @end table
  9776. Default value is @samp{frame}.
  9777. @item shortest
  9778. See @ref{framesync}.
  9779. @item format
  9780. Set the format for the output video.
  9781. It accepts the following values:
  9782. @table @samp
  9783. @item yuv420
  9784. force YUV420 output
  9785. @item yuv422
  9786. force YUV422 output
  9787. @item yuv444
  9788. force YUV444 output
  9789. @item rgb
  9790. force packed RGB output
  9791. @item gbrp
  9792. force planar RGB output
  9793. @item auto
  9794. automatically pick format
  9795. @end table
  9796. Default value is @samp{yuv420}.
  9797. @item repeatlast
  9798. See @ref{framesync}.
  9799. @item alpha
  9800. Set format of alpha of the overlaid video, it can be @var{straight} or
  9801. @var{premultiplied}. Default is @var{straight}.
  9802. @end table
  9803. The @option{x}, and @option{y} expressions can contain the following
  9804. parameters.
  9805. @table @option
  9806. @item main_w, W
  9807. @item main_h, H
  9808. The main input width and height.
  9809. @item overlay_w, w
  9810. @item overlay_h, h
  9811. The overlay input width and height.
  9812. @item x
  9813. @item y
  9814. The computed values for @var{x} and @var{y}. They are evaluated for
  9815. each new frame.
  9816. @item hsub
  9817. @item vsub
  9818. horizontal and vertical chroma subsample values of the output
  9819. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9820. @var{vsub} is 1.
  9821. @item n
  9822. the number of input frame, starting from 0
  9823. @item pos
  9824. the position in the file of the input frame, NAN if unknown
  9825. @item t
  9826. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9827. @end table
  9828. This filter also supports the @ref{framesync} options.
  9829. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9830. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9831. when @option{eval} is set to @samp{init}.
  9832. Be aware that frames are taken from each input video in timestamp
  9833. order, hence, if their initial timestamps differ, it is a good idea
  9834. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9835. have them begin in the same zero timestamp, as the example for
  9836. the @var{movie} filter does.
  9837. You can chain together more overlays but you should test the
  9838. efficiency of such approach.
  9839. @subsection Commands
  9840. This filter supports the following commands:
  9841. @table @option
  9842. @item x
  9843. @item y
  9844. Modify the x and y of the overlay input.
  9845. The command accepts the same syntax of the corresponding option.
  9846. If the specified expression is not valid, it is kept at its current
  9847. value.
  9848. @end table
  9849. @subsection Examples
  9850. @itemize
  9851. @item
  9852. Draw the overlay at 10 pixels from the bottom right corner of the main
  9853. video:
  9854. @example
  9855. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9856. @end example
  9857. Using named options the example above becomes:
  9858. @example
  9859. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9860. @end example
  9861. @item
  9862. Insert a transparent PNG logo in the bottom left corner of the input,
  9863. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9864. @example
  9865. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9866. @end example
  9867. @item
  9868. Insert 2 different transparent PNG logos (second logo on bottom
  9869. right corner) using the @command{ffmpeg} tool:
  9870. @example
  9871. 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
  9872. @end example
  9873. @item
  9874. Add a transparent color layer on top of the main video; @code{WxH}
  9875. must specify the size of the main input to the overlay filter:
  9876. @example
  9877. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9878. @end example
  9879. @item
  9880. Play an original video and a filtered version (here with the deshake
  9881. filter) side by side using the @command{ffplay} tool:
  9882. @example
  9883. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9884. @end example
  9885. The above command is the same as:
  9886. @example
  9887. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9888. @end example
  9889. @item
  9890. Make a sliding overlay appearing from the left to the right top part of the
  9891. screen starting since time 2:
  9892. @example
  9893. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9894. @end example
  9895. @item
  9896. Compose output by putting two input videos side to side:
  9897. @example
  9898. ffmpeg -i left.avi -i right.avi -filter_complex "
  9899. nullsrc=size=200x100 [background];
  9900. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9901. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9902. [background][left] overlay=shortest=1 [background+left];
  9903. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9904. "
  9905. @end example
  9906. @item
  9907. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9908. @example
  9909. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9910. -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]'
  9911. masked.avi
  9912. @end example
  9913. @item
  9914. Chain several overlays in cascade:
  9915. @example
  9916. nullsrc=s=200x200 [bg];
  9917. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9918. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9919. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9920. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9921. [in3] null, [mid2] overlay=100:100 [out0]
  9922. @end example
  9923. @end itemize
  9924. @section owdenoise
  9925. Apply Overcomplete Wavelet denoiser.
  9926. The filter accepts the following options:
  9927. @table @option
  9928. @item depth
  9929. Set depth.
  9930. Larger depth values will denoise lower frequency components more, but
  9931. slow down filtering.
  9932. Must be an int in the range 8-16, default is @code{8}.
  9933. @item luma_strength, ls
  9934. Set luma strength.
  9935. Must be a double value in the range 0-1000, default is @code{1.0}.
  9936. @item chroma_strength, cs
  9937. Set chroma strength.
  9938. Must be a double value in the range 0-1000, default is @code{1.0}.
  9939. @end table
  9940. @anchor{pad}
  9941. @section pad
  9942. Add paddings to the input image, and place the original input at the
  9943. provided @var{x}, @var{y} coordinates.
  9944. It accepts the following parameters:
  9945. @table @option
  9946. @item width, w
  9947. @item height, h
  9948. Specify an expression for the size of the output image with the
  9949. paddings added. If the value for @var{width} or @var{height} is 0, the
  9950. corresponding input size is used for the output.
  9951. The @var{width} expression can reference the value set by the
  9952. @var{height} expression, and vice versa.
  9953. The default value of @var{width} and @var{height} is 0.
  9954. @item x
  9955. @item y
  9956. Specify the offsets to place the input image at within the padded area,
  9957. with respect to the top/left border of the output image.
  9958. The @var{x} expression can reference the value set by the @var{y}
  9959. expression, and vice versa.
  9960. The default value of @var{x} and @var{y} is 0.
  9961. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9962. so the input image is centered on the padded area.
  9963. @item color
  9964. Specify the color of the padded area. For the syntax of this option,
  9965. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9966. manual,ffmpeg-utils}.
  9967. The default value of @var{color} is "black".
  9968. @item eval
  9969. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9970. It accepts the following values:
  9971. @table @samp
  9972. @item init
  9973. Only evaluate expressions once during the filter initialization or when
  9974. a command is processed.
  9975. @item frame
  9976. Evaluate expressions for each incoming frame.
  9977. @end table
  9978. Default value is @samp{init}.
  9979. @item aspect
  9980. Pad to aspect instead to a resolution.
  9981. @end table
  9982. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9983. options are expressions containing the following constants:
  9984. @table @option
  9985. @item in_w
  9986. @item in_h
  9987. The input video width and height.
  9988. @item iw
  9989. @item ih
  9990. These are the same as @var{in_w} and @var{in_h}.
  9991. @item out_w
  9992. @item out_h
  9993. The output width and height (the size of the padded area), as
  9994. specified by the @var{width} and @var{height} expressions.
  9995. @item ow
  9996. @item oh
  9997. These are the same as @var{out_w} and @var{out_h}.
  9998. @item x
  9999. @item y
  10000. The x and y offsets as specified by the @var{x} and @var{y}
  10001. expressions, or NAN if not yet specified.
  10002. @item a
  10003. same as @var{iw} / @var{ih}
  10004. @item sar
  10005. input sample aspect ratio
  10006. @item dar
  10007. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10008. @item hsub
  10009. @item vsub
  10010. The horizontal and vertical chroma subsample values. For example for the
  10011. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10012. @end table
  10013. @subsection Examples
  10014. @itemize
  10015. @item
  10016. Add paddings with the color "violet" to the input video. The output video
  10017. size is 640x480, and the top-left corner of the input video is placed at
  10018. column 0, row 40
  10019. @example
  10020. pad=640:480:0:40:violet
  10021. @end example
  10022. The example above is equivalent to the following command:
  10023. @example
  10024. pad=width=640:height=480:x=0:y=40:color=violet
  10025. @end example
  10026. @item
  10027. Pad the input to get an output with dimensions increased by 3/2,
  10028. and put the input video at the center of the padded area:
  10029. @example
  10030. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10031. @end example
  10032. @item
  10033. Pad the input to get a squared output with size equal to the maximum
  10034. value between the input width and height, and put the input video at
  10035. the center of the padded area:
  10036. @example
  10037. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10038. @end example
  10039. @item
  10040. Pad the input to get a final w/h ratio of 16:9:
  10041. @example
  10042. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10043. @end example
  10044. @item
  10045. In case of anamorphic video, in order to set the output display aspect
  10046. correctly, it is necessary to use @var{sar} in the expression,
  10047. according to the relation:
  10048. @example
  10049. (ih * X / ih) * sar = output_dar
  10050. X = output_dar / sar
  10051. @end example
  10052. Thus the previous example needs to be modified to:
  10053. @example
  10054. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10055. @end example
  10056. @item
  10057. Double the output size and put the input video in the bottom-right
  10058. corner of the output padded area:
  10059. @example
  10060. pad="2*iw:2*ih:ow-iw:oh-ih"
  10061. @end example
  10062. @end itemize
  10063. @anchor{palettegen}
  10064. @section palettegen
  10065. Generate one palette for a whole video stream.
  10066. It accepts the following options:
  10067. @table @option
  10068. @item max_colors
  10069. Set the maximum number of colors to quantize in the palette.
  10070. Note: the palette will still contain 256 colors; the unused palette entries
  10071. will be black.
  10072. @item reserve_transparent
  10073. Create a palette of 255 colors maximum and reserve the last one for
  10074. transparency. Reserving the transparency color is useful for GIF optimization.
  10075. If not set, the maximum of colors in the palette will be 256. You probably want
  10076. to disable this option for a standalone image.
  10077. Set by default.
  10078. @item transparency_color
  10079. Set the color that will be used as background for transparency.
  10080. @item stats_mode
  10081. Set statistics mode.
  10082. It accepts the following values:
  10083. @table @samp
  10084. @item full
  10085. Compute full frame histograms.
  10086. @item diff
  10087. Compute histograms only for the part that differs from previous frame. This
  10088. might be relevant to give more importance to the moving part of your input if
  10089. the background is static.
  10090. @item single
  10091. Compute new histogram for each frame.
  10092. @end table
  10093. Default value is @var{full}.
  10094. @end table
  10095. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10096. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10097. color quantization of the palette. This information is also visible at
  10098. @var{info} logging level.
  10099. @subsection Examples
  10100. @itemize
  10101. @item
  10102. Generate a representative palette of a given video using @command{ffmpeg}:
  10103. @example
  10104. ffmpeg -i input.mkv -vf palettegen palette.png
  10105. @end example
  10106. @end itemize
  10107. @section paletteuse
  10108. Use a palette to downsample an input video stream.
  10109. The filter takes two inputs: one video stream and a palette. The palette must
  10110. be a 256 pixels image.
  10111. It accepts the following options:
  10112. @table @option
  10113. @item dither
  10114. Select dithering mode. Available algorithms are:
  10115. @table @samp
  10116. @item bayer
  10117. Ordered 8x8 bayer dithering (deterministic)
  10118. @item heckbert
  10119. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10120. Note: this dithering is sometimes considered "wrong" and is included as a
  10121. reference.
  10122. @item floyd_steinberg
  10123. Floyd and Steingberg dithering (error diffusion)
  10124. @item sierra2
  10125. Frankie Sierra dithering v2 (error diffusion)
  10126. @item sierra2_4a
  10127. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10128. @end table
  10129. Default is @var{sierra2_4a}.
  10130. @item bayer_scale
  10131. When @var{bayer} dithering is selected, this option defines the scale of the
  10132. pattern (how much the crosshatch pattern is visible). A low value means more
  10133. visible pattern for less banding, and higher value means less visible pattern
  10134. at the cost of more banding.
  10135. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10136. @item diff_mode
  10137. If set, define the zone to process
  10138. @table @samp
  10139. @item rectangle
  10140. Only the changing rectangle will be reprocessed. This is similar to GIF
  10141. cropping/offsetting compression mechanism. This option can be useful for speed
  10142. if only a part of the image is changing, and has use cases such as limiting the
  10143. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10144. moving scene (it leads to more deterministic output if the scene doesn't change
  10145. much, and as a result less moving noise and better GIF compression).
  10146. @end table
  10147. Default is @var{none}.
  10148. @item new
  10149. Take new palette for each output frame.
  10150. @item alpha_threshold
  10151. Sets the alpha threshold for transparency. Alpha values above this threshold
  10152. will be treated as completely opaque, and values below this threshold will be
  10153. treated as completely transparent.
  10154. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10155. @end table
  10156. @subsection Examples
  10157. @itemize
  10158. @item
  10159. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10160. using @command{ffmpeg}:
  10161. @example
  10162. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10163. @end example
  10164. @end itemize
  10165. @section perspective
  10166. Correct perspective of video not recorded perpendicular to the screen.
  10167. A description of the accepted parameters follows.
  10168. @table @option
  10169. @item x0
  10170. @item y0
  10171. @item x1
  10172. @item y1
  10173. @item x2
  10174. @item y2
  10175. @item x3
  10176. @item y3
  10177. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10178. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10179. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10180. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10181. then the corners of the source will be sent to the specified coordinates.
  10182. The expressions can use the following variables:
  10183. @table @option
  10184. @item W
  10185. @item H
  10186. the width and height of video frame.
  10187. @item in
  10188. Input frame count.
  10189. @item on
  10190. Output frame count.
  10191. @end table
  10192. @item interpolation
  10193. Set interpolation for perspective correction.
  10194. It accepts the following values:
  10195. @table @samp
  10196. @item linear
  10197. @item cubic
  10198. @end table
  10199. Default value is @samp{linear}.
  10200. @item sense
  10201. Set interpretation of coordinate options.
  10202. It accepts the following values:
  10203. @table @samp
  10204. @item 0, source
  10205. Send point in the source specified by the given coordinates to
  10206. the corners of the destination.
  10207. @item 1, destination
  10208. Send the corners of the source to the point in the destination specified
  10209. by the given coordinates.
  10210. Default value is @samp{source}.
  10211. @end table
  10212. @item eval
  10213. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10214. It accepts the following values:
  10215. @table @samp
  10216. @item init
  10217. only evaluate expressions once during the filter initialization or
  10218. when a command is processed
  10219. @item frame
  10220. evaluate expressions for each incoming frame
  10221. @end table
  10222. Default value is @samp{init}.
  10223. @end table
  10224. @section phase
  10225. Delay interlaced video by one field time so that the field order changes.
  10226. The intended use is to fix PAL movies that have been captured with the
  10227. opposite field order to the film-to-video transfer.
  10228. A description of the accepted parameters follows.
  10229. @table @option
  10230. @item mode
  10231. Set phase mode.
  10232. It accepts the following values:
  10233. @table @samp
  10234. @item t
  10235. Capture field order top-first, transfer bottom-first.
  10236. Filter will delay the bottom field.
  10237. @item b
  10238. Capture field order bottom-first, transfer top-first.
  10239. Filter will delay the top field.
  10240. @item p
  10241. Capture and transfer with the same field order. This mode only exists
  10242. for the documentation of the other options to refer to, but if you
  10243. actually select it, the filter will faithfully do nothing.
  10244. @item a
  10245. Capture field order determined automatically by field flags, transfer
  10246. opposite.
  10247. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10248. basis using field flags. If no field information is available,
  10249. then this works just like @samp{u}.
  10250. @item u
  10251. Capture unknown or varying, transfer opposite.
  10252. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10253. analyzing the images and selecting the alternative that produces best
  10254. match between the fields.
  10255. @item T
  10256. Capture top-first, transfer unknown or varying.
  10257. Filter selects among @samp{t} and @samp{p} using image analysis.
  10258. @item B
  10259. Capture bottom-first, transfer unknown or varying.
  10260. Filter selects among @samp{b} and @samp{p} using image analysis.
  10261. @item A
  10262. Capture determined by field flags, transfer unknown or varying.
  10263. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10264. image analysis. If no field information is available, then this works just
  10265. like @samp{U}. This is the default mode.
  10266. @item U
  10267. Both capture and transfer unknown or varying.
  10268. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10269. @end table
  10270. @end table
  10271. @section pixdesctest
  10272. Pixel format descriptor test filter, mainly useful for internal
  10273. testing. The output video should be equal to the input video.
  10274. For example:
  10275. @example
  10276. format=monow, pixdesctest
  10277. @end example
  10278. can be used to test the monowhite pixel format descriptor definition.
  10279. @section pixscope
  10280. Display sample values of color channels. Mainly useful for checking color
  10281. and levels. Minimum supported resolution is 640x480.
  10282. The filters accept the following options:
  10283. @table @option
  10284. @item x
  10285. Set scope X position, relative offset on X axis.
  10286. @item y
  10287. Set scope Y position, relative offset on Y axis.
  10288. @item w
  10289. Set scope width.
  10290. @item h
  10291. Set scope height.
  10292. @item o
  10293. Set window opacity. This window also holds statistics about pixel area.
  10294. @item wx
  10295. Set window X position, relative offset on X axis.
  10296. @item wy
  10297. Set window Y position, relative offset on Y axis.
  10298. @end table
  10299. @section pp
  10300. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10301. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10302. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10303. Each subfilter and some options have a short and a long name that can be used
  10304. interchangeably, i.e. dr/dering are the same.
  10305. The filters accept the following options:
  10306. @table @option
  10307. @item subfilters
  10308. Set postprocessing subfilters string.
  10309. @end table
  10310. All subfilters share common options to determine their scope:
  10311. @table @option
  10312. @item a/autoq
  10313. Honor the quality commands for this subfilter.
  10314. @item c/chrom
  10315. Do chrominance filtering, too (default).
  10316. @item y/nochrom
  10317. Do luminance filtering only (no chrominance).
  10318. @item n/noluma
  10319. Do chrominance filtering only (no luminance).
  10320. @end table
  10321. These options can be appended after the subfilter name, separated by a '|'.
  10322. Available subfilters are:
  10323. @table @option
  10324. @item hb/hdeblock[|difference[|flatness]]
  10325. Horizontal deblocking filter
  10326. @table @option
  10327. @item difference
  10328. Difference factor where higher values mean more deblocking (default: @code{32}).
  10329. @item flatness
  10330. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10331. @end table
  10332. @item vb/vdeblock[|difference[|flatness]]
  10333. Vertical deblocking filter
  10334. @table @option
  10335. @item difference
  10336. Difference factor where higher values mean more deblocking (default: @code{32}).
  10337. @item flatness
  10338. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10339. @end table
  10340. @item ha/hadeblock[|difference[|flatness]]
  10341. Accurate horizontal deblocking filter
  10342. @table @option
  10343. @item difference
  10344. Difference factor where higher values mean more deblocking (default: @code{32}).
  10345. @item flatness
  10346. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10347. @end table
  10348. @item va/vadeblock[|difference[|flatness]]
  10349. Accurate vertical deblocking filter
  10350. @table @option
  10351. @item difference
  10352. Difference factor where higher values mean more deblocking (default: @code{32}).
  10353. @item flatness
  10354. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10355. @end table
  10356. @end table
  10357. The horizontal and vertical deblocking filters share the difference and
  10358. flatness values so you cannot set different horizontal and vertical
  10359. thresholds.
  10360. @table @option
  10361. @item h1/x1hdeblock
  10362. Experimental horizontal deblocking filter
  10363. @item v1/x1vdeblock
  10364. Experimental vertical deblocking filter
  10365. @item dr/dering
  10366. Deringing filter
  10367. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10368. @table @option
  10369. @item threshold1
  10370. larger -> stronger filtering
  10371. @item threshold2
  10372. larger -> stronger filtering
  10373. @item threshold3
  10374. larger -> stronger filtering
  10375. @end table
  10376. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10377. @table @option
  10378. @item f/fullyrange
  10379. Stretch luminance to @code{0-255}.
  10380. @end table
  10381. @item lb/linblenddeint
  10382. Linear blend deinterlacing filter that deinterlaces the given block by
  10383. filtering all lines with a @code{(1 2 1)} filter.
  10384. @item li/linipoldeint
  10385. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10386. linearly interpolating every second line.
  10387. @item ci/cubicipoldeint
  10388. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10389. cubically interpolating every second line.
  10390. @item md/mediandeint
  10391. Median deinterlacing filter that deinterlaces the given block by applying a
  10392. median filter to every second line.
  10393. @item fd/ffmpegdeint
  10394. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10395. second line with a @code{(-1 4 2 4 -1)} filter.
  10396. @item l5/lowpass5
  10397. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10398. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10399. @item fq/forceQuant[|quantizer]
  10400. Overrides the quantizer table from the input with the constant quantizer you
  10401. specify.
  10402. @table @option
  10403. @item quantizer
  10404. Quantizer to use
  10405. @end table
  10406. @item de/default
  10407. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10408. @item fa/fast
  10409. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10410. @item ac
  10411. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10412. @end table
  10413. @subsection Examples
  10414. @itemize
  10415. @item
  10416. Apply horizontal and vertical deblocking, deringing and automatic
  10417. brightness/contrast:
  10418. @example
  10419. pp=hb/vb/dr/al
  10420. @end example
  10421. @item
  10422. Apply default filters without brightness/contrast correction:
  10423. @example
  10424. pp=de/-al
  10425. @end example
  10426. @item
  10427. Apply default filters and temporal denoiser:
  10428. @example
  10429. pp=default/tmpnoise|1|2|3
  10430. @end example
  10431. @item
  10432. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10433. automatically depending on available CPU time:
  10434. @example
  10435. pp=hb|y/vb|a
  10436. @end example
  10437. @end itemize
  10438. @section pp7
  10439. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10440. similar to spp = 6 with 7 point DCT, where only the center sample is
  10441. used after IDCT.
  10442. The filter accepts the following options:
  10443. @table @option
  10444. @item qp
  10445. Force a constant quantization parameter. It accepts an integer in range
  10446. 0 to 63. If not set, the filter will use the QP from the video stream
  10447. (if available).
  10448. @item mode
  10449. Set thresholding mode. Available modes are:
  10450. @table @samp
  10451. @item hard
  10452. Set hard thresholding.
  10453. @item soft
  10454. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10455. @item medium
  10456. Set medium thresholding (good results, default).
  10457. @end table
  10458. @end table
  10459. @section premultiply
  10460. Apply alpha premultiply effect to input video stream using first plane
  10461. of second stream as alpha.
  10462. Both streams must have same dimensions and same pixel format.
  10463. The filter accepts the following option:
  10464. @table @option
  10465. @item planes
  10466. Set which planes will be processed, unprocessed planes will be copied.
  10467. By default value 0xf, all planes will be processed.
  10468. @item inplace
  10469. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10470. @end table
  10471. @section prewitt
  10472. Apply prewitt operator to input video stream.
  10473. The filter accepts the following option:
  10474. @table @option
  10475. @item planes
  10476. Set which planes will be processed, unprocessed planes will be copied.
  10477. By default value 0xf, all planes will be processed.
  10478. @item scale
  10479. Set value which will be multiplied with filtered result.
  10480. @item delta
  10481. Set value which will be added to filtered result.
  10482. @end table
  10483. @anchor{program_opencl}
  10484. @section program_opencl
  10485. Filter video using an OpenCL program.
  10486. @table @option
  10487. @item source
  10488. OpenCL program source file.
  10489. @item kernel
  10490. Kernel name in program.
  10491. @item inputs
  10492. Number of inputs to the filter. Defaults to 1.
  10493. @item size, s
  10494. Size of output frames. Defaults to the same as the first input.
  10495. @end table
  10496. The program source file must contain a kernel function with the given name,
  10497. which will be run once for each plane of the output. Each run on a plane
  10498. gets enqueued as a separate 2D global NDRange with one work-item for each
  10499. pixel to be generated. The global ID offset for each work-item is therefore
  10500. the coordinates of a pixel in the destination image.
  10501. The kernel function needs to take the following arguments:
  10502. @itemize
  10503. @item
  10504. Destination image, @var{__write_only image2d_t}.
  10505. This image will become the output; the kernel should write all of it.
  10506. @item
  10507. Frame index, @var{unsigned int}.
  10508. This is a counter starting from zero and increasing by one for each frame.
  10509. @item
  10510. Source images, @var{__read_only image2d_t}.
  10511. These are the most recent images on each input. The kernel may read from
  10512. them to generate the output, but they can't be written to.
  10513. @end itemize
  10514. Example programs:
  10515. @itemize
  10516. @item
  10517. Copy the input to the output (output must be the same size as the input).
  10518. @verbatim
  10519. __kernel void copy(__write_only image2d_t destination,
  10520. unsigned int index,
  10521. __read_only image2d_t source)
  10522. {
  10523. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10524. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10525. float4 value = read_imagef(source, sampler, location);
  10526. write_imagef(destination, location, value);
  10527. }
  10528. @end verbatim
  10529. @item
  10530. Apply a simple transformation, rotating the input by an amount increasing
  10531. with the index counter. Pixel values are linearly interpolated by the
  10532. sampler, and the output need not have the same dimensions as the input.
  10533. @verbatim
  10534. __kernel void rotate_image(__write_only image2d_t dst,
  10535. unsigned int index,
  10536. __read_only image2d_t src)
  10537. {
  10538. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10539. CLK_FILTER_LINEAR);
  10540. float angle = (float)index / 100.0f;
  10541. float2 dst_dim = convert_float2(get_image_dim(dst));
  10542. float2 src_dim = convert_float2(get_image_dim(src));
  10543. float2 dst_cen = dst_dim / 2.0f;
  10544. float2 src_cen = src_dim / 2.0f;
  10545. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10546. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10547. float2 src_pos = {
  10548. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10549. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10550. };
  10551. src_pos = src_pos * src_dim / dst_dim;
  10552. float2 src_loc = src_pos + src_cen;
  10553. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10554. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10555. write_imagef(dst, dst_loc, 0.5f);
  10556. else
  10557. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10558. }
  10559. @end verbatim
  10560. @item
  10561. Blend two inputs together, with the amount of each input used varying
  10562. with the index counter.
  10563. @verbatim
  10564. __kernel void blend_images(__write_only image2d_t dst,
  10565. unsigned int index,
  10566. __read_only image2d_t src1,
  10567. __read_only image2d_t src2)
  10568. {
  10569. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10570. CLK_FILTER_LINEAR);
  10571. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10572. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10573. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10574. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10575. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10576. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10577. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10578. }
  10579. @end verbatim
  10580. @end itemize
  10581. @section pseudocolor
  10582. Alter frame colors in video with pseudocolors.
  10583. This filter accept the following options:
  10584. @table @option
  10585. @item c0
  10586. set pixel first component expression
  10587. @item c1
  10588. set pixel second component expression
  10589. @item c2
  10590. set pixel third component expression
  10591. @item c3
  10592. set pixel fourth component expression, corresponds to the alpha component
  10593. @item i
  10594. set component to use as base for altering colors
  10595. @end table
  10596. Each of them specifies the expression to use for computing the lookup table for
  10597. the corresponding pixel component values.
  10598. The expressions can contain the following constants and functions:
  10599. @table @option
  10600. @item w
  10601. @item h
  10602. The input width and height.
  10603. @item val
  10604. The input value for the pixel component.
  10605. @item ymin, umin, vmin, amin
  10606. The minimum allowed component value.
  10607. @item ymax, umax, vmax, amax
  10608. The maximum allowed component value.
  10609. @end table
  10610. All expressions default to "val".
  10611. @subsection Examples
  10612. @itemize
  10613. @item
  10614. Change too high luma values to gradient:
  10615. @example
  10616. 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'"
  10617. @end example
  10618. @end itemize
  10619. @section psnr
  10620. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10621. Ratio) between two input videos.
  10622. This filter takes in input two input videos, the first input is
  10623. considered the "main" source and is passed unchanged to the
  10624. output. The second input is used as a "reference" video for computing
  10625. the PSNR.
  10626. Both video inputs must have the same resolution and pixel format for
  10627. this filter to work correctly. Also it assumes that both inputs
  10628. have the same number of frames, which are compared one by one.
  10629. The obtained average PSNR is printed through the logging system.
  10630. The filter stores the accumulated MSE (mean squared error) of each
  10631. frame, and at the end of the processing it is averaged across all frames
  10632. equally, and the following formula is applied to obtain the PSNR:
  10633. @example
  10634. PSNR = 10*log10(MAX^2/MSE)
  10635. @end example
  10636. Where MAX is the average of the maximum values of each component of the
  10637. image.
  10638. The description of the accepted parameters follows.
  10639. @table @option
  10640. @item stats_file, f
  10641. If specified the filter will use the named file to save the PSNR of
  10642. each individual frame. When filename equals "-" the data is sent to
  10643. standard output.
  10644. @item stats_version
  10645. Specifies which version of the stats file format to use. Details of
  10646. each format are written below.
  10647. Default value is 1.
  10648. @item stats_add_max
  10649. Determines whether the max value is output to the stats log.
  10650. Default value is 0.
  10651. Requires stats_version >= 2. If this is set and stats_version < 2,
  10652. the filter will return an error.
  10653. @end table
  10654. This filter also supports the @ref{framesync} options.
  10655. The file printed if @var{stats_file} is selected, contains a sequence of
  10656. key/value pairs of the form @var{key}:@var{value} for each compared
  10657. couple of frames.
  10658. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10659. the list of per-frame-pair stats, with key value pairs following the frame
  10660. format with the following parameters:
  10661. @table @option
  10662. @item psnr_log_version
  10663. The version of the log file format. Will match @var{stats_version}.
  10664. @item fields
  10665. A comma separated list of the per-frame-pair parameters included in
  10666. the log.
  10667. @end table
  10668. A description of each shown per-frame-pair parameter follows:
  10669. @table @option
  10670. @item n
  10671. sequential number of the input frame, starting from 1
  10672. @item mse_avg
  10673. Mean Square Error pixel-by-pixel average difference of the compared
  10674. frames, averaged over all the image components.
  10675. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10676. Mean Square Error pixel-by-pixel average difference of the compared
  10677. frames for the component specified by the suffix.
  10678. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10679. Peak Signal to Noise ratio of the compared frames for the component
  10680. specified by the suffix.
  10681. @item max_avg, max_y, max_u, max_v
  10682. Maximum allowed value for each channel, and average over all
  10683. channels.
  10684. @end table
  10685. For example:
  10686. @example
  10687. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10688. [main][ref] psnr="stats_file=stats.log" [out]
  10689. @end example
  10690. On this example the input file being processed is compared with the
  10691. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10692. is stored in @file{stats.log}.
  10693. @anchor{pullup}
  10694. @section pullup
  10695. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10696. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10697. content.
  10698. The pullup filter is designed to take advantage of future context in making
  10699. its decisions. This filter is stateless in the sense that it does not lock
  10700. onto a pattern to follow, but it instead looks forward to the following
  10701. fields in order to identify matches and rebuild progressive frames.
  10702. To produce content with an even framerate, insert the fps filter after
  10703. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10704. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10705. The filter accepts the following options:
  10706. @table @option
  10707. @item jl
  10708. @item jr
  10709. @item jt
  10710. @item jb
  10711. These options set the amount of "junk" to ignore at the left, right, top, and
  10712. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10713. while top and bottom are in units of 2 lines.
  10714. The default is 8 pixels on each side.
  10715. @item sb
  10716. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10717. filter generating an occasional mismatched frame, but it may also cause an
  10718. excessive number of frames to be dropped during high motion sequences.
  10719. Conversely, setting it to -1 will make filter match fields more easily.
  10720. This may help processing of video where there is slight blurring between
  10721. the fields, but may also cause there to be interlaced frames in the output.
  10722. Default value is @code{0}.
  10723. @item mp
  10724. Set the metric plane to use. It accepts the following values:
  10725. @table @samp
  10726. @item l
  10727. Use luma plane.
  10728. @item u
  10729. Use chroma blue plane.
  10730. @item v
  10731. Use chroma red plane.
  10732. @end table
  10733. This option may be set to use chroma plane instead of the default luma plane
  10734. for doing filter's computations. This may improve accuracy on very clean
  10735. source material, but more likely will decrease accuracy, especially if there
  10736. is chroma noise (rainbow effect) or any grayscale video.
  10737. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10738. load and make pullup usable in realtime on slow machines.
  10739. @end table
  10740. For best results (without duplicated frames in the output file) it is
  10741. necessary to change the output frame rate. For example, to inverse
  10742. telecine NTSC input:
  10743. @example
  10744. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10745. @end example
  10746. @section qp
  10747. Change video quantization parameters (QP).
  10748. The filter accepts the following option:
  10749. @table @option
  10750. @item qp
  10751. Set expression for quantization parameter.
  10752. @end table
  10753. The expression is evaluated through the eval API and can contain, among others,
  10754. the following constants:
  10755. @table @var
  10756. @item known
  10757. 1 if index is not 129, 0 otherwise.
  10758. @item qp
  10759. Sequential index starting from -129 to 128.
  10760. @end table
  10761. @subsection Examples
  10762. @itemize
  10763. @item
  10764. Some equation like:
  10765. @example
  10766. qp=2+2*sin(PI*qp)
  10767. @end example
  10768. @end itemize
  10769. @section random
  10770. Flush video frames from internal cache of frames into a random order.
  10771. No frame is discarded.
  10772. Inspired by @ref{frei0r} nervous filter.
  10773. @table @option
  10774. @item frames
  10775. Set size in number of frames of internal cache, in range from @code{2} to
  10776. @code{512}. Default is @code{30}.
  10777. @item seed
  10778. Set seed for random number generator, must be an integer included between
  10779. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10780. less than @code{0}, the filter will try to use a good random seed on a
  10781. best effort basis.
  10782. @end table
  10783. @section readeia608
  10784. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10785. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10786. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10787. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10788. @table @option
  10789. @item lavfi.readeia608.X.cc
  10790. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10791. @item lavfi.readeia608.X.line
  10792. The number of the line on which the EIA-608 data was identified and read.
  10793. @end table
  10794. This filter accepts the following options:
  10795. @table @option
  10796. @item scan_min
  10797. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10798. @item scan_max
  10799. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10800. @item mac
  10801. Set minimal acceptable amplitude change for sync codes detection.
  10802. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10803. @item spw
  10804. Set the ratio of width reserved for sync code detection.
  10805. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10806. @item mhd
  10807. Set the max peaks height difference for sync code detection.
  10808. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10809. @item mpd
  10810. Set max peaks period difference for sync code detection.
  10811. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10812. @item msd
  10813. Set the first two max start code bits differences.
  10814. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10815. @item bhd
  10816. Set the minimum ratio of bits height compared to 3rd start code bit.
  10817. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10818. @item th_w
  10819. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10820. @item th_b
  10821. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10822. @item chp
  10823. Enable checking the parity bit. In the event of a parity error, the filter will output
  10824. @code{0x00} for that character. Default is false.
  10825. @end table
  10826. @subsection Examples
  10827. @itemize
  10828. @item
  10829. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10830. @example
  10831. 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
  10832. @end example
  10833. @end itemize
  10834. @section readvitc
  10835. Read vertical interval timecode (VITC) information from the top lines of a
  10836. video frame.
  10837. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10838. timecode value, if a valid timecode has been detected. Further metadata key
  10839. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10840. timecode data has been found or not.
  10841. This filter accepts the following options:
  10842. @table @option
  10843. @item scan_max
  10844. Set the maximum number of lines to scan for VITC data. If the value is set to
  10845. @code{-1} the full video frame is scanned. Default is @code{45}.
  10846. @item thr_b
  10847. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10848. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10849. @item thr_w
  10850. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10851. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10852. @end table
  10853. @subsection Examples
  10854. @itemize
  10855. @item
  10856. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10857. draw @code{--:--:--:--} as a placeholder:
  10858. @example
  10859. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10860. @end example
  10861. @end itemize
  10862. @section remap
  10863. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10864. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10865. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10866. value for pixel will be used for destination pixel.
  10867. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10868. will have Xmap/Ymap video stream dimensions.
  10869. Xmap and Ymap input video streams are 16bit depth, single channel.
  10870. @section removegrain
  10871. The removegrain filter is a spatial denoiser for progressive video.
  10872. @table @option
  10873. @item m0
  10874. Set mode for the first plane.
  10875. @item m1
  10876. Set mode for the second plane.
  10877. @item m2
  10878. Set mode for the third plane.
  10879. @item m3
  10880. Set mode for the fourth plane.
  10881. @end table
  10882. Range of mode is from 0 to 24. Description of each mode follows:
  10883. @table @var
  10884. @item 0
  10885. Leave input plane unchanged. Default.
  10886. @item 1
  10887. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10888. @item 2
  10889. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10890. @item 3
  10891. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10892. @item 4
  10893. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10894. This is equivalent to a median filter.
  10895. @item 5
  10896. Line-sensitive clipping giving the minimal change.
  10897. @item 6
  10898. Line-sensitive clipping, intermediate.
  10899. @item 7
  10900. Line-sensitive clipping, intermediate.
  10901. @item 8
  10902. Line-sensitive clipping, intermediate.
  10903. @item 9
  10904. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10905. @item 10
  10906. Replaces the target pixel with the closest neighbour.
  10907. @item 11
  10908. [1 2 1] horizontal and vertical kernel blur.
  10909. @item 12
  10910. Same as mode 11.
  10911. @item 13
  10912. Bob mode, interpolates top field from the line where the neighbours
  10913. pixels are the closest.
  10914. @item 14
  10915. Bob mode, interpolates bottom field from the line where the neighbours
  10916. pixels are the closest.
  10917. @item 15
  10918. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10919. interpolation formula.
  10920. @item 16
  10921. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10922. interpolation formula.
  10923. @item 17
  10924. Clips the pixel with the minimum and maximum of respectively the maximum and
  10925. minimum of each pair of opposite neighbour pixels.
  10926. @item 18
  10927. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10928. the current pixel is minimal.
  10929. @item 19
  10930. Replaces the pixel with the average of its 8 neighbours.
  10931. @item 20
  10932. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10933. @item 21
  10934. Clips pixels using the averages of opposite neighbour.
  10935. @item 22
  10936. Same as mode 21 but simpler and faster.
  10937. @item 23
  10938. Small edge and halo removal, but reputed useless.
  10939. @item 24
  10940. Similar as 23.
  10941. @end table
  10942. @section removelogo
  10943. Suppress a TV station logo, using an image file to determine which
  10944. pixels comprise the logo. It works by filling in the pixels that
  10945. comprise the logo with neighboring pixels.
  10946. The filter accepts the following options:
  10947. @table @option
  10948. @item filename, f
  10949. Set the filter bitmap file, which can be any image format supported by
  10950. libavformat. The width and height of the image file must match those of the
  10951. video stream being processed.
  10952. @end table
  10953. Pixels in the provided bitmap image with a value of zero are not
  10954. considered part of the logo, non-zero pixels are considered part of
  10955. the logo. If you use white (255) for the logo and black (0) for the
  10956. rest, you will be safe. For making the filter bitmap, it is
  10957. recommended to take a screen capture of a black frame with the logo
  10958. visible, and then using a threshold filter followed by the erode
  10959. filter once or twice.
  10960. If needed, little splotches can be fixed manually. Remember that if
  10961. logo pixels are not covered, the filter quality will be much
  10962. reduced. Marking too many pixels as part of the logo does not hurt as
  10963. much, but it will increase the amount of blurring needed to cover over
  10964. the image and will destroy more information than necessary, and extra
  10965. pixels will slow things down on a large logo.
  10966. @section repeatfields
  10967. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10968. fields based on its value.
  10969. @section reverse
  10970. Reverse a video clip.
  10971. Warning: This filter requires memory to buffer the entire clip, so trimming
  10972. is suggested.
  10973. @subsection Examples
  10974. @itemize
  10975. @item
  10976. Take the first 5 seconds of a clip, and reverse it.
  10977. @example
  10978. trim=end=5,reverse
  10979. @end example
  10980. @end itemize
  10981. @section rgbashift
  10982. Shift R/G/B/A pixels horizontally and/or vertically.
  10983. The filter accepts the following options:
  10984. @table @option
  10985. @item rh
  10986. Set amount to shift red horizontally.
  10987. @item rv
  10988. Set amount to shift red vertically.
  10989. @item gh
  10990. Set amount to shift green horizontally.
  10991. @item gv
  10992. Set amount to shift green vertically.
  10993. @item bh
  10994. Set amount to shift blue horizontally.
  10995. @item bv
  10996. Set amount to shift blue vertically.
  10997. @item ah
  10998. Set amount to shift alpha horizontally.
  10999. @item av
  11000. Set amount to shift alpha vertically.
  11001. @item edge
  11002. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11003. @end table
  11004. @section roberts
  11005. Apply roberts cross operator to input video stream.
  11006. The filter accepts the following option:
  11007. @table @option
  11008. @item planes
  11009. Set which planes will be processed, unprocessed planes will be copied.
  11010. By default value 0xf, all planes will be processed.
  11011. @item scale
  11012. Set value which will be multiplied with filtered result.
  11013. @item delta
  11014. Set value which will be added to filtered result.
  11015. @end table
  11016. @section rotate
  11017. Rotate video by an arbitrary angle expressed in radians.
  11018. The filter accepts the following options:
  11019. A description of the optional parameters follows.
  11020. @table @option
  11021. @item angle, a
  11022. Set an expression for the angle by which to rotate the input video
  11023. clockwise, expressed as a number of radians. A negative value will
  11024. result in a counter-clockwise rotation. By default it is set to "0".
  11025. This expression is evaluated for each frame.
  11026. @item out_w, ow
  11027. Set the output width expression, default value is "iw".
  11028. This expression is evaluated just once during configuration.
  11029. @item out_h, oh
  11030. Set the output height expression, default value is "ih".
  11031. This expression is evaluated just once during configuration.
  11032. @item bilinear
  11033. Enable bilinear interpolation if set to 1, a value of 0 disables
  11034. it. Default value is 1.
  11035. @item fillcolor, c
  11036. Set the color used to fill the output area not covered by the rotated
  11037. image. For the general syntax of this option, check the
  11038. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11039. If the special value "none" is selected then no
  11040. background is printed (useful for example if the background is never shown).
  11041. Default value is "black".
  11042. @end table
  11043. The expressions for the angle and the output size can contain the
  11044. following constants and functions:
  11045. @table @option
  11046. @item n
  11047. sequential number of the input frame, starting from 0. It is always NAN
  11048. before the first frame is filtered.
  11049. @item t
  11050. time in seconds of the input frame, it is set to 0 when the filter is
  11051. configured. It is always NAN before the first frame is filtered.
  11052. @item hsub
  11053. @item vsub
  11054. horizontal and vertical chroma subsample values. For example for the
  11055. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11056. @item in_w, iw
  11057. @item in_h, ih
  11058. the input video width and height
  11059. @item out_w, ow
  11060. @item out_h, oh
  11061. the output width and height, that is the size of the padded area as
  11062. specified by the @var{width} and @var{height} expressions
  11063. @item rotw(a)
  11064. @item roth(a)
  11065. the minimal width/height required for completely containing the input
  11066. video rotated by @var{a} radians.
  11067. These are only available when computing the @option{out_w} and
  11068. @option{out_h} expressions.
  11069. @end table
  11070. @subsection Examples
  11071. @itemize
  11072. @item
  11073. Rotate the input by PI/6 radians clockwise:
  11074. @example
  11075. rotate=PI/6
  11076. @end example
  11077. @item
  11078. Rotate the input by PI/6 radians counter-clockwise:
  11079. @example
  11080. rotate=-PI/6
  11081. @end example
  11082. @item
  11083. Rotate the input by 45 degrees clockwise:
  11084. @example
  11085. rotate=45*PI/180
  11086. @end example
  11087. @item
  11088. Apply a constant rotation with period T, starting from an angle of PI/3:
  11089. @example
  11090. rotate=PI/3+2*PI*t/T
  11091. @end example
  11092. @item
  11093. Make the input video rotation oscillating with a period of T
  11094. seconds and an amplitude of A radians:
  11095. @example
  11096. rotate=A*sin(2*PI/T*t)
  11097. @end example
  11098. @item
  11099. Rotate the video, output size is chosen so that the whole rotating
  11100. input video is always completely contained in the output:
  11101. @example
  11102. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11103. @end example
  11104. @item
  11105. Rotate the video, reduce the output size so that no background is ever
  11106. shown:
  11107. @example
  11108. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11109. @end example
  11110. @end itemize
  11111. @subsection Commands
  11112. The filter supports the following commands:
  11113. @table @option
  11114. @item a, angle
  11115. Set the angle expression.
  11116. The command accepts the same syntax of the corresponding option.
  11117. If the specified expression is not valid, it is kept at its current
  11118. value.
  11119. @end table
  11120. @section sab
  11121. Apply Shape Adaptive Blur.
  11122. The filter accepts the following options:
  11123. @table @option
  11124. @item luma_radius, lr
  11125. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11126. value is 1.0. A greater value will result in a more blurred image, and
  11127. in slower processing.
  11128. @item luma_pre_filter_radius, lpfr
  11129. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11130. value is 1.0.
  11131. @item luma_strength, ls
  11132. Set luma maximum difference between pixels to still be considered, must
  11133. be a value in the 0.1-100.0 range, default value is 1.0.
  11134. @item chroma_radius, cr
  11135. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11136. greater value will result in a more blurred image, and in slower
  11137. processing.
  11138. @item chroma_pre_filter_radius, cpfr
  11139. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11140. @item chroma_strength, cs
  11141. Set chroma maximum difference between pixels to still be considered,
  11142. must be a value in the -0.9-100.0 range.
  11143. @end table
  11144. Each chroma option value, if not explicitly specified, is set to the
  11145. corresponding luma option value.
  11146. @anchor{scale}
  11147. @section scale
  11148. Scale (resize) the input video, using the libswscale library.
  11149. The scale filter forces the output display aspect ratio to be the same
  11150. of the input, by changing the output sample aspect ratio.
  11151. If the input image format is different from the format requested by
  11152. the next filter, the scale filter will convert the input to the
  11153. requested format.
  11154. @subsection Options
  11155. The filter accepts the following options, or any of the options
  11156. supported by the libswscale scaler.
  11157. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11158. the complete list of scaler options.
  11159. @table @option
  11160. @item width, w
  11161. @item height, h
  11162. Set the output video dimension expression. Default value is the input
  11163. dimension.
  11164. If the @var{width} or @var{w} value is 0, the input width is used for
  11165. the output. If the @var{height} or @var{h} value is 0, the input height
  11166. is used for the output.
  11167. If one and only one of the values is -n with n >= 1, the scale filter
  11168. will use a value that maintains the aspect ratio of the input image,
  11169. calculated from the other specified dimension. After that it will,
  11170. however, make sure that the calculated dimension is divisible by n and
  11171. adjust the value if necessary.
  11172. If both values are -n with n >= 1, the behavior will be identical to
  11173. both values being set to 0 as previously detailed.
  11174. See below for the list of accepted constants for use in the dimension
  11175. expression.
  11176. @item eval
  11177. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11178. @table @samp
  11179. @item init
  11180. Only evaluate expressions once during the filter initialization or when a command is processed.
  11181. @item frame
  11182. Evaluate expressions for each incoming frame.
  11183. @end table
  11184. Default value is @samp{init}.
  11185. @item interl
  11186. Set the interlacing mode. It accepts the following values:
  11187. @table @samp
  11188. @item 1
  11189. Force interlaced aware scaling.
  11190. @item 0
  11191. Do not apply interlaced scaling.
  11192. @item -1
  11193. Select interlaced aware scaling depending on whether the source frames
  11194. are flagged as interlaced or not.
  11195. @end table
  11196. Default value is @samp{0}.
  11197. @item flags
  11198. Set libswscale scaling flags. See
  11199. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11200. complete list of values. If not explicitly specified the filter applies
  11201. the default flags.
  11202. @item param0, param1
  11203. Set libswscale input parameters for scaling algorithms that need them. See
  11204. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11205. complete documentation. If not explicitly specified the filter applies
  11206. empty parameters.
  11207. @item size, s
  11208. Set the video size. For the syntax of this option, check the
  11209. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11210. @item in_color_matrix
  11211. @item out_color_matrix
  11212. Set in/output YCbCr color space type.
  11213. This allows the autodetected value to be overridden as well as allows forcing
  11214. a specific value used for the output and encoder.
  11215. If not specified, the color space type depends on the pixel format.
  11216. Possible values:
  11217. @table @samp
  11218. @item auto
  11219. Choose automatically.
  11220. @item bt709
  11221. Format conforming to International Telecommunication Union (ITU)
  11222. Recommendation BT.709.
  11223. @item fcc
  11224. Set color space conforming to the United States Federal Communications
  11225. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11226. @item bt601
  11227. Set color space conforming to:
  11228. @itemize
  11229. @item
  11230. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11231. @item
  11232. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11233. @item
  11234. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11235. @end itemize
  11236. @item smpte240m
  11237. Set color space conforming to SMPTE ST 240:1999.
  11238. @end table
  11239. @item in_range
  11240. @item out_range
  11241. Set in/output YCbCr sample range.
  11242. This allows the autodetected value to be overridden as well as allows forcing
  11243. a specific value used for the output and encoder. If not specified, the
  11244. range depends on the pixel format. Possible values:
  11245. @table @samp
  11246. @item auto/unknown
  11247. Choose automatically.
  11248. @item jpeg/full/pc
  11249. Set full range (0-255 in case of 8-bit luma).
  11250. @item mpeg/limited/tv
  11251. Set "MPEG" range (16-235 in case of 8-bit luma).
  11252. @end table
  11253. @item force_original_aspect_ratio
  11254. Enable decreasing or increasing output video width or height if necessary to
  11255. keep the original aspect ratio. Possible values:
  11256. @table @samp
  11257. @item disable
  11258. Scale the video as specified and disable this feature.
  11259. @item decrease
  11260. The output video dimensions will automatically be decreased if needed.
  11261. @item increase
  11262. The output video dimensions will automatically be increased if needed.
  11263. @end table
  11264. One useful instance of this option is that when you know a specific device's
  11265. maximum allowed resolution, you can use this to limit the output video to
  11266. that, while retaining the aspect ratio. For example, device A allows
  11267. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11268. decrease) and specifying 1280x720 to the command line makes the output
  11269. 1280x533.
  11270. Please note that this is a different thing than specifying -1 for @option{w}
  11271. or @option{h}, you still need to specify the output resolution for this option
  11272. to work.
  11273. @end table
  11274. The values of the @option{w} and @option{h} options are expressions
  11275. containing the following constants:
  11276. @table @var
  11277. @item in_w
  11278. @item in_h
  11279. The input width and height
  11280. @item iw
  11281. @item ih
  11282. These are the same as @var{in_w} and @var{in_h}.
  11283. @item out_w
  11284. @item out_h
  11285. The output (scaled) width and height
  11286. @item ow
  11287. @item oh
  11288. These are the same as @var{out_w} and @var{out_h}
  11289. @item a
  11290. The same as @var{iw} / @var{ih}
  11291. @item sar
  11292. input sample aspect ratio
  11293. @item dar
  11294. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11295. @item hsub
  11296. @item vsub
  11297. horizontal and vertical input chroma subsample values. For example for the
  11298. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11299. @item ohsub
  11300. @item ovsub
  11301. horizontal and vertical output chroma subsample values. For example for the
  11302. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11303. @end table
  11304. @subsection Examples
  11305. @itemize
  11306. @item
  11307. Scale the input video to a size of 200x100
  11308. @example
  11309. scale=w=200:h=100
  11310. @end example
  11311. This is equivalent to:
  11312. @example
  11313. scale=200:100
  11314. @end example
  11315. or:
  11316. @example
  11317. scale=200x100
  11318. @end example
  11319. @item
  11320. Specify a size abbreviation for the output size:
  11321. @example
  11322. scale=qcif
  11323. @end example
  11324. which can also be written as:
  11325. @example
  11326. scale=size=qcif
  11327. @end example
  11328. @item
  11329. Scale the input to 2x:
  11330. @example
  11331. scale=w=2*iw:h=2*ih
  11332. @end example
  11333. @item
  11334. The above is the same as:
  11335. @example
  11336. scale=2*in_w:2*in_h
  11337. @end example
  11338. @item
  11339. Scale the input to 2x with forced interlaced scaling:
  11340. @example
  11341. scale=2*iw:2*ih:interl=1
  11342. @end example
  11343. @item
  11344. Scale the input to half size:
  11345. @example
  11346. scale=w=iw/2:h=ih/2
  11347. @end example
  11348. @item
  11349. Increase the width, and set the height to the same size:
  11350. @example
  11351. scale=3/2*iw:ow
  11352. @end example
  11353. @item
  11354. Seek Greek harmony:
  11355. @example
  11356. scale=iw:1/PHI*iw
  11357. scale=ih*PHI:ih
  11358. @end example
  11359. @item
  11360. Increase the height, and set the width to 3/2 of the height:
  11361. @example
  11362. scale=w=3/2*oh:h=3/5*ih
  11363. @end example
  11364. @item
  11365. Increase the size, making the size a multiple of the chroma
  11366. subsample values:
  11367. @example
  11368. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11369. @end example
  11370. @item
  11371. Increase the width to a maximum of 500 pixels,
  11372. keeping the same aspect ratio as the input:
  11373. @example
  11374. scale=w='min(500\, iw*3/2):h=-1'
  11375. @end example
  11376. @item
  11377. Make pixels square by combining scale and setsar:
  11378. @example
  11379. scale='trunc(ih*dar):ih',setsar=1/1
  11380. @end example
  11381. @item
  11382. Make pixels square by combining scale and setsar,
  11383. making sure the resulting resolution is even (required by some codecs):
  11384. @example
  11385. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11386. @end example
  11387. @end itemize
  11388. @subsection Commands
  11389. This filter supports the following commands:
  11390. @table @option
  11391. @item width, w
  11392. @item height, h
  11393. Set the output video dimension expression.
  11394. The command accepts the same syntax of the corresponding option.
  11395. If the specified expression is not valid, it is kept at its current
  11396. value.
  11397. @end table
  11398. @section scale_npp
  11399. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11400. format conversion on CUDA video frames. Setting the output width and height
  11401. works in the same way as for the @var{scale} filter.
  11402. The following additional options are accepted:
  11403. @table @option
  11404. @item format
  11405. The pixel format of the output CUDA frames. If set to the string "same" (the
  11406. default), the input format will be kept. Note that automatic format negotiation
  11407. and conversion is not yet supported for hardware frames
  11408. @item interp_algo
  11409. The interpolation algorithm used for resizing. One of the following:
  11410. @table @option
  11411. @item nn
  11412. Nearest neighbour.
  11413. @item linear
  11414. @item cubic
  11415. @item cubic2p_bspline
  11416. 2-parameter cubic (B=1, C=0)
  11417. @item cubic2p_catmullrom
  11418. 2-parameter cubic (B=0, C=1/2)
  11419. @item cubic2p_b05c03
  11420. 2-parameter cubic (B=1/2, C=3/10)
  11421. @item super
  11422. Supersampling
  11423. @item lanczos
  11424. @end table
  11425. @end table
  11426. @section scale2ref
  11427. Scale (resize) the input video, based on a reference video.
  11428. See the scale filter for available options, scale2ref supports the same but
  11429. uses the reference video instead of the main input as basis. scale2ref also
  11430. supports the following additional constants for the @option{w} and
  11431. @option{h} options:
  11432. @table @var
  11433. @item main_w
  11434. @item main_h
  11435. The main input video's width and height
  11436. @item main_a
  11437. The same as @var{main_w} / @var{main_h}
  11438. @item main_sar
  11439. The main input video's sample aspect ratio
  11440. @item main_dar, mdar
  11441. The main input video's display aspect ratio. Calculated from
  11442. @code{(main_w / main_h) * main_sar}.
  11443. @item main_hsub
  11444. @item main_vsub
  11445. The main input video's horizontal and vertical chroma subsample values.
  11446. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11447. is 1.
  11448. @end table
  11449. @subsection Examples
  11450. @itemize
  11451. @item
  11452. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11453. @example
  11454. 'scale2ref[b][a];[a][b]overlay'
  11455. @end example
  11456. @end itemize
  11457. @anchor{selectivecolor}
  11458. @section selectivecolor
  11459. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11460. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11461. by the "purity" of the color (that is, how saturated it already is).
  11462. This filter is similar to the Adobe Photoshop Selective Color tool.
  11463. The filter accepts the following options:
  11464. @table @option
  11465. @item correction_method
  11466. Select color correction method.
  11467. Available values are:
  11468. @table @samp
  11469. @item absolute
  11470. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11471. component value).
  11472. @item relative
  11473. Specified adjustments are relative to the original component value.
  11474. @end table
  11475. Default is @code{absolute}.
  11476. @item reds
  11477. Adjustments for red pixels (pixels where the red component is the maximum)
  11478. @item yellows
  11479. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11480. @item greens
  11481. Adjustments for green pixels (pixels where the green component is the maximum)
  11482. @item cyans
  11483. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11484. @item blues
  11485. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11486. @item magentas
  11487. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11488. @item whites
  11489. Adjustments for white pixels (pixels where all components are greater than 128)
  11490. @item neutrals
  11491. Adjustments for all pixels except pure black and pure white
  11492. @item blacks
  11493. Adjustments for black pixels (pixels where all components are lesser than 128)
  11494. @item psfile
  11495. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11496. @end table
  11497. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11498. 4 space separated floating point adjustment values in the [-1,1] range,
  11499. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11500. pixels of its range.
  11501. @subsection Examples
  11502. @itemize
  11503. @item
  11504. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11505. increase magenta by 27% in blue areas:
  11506. @example
  11507. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11508. @end example
  11509. @item
  11510. Use a Photoshop selective color preset:
  11511. @example
  11512. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11513. @end example
  11514. @end itemize
  11515. @anchor{separatefields}
  11516. @section separatefields
  11517. The @code{separatefields} takes a frame-based video input and splits
  11518. each frame into its components fields, producing a new half height clip
  11519. with twice the frame rate and twice the frame count.
  11520. This filter use field-dominance information in frame to decide which
  11521. of each pair of fields to place first in the output.
  11522. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11523. @section setdar, setsar
  11524. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11525. output video.
  11526. This is done by changing the specified Sample (aka Pixel) Aspect
  11527. Ratio, according to the following equation:
  11528. @example
  11529. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11530. @end example
  11531. Keep in mind that the @code{setdar} filter does not modify the pixel
  11532. dimensions of the video frame. Also, the display aspect ratio set by
  11533. this filter may be changed by later filters in the filterchain,
  11534. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11535. applied.
  11536. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11537. the filter output video.
  11538. Note that as a consequence of the application of this filter, the
  11539. output display aspect ratio will change according to the equation
  11540. above.
  11541. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11542. filter may be changed by later filters in the filterchain, e.g. if
  11543. another "setsar" or a "setdar" filter is applied.
  11544. It accepts the following parameters:
  11545. @table @option
  11546. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11547. Set the aspect ratio used by the filter.
  11548. The parameter can be a floating point number string, an expression, or
  11549. a string of the form @var{num}:@var{den}, where @var{num} and
  11550. @var{den} are the numerator and denominator of the aspect ratio. If
  11551. the parameter is not specified, it is assumed the value "0".
  11552. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11553. should be escaped.
  11554. @item max
  11555. Set the maximum integer value to use for expressing numerator and
  11556. denominator when reducing the expressed aspect ratio to a rational.
  11557. Default value is @code{100}.
  11558. @end table
  11559. The parameter @var{sar} is an expression containing
  11560. the following constants:
  11561. @table @option
  11562. @item E, PI, PHI
  11563. These are approximated values for the mathematical constants e
  11564. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11565. @item w, h
  11566. The input width and height.
  11567. @item a
  11568. These are the same as @var{w} / @var{h}.
  11569. @item sar
  11570. The input sample aspect ratio.
  11571. @item dar
  11572. The input display aspect ratio. It is the same as
  11573. (@var{w} / @var{h}) * @var{sar}.
  11574. @item hsub, vsub
  11575. Horizontal and vertical chroma subsample values. For example, for the
  11576. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11577. @end table
  11578. @subsection Examples
  11579. @itemize
  11580. @item
  11581. To change the display aspect ratio to 16:9, specify one of the following:
  11582. @example
  11583. setdar=dar=1.77777
  11584. setdar=dar=16/9
  11585. @end example
  11586. @item
  11587. To change the sample aspect ratio to 10:11, specify:
  11588. @example
  11589. setsar=sar=10/11
  11590. @end example
  11591. @item
  11592. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11593. 1000 in the aspect ratio reduction, use the command:
  11594. @example
  11595. setdar=ratio=16/9:max=1000
  11596. @end example
  11597. @end itemize
  11598. @anchor{setfield}
  11599. @section setfield
  11600. Force field for the output video frame.
  11601. The @code{setfield} filter marks the interlace type field for the
  11602. output frames. It does not change the input frame, but only sets the
  11603. corresponding property, which affects how the frame is treated by
  11604. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11605. The filter accepts the following options:
  11606. @table @option
  11607. @item mode
  11608. Available values are:
  11609. @table @samp
  11610. @item auto
  11611. Keep the same field property.
  11612. @item bff
  11613. Mark the frame as bottom-field-first.
  11614. @item tff
  11615. Mark the frame as top-field-first.
  11616. @item prog
  11617. Mark the frame as progressive.
  11618. @end table
  11619. @end table
  11620. @anchor{setparams}
  11621. @section setparams
  11622. Force frame parameter for the output video frame.
  11623. The @code{setparams} filter marks interlace and color range for the
  11624. output frames. It does not change the input frame, but only sets the
  11625. corresponding property, which affects how the frame is treated by
  11626. filters/encoders.
  11627. @table @option
  11628. @item field_mode
  11629. Available values are:
  11630. @table @samp
  11631. @item auto
  11632. Keep the same field property (default).
  11633. @item bff
  11634. Mark the frame as bottom-field-first.
  11635. @item tff
  11636. Mark the frame as top-field-first.
  11637. @item prog
  11638. Mark the frame as progressive.
  11639. @end table
  11640. @item range
  11641. Available values are:
  11642. @table @samp
  11643. @item auto
  11644. Keep the same color range property (default).
  11645. @item unspecified, unknown
  11646. Mark the frame as unspecified color range.
  11647. @item limited, tv, mpeg
  11648. Mark the frame as limited range.
  11649. @item full, pc, jpeg
  11650. Mark the frame as full range.
  11651. @end table
  11652. @item color_primaries
  11653. Set the color primaries.
  11654. Available values are:
  11655. @table @samp
  11656. @item auto
  11657. Keep the same color primaries property (default).
  11658. @item bt709
  11659. @item unknown
  11660. @item bt470m
  11661. @item bt470bg
  11662. @item smpte170m
  11663. @item smpte240m
  11664. @item film
  11665. @item bt2020
  11666. @item smpte428
  11667. @item smpte431
  11668. @item smpte432
  11669. @item jedec-p22
  11670. @end table
  11671. @item color_trc
  11672. Set the color transfert.
  11673. Available values are:
  11674. @table @samp
  11675. @item auto
  11676. Keep the same color trc property (default).
  11677. @item bt709
  11678. @item unknown
  11679. @item bt470m
  11680. @item bt470bg
  11681. @item smpte170m
  11682. @item smpte240m
  11683. @item linear
  11684. @item log100
  11685. @item log316
  11686. @item iec61966-2-4
  11687. @item bt1361e
  11688. @item iec61966-2-1
  11689. @item bt2020-10
  11690. @item bt2020-12
  11691. @item smpte2084
  11692. @item smpte428
  11693. @item arib-std-b67
  11694. @end table
  11695. @item colorspace
  11696. Set the colorspace.
  11697. Available values are:
  11698. @table @samp
  11699. @item auto
  11700. Keep the same colorspace property (default).
  11701. @item gbr
  11702. @item bt709
  11703. @item unknown
  11704. @item fcc
  11705. @item bt470bg
  11706. @item smpte170m
  11707. @item smpte240m
  11708. @item ycgco
  11709. @item bt2020nc
  11710. @item bt2020c
  11711. @item smpte2085
  11712. @item chroma-derived-nc
  11713. @item chroma-derived-c
  11714. @item ictcp
  11715. @end table
  11716. @end table
  11717. @section showinfo
  11718. Show a line containing various information for each input video frame.
  11719. The input video is not modified.
  11720. This filter supports the following options:
  11721. @table @option
  11722. @item checksum
  11723. Calculate checksums of each plane. By default enabled.
  11724. @end table
  11725. The shown line contains a sequence of key/value pairs of the form
  11726. @var{key}:@var{value}.
  11727. The following values are shown in the output:
  11728. @table @option
  11729. @item n
  11730. The (sequential) number of the input frame, starting from 0.
  11731. @item pts
  11732. The Presentation TimeStamp of the input frame, expressed as a number of
  11733. time base units. The time base unit depends on the filter input pad.
  11734. @item pts_time
  11735. The Presentation TimeStamp of the input frame, expressed as a number of
  11736. seconds.
  11737. @item pos
  11738. The position of the frame in the input stream, or -1 if this information is
  11739. unavailable and/or meaningless (for example in case of synthetic video).
  11740. @item fmt
  11741. The pixel format name.
  11742. @item sar
  11743. The sample aspect ratio of the input frame, expressed in the form
  11744. @var{num}/@var{den}.
  11745. @item s
  11746. The size of the input frame. For the syntax of this option, check the
  11747. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11748. @item i
  11749. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  11750. for bottom field first).
  11751. @item iskey
  11752. This is 1 if the frame is a key frame, 0 otherwise.
  11753. @item type
  11754. The picture type of the input frame ("I" for an I-frame, "P" for a
  11755. P-frame, "B" for a B-frame, or "?" for an unknown type).
  11756. Also refer to the documentation of the @code{AVPictureType} enum and of
  11757. the @code{av_get_picture_type_char} function defined in
  11758. @file{libavutil/avutil.h}.
  11759. @item checksum
  11760. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  11761. @item plane_checksum
  11762. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  11763. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  11764. @end table
  11765. @section showpalette
  11766. Displays the 256 colors palette of each frame. This filter is only relevant for
  11767. @var{pal8} pixel format frames.
  11768. It accepts the following option:
  11769. @table @option
  11770. @item s
  11771. Set the size of the box used to represent one palette color entry. Default is
  11772. @code{30} (for a @code{30x30} pixel box).
  11773. @end table
  11774. @section shuffleframes
  11775. Reorder and/or duplicate and/or drop video frames.
  11776. It accepts the following parameters:
  11777. @table @option
  11778. @item mapping
  11779. Set the destination indexes of input frames.
  11780. This is space or '|' separated list of indexes that maps input frames to output
  11781. frames. Number of indexes also sets maximal value that each index may have.
  11782. '-1' index have special meaning and that is to drop frame.
  11783. @end table
  11784. The first frame has the index 0. The default is to keep the input unchanged.
  11785. @subsection Examples
  11786. @itemize
  11787. @item
  11788. Swap second and third frame of every three frames of the input:
  11789. @example
  11790. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  11791. @end example
  11792. @item
  11793. Swap 10th and 1st frame of every ten frames of the input:
  11794. @example
  11795. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  11796. @end example
  11797. @end itemize
  11798. @section shuffleplanes
  11799. Reorder and/or duplicate video planes.
  11800. It accepts the following parameters:
  11801. @table @option
  11802. @item map0
  11803. The index of the input plane to be used as the first output plane.
  11804. @item map1
  11805. The index of the input plane to be used as the second output plane.
  11806. @item map2
  11807. The index of the input plane to be used as the third output plane.
  11808. @item map3
  11809. The index of the input plane to be used as the fourth output plane.
  11810. @end table
  11811. The first plane has the index 0. The default is to keep the input unchanged.
  11812. @subsection Examples
  11813. @itemize
  11814. @item
  11815. Swap the second and third planes of the input:
  11816. @example
  11817. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  11818. @end example
  11819. @end itemize
  11820. @anchor{signalstats}
  11821. @section signalstats
  11822. Evaluate various visual metrics that assist in determining issues associated
  11823. with the digitization of analog video media.
  11824. By default the filter will log these metadata values:
  11825. @table @option
  11826. @item YMIN
  11827. Display the minimal Y value contained within the input frame. Expressed in
  11828. range of [0-255].
  11829. @item YLOW
  11830. Display the Y value at the 10% percentile within the input frame. Expressed in
  11831. range of [0-255].
  11832. @item YAVG
  11833. Display the average Y value within the input frame. Expressed in range of
  11834. [0-255].
  11835. @item YHIGH
  11836. Display the Y value at the 90% percentile within the input frame. Expressed in
  11837. range of [0-255].
  11838. @item YMAX
  11839. Display the maximum Y value contained within the input frame. Expressed in
  11840. range of [0-255].
  11841. @item UMIN
  11842. Display the minimal U value contained within the input frame. Expressed in
  11843. range of [0-255].
  11844. @item ULOW
  11845. Display the U value at the 10% percentile within the input frame. Expressed in
  11846. range of [0-255].
  11847. @item UAVG
  11848. Display the average U value within the input frame. Expressed in range of
  11849. [0-255].
  11850. @item UHIGH
  11851. Display the U value at the 90% percentile within the input frame. Expressed in
  11852. range of [0-255].
  11853. @item UMAX
  11854. Display the maximum U value contained within the input frame. Expressed in
  11855. range of [0-255].
  11856. @item VMIN
  11857. Display the minimal V value contained within the input frame. Expressed in
  11858. range of [0-255].
  11859. @item VLOW
  11860. Display the V value at the 10% percentile within the input frame. Expressed in
  11861. range of [0-255].
  11862. @item VAVG
  11863. Display the average V value within the input frame. Expressed in range of
  11864. [0-255].
  11865. @item VHIGH
  11866. Display the V value at the 90% percentile within the input frame. Expressed in
  11867. range of [0-255].
  11868. @item VMAX
  11869. Display the maximum V value contained within the input frame. Expressed in
  11870. range of [0-255].
  11871. @item SATMIN
  11872. Display the minimal saturation value contained within the input frame.
  11873. Expressed in range of [0-~181.02].
  11874. @item SATLOW
  11875. Display the saturation value at the 10% percentile within the input frame.
  11876. Expressed in range of [0-~181.02].
  11877. @item SATAVG
  11878. Display the average saturation value within the input frame. Expressed in range
  11879. of [0-~181.02].
  11880. @item SATHIGH
  11881. Display the saturation value at the 90% percentile within the input frame.
  11882. Expressed in range of [0-~181.02].
  11883. @item SATMAX
  11884. Display the maximum saturation value contained within the input frame.
  11885. Expressed in range of [0-~181.02].
  11886. @item HUEMED
  11887. Display the median value for hue within the input frame. Expressed in range of
  11888. [0-360].
  11889. @item HUEAVG
  11890. Display the average value for hue within the input frame. Expressed in range of
  11891. [0-360].
  11892. @item YDIF
  11893. Display the average of sample value difference between all values of the Y
  11894. plane in the current frame and corresponding values of the previous input frame.
  11895. Expressed in range of [0-255].
  11896. @item UDIF
  11897. Display the average of sample value difference between all values of the U
  11898. plane in the current frame and corresponding values of the previous input frame.
  11899. Expressed in range of [0-255].
  11900. @item VDIF
  11901. Display the average of sample value difference between all values of the V
  11902. plane in the current frame and corresponding values of the previous input frame.
  11903. Expressed in range of [0-255].
  11904. @item YBITDEPTH
  11905. Display bit depth of Y plane in current frame.
  11906. Expressed in range of [0-16].
  11907. @item UBITDEPTH
  11908. Display bit depth of U plane in current frame.
  11909. Expressed in range of [0-16].
  11910. @item VBITDEPTH
  11911. Display bit depth of V plane in current frame.
  11912. Expressed in range of [0-16].
  11913. @end table
  11914. The filter accepts the following options:
  11915. @table @option
  11916. @item stat
  11917. @item out
  11918. @option{stat} specify an additional form of image analysis.
  11919. @option{out} output video with the specified type of pixel highlighted.
  11920. Both options accept the following values:
  11921. @table @samp
  11922. @item tout
  11923. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  11924. unlike the neighboring pixels of the same field. Examples of temporal outliers
  11925. include the results of video dropouts, head clogs, or tape tracking issues.
  11926. @item vrep
  11927. Identify @var{vertical line repetition}. Vertical line repetition includes
  11928. similar rows of pixels within a frame. In born-digital video vertical line
  11929. repetition is common, but this pattern is uncommon in video digitized from an
  11930. analog source. When it occurs in video that results from the digitization of an
  11931. analog source it can indicate concealment from a dropout compensator.
  11932. @item brng
  11933. Identify pixels that fall outside of legal broadcast range.
  11934. @end table
  11935. @item color, c
  11936. Set the highlight color for the @option{out} option. The default color is
  11937. yellow.
  11938. @end table
  11939. @subsection Examples
  11940. @itemize
  11941. @item
  11942. Output data of various video metrics:
  11943. @example
  11944. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11945. @end example
  11946. @item
  11947. Output specific data about the minimum and maximum values of the Y plane per frame:
  11948. @example
  11949. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11950. @end example
  11951. @item
  11952. Playback video while highlighting pixels that are outside of broadcast range in red.
  11953. @example
  11954. ffplay example.mov -vf signalstats="out=brng:color=red"
  11955. @end example
  11956. @item
  11957. Playback video with signalstats metadata drawn over the frame.
  11958. @example
  11959. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11960. @end example
  11961. The contents of signalstat_drawtext.txt used in the command are:
  11962. @example
  11963. time %@{pts:hms@}
  11964. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11965. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11966. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11967. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11968. @end example
  11969. @end itemize
  11970. @anchor{signature}
  11971. @section signature
  11972. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11973. input. In this case the matching between the inputs can be calculated additionally.
  11974. The filter always passes through the first input. The signature of each stream can
  11975. be written into a file.
  11976. It accepts the following options:
  11977. @table @option
  11978. @item detectmode
  11979. Enable or disable the matching process.
  11980. Available values are:
  11981. @table @samp
  11982. @item off
  11983. Disable the calculation of a matching (default).
  11984. @item full
  11985. Calculate the matching for the whole video and output whether the whole video
  11986. matches or only parts.
  11987. @item fast
  11988. Calculate only until a matching is found or the video ends. Should be faster in
  11989. some cases.
  11990. @end table
  11991. @item nb_inputs
  11992. Set the number of inputs. The option value must be a non negative integer.
  11993. Default value is 1.
  11994. @item filename
  11995. Set the path to which the output is written. If there is more than one input,
  11996. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11997. integer), that will be replaced with the input number. If no filename is
  11998. specified, no output will be written. This is the default.
  11999. @item format
  12000. Choose the output format.
  12001. Available values are:
  12002. @table @samp
  12003. @item binary
  12004. Use the specified binary representation (default).
  12005. @item xml
  12006. Use the specified xml representation.
  12007. @end table
  12008. @item th_d
  12009. Set threshold to detect one word as similar. The option value must be an integer
  12010. greater than zero. The default value is 9000.
  12011. @item th_dc
  12012. Set threshold to detect all words as similar. The option value must be an integer
  12013. greater than zero. The default value is 60000.
  12014. @item th_xh
  12015. Set threshold to detect frames as similar. The option value must be an integer
  12016. greater than zero. The default value is 116.
  12017. @item th_di
  12018. Set the minimum length of a sequence in frames to recognize it as matching
  12019. sequence. The option value must be a non negative integer value.
  12020. The default value is 0.
  12021. @item th_it
  12022. Set the minimum relation, that matching frames to all frames must have.
  12023. The option value must be a double value between 0 and 1. The default value is 0.5.
  12024. @end table
  12025. @subsection Examples
  12026. @itemize
  12027. @item
  12028. To calculate the signature of an input video and store it in signature.bin:
  12029. @example
  12030. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12031. @end example
  12032. @item
  12033. To detect whether two videos match and store the signatures in XML format in
  12034. signature0.xml and signature1.xml:
  12035. @example
  12036. 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 -
  12037. @end example
  12038. @end itemize
  12039. @anchor{smartblur}
  12040. @section smartblur
  12041. Blur the input video without impacting the outlines.
  12042. It accepts the following options:
  12043. @table @option
  12044. @item luma_radius, lr
  12045. Set the luma radius. The option value must be a float number in
  12046. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12047. used to blur the image (slower if larger). Default value is 1.0.
  12048. @item luma_strength, ls
  12049. Set the luma strength. The option value must be a float number
  12050. in the range [-1.0,1.0] that configures the blurring. A value included
  12051. in [0.0,1.0] will blur the image whereas a value included in
  12052. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12053. @item luma_threshold, lt
  12054. Set the luma threshold used as a coefficient to determine
  12055. whether a pixel should be blurred or not. The option value must be an
  12056. integer in the range [-30,30]. A value of 0 will filter all the image,
  12057. a value included in [0,30] will filter flat areas and a value included
  12058. in [-30,0] will filter edges. Default value is 0.
  12059. @item chroma_radius, cr
  12060. Set the chroma radius. The option value must be a float number in
  12061. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12062. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12063. @item chroma_strength, cs
  12064. Set the chroma strength. The option value must be a float number
  12065. in the range [-1.0,1.0] that configures the blurring. A value included
  12066. in [0.0,1.0] will blur the image whereas a value included in
  12067. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12068. @item chroma_threshold, ct
  12069. Set the chroma threshold used as a coefficient to determine
  12070. whether a pixel should be blurred or not. The option value must be an
  12071. integer in the range [-30,30]. A value of 0 will filter all the image,
  12072. a value included in [0,30] will filter flat areas and a value included
  12073. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12074. @end table
  12075. If a chroma option is not explicitly set, the corresponding luma value
  12076. is set.
  12077. @section ssim
  12078. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12079. This filter takes in input two input videos, the first input is
  12080. considered the "main" source and is passed unchanged to the
  12081. output. The second input is used as a "reference" video for computing
  12082. the SSIM.
  12083. Both video inputs must have the same resolution and pixel format for
  12084. this filter to work correctly. Also it assumes that both inputs
  12085. have the same number of frames, which are compared one by one.
  12086. The filter stores the calculated SSIM of each frame.
  12087. The description of the accepted parameters follows.
  12088. @table @option
  12089. @item stats_file, f
  12090. If specified the filter will use the named file to save the SSIM of
  12091. each individual frame. When filename equals "-" the data is sent to
  12092. standard output.
  12093. @end table
  12094. The file printed if @var{stats_file} is selected, contains a sequence of
  12095. key/value pairs of the form @var{key}:@var{value} for each compared
  12096. couple of frames.
  12097. A description of each shown parameter follows:
  12098. @table @option
  12099. @item n
  12100. sequential number of the input frame, starting from 1
  12101. @item Y, U, V, R, G, B
  12102. SSIM of the compared frames for the component specified by the suffix.
  12103. @item All
  12104. SSIM of the compared frames for the whole frame.
  12105. @item dB
  12106. Same as above but in dB representation.
  12107. @end table
  12108. This filter also supports the @ref{framesync} options.
  12109. For example:
  12110. @example
  12111. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12112. [main][ref] ssim="stats_file=stats.log" [out]
  12113. @end example
  12114. On this example the input file being processed is compared with the
  12115. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12116. is stored in @file{stats.log}.
  12117. Another example with both psnr and ssim at same time:
  12118. @example
  12119. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12120. @end example
  12121. @section stereo3d
  12122. Convert between different stereoscopic image formats.
  12123. The filters accept the following options:
  12124. @table @option
  12125. @item in
  12126. Set stereoscopic image format of input.
  12127. Available values for input image formats are:
  12128. @table @samp
  12129. @item sbsl
  12130. side by side parallel (left eye left, right eye right)
  12131. @item sbsr
  12132. side by side crosseye (right eye left, left eye right)
  12133. @item sbs2l
  12134. side by side parallel with half width resolution
  12135. (left eye left, right eye right)
  12136. @item sbs2r
  12137. side by side crosseye with half width resolution
  12138. (right eye left, left eye right)
  12139. @item abl
  12140. above-below (left eye above, right eye below)
  12141. @item abr
  12142. above-below (right eye above, left eye below)
  12143. @item ab2l
  12144. above-below with half height resolution
  12145. (left eye above, right eye below)
  12146. @item ab2r
  12147. above-below with half height resolution
  12148. (right eye above, left eye below)
  12149. @item al
  12150. alternating frames (left eye first, right eye second)
  12151. @item ar
  12152. alternating frames (right eye first, left eye second)
  12153. @item irl
  12154. interleaved rows (left eye has top row, right eye starts on next row)
  12155. @item irr
  12156. interleaved rows (right eye has top row, left eye starts on next row)
  12157. @item icl
  12158. interleaved columns, left eye first
  12159. @item icr
  12160. interleaved columns, right eye first
  12161. Default value is @samp{sbsl}.
  12162. @end table
  12163. @item out
  12164. Set stereoscopic image format of output.
  12165. @table @samp
  12166. @item sbsl
  12167. side by side parallel (left eye left, right eye right)
  12168. @item sbsr
  12169. side by side crosseye (right eye left, left eye right)
  12170. @item sbs2l
  12171. side by side parallel with half width resolution
  12172. (left eye left, right eye right)
  12173. @item sbs2r
  12174. side by side crosseye with half width resolution
  12175. (right eye left, left eye right)
  12176. @item abl
  12177. above-below (left eye above, right eye below)
  12178. @item abr
  12179. above-below (right eye above, left eye below)
  12180. @item ab2l
  12181. above-below with half height resolution
  12182. (left eye above, right eye below)
  12183. @item ab2r
  12184. above-below with half height resolution
  12185. (right eye above, left eye below)
  12186. @item al
  12187. alternating frames (left eye first, right eye second)
  12188. @item ar
  12189. alternating frames (right eye first, left eye second)
  12190. @item irl
  12191. interleaved rows (left eye has top row, right eye starts on next row)
  12192. @item irr
  12193. interleaved rows (right eye has top row, left eye starts on next row)
  12194. @item arbg
  12195. anaglyph red/blue gray
  12196. (red filter on left eye, blue filter on right eye)
  12197. @item argg
  12198. anaglyph red/green gray
  12199. (red filter on left eye, green filter on right eye)
  12200. @item arcg
  12201. anaglyph red/cyan gray
  12202. (red filter on left eye, cyan filter on right eye)
  12203. @item arch
  12204. anaglyph red/cyan half colored
  12205. (red filter on left eye, cyan filter on right eye)
  12206. @item arcc
  12207. anaglyph red/cyan color
  12208. (red filter on left eye, cyan filter on right eye)
  12209. @item arcd
  12210. anaglyph red/cyan color optimized with the least squares projection of dubois
  12211. (red filter on left eye, cyan filter on right eye)
  12212. @item agmg
  12213. anaglyph green/magenta gray
  12214. (green filter on left eye, magenta filter on right eye)
  12215. @item agmh
  12216. anaglyph green/magenta half colored
  12217. (green filter on left eye, magenta filter on right eye)
  12218. @item agmc
  12219. anaglyph green/magenta colored
  12220. (green filter on left eye, magenta filter on right eye)
  12221. @item agmd
  12222. anaglyph green/magenta color optimized with the least squares projection of dubois
  12223. (green filter on left eye, magenta filter on right eye)
  12224. @item aybg
  12225. anaglyph yellow/blue gray
  12226. (yellow filter on left eye, blue filter on right eye)
  12227. @item aybh
  12228. anaglyph yellow/blue half colored
  12229. (yellow filter on left eye, blue filter on right eye)
  12230. @item aybc
  12231. anaglyph yellow/blue colored
  12232. (yellow filter on left eye, blue filter on right eye)
  12233. @item aybd
  12234. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12235. (yellow filter on left eye, blue filter on right eye)
  12236. @item ml
  12237. mono output (left eye only)
  12238. @item mr
  12239. mono output (right eye only)
  12240. @item chl
  12241. checkerboard, left eye first
  12242. @item chr
  12243. checkerboard, right eye first
  12244. @item icl
  12245. interleaved columns, left eye first
  12246. @item icr
  12247. interleaved columns, right eye first
  12248. @item hdmi
  12249. HDMI frame pack
  12250. @end table
  12251. Default value is @samp{arcd}.
  12252. @end table
  12253. @subsection Examples
  12254. @itemize
  12255. @item
  12256. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12257. @example
  12258. stereo3d=sbsl:aybd
  12259. @end example
  12260. @item
  12261. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12262. @example
  12263. stereo3d=abl:sbsr
  12264. @end example
  12265. @end itemize
  12266. @section streamselect, astreamselect
  12267. Select video or audio streams.
  12268. The filter accepts the following options:
  12269. @table @option
  12270. @item inputs
  12271. Set number of inputs. Default is 2.
  12272. @item map
  12273. Set input indexes to remap to outputs.
  12274. @end table
  12275. @subsection Commands
  12276. The @code{streamselect} and @code{astreamselect} filter supports the following
  12277. commands:
  12278. @table @option
  12279. @item map
  12280. Set input indexes to remap to outputs.
  12281. @end table
  12282. @subsection Examples
  12283. @itemize
  12284. @item
  12285. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12286. @example
  12287. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12288. @end example
  12289. @item
  12290. Same as above, but for audio:
  12291. @example
  12292. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12293. @end example
  12294. @end itemize
  12295. @section sobel
  12296. Apply sobel operator to input video stream.
  12297. The filter accepts the following option:
  12298. @table @option
  12299. @item planes
  12300. Set which planes will be processed, unprocessed planes will be copied.
  12301. By default value 0xf, all planes will be processed.
  12302. @item scale
  12303. Set value which will be multiplied with filtered result.
  12304. @item delta
  12305. Set value which will be added to filtered result.
  12306. @end table
  12307. @anchor{spp}
  12308. @section spp
  12309. Apply a simple postprocessing filter that compresses and decompresses the image
  12310. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12311. and average the results.
  12312. The filter accepts the following options:
  12313. @table @option
  12314. @item quality
  12315. Set quality. This option defines the number of levels for averaging. It accepts
  12316. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12317. effect. A value of @code{6} means the higher quality. For each increment of
  12318. that value the speed drops by a factor of approximately 2. Default value is
  12319. @code{3}.
  12320. @item qp
  12321. Force a constant quantization parameter. If not set, the filter will use the QP
  12322. from the video stream (if available).
  12323. @item mode
  12324. Set thresholding mode. Available modes are:
  12325. @table @samp
  12326. @item hard
  12327. Set hard thresholding (default).
  12328. @item soft
  12329. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12330. @end table
  12331. @item use_bframe_qp
  12332. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12333. option may cause flicker since the B-Frames have often larger QP. Default is
  12334. @code{0} (not enabled).
  12335. @end table
  12336. @section sr
  12337. Scale the input by applying one of the super-resolution methods based on
  12338. convolutional neural networks. Supported models:
  12339. @itemize
  12340. @item
  12341. Super-Resolution Convolutional Neural Network model (SRCNN).
  12342. See @url{https://arxiv.org/abs/1501.00092}.
  12343. @item
  12344. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12345. See @url{https://arxiv.org/abs/1609.05158}.
  12346. @end itemize
  12347. Training scripts as well as scripts for model generation are provided in
  12348. the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12349. The filter accepts the following options:
  12350. @table @option
  12351. @item dnn_backend
  12352. Specify which DNN backend to use for model loading and execution. This option accepts
  12353. the following values:
  12354. @table @samp
  12355. @item native
  12356. Native implementation of DNN loading and execution.
  12357. @item tensorflow
  12358. TensorFlow backend. To enable this backend you
  12359. need to install the TensorFlow for C library (see
  12360. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12361. @code{--enable-libtensorflow}
  12362. @end table
  12363. Default value is @samp{native}.
  12364. @item model
  12365. Set path to model file specifying network architecture and its parameters.
  12366. Note that different backends use different file formats. TensorFlow backend
  12367. can load files for both formats, while native backend can load files for only
  12368. its format.
  12369. @item scale_factor
  12370. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12371. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12372. input upscaled using bicubic upscaling with proper scale factor.
  12373. @end table
  12374. @anchor{subtitles}
  12375. @section subtitles
  12376. Draw subtitles on top of input video using the libass library.
  12377. To enable compilation of this filter you need to configure FFmpeg with
  12378. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12379. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12380. Alpha) subtitles format.
  12381. The filter accepts the following options:
  12382. @table @option
  12383. @item filename, f
  12384. Set the filename of the subtitle file to read. It must be specified.
  12385. @item original_size
  12386. Specify the size of the original video, the video for which the ASS file
  12387. was composed. For the syntax of this option, check the
  12388. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12389. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12390. correctly scale the fonts if the aspect ratio has been changed.
  12391. @item fontsdir
  12392. Set a directory path containing fonts that can be used by the filter.
  12393. These fonts will be used in addition to whatever the font provider uses.
  12394. @item alpha
  12395. Process alpha channel, by default alpha channel is untouched.
  12396. @item charenc
  12397. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12398. useful if not UTF-8.
  12399. @item stream_index, si
  12400. Set subtitles stream index. @code{subtitles} filter only.
  12401. @item force_style
  12402. Override default style or script info parameters of the subtitles. It accepts a
  12403. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12404. @end table
  12405. If the first key is not specified, it is assumed that the first value
  12406. specifies the @option{filename}.
  12407. For example, to render the file @file{sub.srt} on top of the input
  12408. video, use the command:
  12409. @example
  12410. subtitles=sub.srt
  12411. @end example
  12412. which is equivalent to:
  12413. @example
  12414. subtitles=filename=sub.srt
  12415. @end example
  12416. To render the default subtitles stream from file @file{video.mkv}, use:
  12417. @example
  12418. subtitles=video.mkv
  12419. @end example
  12420. To render the second subtitles stream from that file, use:
  12421. @example
  12422. subtitles=video.mkv:si=1
  12423. @end example
  12424. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12425. @code{DejaVu Serif}, use:
  12426. @example
  12427. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12428. @end example
  12429. @section super2xsai
  12430. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12431. Interpolate) pixel art scaling algorithm.
  12432. Useful for enlarging pixel art images without reducing sharpness.
  12433. @section swaprect
  12434. Swap two rectangular objects in video.
  12435. This filter accepts the following options:
  12436. @table @option
  12437. @item w
  12438. Set object width.
  12439. @item h
  12440. Set object height.
  12441. @item x1
  12442. Set 1st rect x coordinate.
  12443. @item y1
  12444. Set 1st rect y coordinate.
  12445. @item x2
  12446. Set 2nd rect x coordinate.
  12447. @item y2
  12448. Set 2nd rect y coordinate.
  12449. All expressions are evaluated once for each frame.
  12450. @end table
  12451. The all options are expressions containing the following constants:
  12452. @table @option
  12453. @item w
  12454. @item h
  12455. The input width and height.
  12456. @item a
  12457. same as @var{w} / @var{h}
  12458. @item sar
  12459. input sample aspect ratio
  12460. @item dar
  12461. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12462. @item n
  12463. The number of the input frame, starting from 0.
  12464. @item t
  12465. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12466. @item pos
  12467. the position in the file of the input frame, NAN if unknown
  12468. @end table
  12469. @section swapuv
  12470. Swap U & V plane.
  12471. @section telecine
  12472. Apply telecine process to the video.
  12473. This filter accepts the following options:
  12474. @table @option
  12475. @item first_field
  12476. @table @samp
  12477. @item top, t
  12478. top field first
  12479. @item bottom, b
  12480. bottom field first
  12481. The default value is @code{top}.
  12482. @end table
  12483. @item pattern
  12484. A string of numbers representing the pulldown pattern you wish to apply.
  12485. The default value is @code{23}.
  12486. @end table
  12487. @example
  12488. Some typical patterns:
  12489. NTSC output (30i):
  12490. 27.5p: 32222
  12491. 24p: 23 (classic)
  12492. 24p: 2332 (preferred)
  12493. 20p: 33
  12494. 18p: 334
  12495. 16p: 3444
  12496. PAL output (25i):
  12497. 27.5p: 12222
  12498. 24p: 222222222223 ("Euro pulldown")
  12499. 16.67p: 33
  12500. 16p: 33333334
  12501. @end example
  12502. @section threshold
  12503. Apply threshold effect to video stream.
  12504. This filter needs four video streams to perform thresholding.
  12505. First stream is stream we are filtering.
  12506. Second stream is holding threshold values, third stream is holding min values,
  12507. and last, fourth stream is holding max values.
  12508. The filter accepts the following option:
  12509. @table @option
  12510. @item planes
  12511. Set which planes will be processed, unprocessed planes will be copied.
  12512. By default value 0xf, all planes will be processed.
  12513. @end table
  12514. For example if first stream pixel's component value is less then threshold value
  12515. of pixel component from 2nd threshold stream, third stream value will picked,
  12516. otherwise fourth stream pixel component value will be picked.
  12517. Using color source filter one can perform various types of thresholding:
  12518. @subsection Examples
  12519. @itemize
  12520. @item
  12521. Binary threshold, using gray color as threshold:
  12522. @example
  12523. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12524. @end example
  12525. @item
  12526. Inverted binary threshold, using gray color as threshold:
  12527. @example
  12528. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12529. @end example
  12530. @item
  12531. Truncate binary threshold, using gray color as threshold:
  12532. @example
  12533. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12534. @end example
  12535. @item
  12536. Threshold to zero, using gray color as threshold:
  12537. @example
  12538. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12539. @end example
  12540. @item
  12541. Inverted threshold to zero, using gray color as threshold:
  12542. @example
  12543. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12544. @end example
  12545. @end itemize
  12546. @section thumbnail
  12547. Select the most representative frame in a given sequence of consecutive frames.
  12548. The filter accepts the following options:
  12549. @table @option
  12550. @item n
  12551. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12552. will pick one of them, and then handle the next batch of @var{n} frames until
  12553. the end. Default is @code{100}.
  12554. @end table
  12555. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12556. value will result in a higher memory usage, so a high value is not recommended.
  12557. @subsection Examples
  12558. @itemize
  12559. @item
  12560. Extract one picture each 50 frames:
  12561. @example
  12562. thumbnail=50
  12563. @end example
  12564. @item
  12565. Complete example of a thumbnail creation with @command{ffmpeg}:
  12566. @example
  12567. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12568. @end example
  12569. @end itemize
  12570. @section tile
  12571. Tile several successive frames together.
  12572. The filter accepts the following options:
  12573. @table @option
  12574. @item layout
  12575. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12576. this option, check the
  12577. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12578. @item nb_frames
  12579. Set the maximum number of frames to render in the given area. It must be less
  12580. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12581. the area will be used.
  12582. @item margin
  12583. Set the outer border margin in pixels.
  12584. @item padding
  12585. Set the inner border thickness (i.e. the number of pixels between frames). For
  12586. more advanced padding options (such as having different values for the edges),
  12587. refer to the pad video filter.
  12588. @item color
  12589. Specify the color of the unused area. For the syntax of this option, check the
  12590. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12591. The default value of @var{color} is "black".
  12592. @item overlap
  12593. Set the number of frames to overlap when tiling several successive frames together.
  12594. The value must be between @code{0} and @var{nb_frames - 1}.
  12595. @item init_padding
  12596. Set the number of frames to initially be empty before displaying first output frame.
  12597. This controls how soon will one get first output frame.
  12598. The value must be between @code{0} and @var{nb_frames - 1}.
  12599. @end table
  12600. @subsection Examples
  12601. @itemize
  12602. @item
  12603. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12604. @example
  12605. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12606. @end example
  12607. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12608. duplicating each output frame to accommodate the originally detected frame
  12609. rate.
  12610. @item
  12611. Display @code{5} pictures in an area of @code{3x2} frames,
  12612. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12613. mixed flat and named options:
  12614. @example
  12615. tile=3x2:nb_frames=5:padding=7:margin=2
  12616. @end example
  12617. @end itemize
  12618. @section tinterlace
  12619. Perform various types of temporal field interlacing.
  12620. Frames are counted starting from 1, so the first input frame is
  12621. considered odd.
  12622. The filter accepts the following options:
  12623. @table @option
  12624. @item mode
  12625. Specify the mode of the interlacing. This option can also be specified
  12626. as a value alone. See below for a list of values for this option.
  12627. Available values are:
  12628. @table @samp
  12629. @item merge, 0
  12630. Move odd frames into the upper field, even into the lower field,
  12631. generating a double height frame at half frame rate.
  12632. @example
  12633. ------> time
  12634. Input:
  12635. Frame 1 Frame 2 Frame 3 Frame 4
  12636. 11111 22222 33333 44444
  12637. 11111 22222 33333 44444
  12638. 11111 22222 33333 44444
  12639. 11111 22222 33333 44444
  12640. Output:
  12641. 11111 33333
  12642. 22222 44444
  12643. 11111 33333
  12644. 22222 44444
  12645. 11111 33333
  12646. 22222 44444
  12647. 11111 33333
  12648. 22222 44444
  12649. @end example
  12650. @item drop_even, 1
  12651. Only output odd frames, even frames are dropped, generating a frame with
  12652. unchanged height at half frame rate.
  12653. @example
  12654. ------> time
  12655. Input:
  12656. Frame 1 Frame 2 Frame 3 Frame 4
  12657. 11111 22222 33333 44444
  12658. 11111 22222 33333 44444
  12659. 11111 22222 33333 44444
  12660. 11111 22222 33333 44444
  12661. Output:
  12662. 11111 33333
  12663. 11111 33333
  12664. 11111 33333
  12665. 11111 33333
  12666. @end example
  12667. @item drop_odd, 2
  12668. Only output even frames, odd frames are dropped, generating a frame with
  12669. unchanged height at half frame rate.
  12670. @example
  12671. ------> time
  12672. Input:
  12673. Frame 1 Frame 2 Frame 3 Frame 4
  12674. 11111 22222 33333 44444
  12675. 11111 22222 33333 44444
  12676. 11111 22222 33333 44444
  12677. 11111 22222 33333 44444
  12678. Output:
  12679. 22222 44444
  12680. 22222 44444
  12681. 22222 44444
  12682. 22222 44444
  12683. @end example
  12684. @item pad, 3
  12685. Expand each frame to full height, but pad alternate lines with black,
  12686. generating a frame with double height at the same input frame rate.
  12687. @example
  12688. ------> time
  12689. Input:
  12690. Frame 1 Frame 2 Frame 3 Frame 4
  12691. 11111 22222 33333 44444
  12692. 11111 22222 33333 44444
  12693. 11111 22222 33333 44444
  12694. 11111 22222 33333 44444
  12695. Output:
  12696. 11111 ..... 33333 .....
  12697. ..... 22222 ..... 44444
  12698. 11111 ..... 33333 .....
  12699. ..... 22222 ..... 44444
  12700. 11111 ..... 33333 .....
  12701. ..... 22222 ..... 44444
  12702. 11111 ..... 33333 .....
  12703. ..... 22222 ..... 44444
  12704. @end example
  12705. @item interleave_top, 4
  12706. Interleave the upper field from odd frames with the lower field from
  12707. even frames, generating a frame with unchanged height at half frame rate.
  12708. @example
  12709. ------> time
  12710. Input:
  12711. Frame 1 Frame 2 Frame 3 Frame 4
  12712. 11111<- 22222 33333<- 44444
  12713. 11111 22222<- 33333 44444<-
  12714. 11111<- 22222 33333<- 44444
  12715. 11111 22222<- 33333 44444<-
  12716. Output:
  12717. 11111 33333
  12718. 22222 44444
  12719. 11111 33333
  12720. 22222 44444
  12721. @end example
  12722. @item interleave_bottom, 5
  12723. Interleave the lower field from odd frames with the upper field from
  12724. even frames, generating a frame with unchanged height at half frame rate.
  12725. @example
  12726. ------> time
  12727. Input:
  12728. Frame 1 Frame 2 Frame 3 Frame 4
  12729. 11111 22222<- 33333 44444<-
  12730. 11111<- 22222 33333<- 44444
  12731. 11111 22222<- 33333 44444<-
  12732. 11111<- 22222 33333<- 44444
  12733. Output:
  12734. 22222 44444
  12735. 11111 33333
  12736. 22222 44444
  12737. 11111 33333
  12738. @end example
  12739. @item interlacex2, 6
  12740. Double frame rate with unchanged height. Frames are inserted each
  12741. containing the second temporal field from the previous input frame and
  12742. the first temporal field from the next input frame. This mode relies on
  12743. the top_field_first flag. Useful for interlaced video displays with no
  12744. field synchronisation.
  12745. @example
  12746. ------> time
  12747. Input:
  12748. Frame 1 Frame 2 Frame 3 Frame 4
  12749. 11111 22222 33333 44444
  12750. 11111 22222 33333 44444
  12751. 11111 22222 33333 44444
  12752. 11111 22222 33333 44444
  12753. Output:
  12754. 11111 22222 22222 33333 33333 44444 44444
  12755. 11111 11111 22222 22222 33333 33333 44444
  12756. 11111 22222 22222 33333 33333 44444 44444
  12757. 11111 11111 22222 22222 33333 33333 44444
  12758. @end example
  12759. @item mergex2, 7
  12760. Move odd frames into the upper field, even into the lower field,
  12761. generating a double height frame at same frame rate.
  12762. @example
  12763. ------> time
  12764. Input:
  12765. Frame 1 Frame 2 Frame 3 Frame 4
  12766. 11111 22222 33333 44444
  12767. 11111 22222 33333 44444
  12768. 11111 22222 33333 44444
  12769. 11111 22222 33333 44444
  12770. Output:
  12771. 11111 33333 33333 55555
  12772. 22222 22222 44444 44444
  12773. 11111 33333 33333 55555
  12774. 22222 22222 44444 44444
  12775. 11111 33333 33333 55555
  12776. 22222 22222 44444 44444
  12777. 11111 33333 33333 55555
  12778. 22222 22222 44444 44444
  12779. @end example
  12780. @end table
  12781. Numeric values are deprecated but are accepted for backward
  12782. compatibility reasons.
  12783. Default mode is @code{merge}.
  12784. @item flags
  12785. Specify flags influencing the filter process.
  12786. Available value for @var{flags} is:
  12787. @table @option
  12788. @item low_pass_filter, vlfp
  12789. Enable linear vertical low-pass filtering in the filter.
  12790. Vertical low-pass filtering is required when creating an interlaced
  12791. destination from a progressive source which contains high-frequency
  12792. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  12793. patterning.
  12794. @item complex_filter, cvlfp
  12795. Enable complex vertical low-pass filtering.
  12796. This will slightly less reduce interlace 'twitter' and Moire
  12797. patterning but better retain detail and subjective sharpness impression.
  12798. @end table
  12799. Vertical low-pass filtering can only be enabled for @option{mode}
  12800. @var{interleave_top} and @var{interleave_bottom}.
  12801. @end table
  12802. @section tmix
  12803. Mix successive video frames.
  12804. A description of the accepted options follows.
  12805. @table @option
  12806. @item frames
  12807. The number of successive frames to mix. If unspecified, it defaults to 3.
  12808. @item weights
  12809. Specify weight of each input video frame.
  12810. Each weight is separated by space. If number of weights is smaller than
  12811. number of @var{frames} last specified weight will be used for all remaining
  12812. unset weights.
  12813. @item scale
  12814. Specify scale, if it is set it will be multiplied with sum
  12815. of each weight multiplied with pixel values to give final destination
  12816. pixel value. By default @var{scale} is auto scaled to sum of weights.
  12817. @end table
  12818. @subsection Examples
  12819. @itemize
  12820. @item
  12821. Average 7 successive frames:
  12822. @example
  12823. tmix=frames=7:weights="1 1 1 1 1 1 1"
  12824. @end example
  12825. @item
  12826. Apply simple temporal convolution:
  12827. @example
  12828. tmix=frames=3:weights="-1 3 -1"
  12829. @end example
  12830. @item
  12831. Similar as above but only showing temporal differences:
  12832. @example
  12833. tmix=frames=3:weights="-1 2 -1":scale=1
  12834. @end example
  12835. @end itemize
  12836. @anchor{tonemap}
  12837. @section tonemap
  12838. Tone map colors from different dynamic ranges.
  12839. This filter expects data in single precision floating point, as it needs to
  12840. operate on (and can output) out-of-range values. Another filter, such as
  12841. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  12842. The tonemapping algorithms implemented only work on linear light, so input
  12843. data should be linearized beforehand (and possibly correctly tagged).
  12844. @example
  12845. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  12846. @end example
  12847. @subsection Options
  12848. The filter accepts the following options.
  12849. @table @option
  12850. @item tonemap
  12851. Set the tone map algorithm to use.
  12852. Possible values are:
  12853. @table @var
  12854. @item none
  12855. Do not apply any tone map, only desaturate overbright pixels.
  12856. @item clip
  12857. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  12858. in-range values, while distorting out-of-range values.
  12859. @item linear
  12860. Stretch the entire reference gamut to a linear multiple of the display.
  12861. @item gamma
  12862. Fit a logarithmic transfer between the tone curves.
  12863. @item reinhard
  12864. Preserve overall image brightness with a simple curve, using nonlinear
  12865. contrast, which results in flattening details and degrading color accuracy.
  12866. @item hable
  12867. Preserve both dark and bright details better than @var{reinhard}, at the cost
  12868. of slightly darkening everything. Use it when detail preservation is more
  12869. important than color and brightness accuracy.
  12870. @item mobius
  12871. Smoothly map out-of-range values, while retaining contrast and colors for
  12872. in-range material as much as possible. Use it when color accuracy is more
  12873. important than detail preservation.
  12874. @end table
  12875. Default is none.
  12876. @item param
  12877. Tune the tone mapping algorithm.
  12878. This affects the following algorithms:
  12879. @table @var
  12880. @item none
  12881. Ignored.
  12882. @item linear
  12883. Specifies the scale factor to use while stretching.
  12884. Default to 1.0.
  12885. @item gamma
  12886. Specifies the exponent of the function.
  12887. Default to 1.8.
  12888. @item clip
  12889. Specify an extra linear coefficient to multiply into the signal before clipping.
  12890. Default to 1.0.
  12891. @item reinhard
  12892. Specify the local contrast coefficient at the display peak.
  12893. Default to 0.5, which means that in-gamut values will be about half as bright
  12894. as when clipping.
  12895. @item hable
  12896. Ignored.
  12897. @item mobius
  12898. Specify the transition point from linear to mobius transform. Every value
  12899. below this point is guaranteed to be mapped 1:1. The higher the value, the
  12900. more accurate the result will be, at the cost of losing bright details.
  12901. Default to 0.3, which due to the steep initial slope still preserves in-range
  12902. colors fairly accurately.
  12903. @end table
  12904. @item desat
  12905. Apply desaturation for highlights that exceed this level of brightness. The
  12906. higher the parameter, the more color information will be preserved. This
  12907. setting helps prevent unnaturally blown-out colors for super-highlights, by
  12908. (smoothly) turning into white instead. This makes images feel more natural,
  12909. at the cost of reducing information about out-of-range colors.
  12910. The default of 2.0 is somewhat conservative and will mostly just apply to
  12911. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  12912. This option works only if the input frame has a supported color tag.
  12913. @item peak
  12914. Override signal/nominal/reference peak with this value. Useful when the
  12915. embedded peak information in display metadata is not reliable or when tone
  12916. mapping from a lower range to a higher range.
  12917. @end table
  12918. @section tpad
  12919. Temporarily pad video frames.
  12920. The filter accepts the following options:
  12921. @table @option
  12922. @item start
  12923. Specify number of delay frames before input video stream.
  12924. @item stop
  12925. Specify number of padding frames after input video stream.
  12926. Set to -1 to pad indefinitely.
  12927. @item start_mode
  12928. Set kind of frames added to beginning of stream.
  12929. Can be either @var{add} or @var{clone}.
  12930. With @var{add} frames of solid-color are added.
  12931. With @var{clone} frames are clones of first frame.
  12932. @item stop_mode
  12933. Set kind of frames added to end of stream.
  12934. Can be either @var{add} or @var{clone}.
  12935. With @var{add} frames of solid-color are added.
  12936. With @var{clone} frames are clones of last frame.
  12937. @item start_duration, stop_duration
  12938. Specify the duration of the start/stop delay. See
  12939. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12940. for the accepted syntax.
  12941. These options override @var{start} and @var{stop}.
  12942. @item color
  12943. Specify the color of the padded area. For the syntax of this option,
  12944. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12945. manual,ffmpeg-utils}.
  12946. The default value of @var{color} is "black".
  12947. @end table
  12948. @anchor{transpose}
  12949. @section transpose
  12950. Transpose rows with columns in the input video and optionally flip it.
  12951. It accepts the following parameters:
  12952. @table @option
  12953. @item dir
  12954. Specify the transposition direction.
  12955. Can assume the following values:
  12956. @table @samp
  12957. @item 0, 4, cclock_flip
  12958. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  12959. @example
  12960. L.R L.l
  12961. . . -> . .
  12962. l.r R.r
  12963. @end example
  12964. @item 1, 5, clock
  12965. Rotate by 90 degrees clockwise, that is:
  12966. @example
  12967. L.R l.L
  12968. . . -> . .
  12969. l.r r.R
  12970. @end example
  12971. @item 2, 6, cclock
  12972. Rotate by 90 degrees counterclockwise, that is:
  12973. @example
  12974. L.R R.r
  12975. . . -> . .
  12976. l.r L.l
  12977. @end example
  12978. @item 3, 7, clock_flip
  12979. Rotate by 90 degrees clockwise and vertically flip, that is:
  12980. @example
  12981. L.R r.R
  12982. . . -> . .
  12983. l.r l.L
  12984. @end example
  12985. @end table
  12986. For values between 4-7, the transposition is only done if the input
  12987. video geometry is portrait and not landscape. These values are
  12988. deprecated, the @code{passthrough} option should be used instead.
  12989. Numerical values are deprecated, and should be dropped in favor of
  12990. symbolic constants.
  12991. @item passthrough
  12992. Do not apply the transposition if the input geometry matches the one
  12993. specified by the specified value. It accepts the following values:
  12994. @table @samp
  12995. @item none
  12996. Always apply transposition.
  12997. @item portrait
  12998. Preserve portrait geometry (when @var{height} >= @var{width}).
  12999. @item landscape
  13000. Preserve landscape geometry (when @var{width} >= @var{height}).
  13001. @end table
  13002. Default value is @code{none}.
  13003. @end table
  13004. For example to rotate by 90 degrees clockwise and preserve portrait
  13005. layout:
  13006. @example
  13007. transpose=dir=1:passthrough=portrait
  13008. @end example
  13009. The command above can also be specified as:
  13010. @example
  13011. transpose=1:portrait
  13012. @end example
  13013. @section transpose_npp
  13014. Transpose rows with columns in the input video and optionally flip it.
  13015. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13016. It accepts the following parameters:
  13017. @table @option
  13018. @item dir
  13019. Specify the transposition direction.
  13020. Can assume the following values:
  13021. @table @samp
  13022. @item cclock_flip
  13023. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13024. @item clock
  13025. Rotate by 90 degrees clockwise.
  13026. @item cclock
  13027. Rotate by 90 degrees counterclockwise.
  13028. @item clock_flip
  13029. Rotate by 90 degrees clockwise and vertically flip.
  13030. @end table
  13031. @item passthrough
  13032. Do not apply the transposition if the input geometry matches the one
  13033. specified by the specified value. It accepts the following values:
  13034. @table @samp
  13035. @item none
  13036. Always apply transposition. (default)
  13037. @item portrait
  13038. Preserve portrait geometry (when @var{height} >= @var{width}).
  13039. @item landscape
  13040. Preserve landscape geometry (when @var{width} >= @var{height}).
  13041. @end table
  13042. @end table
  13043. @section trim
  13044. Trim the input so that the output contains one continuous subpart of the input.
  13045. It accepts the following parameters:
  13046. @table @option
  13047. @item start
  13048. Specify the time of the start of the kept section, i.e. the frame with the
  13049. timestamp @var{start} will be the first frame in the output.
  13050. @item end
  13051. Specify the time of the first frame that will be dropped, i.e. the frame
  13052. immediately preceding the one with the timestamp @var{end} will be the last
  13053. frame in the output.
  13054. @item start_pts
  13055. This is the same as @var{start}, except this option sets the start timestamp
  13056. in timebase units instead of seconds.
  13057. @item end_pts
  13058. This is the same as @var{end}, except this option sets the end timestamp
  13059. in timebase units instead of seconds.
  13060. @item duration
  13061. The maximum duration of the output in seconds.
  13062. @item start_frame
  13063. The number of the first frame that should be passed to the output.
  13064. @item end_frame
  13065. The number of the first frame that should be dropped.
  13066. @end table
  13067. @option{start}, @option{end}, and @option{duration} are expressed as time
  13068. duration specifications; see
  13069. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13070. for the accepted syntax.
  13071. Note that the first two sets of the start/end options and the @option{duration}
  13072. option look at the frame timestamp, while the _frame variants simply count the
  13073. frames that pass through the filter. Also note that this filter does not modify
  13074. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13075. setpts filter after the trim filter.
  13076. If multiple start or end options are set, this filter tries to be greedy and
  13077. keep all the frames that match at least one of the specified constraints. To keep
  13078. only the part that matches all the constraints at once, chain multiple trim
  13079. filters.
  13080. The defaults are such that all the input is kept. So it is possible to set e.g.
  13081. just the end values to keep everything before the specified time.
  13082. Examples:
  13083. @itemize
  13084. @item
  13085. Drop everything except the second minute of input:
  13086. @example
  13087. ffmpeg -i INPUT -vf trim=60:120
  13088. @end example
  13089. @item
  13090. Keep only the first second:
  13091. @example
  13092. ffmpeg -i INPUT -vf trim=duration=1
  13093. @end example
  13094. @end itemize
  13095. @section unpremultiply
  13096. Apply alpha unpremultiply effect to input video stream using first plane
  13097. of second stream as alpha.
  13098. Both streams must have same dimensions and same pixel format.
  13099. The filter accepts the following option:
  13100. @table @option
  13101. @item planes
  13102. Set which planes will be processed, unprocessed planes will be copied.
  13103. By default value 0xf, all planes will be processed.
  13104. If the format has 1 or 2 components, then luma is bit 0.
  13105. If the format has 3 or 4 components:
  13106. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13107. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13108. If present, the alpha channel is always the last bit.
  13109. @item inplace
  13110. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13111. @end table
  13112. @anchor{unsharp}
  13113. @section unsharp
  13114. Sharpen or blur the input video.
  13115. It accepts the following parameters:
  13116. @table @option
  13117. @item luma_msize_x, lx
  13118. Set the luma matrix horizontal size. It must be an odd integer between
  13119. 3 and 23. The default value is 5.
  13120. @item luma_msize_y, ly
  13121. Set the luma matrix vertical size. It must be an odd integer between 3
  13122. and 23. The default value is 5.
  13123. @item luma_amount, la
  13124. Set the luma effect strength. It must be a floating point number, reasonable
  13125. values lay between -1.5 and 1.5.
  13126. Negative values will blur the input video, while positive values will
  13127. sharpen it, a value of zero will disable the effect.
  13128. Default value is 1.0.
  13129. @item chroma_msize_x, cx
  13130. Set the chroma matrix horizontal size. It must be an odd integer
  13131. between 3 and 23. The default value is 5.
  13132. @item chroma_msize_y, cy
  13133. Set the chroma matrix vertical size. It must be an odd integer
  13134. between 3 and 23. The default value is 5.
  13135. @item chroma_amount, ca
  13136. Set the chroma effect strength. It must be a floating point number, reasonable
  13137. values lay between -1.5 and 1.5.
  13138. Negative values will blur the input video, while positive values will
  13139. sharpen it, a value of zero will disable the effect.
  13140. Default value is 0.0.
  13141. @end table
  13142. All parameters are optional and default to the equivalent of the
  13143. string '5:5:1.0:5:5:0.0'.
  13144. @subsection Examples
  13145. @itemize
  13146. @item
  13147. Apply strong luma sharpen effect:
  13148. @example
  13149. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13150. @end example
  13151. @item
  13152. Apply a strong blur of both luma and chroma parameters:
  13153. @example
  13154. unsharp=7:7:-2:7:7:-2
  13155. @end example
  13156. @end itemize
  13157. @section uspp
  13158. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13159. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13160. shifts and average the results.
  13161. The way this differs from the behavior of spp is that uspp actually encodes &
  13162. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13163. DCT similar to MJPEG.
  13164. The filter accepts the following options:
  13165. @table @option
  13166. @item quality
  13167. Set quality. This option defines the number of levels for averaging. It accepts
  13168. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13169. effect. A value of @code{8} means the higher quality. For each increment of
  13170. that value the speed drops by a factor of approximately 2. Default value is
  13171. @code{3}.
  13172. @item qp
  13173. Force a constant quantization parameter. If not set, the filter will use the QP
  13174. from the video stream (if available).
  13175. @end table
  13176. @section vaguedenoiser
  13177. Apply a wavelet based denoiser.
  13178. It transforms each frame from the video input into the wavelet domain,
  13179. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13180. the obtained coefficients. It does an inverse wavelet transform after.
  13181. Due to wavelet properties, it should give a nice smoothed result, and
  13182. reduced noise, without blurring picture features.
  13183. This filter accepts the following options:
  13184. @table @option
  13185. @item threshold
  13186. The filtering strength. The higher, the more filtered the video will be.
  13187. Hard thresholding can use a higher threshold than soft thresholding
  13188. before the video looks overfiltered. Default value is 2.
  13189. @item method
  13190. The filtering method the filter will use.
  13191. It accepts the following values:
  13192. @table @samp
  13193. @item hard
  13194. All values under the threshold will be zeroed.
  13195. @item soft
  13196. All values under the threshold will be zeroed. All values above will be
  13197. reduced by the threshold.
  13198. @item garrote
  13199. Scales or nullifies coefficients - intermediary between (more) soft and
  13200. (less) hard thresholding.
  13201. @end table
  13202. Default is garrote.
  13203. @item nsteps
  13204. Number of times, the wavelet will decompose the picture. Picture can't
  13205. be decomposed beyond a particular point (typically, 8 for a 640x480
  13206. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13207. @item percent
  13208. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13209. @item planes
  13210. A list of the planes to process. By default all planes are processed.
  13211. @end table
  13212. @section vectorscope
  13213. Display 2 color component values in the two dimensional graph (which is called
  13214. a vectorscope).
  13215. This filter accepts the following options:
  13216. @table @option
  13217. @item mode, m
  13218. Set vectorscope mode.
  13219. It accepts the following values:
  13220. @table @samp
  13221. @item gray
  13222. Gray values are displayed on graph, higher brightness means more pixels have
  13223. same component color value on location in graph. This is the default mode.
  13224. @item color
  13225. Gray values are displayed on graph. Surrounding pixels values which are not
  13226. present in video frame are drawn in gradient of 2 color components which are
  13227. set by option @code{x} and @code{y}. The 3rd color component is static.
  13228. @item color2
  13229. Actual color components values present in video frame are displayed on graph.
  13230. @item color3
  13231. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13232. on graph increases value of another color component, which is luminance by
  13233. default values of @code{x} and @code{y}.
  13234. @item color4
  13235. Actual colors present in video frame are displayed on graph. If two different
  13236. colors map to same position on graph then color with higher value of component
  13237. not present in graph is picked.
  13238. @item color5
  13239. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13240. component picked from radial gradient.
  13241. @end table
  13242. @item x
  13243. Set which color component will be represented on X-axis. Default is @code{1}.
  13244. @item y
  13245. Set which color component will be represented on Y-axis. Default is @code{2}.
  13246. @item intensity, i
  13247. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13248. of color component which represents frequency of (X, Y) location in graph.
  13249. @item envelope, e
  13250. @table @samp
  13251. @item none
  13252. No envelope, this is default.
  13253. @item instant
  13254. Instant envelope, even darkest single pixel will be clearly highlighted.
  13255. @item peak
  13256. Hold maximum and minimum values presented in graph over time. This way you
  13257. can still spot out of range values without constantly looking at vectorscope.
  13258. @item peak+instant
  13259. Peak and instant envelope combined together.
  13260. @end table
  13261. @item graticule, g
  13262. Set what kind of graticule to draw.
  13263. @table @samp
  13264. @item none
  13265. @item green
  13266. @item color
  13267. @end table
  13268. @item opacity, o
  13269. Set graticule opacity.
  13270. @item flags, f
  13271. Set graticule flags.
  13272. @table @samp
  13273. @item white
  13274. Draw graticule for white point.
  13275. @item black
  13276. Draw graticule for black point.
  13277. @item name
  13278. Draw color points short names.
  13279. @end table
  13280. @item bgopacity, b
  13281. Set background opacity.
  13282. @item lthreshold, l
  13283. Set low threshold for color component not represented on X or Y axis.
  13284. Values lower than this value will be ignored. Default is 0.
  13285. Note this value is multiplied with actual max possible value one pixel component
  13286. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13287. is 0.1 * 255 = 25.
  13288. @item hthreshold, h
  13289. Set high threshold for color component not represented on X or Y axis.
  13290. Values higher than this value will be ignored. Default is 1.
  13291. Note this value is multiplied with actual max possible value one pixel component
  13292. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13293. is 0.9 * 255 = 230.
  13294. @item colorspace, c
  13295. Set what kind of colorspace to use when drawing graticule.
  13296. @table @samp
  13297. @item auto
  13298. @item 601
  13299. @item 709
  13300. @end table
  13301. Default is auto.
  13302. @end table
  13303. @anchor{vidstabdetect}
  13304. @section vidstabdetect
  13305. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13306. @ref{vidstabtransform} for pass 2.
  13307. This filter generates a file with relative translation and rotation
  13308. transform information about subsequent frames, which is then used by
  13309. the @ref{vidstabtransform} filter.
  13310. To enable compilation of this filter you need to configure FFmpeg with
  13311. @code{--enable-libvidstab}.
  13312. This filter accepts the following options:
  13313. @table @option
  13314. @item result
  13315. Set the path to the file used to write the transforms information.
  13316. Default value is @file{transforms.trf}.
  13317. @item shakiness
  13318. Set how shaky the video is and how quick the camera is. It accepts an
  13319. integer in the range 1-10, a value of 1 means little shakiness, a
  13320. value of 10 means strong shakiness. Default value is 5.
  13321. @item accuracy
  13322. Set the accuracy of the detection process. It must be a value in the
  13323. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13324. accuracy. Default value is 15.
  13325. @item stepsize
  13326. Set stepsize of the search process. The region around minimum is
  13327. scanned with 1 pixel resolution. Default value is 6.
  13328. @item mincontrast
  13329. Set minimum contrast. Below this value a local measurement field is
  13330. discarded. Must be a floating point value in the range 0-1. Default
  13331. value is 0.3.
  13332. @item tripod
  13333. Set reference frame number for tripod mode.
  13334. If enabled, the motion of the frames is compared to a reference frame
  13335. in the filtered stream, identified by the specified number. The idea
  13336. is to compensate all movements in a more-or-less static scene and keep
  13337. the camera view absolutely still.
  13338. If set to 0, it is disabled. The frames are counted starting from 1.
  13339. @item show
  13340. Show fields and transforms in the resulting frames. It accepts an
  13341. integer in the range 0-2. Default value is 0, which disables any
  13342. visualization.
  13343. @end table
  13344. @subsection Examples
  13345. @itemize
  13346. @item
  13347. Use default values:
  13348. @example
  13349. vidstabdetect
  13350. @end example
  13351. @item
  13352. Analyze strongly shaky movie and put the results in file
  13353. @file{mytransforms.trf}:
  13354. @example
  13355. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13356. @end example
  13357. @item
  13358. Visualize the result of internal transformations in the resulting
  13359. video:
  13360. @example
  13361. vidstabdetect=show=1
  13362. @end example
  13363. @item
  13364. Analyze a video with medium shakiness using @command{ffmpeg}:
  13365. @example
  13366. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13367. @end example
  13368. @end itemize
  13369. @anchor{vidstabtransform}
  13370. @section vidstabtransform
  13371. Video stabilization/deshaking: pass 2 of 2,
  13372. see @ref{vidstabdetect} for pass 1.
  13373. Read a file with transform information for each frame and
  13374. apply/compensate them. Together with the @ref{vidstabdetect}
  13375. filter this can be used to deshake videos. See also
  13376. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13377. the @ref{unsharp} filter, see below.
  13378. To enable compilation of this filter you need to configure FFmpeg with
  13379. @code{--enable-libvidstab}.
  13380. @subsection Options
  13381. @table @option
  13382. @item input
  13383. Set path to the file used to read the transforms. Default value is
  13384. @file{transforms.trf}.
  13385. @item smoothing
  13386. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13387. camera movements. Default value is 10.
  13388. For example a number of 10 means that 21 frames are used (10 in the
  13389. past and 10 in the future) to smoothen the motion in the video. A
  13390. larger value leads to a smoother video, but limits the acceleration of
  13391. the camera (pan/tilt movements). 0 is a special case where a static
  13392. camera is simulated.
  13393. @item optalgo
  13394. Set the camera path optimization algorithm.
  13395. Accepted values are:
  13396. @table @samp
  13397. @item gauss
  13398. gaussian kernel low-pass filter on camera motion (default)
  13399. @item avg
  13400. averaging on transformations
  13401. @end table
  13402. @item maxshift
  13403. Set maximal number of pixels to translate frames. Default value is -1,
  13404. meaning no limit.
  13405. @item maxangle
  13406. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13407. value is -1, meaning no limit.
  13408. @item crop
  13409. Specify how to deal with borders that may be visible due to movement
  13410. compensation.
  13411. Available values are:
  13412. @table @samp
  13413. @item keep
  13414. keep image information from previous frame (default)
  13415. @item black
  13416. fill the border black
  13417. @end table
  13418. @item invert
  13419. Invert transforms if set to 1. Default value is 0.
  13420. @item relative
  13421. Consider transforms as relative to previous frame if set to 1,
  13422. absolute if set to 0. Default value is 0.
  13423. @item zoom
  13424. Set percentage to zoom. A positive value will result in a zoom-in
  13425. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13426. zoom).
  13427. @item optzoom
  13428. Set optimal zooming to avoid borders.
  13429. Accepted values are:
  13430. @table @samp
  13431. @item 0
  13432. disabled
  13433. @item 1
  13434. optimal static zoom value is determined (only very strong movements
  13435. will lead to visible borders) (default)
  13436. @item 2
  13437. optimal adaptive zoom value is determined (no borders will be
  13438. visible), see @option{zoomspeed}
  13439. @end table
  13440. Note that the value given at zoom is added to the one calculated here.
  13441. @item zoomspeed
  13442. Set percent to zoom maximally each frame (enabled when
  13443. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13444. 0.25.
  13445. @item interpol
  13446. Specify type of interpolation.
  13447. Available values are:
  13448. @table @samp
  13449. @item no
  13450. no interpolation
  13451. @item linear
  13452. linear only horizontal
  13453. @item bilinear
  13454. linear in both directions (default)
  13455. @item bicubic
  13456. cubic in both directions (slow)
  13457. @end table
  13458. @item tripod
  13459. Enable virtual tripod mode if set to 1, which is equivalent to
  13460. @code{relative=0:smoothing=0}. Default value is 0.
  13461. Use also @code{tripod} option of @ref{vidstabdetect}.
  13462. @item debug
  13463. Increase log verbosity if set to 1. Also the detected global motions
  13464. are written to the temporary file @file{global_motions.trf}. Default
  13465. value is 0.
  13466. @end table
  13467. @subsection Examples
  13468. @itemize
  13469. @item
  13470. Use @command{ffmpeg} for a typical stabilization with default values:
  13471. @example
  13472. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13473. @end example
  13474. Note the use of the @ref{unsharp} filter which is always recommended.
  13475. @item
  13476. Zoom in a bit more and load transform data from a given file:
  13477. @example
  13478. vidstabtransform=zoom=5:input="mytransforms.trf"
  13479. @end example
  13480. @item
  13481. Smoothen the video even more:
  13482. @example
  13483. vidstabtransform=smoothing=30
  13484. @end example
  13485. @end itemize
  13486. @section vflip
  13487. Flip the input video vertically.
  13488. For example, to vertically flip a video with @command{ffmpeg}:
  13489. @example
  13490. ffmpeg -i in.avi -vf "vflip" out.avi
  13491. @end example
  13492. @section vfrdet
  13493. Detect variable frame rate video.
  13494. This filter tries to detect if the input is variable or constant frame rate.
  13495. At end it will output number of frames detected as having variable delta pts,
  13496. and ones with constant delta pts.
  13497. If there was frames with variable delta, than it will also show min and max delta
  13498. encountered.
  13499. @section vibrance
  13500. Boost or alter saturation.
  13501. The filter accepts the following options:
  13502. @table @option
  13503. @item intensity
  13504. Set strength of boost if positive value or strength of alter if negative value.
  13505. Default is 0. Allowed range is from -2 to 2.
  13506. @item rbal
  13507. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  13508. @item gbal
  13509. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  13510. @item bbal
  13511. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  13512. @item rlum
  13513. Set the red luma coefficient.
  13514. @item glum
  13515. Set the green luma coefficient.
  13516. @item blum
  13517. Set the blue luma coefficient.
  13518. @end table
  13519. @anchor{vignette}
  13520. @section vignette
  13521. Make or reverse a natural vignetting effect.
  13522. The filter accepts the following options:
  13523. @table @option
  13524. @item angle, a
  13525. Set lens angle expression as a number of radians.
  13526. The value is clipped in the @code{[0,PI/2]} range.
  13527. Default value: @code{"PI/5"}
  13528. @item x0
  13529. @item y0
  13530. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13531. by default.
  13532. @item mode
  13533. Set forward/backward mode.
  13534. Available modes are:
  13535. @table @samp
  13536. @item forward
  13537. The larger the distance from the central point, the darker the image becomes.
  13538. @item backward
  13539. The larger the distance from the central point, the brighter the image becomes.
  13540. This can be used to reverse a vignette effect, though there is no automatic
  13541. detection to extract the lens @option{angle} and other settings (yet). It can
  13542. also be used to create a burning effect.
  13543. @end table
  13544. Default value is @samp{forward}.
  13545. @item eval
  13546. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13547. It accepts the following values:
  13548. @table @samp
  13549. @item init
  13550. Evaluate expressions only once during the filter initialization.
  13551. @item frame
  13552. Evaluate expressions for each incoming frame. This is way slower than the
  13553. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13554. allows advanced dynamic expressions.
  13555. @end table
  13556. Default value is @samp{init}.
  13557. @item dither
  13558. Set dithering to reduce the circular banding effects. Default is @code{1}
  13559. (enabled).
  13560. @item aspect
  13561. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13562. Setting this value to the SAR of the input will make a rectangular vignetting
  13563. following the dimensions of the video.
  13564. Default is @code{1/1}.
  13565. @end table
  13566. @subsection Expressions
  13567. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13568. following parameters.
  13569. @table @option
  13570. @item w
  13571. @item h
  13572. input width and height
  13573. @item n
  13574. the number of input frame, starting from 0
  13575. @item pts
  13576. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13577. @var{TB} units, NAN if undefined
  13578. @item r
  13579. frame rate of the input video, NAN if the input frame rate is unknown
  13580. @item t
  13581. the PTS (Presentation TimeStamp) of the filtered video frame,
  13582. expressed in seconds, NAN if undefined
  13583. @item tb
  13584. time base of the input video
  13585. @end table
  13586. @subsection Examples
  13587. @itemize
  13588. @item
  13589. Apply simple strong vignetting effect:
  13590. @example
  13591. vignette=PI/4
  13592. @end example
  13593. @item
  13594. Make a flickering vignetting:
  13595. @example
  13596. vignette='PI/4+random(1)*PI/50':eval=frame
  13597. @end example
  13598. @end itemize
  13599. @section vmafmotion
  13600. Obtain the average vmaf motion score of a video.
  13601. It is one of the component filters of VMAF.
  13602. The obtained average motion score is printed through the logging system.
  13603. In the below example the input file @file{ref.mpg} is being processed and score
  13604. is computed.
  13605. @example
  13606. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13607. @end example
  13608. @section vstack
  13609. Stack input videos vertically.
  13610. All streams must be of same pixel format and of same width.
  13611. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13612. to create same output.
  13613. The filter accept the following option:
  13614. @table @option
  13615. @item inputs
  13616. Set number of input streams. Default is 2.
  13617. @item shortest
  13618. If set to 1, force the output to terminate when the shortest input
  13619. terminates. Default value is 0.
  13620. @end table
  13621. @section w3fdif
  13622. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13623. Deinterlacing Filter").
  13624. Based on the process described by Martin Weston for BBC R&D, and
  13625. implemented based on the de-interlace algorithm written by Jim
  13626. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13627. uses filter coefficients calculated by BBC R&D.
  13628. There are two sets of filter coefficients, so called "simple":
  13629. and "complex". Which set of filter coefficients is used can
  13630. be set by passing an optional parameter:
  13631. @table @option
  13632. @item filter
  13633. Set the interlacing filter coefficients. Accepts one of the following values:
  13634. @table @samp
  13635. @item simple
  13636. Simple filter coefficient set.
  13637. @item complex
  13638. More-complex filter coefficient set.
  13639. @end table
  13640. Default value is @samp{complex}.
  13641. @item deint
  13642. Specify which frames to deinterlace. Accept one of the following values:
  13643. @table @samp
  13644. @item all
  13645. Deinterlace all frames,
  13646. @item interlaced
  13647. Only deinterlace frames marked as interlaced.
  13648. @end table
  13649. Default value is @samp{all}.
  13650. @end table
  13651. @section waveform
  13652. Video waveform monitor.
  13653. The waveform monitor plots color component intensity. By default luminance
  13654. only. Each column of the waveform corresponds to a column of pixels in the
  13655. source video.
  13656. It accepts the following options:
  13657. @table @option
  13658. @item mode, m
  13659. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13660. In row mode, the graph on the left side represents color component value 0 and
  13661. the right side represents value = 255. In column mode, the top side represents
  13662. color component value = 0 and bottom side represents value = 255.
  13663. @item intensity, i
  13664. Set intensity. Smaller values are useful to find out how many values of the same
  13665. luminance are distributed across input rows/columns.
  13666. Default value is @code{0.04}. Allowed range is [0, 1].
  13667. @item mirror, r
  13668. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13669. In mirrored mode, higher values will be represented on the left
  13670. side for @code{row} mode and at the top for @code{column} mode. Default is
  13671. @code{1} (mirrored).
  13672. @item display, d
  13673. Set display mode.
  13674. It accepts the following values:
  13675. @table @samp
  13676. @item overlay
  13677. Presents information identical to that in the @code{parade}, except
  13678. that the graphs representing color components are superimposed directly
  13679. over one another.
  13680. This display mode makes it easier to spot relative differences or similarities
  13681. in overlapping areas of the color components that are supposed to be identical,
  13682. such as neutral whites, grays, or blacks.
  13683. @item stack
  13684. Display separate graph for the color components side by side in
  13685. @code{row} mode or one below the other in @code{column} mode.
  13686. @item parade
  13687. Display separate graph for the color components side by side in
  13688. @code{column} mode or one below the other in @code{row} mode.
  13689. Using this display mode makes it easy to spot color casts in the highlights
  13690. and shadows of an image, by comparing the contours of the top and the bottom
  13691. graphs of each waveform. Since whites, grays, and blacks are characterized
  13692. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  13693. should display three waveforms of roughly equal width/height. If not, the
  13694. correction is easy to perform by making level adjustments the three waveforms.
  13695. @end table
  13696. Default is @code{stack}.
  13697. @item components, c
  13698. Set which color components to display. Default is 1, which means only luminance
  13699. or red color component if input is in RGB colorspace. If is set for example to
  13700. 7 it will display all 3 (if) available color components.
  13701. @item envelope, e
  13702. @table @samp
  13703. @item none
  13704. No envelope, this is default.
  13705. @item instant
  13706. Instant envelope, minimum and maximum values presented in graph will be easily
  13707. visible even with small @code{step} value.
  13708. @item peak
  13709. Hold minimum and maximum values presented in graph across time. This way you
  13710. can still spot out of range values without constantly looking at waveforms.
  13711. @item peak+instant
  13712. Peak and instant envelope combined together.
  13713. @end table
  13714. @item filter, f
  13715. @table @samp
  13716. @item lowpass
  13717. No filtering, this is default.
  13718. @item flat
  13719. Luma and chroma combined together.
  13720. @item aflat
  13721. Similar as above, but shows difference between blue and red chroma.
  13722. @item xflat
  13723. Similar as above, but use different colors.
  13724. @item chroma
  13725. Displays only chroma.
  13726. @item color
  13727. Displays actual color value on waveform.
  13728. @item acolor
  13729. Similar as above, but with luma showing frequency of chroma values.
  13730. @end table
  13731. @item graticule, g
  13732. Set which graticule to display.
  13733. @table @samp
  13734. @item none
  13735. Do not display graticule.
  13736. @item green
  13737. Display green graticule showing legal broadcast ranges.
  13738. @item orange
  13739. Display orange graticule showing legal broadcast ranges.
  13740. @end table
  13741. @item opacity, o
  13742. Set graticule opacity.
  13743. @item flags, fl
  13744. Set graticule flags.
  13745. @table @samp
  13746. @item numbers
  13747. Draw numbers above lines. By default enabled.
  13748. @item dots
  13749. Draw dots instead of lines.
  13750. @end table
  13751. @item scale, s
  13752. Set scale used for displaying graticule.
  13753. @table @samp
  13754. @item digital
  13755. @item millivolts
  13756. @item ire
  13757. @end table
  13758. Default is digital.
  13759. @item bgopacity, b
  13760. Set background opacity.
  13761. @end table
  13762. @section weave, doubleweave
  13763. The @code{weave} takes a field-based video input and join
  13764. each two sequential fields into single frame, producing a new double
  13765. height clip with half the frame rate and half the frame count.
  13766. The @code{doubleweave} works same as @code{weave} but without
  13767. halving frame rate and frame count.
  13768. It accepts the following option:
  13769. @table @option
  13770. @item first_field
  13771. Set first field. Available values are:
  13772. @table @samp
  13773. @item top, t
  13774. Set the frame as top-field-first.
  13775. @item bottom, b
  13776. Set the frame as bottom-field-first.
  13777. @end table
  13778. @end table
  13779. @subsection Examples
  13780. @itemize
  13781. @item
  13782. Interlace video using @ref{select} and @ref{separatefields} filter:
  13783. @example
  13784. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  13785. @end example
  13786. @end itemize
  13787. @section xbr
  13788. Apply the xBR high-quality magnification filter which is designed for pixel
  13789. art. It follows a set of edge-detection rules, see
  13790. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  13791. It accepts the following option:
  13792. @table @option
  13793. @item n
  13794. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  13795. @code{3xBR} and @code{4} for @code{4xBR}.
  13796. Default is @code{3}.
  13797. @end table
  13798. @section xstack
  13799. Stack video inputs into custom layout.
  13800. All streams must be of same pixel format.
  13801. The filter accept the following option:
  13802. @table @option
  13803. @item inputs
  13804. Set number of input streams. Default is 2.
  13805. @item layout
  13806. Specify layout of inputs.
  13807. This option requires the desired layout configuration to be explicitly set by the user.
  13808. This sets position of each video input in output. Each input
  13809. is separated by '|'.
  13810. The first number represents the column, and the second number represents the row.
  13811. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  13812. where X is video input from which to take width or height.
  13813. Multiple values can be used when separated by '+'. In such
  13814. case values are summed together.
  13815. @item shortest
  13816. If set to 1, force the output to terminate when the shortest input
  13817. terminates. Default value is 0.
  13818. @end table
  13819. @subsection Examples
  13820. @itemize
  13821. @item
  13822. Display 4 inputs into 2x2 grid,
  13823. note that if inputs are of different sizes unused gaps might appear,
  13824. as not all of output video is used.
  13825. @example
  13826. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  13827. @end example
  13828. @item
  13829. Display 4 inputs into 1x4 grid,
  13830. note that if inputs are of different sizes unused gaps might appear,
  13831. as not all of output video is used.
  13832. @example
  13833. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  13834. @end example
  13835. @item
  13836. Display 9 inputs into 3x3 grid,
  13837. note that if inputs are of different sizes unused gaps might appear,
  13838. as not all of output video is used.
  13839. @example
  13840. 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
  13841. @end example
  13842. @end itemize
  13843. @anchor{yadif}
  13844. @section yadif
  13845. Deinterlace the input video ("yadif" means "yet another deinterlacing
  13846. filter").
  13847. It accepts the following parameters:
  13848. @table @option
  13849. @item mode
  13850. The interlacing mode to adopt. It accepts one of the following values:
  13851. @table @option
  13852. @item 0, send_frame
  13853. Output one frame for each frame.
  13854. @item 1, send_field
  13855. Output one frame for each field.
  13856. @item 2, send_frame_nospatial
  13857. Like @code{send_frame}, but it skips the spatial interlacing check.
  13858. @item 3, send_field_nospatial
  13859. Like @code{send_field}, but it skips the spatial interlacing check.
  13860. @end table
  13861. The default value is @code{send_frame}.
  13862. @item parity
  13863. The picture field parity assumed for the input interlaced video. It accepts one
  13864. of the following values:
  13865. @table @option
  13866. @item 0, tff
  13867. Assume the top field is first.
  13868. @item 1, bff
  13869. Assume the bottom field is first.
  13870. @item -1, auto
  13871. Enable automatic detection of field parity.
  13872. @end table
  13873. The default value is @code{auto}.
  13874. If the interlacing is unknown or the decoder does not export this information,
  13875. top field first will be assumed.
  13876. @item deint
  13877. Specify which frames to deinterlace. Accept one of the following
  13878. values:
  13879. @table @option
  13880. @item 0, all
  13881. Deinterlace all frames.
  13882. @item 1, interlaced
  13883. Only deinterlace frames marked as interlaced.
  13884. @end table
  13885. The default value is @code{all}.
  13886. @end table
  13887. @section yadif_cuda
  13888. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  13889. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  13890. and/or nvenc.
  13891. It accepts the following parameters:
  13892. @table @option
  13893. @item mode
  13894. The interlacing mode to adopt. It accepts one of the following values:
  13895. @table @option
  13896. @item 0, send_frame
  13897. Output one frame for each frame.
  13898. @item 1, send_field
  13899. Output one frame for each field.
  13900. @item 2, send_frame_nospatial
  13901. Like @code{send_frame}, but it skips the spatial interlacing check.
  13902. @item 3, send_field_nospatial
  13903. Like @code{send_field}, but it skips the spatial interlacing check.
  13904. @end table
  13905. The default value is @code{send_frame}.
  13906. @item parity
  13907. The picture field parity assumed for the input interlaced video. It accepts one
  13908. of the following values:
  13909. @table @option
  13910. @item 0, tff
  13911. Assume the top field is first.
  13912. @item 1, bff
  13913. Assume the bottom field is first.
  13914. @item -1, auto
  13915. Enable automatic detection of field parity.
  13916. @end table
  13917. The default value is @code{auto}.
  13918. If the interlacing is unknown or the decoder does not export this information,
  13919. top field first will be assumed.
  13920. @item deint
  13921. Specify which frames to deinterlace. Accept one of the following
  13922. values:
  13923. @table @option
  13924. @item 0, all
  13925. Deinterlace all frames.
  13926. @item 1, interlaced
  13927. Only deinterlace frames marked as interlaced.
  13928. @end table
  13929. The default value is @code{all}.
  13930. @end table
  13931. @section zoompan
  13932. Apply Zoom & Pan effect.
  13933. This filter accepts the following options:
  13934. @table @option
  13935. @item zoom, z
  13936. Set the zoom expression. Default is 1.
  13937. @item x
  13938. @item y
  13939. Set the x and y expression. Default is 0.
  13940. @item d
  13941. Set the duration expression in number of frames.
  13942. This sets for how many number of frames effect will last for
  13943. single input image.
  13944. @item s
  13945. Set the output image size, default is 'hd720'.
  13946. @item fps
  13947. Set the output frame rate, default is '25'.
  13948. @end table
  13949. Each expression can contain the following constants:
  13950. @table @option
  13951. @item in_w, iw
  13952. Input width.
  13953. @item in_h, ih
  13954. Input height.
  13955. @item out_w, ow
  13956. Output width.
  13957. @item out_h, oh
  13958. Output height.
  13959. @item in
  13960. Input frame count.
  13961. @item on
  13962. Output frame count.
  13963. @item x
  13964. @item y
  13965. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  13966. for current input frame.
  13967. @item px
  13968. @item py
  13969. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  13970. not yet such frame (first input frame).
  13971. @item zoom
  13972. Last calculated zoom from 'z' expression for current input frame.
  13973. @item pzoom
  13974. Last calculated zoom of last output frame of previous input frame.
  13975. @item duration
  13976. Number of output frames for current input frame. Calculated from 'd' expression
  13977. for each input frame.
  13978. @item pduration
  13979. number of output frames created for previous input frame
  13980. @item a
  13981. Rational number: input width / input height
  13982. @item sar
  13983. sample aspect ratio
  13984. @item dar
  13985. display aspect ratio
  13986. @end table
  13987. @subsection Examples
  13988. @itemize
  13989. @item
  13990. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  13991. @example
  13992. 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
  13993. @end example
  13994. @item
  13995. Zoom-in up to 1.5 and pan always at center of picture:
  13996. @example
  13997. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13998. @end example
  13999. @item
  14000. Same as above but without pausing:
  14001. @example
  14002. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14003. @end example
  14004. @end itemize
  14005. @anchor{zscale}
  14006. @section zscale
  14007. Scale (resize) the input video, using the z.lib library:
  14008. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14009. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14010. The zscale filter forces the output display aspect ratio to be the same
  14011. as the input, by changing the output sample aspect ratio.
  14012. If the input image format is different from the format requested by
  14013. the next filter, the zscale filter will convert the input to the
  14014. requested format.
  14015. @subsection Options
  14016. The filter accepts the following options.
  14017. @table @option
  14018. @item width, w
  14019. @item height, h
  14020. Set the output video dimension expression. Default value is the input
  14021. dimension.
  14022. If the @var{width} or @var{w} value is 0, the input width is used for
  14023. the output. If the @var{height} or @var{h} value is 0, the input height
  14024. is used for the output.
  14025. If one and only one of the values is -n with n >= 1, the zscale filter
  14026. will use a value that maintains the aspect ratio of the input image,
  14027. calculated from the other specified dimension. After that it will,
  14028. however, make sure that the calculated dimension is divisible by n and
  14029. adjust the value if necessary.
  14030. If both values are -n with n >= 1, the behavior will be identical to
  14031. both values being set to 0 as previously detailed.
  14032. See below for the list of accepted constants for use in the dimension
  14033. expression.
  14034. @item size, s
  14035. Set the video size. For the syntax of this option, check the
  14036. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14037. @item dither, d
  14038. Set the dither type.
  14039. Possible values are:
  14040. @table @var
  14041. @item none
  14042. @item ordered
  14043. @item random
  14044. @item error_diffusion
  14045. @end table
  14046. Default is none.
  14047. @item filter, f
  14048. Set the resize filter type.
  14049. Possible values are:
  14050. @table @var
  14051. @item point
  14052. @item bilinear
  14053. @item bicubic
  14054. @item spline16
  14055. @item spline36
  14056. @item lanczos
  14057. @end table
  14058. Default is bilinear.
  14059. @item range, r
  14060. Set the color range.
  14061. Possible values are:
  14062. @table @var
  14063. @item input
  14064. @item limited
  14065. @item full
  14066. @end table
  14067. Default is same as input.
  14068. @item primaries, p
  14069. Set the color primaries.
  14070. Possible values are:
  14071. @table @var
  14072. @item input
  14073. @item 709
  14074. @item unspecified
  14075. @item 170m
  14076. @item 240m
  14077. @item 2020
  14078. @end table
  14079. Default is same as input.
  14080. @item transfer, t
  14081. Set the transfer characteristics.
  14082. Possible values are:
  14083. @table @var
  14084. @item input
  14085. @item 709
  14086. @item unspecified
  14087. @item 601
  14088. @item linear
  14089. @item 2020_10
  14090. @item 2020_12
  14091. @item smpte2084
  14092. @item iec61966-2-1
  14093. @item arib-std-b67
  14094. @end table
  14095. Default is same as input.
  14096. @item matrix, m
  14097. Set the colorspace matrix.
  14098. Possible value are:
  14099. @table @var
  14100. @item input
  14101. @item 709
  14102. @item unspecified
  14103. @item 470bg
  14104. @item 170m
  14105. @item 2020_ncl
  14106. @item 2020_cl
  14107. @end table
  14108. Default is same as input.
  14109. @item rangein, rin
  14110. Set the input color range.
  14111. Possible values are:
  14112. @table @var
  14113. @item input
  14114. @item limited
  14115. @item full
  14116. @end table
  14117. Default is same as input.
  14118. @item primariesin, pin
  14119. Set the input color primaries.
  14120. Possible values are:
  14121. @table @var
  14122. @item input
  14123. @item 709
  14124. @item unspecified
  14125. @item 170m
  14126. @item 240m
  14127. @item 2020
  14128. @end table
  14129. Default is same as input.
  14130. @item transferin, tin
  14131. Set the input transfer characteristics.
  14132. Possible values are:
  14133. @table @var
  14134. @item input
  14135. @item 709
  14136. @item unspecified
  14137. @item 601
  14138. @item linear
  14139. @item 2020_10
  14140. @item 2020_12
  14141. @end table
  14142. Default is same as input.
  14143. @item matrixin, min
  14144. Set the input colorspace matrix.
  14145. Possible value are:
  14146. @table @var
  14147. @item input
  14148. @item 709
  14149. @item unspecified
  14150. @item 470bg
  14151. @item 170m
  14152. @item 2020_ncl
  14153. @item 2020_cl
  14154. @end table
  14155. @item chromal, c
  14156. Set the output chroma location.
  14157. Possible values are:
  14158. @table @var
  14159. @item input
  14160. @item left
  14161. @item center
  14162. @item topleft
  14163. @item top
  14164. @item bottomleft
  14165. @item bottom
  14166. @end table
  14167. @item chromalin, cin
  14168. Set the input chroma location.
  14169. Possible values are:
  14170. @table @var
  14171. @item input
  14172. @item left
  14173. @item center
  14174. @item topleft
  14175. @item top
  14176. @item bottomleft
  14177. @item bottom
  14178. @end table
  14179. @item npl
  14180. Set the nominal peak luminance.
  14181. @end table
  14182. The values of the @option{w} and @option{h} options are expressions
  14183. containing the following constants:
  14184. @table @var
  14185. @item in_w
  14186. @item in_h
  14187. The input width and height
  14188. @item iw
  14189. @item ih
  14190. These are the same as @var{in_w} and @var{in_h}.
  14191. @item out_w
  14192. @item out_h
  14193. The output (scaled) width and height
  14194. @item ow
  14195. @item oh
  14196. These are the same as @var{out_w} and @var{out_h}
  14197. @item a
  14198. The same as @var{iw} / @var{ih}
  14199. @item sar
  14200. input sample aspect ratio
  14201. @item dar
  14202. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14203. @item hsub
  14204. @item vsub
  14205. horizontal and vertical input chroma subsample values. For example for the
  14206. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14207. @item ohsub
  14208. @item ovsub
  14209. horizontal and vertical output chroma subsample values. For example for the
  14210. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14211. @end table
  14212. @table @option
  14213. @end table
  14214. @c man end VIDEO FILTERS
  14215. @chapter OpenCL Video Filters
  14216. @c man begin OPENCL VIDEO FILTERS
  14217. Below is a description of the currently available OpenCL video filters.
  14218. To enable compilation of these filters you need to configure FFmpeg with
  14219. @code{--enable-opencl}.
  14220. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14221. @table @option
  14222. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14223. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14224. given device parameters.
  14225. @item -filter_hw_device @var{name}
  14226. Pass the hardware device called @var{name} to all filters in any filter graph.
  14227. @end table
  14228. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14229. @itemize
  14230. @item
  14231. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14232. @example
  14233. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14234. @end example
  14235. @end itemize
  14236. 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.
  14237. @section avgblur_opencl
  14238. Apply average blur filter.
  14239. The filter accepts the following options:
  14240. @table @option
  14241. @item sizeX
  14242. Set horizontal radius size.
  14243. Range is @code{[1, 1024]} and default value is @code{1}.
  14244. @item planes
  14245. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14246. @item sizeY
  14247. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14248. @end table
  14249. @subsection Example
  14250. @itemize
  14251. @item
  14252. 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.
  14253. @example
  14254. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14255. @end example
  14256. @end itemize
  14257. @section boxblur_opencl
  14258. Apply a boxblur algorithm to the input video.
  14259. It accepts the following parameters:
  14260. @table @option
  14261. @item luma_radius, lr
  14262. @item luma_power, lp
  14263. @item chroma_radius, cr
  14264. @item chroma_power, cp
  14265. @item alpha_radius, ar
  14266. @item alpha_power, ap
  14267. @end table
  14268. A description of the accepted options follows.
  14269. @table @option
  14270. @item luma_radius, lr
  14271. @item chroma_radius, cr
  14272. @item alpha_radius, ar
  14273. Set an expression for the box radius in pixels used for blurring the
  14274. corresponding input plane.
  14275. The radius value must be a non-negative number, and must not be
  14276. greater than the value of the expression @code{min(w,h)/2} for the
  14277. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14278. planes.
  14279. Default value for @option{luma_radius} is "2". If not specified,
  14280. @option{chroma_radius} and @option{alpha_radius} default to the
  14281. corresponding value set for @option{luma_radius}.
  14282. The expressions can contain the following constants:
  14283. @table @option
  14284. @item w
  14285. @item h
  14286. The input width and height in pixels.
  14287. @item cw
  14288. @item ch
  14289. The input chroma image width and height in pixels.
  14290. @item hsub
  14291. @item vsub
  14292. The horizontal and vertical chroma subsample values. For example, for the
  14293. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14294. @end table
  14295. @item luma_power, lp
  14296. @item chroma_power, cp
  14297. @item alpha_power, ap
  14298. Specify how many times the boxblur filter is applied to the
  14299. corresponding plane.
  14300. Default value for @option{luma_power} is 2. If not specified,
  14301. @option{chroma_power} and @option{alpha_power} default to the
  14302. corresponding value set for @option{luma_power}.
  14303. A value of 0 will disable the effect.
  14304. @end table
  14305. @subsection Examples
  14306. 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.
  14307. @itemize
  14308. @item
  14309. Apply a boxblur filter with the luma, chroma, and alpha radius
  14310. 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.
  14311. @example
  14312. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14313. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14314. @end example
  14315. @item
  14316. 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.
  14317. For the luma plane, a 2x2 box radius will be run once.
  14318. For the chroma plane, a 4x4 box radius will be run 5 times.
  14319. For the alpha plane, a 3x3 box radius will be run 7 times.
  14320. @example
  14321. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14322. @end example
  14323. @end itemize
  14324. @section convolution_opencl
  14325. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14326. The filter accepts the following options:
  14327. @table @option
  14328. @item 0m
  14329. @item 1m
  14330. @item 2m
  14331. @item 3m
  14332. Set matrix for each plane.
  14333. Matrix is sequence of 9, 25 or 49 signed numbers.
  14334. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14335. @item 0rdiv
  14336. @item 1rdiv
  14337. @item 2rdiv
  14338. @item 3rdiv
  14339. Set multiplier for calculated value for each plane.
  14340. If unset or 0, it will be sum of all matrix elements.
  14341. The option value must be an float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14342. @item 0bias
  14343. @item 1bias
  14344. @item 2bias
  14345. @item 3bias
  14346. Set bias for each plane. This value is added to the result of the multiplication.
  14347. Useful for making the overall image brighter or darker.
  14348. The option value must be an float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  14349. @end table
  14350. @subsection Examples
  14351. @itemize
  14352. @item
  14353. Apply sharpen:
  14354. @example
  14355. -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
  14356. @end example
  14357. @item
  14358. Apply blur:
  14359. @example
  14360. -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
  14361. @end example
  14362. @item
  14363. Apply edge enhance:
  14364. @example
  14365. -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
  14366. @end example
  14367. @item
  14368. Apply edge detect:
  14369. @example
  14370. -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
  14371. @end example
  14372. @item
  14373. Apply laplacian edge detector which includes diagonals:
  14374. @example
  14375. -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
  14376. @end example
  14377. @item
  14378. Apply emboss:
  14379. @example
  14380. -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
  14381. @end example
  14382. @end itemize
  14383. @section dilation_opencl
  14384. Apply dilation effect to the video.
  14385. This filter replaces the pixel by the local(3x3) maximum.
  14386. It accepts the following options:
  14387. @table @option
  14388. @item threshold0
  14389. @item threshold1
  14390. @item threshold2
  14391. @item threshold3
  14392. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14393. If @code{0}, plane will remain unchanged.
  14394. @item coordinates
  14395. Flag which specifies the pixel to refer to.
  14396. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14397. Flags to local 3x3 coordinates region centered on @code{x}:
  14398. 1 2 3
  14399. 4 x 5
  14400. 6 7 8
  14401. @end table
  14402. @subsection Example
  14403. @itemize
  14404. @item
  14405. 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.
  14406. @example
  14407. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14408. @end example
  14409. @end itemize
  14410. @section erosion_opencl
  14411. Apply erosion effect to the video.
  14412. This filter replaces the pixel by the local(3x3) minimum.
  14413. It accepts the following options:
  14414. @table @option
  14415. @item threshold0
  14416. @item threshold1
  14417. @item threshold2
  14418. @item threshold3
  14419. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14420. If @code{0}, plane will remain unchanged.
  14421. @item coordinates
  14422. Flag which specifies the pixel to refer to.
  14423. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14424. Flags to local 3x3 coordinates region centered on @code{x}:
  14425. 1 2 3
  14426. 4 x 5
  14427. 6 7 8
  14428. @end table
  14429. @subsection Example
  14430. @itemize
  14431. @item
  14432. 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.
  14433. @example
  14434. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14435. @end example
  14436. @end itemize
  14437. @section overlay_opencl
  14438. Overlay one video on top of another.
  14439. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  14440. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  14441. The filter accepts the following options:
  14442. @table @option
  14443. @item x
  14444. Set the x coordinate of the overlaid video on the main video.
  14445. Default value is @code{0}.
  14446. @item y
  14447. Set the x coordinate of the overlaid video on the main video.
  14448. Default value is @code{0}.
  14449. @end table
  14450. @subsection Examples
  14451. @itemize
  14452. @item
  14453. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  14454. @example
  14455. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14456. @end example
  14457. @item
  14458. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  14459. @example
  14460. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14461. @end example
  14462. @end itemize
  14463. @section prewitt_opencl
  14464. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  14465. The filter accepts the following option:
  14466. @table @option
  14467. @item planes
  14468. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14469. @item scale
  14470. Set value which will be multiplied with filtered result.
  14471. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14472. @item delta
  14473. Set value which will be added to filtered result.
  14474. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14475. @end table
  14476. @subsection Example
  14477. @itemize
  14478. @item
  14479. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  14480. @example
  14481. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14482. @end example
  14483. @end itemize
  14484. @section roberts_opencl
  14485. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  14486. The filter accepts the following option:
  14487. @table @option
  14488. @item planes
  14489. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14490. @item scale
  14491. Set value which will be multiplied with filtered result.
  14492. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14493. @item delta
  14494. Set value which will be added to filtered result.
  14495. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14496. @end table
  14497. @subsection Example
  14498. @itemize
  14499. @item
  14500. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  14501. @example
  14502. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14503. @end example
  14504. @end itemize
  14505. @section sobel_opencl
  14506. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  14507. The filter accepts the following option:
  14508. @table @option
  14509. @item planes
  14510. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14511. @item scale
  14512. Set value which will be multiplied with filtered result.
  14513. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14514. @item delta
  14515. Set value which will be added to filtered result.
  14516. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14517. @end table
  14518. @subsection Example
  14519. @itemize
  14520. @item
  14521. Apply sobel operator with scale set to 2 and delta set to 10
  14522. @example
  14523. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14524. @end example
  14525. @end itemize
  14526. @section tonemap_opencl
  14527. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  14528. It accepts the following parameters:
  14529. @table @option
  14530. @item tonemap
  14531. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  14532. @item param
  14533. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  14534. @item desat
  14535. Apply desaturation for highlights that exceed this level of brightness. The
  14536. higher the parameter, the more color information will be preserved. This
  14537. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14538. (smoothly) turning into white instead. This makes images feel more natural,
  14539. at the cost of reducing information about out-of-range colors.
  14540. The default value is 0.5, and the algorithm here is a little different from
  14541. the cpu version tonemap currently. A setting of 0.0 disables this option.
  14542. @item threshold
  14543. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  14544. is used to detect whether the scene has changed or not. If the distance beween
  14545. the current frame average brightness and the current running average exceeds
  14546. a threshold value, we would re-calculate scene average and peak brightness.
  14547. The default value is 0.2.
  14548. @item format
  14549. Specify the output pixel format.
  14550. Currently supported formats are:
  14551. @table @var
  14552. @item p010
  14553. @item nv12
  14554. @end table
  14555. @item range, r
  14556. Set the output color range.
  14557. Possible values are:
  14558. @table @var
  14559. @item tv/mpeg
  14560. @item pc/jpeg
  14561. @end table
  14562. Default is same as input.
  14563. @item primaries, p
  14564. Set the output color primaries.
  14565. Possible values are:
  14566. @table @var
  14567. @item bt709
  14568. @item bt2020
  14569. @end table
  14570. Default is same as input.
  14571. @item transfer, t
  14572. Set the output transfer characteristics.
  14573. Possible values are:
  14574. @table @var
  14575. @item bt709
  14576. @item bt2020
  14577. @end table
  14578. Default is bt709.
  14579. @item matrix, m
  14580. Set the output colorspace matrix.
  14581. Possible value are:
  14582. @table @var
  14583. @item bt709
  14584. @item bt2020
  14585. @end table
  14586. Default is same as input.
  14587. @end table
  14588. @subsection Example
  14589. @itemize
  14590. @item
  14591. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  14592. @example
  14593. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  14594. @end example
  14595. @end itemize
  14596. @section unsharp_opencl
  14597. Sharpen or blur the input video.
  14598. It accepts the following parameters:
  14599. @table @option
  14600. @item luma_msize_x, lx
  14601. Set the luma matrix horizontal size.
  14602. Range is @code{[1, 23]} and default value is @code{5}.
  14603. @item luma_msize_y, ly
  14604. Set the luma matrix vertical size.
  14605. Range is @code{[1, 23]} and default value is @code{5}.
  14606. @item luma_amount, la
  14607. Set the luma effect strength.
  14608. Range is @code{[-10, 10]} and default value is @code{1.0}.
  14609. Negative values will blur the input video, while positive values will
  14610. sharpen it, a value of zero will disable the effect.
  14611. @item chroma_msize_x, cx
  14612. Set the chroma matrix horizontal size.
  14613. Range is @code{[1, 23]} and default value is @code{5}.
  14614. @item chroma_msize_y, cy
  14615. Set the chroma matrix vertical size.
  14616. Range is @code{[1, 23]} and default value is @code{5}.
  14617. @item chroma_amount, ca
  14618. Set the chroma effect strength.
  14619. Range is @code{[-10, 10]} and default value is @code{0.0}.
  14620. Negative values will blur the input video, while positive values will
  14621. sharpen it, a value of zero will disable the effect.
  14622. @end table
  14623. All parameters are optional and default to the equivalent of the
  14624. string '5:5:1.0:5:5:0.0'.
  14625. @subsection Examples
  14626. @itemize
  14627. @item
  14628. Apply strong luma sharpen effect:
  14629. @example
  14630. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  14631. @end example
  14632. @item
  14633. Apply a strong blur of both luma and chroma parameters:
  14634. @example
  14635. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  14636. @end example
  14637. @end itemize
  14638. @c man end OPENCL VIDEO FILTERS
  14639. @chapter Video Sources
  14640. @c man begin VIDEO SOURCES
  14641. Below is a description of the currently available video sources.
  14642. @section buffer
  14643. Buffer video frames, and make them available to the filter chain.
  14644. This source is mainly intended for a programmatic use, in particular
  14645. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  14646. It accepts the following parameters:
  14647. @table @option
  14648. @item video_size
  14649. Specify the size (width and height) of the buffered video frames. For the
  14650. syntax of this option, check the
  14651. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14652. @item width
  14653. The input video width.
  14654. @item height
  14655. The input video height.
  14656. @item pix_fmt
  14657. A string representing the pixel format of the buffered video frames.
  14658. It may be a number corresponding to a pixel format, or a pixel format
  14659. name.
  14660. @item time_base
  14661. Specify the timebase assumed by the timestamps of the buffered frames.
  14662. @item frame_rate
  14663. Specify the frame rate expected for the video stream.
  14664. @item pixel_aspect, sar
  14665. The sample (pixel) aspect ratio of the input video.
  14666. @item sws_param
  14667. Specify the optional parameters to be used for the scale filter which
  14668. is automatically inserted when an input change is detected in the
  14669. input size or format.
  14670. @item hw_frames_ctx
  14671. When using a hardware pixel format, this should be a reference to an
  14672. AVHWFramesContext describing input frames.
  14673. @end table
  14674. For example:
  14675. @example
  14676. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  14677. @end example
  14678. will instruct the source to accept video frames with size 320x240 and
  14679. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  14680. square pixels (1:1 sample aspect ratio).
  14681. Since the pixel format with name "yuv410p" corresponds to the number 6
  14682. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  14683. this example corresponds to:
  14684. @example
  14685. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  14686. @end example
  14687. Alternatively, the options can be specified as a flat string, but this
  14688. syntax is deprecated:
  14689. @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}]
  14690. @section cellauto
  14691. Create a pattern generated by an elementary cellular automaton.
  14692. The initial state of the cellular automaton can be defined through the
  14693. @option{filename} and @option{pattern} options. If such options are
  14694. not specified an initial state is created randomly.
  14695. At each new frame a new row in the video is filled with the result of
  14696. the cellular automaton next generation. The behavior when the whole
  14697. frame is filled is defined by the @option{scroll} option.
  14698. This source accepts the following options:
  14699. @table @option
  14700. @item filename, f
  14701. Read the initial cellular automaton state, i.e. the starting row, from
  14702. the specified file.
  14703. In the file, each non-whitespace character is considered an alive
  14704. cell, a newline will terminate the row, and further characters in the
  14705. file will be ignored.
  14706. @item pattern, p
  14707. Read the initial cellular automaton state, i.e. the starting row, from
  14708. the specified string.
  14709. Each non-whitespace character in the string is considered an alive
  14710. cell, a newline will terminate the row, and further characters in the
  14711. string will be ignored.
  14712. @item rate, r
  14713. Set the video rate, that is the number of frames generated per second.
  14714. Default is 25.
  14715. @item random_fill_ratio, ratio
  14716. Set the random fill ratio for the initial cellular automaton row. It
  14717. is a floating point number value ranging from 0 to 1, defaults to
  14718. 1/PHI.
  14719. This option is ignored when a file or a pattern is specified.
  14720. @item random_seed, seed
  14721. Set the seed for filling randomly the initial row, must be an integer
  14722. included between 0 and UINT32_MAX. If not specified, or if explicitly
  14723. set to -1, the filter will try to use a good random seed on a best
  14724. effort basis.
  14725. @item rule
  14726. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  14727. Default value is 110.
  14728. @item size, s
  14729. Set the size of the output video. For the syntax of this option, check the
  14730. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14731. If @option{filename} or @option{pattern} is specified, the size is set
  14732. by default to the width of the specified initial state row, and the
  14733. height is set to @var{width} * PHI.
  14734. If @option{size} is set, it must contain the width of the specified
  14735. pattern string, and the specified pattern will be centered in the
  14736. larger row.
  14737. If a filename or a pattern string is not specified, the size value
  14738. defaults to "320x518" (used for a randomly generated initial state).
  14739. @item scroll
  14740. If set to 1, scroll the output upward when all the rows in the output
  14741. have been already filled. If set to 0, the new generated row will be
  14742. written over the top row just after the bottom row is filled.
  14743. Defaults to 1.
  14744. @item start_full, full
  14745. If set to 1, completely fill the output with generated rows before
  14746. outputting the first frame.
  14747. This is the default behavior, for disabling set the value to 0.
  14748. @item stitch
  14749. If set to 1, stitch the left and right row edges together.
  14750. This is the default behavior, for disabling set the value to 0.
  14751. @end table
  14752. @subsection Examples
  14753. @itemize
  14754. @item
  14755. Read the initial state from @file{pattern}, and specify an output of
  14756. size 200x400.
  14757. @example
  14758. cellauto=f=pattern:s=200x400
  14759. @end example
  14760. @item
  14761. Generate a random initial row with a width of 200 cells, with a fill
  14762. ratio of 2/3:
  14763. @example
  14764. cellauto=ratio=2/3:s=200x200
  14765. @end example
  14766. @item
  14767. Create a pattern generated by rule 18 starting by a single alive cell
  14768. centered on an initial row with width 100:
  14769. @example
  14770. cellauto=p=@@:s=100x400:full=0:rule=18
  14771. @end example
  14772. @item
  14773. Specify a more elaborated initial pattern:
  14774. @example
  14775. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  14776. @end example
  14777. @end itemize
  14778. @anchor{coreimagesrc}
  14779. @section coreimagesrc
  14780. Video source generated on GPU using Apple's CoreImage API on OSX.
  14781. This video source is a specialized version of the @ref{coreimage} video filter.
  14782. Use a core image generator at the beginning of the applied filterchain to
  14783. generate the content.
  14784. The coreimagesrc video source accepts the following options:
  14785. @table @option
  14786. @item list_generators
  14787. List all available generators along with all their respective options as well as
  14788. possible minimum and maximum values along with the default values.
  14789. @example
  14790. list_generators=true
  14791. @end example
  14792. @item size, s
  14793. Specify the size of the sourced video. For the syntax of this option, check the
  14794. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14795. The default value is @code{320x240}.
  14796. @item rate, r
  14797. Specify the frame rate of the sourced video, as the number of frames
  14798. generated per second. It has to be a string in the format
  14799. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14800. number or a valid video frame rate abbreviation. The default value is
  14801. "25".
  14802. @item sar
  14803. Set the sample aspect ratio of the sourced video.
  14804. @item duration, d
  14805. Set the duration of the sourced video. See
  14806. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14807. for the accepted syntax.
  14808. If not specified, or the expressed duration is negative, the video is
  14809. supposed to be generated forever.
  14810. @end table
  14811. Additionally, all options of the @ref{coreimage} video filter are accepted.
  14812. A complete filterchain can be used for further processing of the
  14813. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  14814. and examples for details.
  14815. @subsection Examples
  14816. @itemize
  14817. @item
  14818. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  14819. given as complete and escaped command-line for Apple's standard bash shell:
  14820. @example
  14821. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  14822. @end example
  14823. This example is equivalent to the QRCode example of @ref{coreimage} without the
  14824. need for a nullsrc video source.
  14825. @end itemize
  14826. @section mandelbrot
  14827. Generate a Mandelbrot set fractal, and progressively zoom towards the
  14828. point specified with @var{start_x} and @var{start_y}.
  14829. This source accepts the following options:
  14830. @table @option
  14831. @item end_pts
  14832. Set the terminal pts value. Default value is 400.
  14833. @item end_scale
  14834. Set the terminal scale value.
  14835. Must be a floating point value. Default value is 0.3.
  14836. @item inner
  14837. Set the inner coloring mode, that is the algorithm used to draw the
  14838. Mandelbrot fractal internal region.
  14839. It shall assume one of the following values:
  14840. @table @option
  14841. @item black
  14842. Set black mode.
  14843. @item convergence
  14844. Show time until convergence.
  14845. @item mincol
  14846. Set color based on point closest to the origin of the iterations.
  14847. @item period
  14848. Set period mode.
  14849. @end table
  14850. Default value is @var{mincol}.
  14851. @item bailout
  14852. Set the bailout value. Default value is 10.0.
  14853. @item maxiter
  14854. Set the maximum of iterations performed by the rendering
  14855. algorithm. Default value is 7189.
  14856. @item outer
  14857. Set outer coloring mode.
  14858. It shall assume one of following values:
  14859. @table @option
  14860. @item iteration_count
  14861. Set iteration cound mode.
  14862. @item normalized_iteration_count
  14863. set normalized iteration count mode.
  14864. @end table
  14865. Default value is @var{normalized_iteration_count}.
  14866. @item rate, r
  14867. Set frame rate, expressed as number of frames per second. Default
  14868. value is "25".
  14869. @item size, s
  14870. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  14871. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  14872. @item start_scale
  14873. Set the initial scale value. Default value is 3.0.
  14874. @item start_x
  14875. Set the initial x position. Must be a floating point value between
  14876. -100 and 100. Default value is -0.743643887037158704752191506114774.
  14877. @item start_y
  14878. Set the initial y position. Must be a floating point value between
  14879. -100 and 100. Default value is -0.131825904205311970493132056385139.
  14880. @end table
  14881. @section mptestsrc
  14882. Generate various test patterns, as generated by the MPlayer test filter.
  14883. The size of the generated video is fixed, and is 256x256.
  14884. This source is useful in particular for testing encoding features.
  14885. This source accepts the following options:
  14886. @table @option
  14887. @item rate, r
  14888. Specify the frame rate of the sourced video, as the number of frames
  14889. generated per second. It has to be a string in the format
  14890. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14891. number or a valid video frame rate abbreviation. The default value is
  14892. "25".
  14893. @item duration, d
  14894. Set the duration of the sourced video. See
  14895. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14896. for the accepted syntax.
  14897. If not specified, or the expressed duration is negative, the video is
  14898. supposed to be generated forever.
  14899. @item test, t
  14900. Set the number or the name of the test to perform. Supported tests are:
  14901. @table @option
  14902. @item dc_luma
  14903. @item dc_chroma
  14904. @item freq_luma
  14905. @item freq_chroma
  14906. @item amp_luma
  14907. @item amp_chroma
  14908. @item cbp
  14909. @item mv
  14910. @item ring1
  14911. @item ring2
  14912. @item all
  14913. @end table
  14914. Default value is "all", which will cycle through the list of all tests.
  14915. @end table
  14916. Some examples:
  14917. @example
  14918. mptestsrc=t=dc_luma
  14919. @end example
  14920. will generate a "dc_luma" test pattern.
  14921. @section frei0r_src
  14922. Provide a frei0r source.
  14923. To enable compilation of this filter you need to install the frei0r
  14924. header and configure FFmpeg with @code{--enable-frei0r}.
  14925. This source accepts the following parameters:
  14926. @table @option
  14927. @item size
  14928. The size of the video to generate. For the syntax of this option, check the
  14929. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14930. @item framerate
  14931. The framerate of the generated video. It may be a string of the form
  14932. @var{num}/@var{den} or a frame rate abbreviation.
  14933. @item filter_name
  14934. The name to the frei0r source to load. For more information regarding frei0r and
  14935. how to set the parameters, read the @ref{frei0r} section in the video filters
  14936. documentation.
  14937. @item filter_params
  14938. A '|'-separated list of parameters to pass to the frei0r source.
  14939. @end table
  14940. For example, to generate a frei0r partik0l source with size 200x200
  14941. and frame rate 10 which is overlaid on the overlay filter main input:
  14942. @example
  14943. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  14944. @end example
  14945. @section life
  14946. Generate a life pattern.
  14947. This source is based on a generalization of John Conway's life game.
  14948. The sourced input represents a life grid, each pixel represents a cell
  14949. which can be in one of two possible states, alive or dead. Every cell
  14950. interacts with its eight neighbours, which are the cells that are
  14951. horizontally, vertically, or diagonally adjacent.
  14952. At each interaction the grid evolves according to the adopted rule,
  14953. which specifies the number of neighbor alive cells which will make a
  14954. cell stay alive or born. The @option{rule} option allows one to specify
  14955. the rule to adopt.
  14956. This source accepts the following options:
  14957. @table @option
  14958. @item filename, f
  14959. Set the file from which to read the initial grid state. In the file,
  14960. each non-whitespace character is considered an alive cell, and newline
  14961. is used to delimit the end of each row.
  14962. If this option is not specified, the initial grid is generated
  14963. randomly.
  14964. @item rate, r
  14965. Set the video rate, that is the number of frames generated per second.
  14966. Default is 25.
  14967. @item random_fill_ratio, ratio
  14968. Set the random fill ratio for the initial random grid. It is a
  14969. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  14970. It is ignored when a file is specified.
  14971. @item random_seed, seed
  14972. Set the seed for filling the initial random grid, must be an integer
  14973. included between 0 and UINT32_MAX. If not specified, or if explicitly
  14974. set to -1, the filter will try to use a good random seed on a best
  14975. effort basis.
  14976. @item rule
  14977. Set the life rule.
  14978. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  14979. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  14980. @var{NS} specifies the number of alive neighbor cells which make a
  14981. live cell stay alive, and @var{NB} the number of alive neighbor cells
  14982. which make a dead cell to become alive (i.e. to "born").
  14983. "s" and "b" can be used in place of "S" and "B", respectively.
  14984. Alternatively a rule can be specified by an 18-bits integer. The 9
  14985. high order bits are used to encode the next cell state if it is alive
  14986. for each number of neighbor alive cells, the low order bits specify
  14987. the rule for "borning" new cells. Higher order bits encode for an
  14988. higher number of neighbor cells.
  14989. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  14990. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  14991. Default value is "S23/B3", which is the original Conway's game of life
  14992. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  14993. cells, and will born a new cell if there are three alive cells around
  14994. a dead cell.
  14995. @item size, s
  14996. Set the size of the output video. For the syntax of this option, check the
  14997. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14998. If @option{filename} is specified, the size is set by default to the
  14999. same size of the input file. If @option{size} is set, it must contain
  15000. the size specified in the input file, and the initial grid defined in
  15001. that file is centered in the larger resulting area.
  15002. If a filename is not specified, the size value defaults to "320x240"
  15003. (used for a randomly generated initial grid).
  15004. @item stitch
  15005. If set to 1, stitch the left and right grid edges together, and the
  15006. top and bottom edges also. Defaults to 1.
  15007. @item mold
  15008. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15009. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15010. value from 0 to 255.
  15011. @item life_color
  15012. Set the color of living (or new born) cells.
  15013. @item death_color
  15014. Set the color of dead cells. If @option{mold} is set, this is the first color
  15015. used to represent a dead cell.
  15016. @item mold_color
  15017. Set mold color, for definitely dead and moldy cells.
  15018. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15019. ffmpeg-utils manual,ffmpeg-utils}.
  15020. @end table
  15021. @subsection Examples
  15022. @itemize
  15023. @item
  15024. Read a grid from @file{pattern}, and center it on a grid of size
  15025. 300x300 pixels:
  15026. @example
  15027. life=f=pattern:s=300x300
  15028. @end example
  15029. @item
  15030. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15031. @example
  15032. life=ratio=2/3:s=200x200
  15033. @end example
  15034. @item
  15035. Specify a custom rule for evolving a randomly generated grid:
  15036. @example
  15037. life=rule=S14/B34
  15038. @end example
  15039. @item
  15040. Full example with slow death effect (mold) using @command{ffplay}:
  15041. @example
  15042. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15043. @end example
  15044. @end itemize
  15045. @anchor{allrgb}
  15046. @anchor{allyuv}
  15047. @anchor{color}
  15048. @anchor{haldclutsrc}
  15049. @anchor{nullsrc}
  15050. @anchor{pal75bars}
  15051. @anchor{pal100bars}
  15052. @anchor{rgbtestsrc}
  15053. @anchor{smptebars}
  15054. @anchor{smptehdbars}
  15055. @anchor{testsrc}
  15056. @anchor{testsrc2}
  15057. @anchor{yuvtestsrc}
  15058. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15059. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15060. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15061. The @code{color} source provides an uniformly colored input.
  15062. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15063. @ref{haldclut} filter.
  15064. The @code{nullsrc} source returns unprocessed video frames. It is
  15065. mainly useful to be employed in analysis / debugging tools, or as the
  15066. source for filters which ignore the input data.
  15067. The @code{pal75bars} source generates a color bars pattern, based on
  15068. EBU PAL recommendations with 75% color levels.
  15069. The @code{pal100bars} source generates a color bars pattern, based on
  15070. EBU PAL recommendations with 100% color levels.
  15071. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15072. detecting RGB vs BGR issues. You should see a red, green and blue
  15073. stripe from top to bottom.
  15074. The @code{smptebars} source generates a color bars pattern, based on
  15075. the SMPTE Engineering Guideline EG 1-1990.
  15076. The @code{smptehdbars} source generates a color bars pattern, based on
  15077. the SMPTE RP 219-2002.
  15078. The @code{testsrc} source generates a test video pattern, showing a
  15079. color pattern, a scrolling gradient and a timestamp. This is mainly
  15080. intended for testing purposes.
  15081. The @code{testsrc2} source is similar to testsrc, but supports more
  15082. pixel formats instead of just @code{rgb24}. This allows using it as an
  15083. input for other tests without requiring a format conversion.
  15084. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15085. see a y, cb and cr stripe from top to bottom.
  15086. The sources accept the following parameters:
  15087. @table @option
  15088. @item level
  15089. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15090. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15091. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15092. coded on a @code{1/(N*N)} scale.
  15093. @item color, c
  15094. Specify the color of the source, only available in the @code{color}
  15095. source. For the syntax of this option, check the
  15096. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15097. @item size, s
  15098. Specify the size of the sourced video. For the syntax of this option, check the
  15099. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15100. The default value is @code{320x240}.
  15101. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15102. @code{haldclutsrc} filters.
  15103. @item rate, r
  15104. Specify the frame rate of the sourced video, as the number of frames
  15105. generated per second. It has to be a string in the format
  15106. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15107. number or a valid video frame rate abbreviation. The default value is
  15108. "25".
  15109. @item duration, d
  15110. Set the duration of the sourced video. See
  15111. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15112. for the accepted syntax.
  15113. If not specified, or the expressed duration is negative, the video is
  15114. supposed to be generated forever.
  15115. @item sar
  15116. Set the sample aspect ratio of the sourced video.
  15117. @item alpha
  15118. Specify the alpha (opacity) of the background, only available in the
  15119. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15120. 255 (fully opaque, the default).
  15121. @item decimals, n
  15122. Set the number of decimals to show in the timestamp, only available in the
  15123. @code{testsrc} source.
  15124. The displayed timestamp value will correspond to the original
  15125. timestamp value multiplied by the power of 10 of the specified
  15126. value. Default value is 0.
  15127. @end table
  15128. @subsection Examples
  15129. @itemize
  15130. @item
  15131. Generate a video with a duration of 5.3 seconds, with size
  15132. 176x144 and a frame rate of 10 frames per second:
  15133. @example
  15134. testsrc=duration=5.3:size=qcif:rate=10
  15135. @end example
  15136. @item
  15137. The following graph description will generate a red source
  15138. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15139. frames per second:
  15140. @example
  15141. color=c=red@@0.2:s=qcif:r=10
  15142. @end example
  15143. @item
  15144. If the input content is to be ignored, @code{nullsrc} can be used. The
  15145. following command generates noise in the luminance plane by employing
  15146. the @code{geq} filter:
  15147. @example
  15148. nullsrc=s=256x256, geq=random(1)*255:128:128
  15149. @end example
  15150. @end itemize
  15151. @subsection Commands
  15152. The @code{color} source supports the following commands:
  15153. @table @option
  15154. @item c, color
  15155. Set the color of the created image. Accepts the same syntax of the
  15156. corresponding @option{color} option.
  15157. @end table
  15158. @section openclsrc
  15159. Generate video using an OpenCL program.
  15160. @table @option
  15161. @item source
  15162. OpenCL program source file.
  15163. @item kernel
  15164. Kernel name in program.
  15165. @item size, s
  15166. Size of frames to generate. This must be set.
  15167. @item format
  15168. Pixel format to use for the generated frames. This must be set.
  15169. @item rate, r
  15170. Number of frames generated every second. Default value is '25'.
  15171. @end table
  15172. For details of how the program loading works, see the @ref{program_opencl}
  15173. filter.
  15174. Example programs:
  15175. @itemize
  15176. @item
  15177. Generate a colour ramp by setting pixel values from the position of the pixel
  15178. in the output image. (Note that this will work with all pixel formats, but
  15179. the generated output will not be the same.)
  15180. @verbatim
  15181. __kernel void ramp(__write_only image2d_t dst,
  15182. unsigned int index)
  15183. {
  15184. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15185. float4 val;
  15186. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15187. write_imagef(dst, loc, val);
  15188. }
  15189. @end verbatim
  15190. @item
  15191. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15192. @verbatim
  15193. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15194. unsigned int index)
  15195. {
  15196. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15197. float4 value = 0.0f;
  15198. int x = loc.x + index;
  15199. int y = loc.y + index;
  15200. while (x > 0 || y > 0) {
  15201. if (x % 3 == 1 && y % 3 == 1) {
  15202. value = 1.0f;
  15203. break;
  15204. }
  15205. x /= 3;
  15206. y /= 3;
  15207. }
  15208. write_imagef(dst, loc, value);
  15209. }
  15210. @end verbatim
  15211. @end itemize
  15212. @c man end VIDEO SOURCES
  15213. @chapter Video Sinks
  15214. @c man begin VIDEO SINKS
  15215. Below is a description of the currently available video sinks.
  15216. @section buffersink
  15217. Buffer video frames, and make them available to the end of the filter
  15218. graph.
  15219. This sink is mainly intended for programmatic use, in particular
  15220. through the interface defined in @file{libavfilter/buffersink.h}
  15221. or the options system.
  15222. It accepts a pointer to an AVBufferSinkContext structure, which
  15223. defines the incoming buffers' formats, to be passed as the opaque
  15224. parameter to @code{avfilter_init_filter} for initialization.
  15225. @section nullsink
  15226. Null video sink: do absolutely nothing with the input video. It is
  15227. mainly useful as a template and for use in analysis / debugging
  15228. tools.
  15229. @c man end VIDEO SINKS
  15230. @chapter Multimedia Filters
  15231. @c man begin MULTIMEDIA FILTERS
  15232. Below is a description of the currently available multimedia filters.
  15233. @section abitscope
  15234. Convert input audio to a video output, displaying the audio bit scope.
  15235. The filter accepts the following options:
  15236. @table @option
  15237. @item rate, r
  15238. Set frame rate, expressed as number of frames per second. Default
  15239. value is "25".
  15240. @item size, s
  15241. Specify the video size for the output. For the syntax of this option, check the
  15242. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15243. Default value is @code{1024x256}.
  15244. @item colors
  15245. Specify list of colors separated by space or by '|' which will be used to
  15246. draw channels. Unrecognized or missing colors will be replaced
  15247. by white color.
  15248. @end table
  15249. @section ahistogram
  15250. Convert input audio to a video output, displaying the volume histogram.
  15251. The filter accepts the following options:
  15252. @table @option
  15253. @item dmode
  15254. Specify how histogram is calculated.
  15255. It accepts the following values:
  15256. @table @samp
  15257. @item single
  15258. Use single histogram for all channels.
  15259. @item separate
  15260. Use separate histogram for each channel.
  15261. @end table
  15262. Default is @code{single}.
  15263. @item rate, r
  15264. Set frame rate, expressed as number of frames per second. Default
  15265. value is "25".
  15266. @item size, s
  15267. Specify the video size for the output. For the syntax of this option, check the
  15268. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15269. Default value is @code{hd720}.
  15270. @item scale
  15271. Set display scale.
  15272. It accepts the following values:
  15273. @table @samp
  15274. @item log
  15275. logarithmic
  15276. @item sqrt
  15277. square root
  15278. @item cbrt
  15279. cubic root
  15280. @item lin
  15281. linear
  15282. @item rlog
  15283. reverse logarithmic
  15284. @end table
  15285. Default is @code{log}.
  15286. @item ascale
  15287. Set amplitude scale.
  15288. It accepts the following values:
  15289. @table @samp
  15290. @item log
  15291. logarithmic
  15292. @item lin
  15293. linear
  15294. @end table
  15295. Default is @code{log}.
  15296. @item acount
  15297. Set how much frames to accumulate in histogram.
  15298. Defauls is 1. Setting this to -1 accumulates all frames.
  15299. @item rheight
  15300. Set histogram ratio of window height.
  15301. @item slide
  15302. Set sonogram sliding.
  15303. It accepts the following values:
  15304. @table @samp
  15305. @item replace
  15306. replace old rows with new ones.
  15307. @item scroll
  15308. scroll from top to bottom.
  15309. @end table
  15310. Default is @code{replace}.
  15311. @end table
  15312. @section aphasemeter
  15313. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  15314. representing mean phase of current audio frame. A video output can also be produced and is
  15315. enabled by default. The audio is passed through as first output.
  15316. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  15317. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  15318. and @code{1} means channels are in phase.
  15319. The filter accepts the following options, all related to its video output:
  15320. @table @option
  15321. @item rate, r
  15322. Set the output frame rate. Default value is @code{25}.
  15323. @item size, s
  15324. Set the video size for the output. For the syntax of this option, check the
  15325. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15326. Default value is @code{800x400}.
  15327. @item rc
  15328. @item gc
  15329. @item bc
  15330. Specify the red, green, blue contrast. Default values are @code{2},
  15331. @code{7} and @code{1}.
  15332. Allowed range is @code{[0, 255]}.
  15333. @item mpc
  15334. Set color which will be used for drawing median phase. If color is
  15335. @code{none} which is default, no median phase value will be drawn.
  15336. @item video
  15337. Enable video output. Default is enabled.
  15338. @end table
  15339. @section avectorscope
  15340. Convert input audio to a video output, representing the audio vector
  15341. scope.
  15342. The filter is used to measure the difference between channels of stereo
  15343. audio stream. A monoaural signal, consisting of identical left and right
  15344. signal, results in straight vertical line. Any stereo separation is visible
  15345. as a deviation from this line, creating a Lissajous figure.
  15346. If the straight (or deviation from it) but horizontal line appears this
  15347. indicates that the left and right channels are out of phase.
  15348. The filter accepts the following options:
  15349. @table @option
  15350. @item mode, m
  15351. Set the vectorscope mode.
  15352. Available values are:
  15353. @table @samp
  15354. @item lissajous
  15355. Lissajous rotated by 45 degrees.
  15356. @item lissajous_xy
  15357. Same as above but not rotated.
  15358. @item polar
  15359. Shape resembling half of circle.
  15360. @end table
  15361. Default value is @samp{lissajous}.
  15362. @item size, s
  15363. Set the video size for the output. For the syntax of this option, check the
  15364. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15365. Default value is @code{400x400}.
  15366. @item rate, r
  15367. Set the output frame rate. Default value is @code{25}.
  15368. @item rc
  15369. @item gc
  15370. @item bc
  15371. @item ac
  15372. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  15373. @code{160}, @code{80} and @code{255}.
  15374. Allowed range is @code{[0, 255]}.
  15375. @item rf
  15376. @item gf
  15377. @item bf
  15378. @item af
  15379. Specify the red, green, blue and alpha fade. Default values are @code{15},
  15380. @code{10}, @code{5} and @code{5}.
  15381. Allowed range is @code{[0, 255]}.
  15382. @item zoom
  15383. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  15384. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  15385. @item draw
  15386. Set the vectorscope drawing mode.
  15387. Available values are:
  15388. @table @samp
  15389. @item dot
  15390. Draw dot for each sample.
  15391. @item line
  15392. Draw line between previous and current sample.
  15393. @end table
  15394. Default value is @samp{dot}.
  15395. @item scale
  15396. Specify amplitude scale of audio samples.
  15397. Available values are:
  15398. @table @samp
  15399. @item lin
  15400. Linear.
  15401. @item sqrt
  15402. Square root.
  15403. @item cbrt
  15404. Cubic root.
  15405. @item log
  15406. Logarithmic.
  15407. @end table
  15408. @item swap
  15409. Swap left channel axis with right channel axis.
  15410. @item mirror
  15411. Mirror axis.
  15412. @table @samp
  15413. @item none
  15414. No mirror.
  15415. @item x
  15416. Mirror only x axis.
  15417. @item y
  15418. Mirror only y axis.
  15419. @item xy
  15420. Mirror both axis.
  15421. @end table
  15422. @end table
  15423. @subsection Examples
  15424. @itemize
  15425. @item
  15426. Complete example using @command{ffplay}:
  15427. @example
  15428. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15429. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  15430. @end example
  15431. @end itemize
  15432. @section bench, abench
  15433. Benchmark part of a filtergraph.
  15434. The filter accepts the following options:
  15435. @table @option
  15436. @item action
  15437. Start or stop a timer.
  15438. Available values are:
  15439. @table @samp
  15440. @item start
  15441. Get the current time, set it as frame metadata (using the key
  15442. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  15443. @item stop
  15444. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  15445. the input frame metadata to get the time difference. Time difference, average,
  15446. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  15447. @code{min}) are then printed. The timestamps are expressed in seconds.
  15448. @end table
  15449. @end table
  15450. @subsection Examples
  15451. @itemize
  15452. @item
  15453. Benchmark @ref{selectivecolor} filter:
  15454. @example
  15455. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  15456. @end example
  15457. @end itemize
  15458. @section concat
  15459. Concatenate audio and video streams, joining them together one after the
  15460. other.
  15461. The filter works on segments of synchronized video and audio streams. All
  15462. segments must have the same number of streams of each type, and that will
  15463. also be the number of streams at output.
  15464. The filter accepts the following options:
  15465. @table @option
  15466. @item n
  15467. Set the number of segments. Default is 2.
  15468. @item v
  15469. Set the number of output video streams, that is also the number of video
  15470. streams in each segment. Default is 1.
  15471. @item a
  15472. Set the number of output audio streams, that is also the number of audio
  15473. streams in each segment. Default is 0.
  15474. @item unsafe
  15475. Activate unsafe mode: do not fail if segments have a different format.
  15476. @end table
  15477. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  15478. @var{a} audio outputs.
  15479. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  15480. segment, in the same order as the outputs, then the inputs for the second
  15481. segment, etc.
  15482. Related streams do not always have exactly the same duration, for various
  15483. reasons including codec frame size or sloppy authoring. For that reason,
  15484. related synchronized streams (e.g. a video and its audio track) should be
  15485. concatenated at once. The concat filter will use the duration of the longest
  15486. stream in each segment (except the last one), and if necessary pad shorter
  15487. audio streams with silence.
  15488. For this filter to work correctly, all segments must start at timestamp 0.
  15489. All corresponding streams must have the same parameters in all segments; the
  15490. filtering system will automatically select a common pixel format for video
  15491. streams, and a common sample format, sample rate and channel layout for
  15492. audio streams, but other settings, such as resolution, must be converted
  15493. explicitly by the user.
  15494. Different frame rates are acceptable but will result in variable frame rate
  15495. at output; be sure to configure the output file to handle it.
  15496. @subsection Examples
  15497. @itemize
  15498. @item
  15499. Concatenate an opening, an episode and an ending, all in bilingual version
  15500. (video in stream 0, audio in streams 1 and 2):
  15501. @example
  15502. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  15503. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  15504. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  15505. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  15506. @end example
  15507. @item
  15508. Concatenate two parts, handling audio and video separately, using the
  15509. (a)movie sources, and adjusting the resolution:
  15510. @example
  15511. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  15512. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  15513. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  15514. @end example
  15515. Note that a desync will happen at the stitch if the audio and video streams
  15516. do not have exactly the same duration in the first file.
  15517. @end itemize
  15518. @subsection Commands
  15519. This filter supports the following commands:
  15520. @table @option
  15521. @item next
  15522. Close the current segment and step to the next one
  15523. @end table
  15524. @section drawgraph, adrawgraph
  15525. Draw a graph using input video or audio metadata.
  15526. It accepts the following parameters:
  15527. @table @option
  15528. @item m1
  15529. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  15530. @item fg1
  15531. Set 1st foreground color expression.
  15532. @item m2
  15533. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  15534. @item fg2
  15535. Set 2nd foreground color expression.
  15536. @item m3
  15537. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  15538. @item fg3
  15539. Set 3rd foreground color expression.
  15540. @item m4
  15541. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  15542. @item fg4
  15543. Set 4th foreground color expression.
  15544. @item min
  15545. Set minimal value of metadata value.
  15546. @item max
  15547. Set maximal value of metadata value.
  15548. @item bg
  15549. Set graph background color. Default is white.
  15550. @item mode
  15551. Set graph mode.
  15552. Available values for mode is:
  15553. @table @samp
  15554. @item bar
  15555. @item dot
  15556. @item line
  15557. @end table
  15558. Default is @code{line}.
  15559. @item slide
  15560. Set slide mode.
  15561. Available values for slide is:
  15562. @table @samp
  15563. @item frame
  15564. Draw new frame when right border is reached.
  15565. @item replace
  15566. Replace old columns with new ones.
  15567. @item scroll
  15568. Scroll from right to left.
  15569. @item rscroll
  15570. Scroll from left to right.
  15571. @item picture
  15572. Draw single picture.
  15573. @end table
  15574. Default is @code{frame}.
  15575. @item size
  15576. Set size of graph video. For the syntax of this option, check the
  15577. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15578. The default value is @code{900x256}.
  15579. The foreground color expressions can use the following variables:
  15580. @table @option
  15581. @item MIN
  15582. Minimal value of metadata value.
  15583. @item MAX
  15584. Maximal value of metadata value.
  15585. @item VAL
  15586. Current metadata key value.
  15587. @end table
  15588. The color is defined as 0xAABBGGRR.
  15589. @end table
  15590. Example using metadata from @ref{signalstats} filter:
  15591. @example
  15592. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  15593. @end example
  15594. Example using metadata from @ref{ebur128} filter:
  15595. @example
  15596. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  15597. @end example
  15598. @anchor{ebur128}
  15599. @section ebur128
  15600. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  15601. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  15602. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  15603. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  15604. The filter also has a video output (see the @var{video} option) with a real
  15605. time graph to observe the loudness evolution. The graphic contains the logged
  15606. message mentioned above, so it is not printed anymore when this option is set,
  15607. unless the verbose logging is set. The main graphing area contains the
  15608. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  15609. the momentary loudness (400 milliseconds), but can optionally be configured
  15610. to instead display short-term loudness (see @var{gauge}).
  15611. The green area marks a +/- 1LU target range around the target loudness
  15612. (-23LUFS by default, unless modified through @var{target}).
  15613. More information about the Loudness Recommendation EBU R128 on
  15614. @url{http://tech.ebu.ch/loudness}.
  15615. The filter accepts the following options:
  15616. @table @option
  15617. @item video
  15618. Activate the video output. The audio stream is passed unchanged whether this
  15619. option is set or no. The video stream will be the first output stream if
  15620. activated. Default is @code{0}.
  15621. @item size
  15622. Set the video size. This option is for video only. For the syntax of this
  15623. option, check the
  15624. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15625. Default and minimum resolution is @code{640x480}.
  15626. @item meter
  15627. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  15628. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  15629. other integer value between this range is allowed.
  15630. @item metadata
  15631. Set metadata injection. If set to @code{1}, the audio input will be segmented
  15632. into 100ms output frames, each of them containing various loudness information
  15633. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  15634. Default is @code{0}.
  15635. @item framelog
  15636. Force the frame logging level.
  15637. Available values are:
  15638. @table @samp
  15639. @item info
  15640. information logging level
  15641. @item verbose
  15642. verbose logging level
  15643. @end table
  15644. By default, the logging level is set to @var{info}. If the @option{video} or
  15645. the @option{metadata} options are set, it switches to @var{verbose}.
  15646. @item peak
  15647. Set peak mode(s).
  15648. Available modes can be cumulated (the option is a @code{flag} type). Possible
  15649. values are:
  15650. @table @samp
  15651. @item none
  15652. Disable any peak mode (default).
  15653. @item sample
  15654. Enable sample-peak mode.
  15655. Simple peak mode looking for the higher sample value. It logs a message
  15656. for sample-peak (identified by @code{SPK}).
  15657. @item true
  15658. Enable true-peak mode.
  15659. If enabled, the peak lookup is done on an over-sampled version of the input
  15660. stream for better peak accuracy. It logs a message for true-peak.
  15661. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  15662. This mode requires a build with @code{libswresample}.
  15663. @end table
  15664. @item dualmono
  15665. Treat mono input files as "dual mono". If a mono file is intended for playback
  15666. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  15667. If set to @code{true}, this option will compensate for this effect.
  15668. Multi-channel input files are not affected by this option.
  15669. @item panlaw
  15670. Set a specific pan law to be used for the measurement of dual mono files.
  15671. This parameter is optional, and has a default value of -3.01dB.
  15672. @item target
  15673. Set a specific target level (in LUFS) used as relative zero in the visualization.
  15674. This parameter is optional and has a default value of -23LUFS as specified
  15675. by EBU R128. However, material published online may prefer a level of -16LUFS
  15676. (e.g. for use with podcasts or video platforms).
  15677. @item gauge
  15678. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  15679. @code{shortterm}. By default the momentary value will be used, but in certain
  15680. scenarios it may be more useful to observe the short term value instead (e.g.
  15681. live mixing).
  15682. @item scale
  15683. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  15684. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  15685. video output, not the summary or continuous log output.
  15686. @end table
  15687. @subsection Examples
  15688. @itemize
  15689. @item
  15690. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  15691. @example
  15692. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  15693. @end example
  15694. @item
  15695. Run an analysis with @command{ffmpeg}:
  15696. @example
  15697. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  15698. @end example
  15699. @end itemize
  15700. @section interleave, ainterleave
  15701. Temporally interleave frames from several inputs.
  15702. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  15703. These filters read frames from several inputs and send the oldest
  15704. queued frame to the output.
  15705. Input streams must have well defined, monotonically increasing frame
  15706. timestamp values.
  15707. In order to submit one frame to output, these filters need to enqueue
  15708. at least one frame for each input, so they cannot work in case one
  15709. input is not yet terminated and will not receive incoming frames.
  15710. For example consider the case when one input is a @code{select} filter
  15711. which always drops input frames. The @code{interleave} filter will keep
  15712. reading from that input, but it will never be able to send new frames
  15713. to output until the input sends an end-of-stream signal.
  15714. Also, depending on inputs synchronization, the filters will drop
  15715. frames in case one input receives more frames than the other ones, and
  15716. the queue is already filled.
  15717. These filters accept the following options:
  15718. @table @option
  15719. @item nb_inputs, n
  15720. Set the number of different inputs, it is 2 by default.
  15721. @end table
  15722. @subsection Examples
  15723. @itemize
  15724. @item
  15725. Interleave frames belonging to different streams using @command{ffmpeg}:
  15726. @example
  15727. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  15728. @end example
  15729. @item
  15730. Add flickering blur effect:
  15731. @example
  15732. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  15733. @end example
  15734. @end itemize
  15735. @section metadata, ametadata
  15736. Manipulate frame metadata.
  15737. This filter accepts the following options:
  15738. @table @option
  15739. @item mode
  15740. Set mode of operation of the filter.
  15741. Can be one of the following:
  15742. @table @samp
  15743. @item select
  15744. If both @code{value} and @code{key} is set, select frames
  15745. which have such metadata. If only @code{key} is set, select
  15746. every frame that has such key in metadata.
  15747. @item add
  15748. Add new metadata @code{key} and @code{value}. If key is already available
  15749. do nothing.
  15750. @item modify
  15751. Modify value of already present key.
  15752. @item delete
  15753. If @code{value} is set, delete only keys that have such value.
  15754. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  15755. the frame.
  15756. @item print
  15757. Print key and its value if metadata was found. If @code{key} is not set print all
  15758. metadata values available in frame.
  15759. @end table
  15760. @item key
  15761. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  15762. @item value
  15763. Set metadata value which will be used. This option is mandatory for
  15764. @code{modify} and @code{add} mode.
  15765. @item function
  15766. Which function to use when comparing metadata value and @code{value}.
  15767. Can be one of following:
  15768. @table @samp
  15769. @item same_str
  15770. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  15771. @item starts_with
  15772. Values are interpreted as strings, returns true if metadata value starts with
  15773. the @code{value} option string.
  15774. @item less
  15775. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  15776. @item equal
  15777. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  15778. @item greater
  15779. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  15780. @item expr
  15781. Values are interpreted as floats, returns true if expression from option @code{expr}
  15782. evaluates to true.
  15783. @end table
  15784. @item expr
  15785. Set expression which is used when @code{function} is set to @code{expr}.
  15786. The expression is evaluated through the eval API and can contain the following
  15787. constants:
  15788. @table @option
  15789. @item VALUE1
  15790. Float representation of @code{value} from metadata key.
  15791. @item VALUE2
  15792. Float representation of @code{value} as supplied by user in @code{value} option.
  15793. @end table
  15794. @item file
  15795. If specified in @code{print} mode, output is written to the named file. Instead of
  15796. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  15797. for standard output. If @code{file} option is not set, output is written to the log
  15798. with AV_LOG_INFO loglevel.
  15799. @end table
  15800. @subsection Examples
  15801. @itemize
  15802. @item
  15803. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  15804. between 0 and 1.
  15805. @example
  15806. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  15807. @end example
  15808. @item
  15809. Print silencedetect output to file @file{metadata.txt}.
  15810. @example
  15811. silencedetect,ametadata=mode=print:file=metadata.txt
  15812. @end example
  15813. @item
  15814. Direct all metadata to a pipe with file descriptor 4.
  15815. @example
  15816. metadata=mode=print:file='pipe\:4'
  15817. @end example
  15818. @end itemize
  15819. @section perms, aperms
  15820. Set read/write permissions for the output frames.
  15821. These filters are mainly aimed at developers to test direct path in the
  15822. following filter in the filtergraph.
  15823. The filters accept the following options:
  15824. @table @option
  15825. @item mode
  15826. Select the permissions mode.
  15827. It accepts the following values:
  15828. @table @samp
  15829. @item none
  15830. Do nothing. This is the default.
  15831. @item ro
  15832. Set all the output frames read-only.
  15833. @item rw
  15834. Set all the output frames directly writable.
  15835. @item toggle
  15836. Make the frame read-only if writable, and writable if read-only.
  15837. @item random
  15838. Set each output frame read-only or writable randomly.
  15839. @end table
  15840. @item seed
  15841. Set the seed for the @var{random} mode, must be an integer included between
  15842. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  15843. @code{-1}, the filter will try to use a good random seed on a best effort
  15844. basis.
  15845. @end table
  15846. Note: in case of auto-inserted filter between the permission filter and the
  15847. following one, the permission might not be received as expected in that
  15848. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  15849. perms/aperms filter can avoid this problem.
  15850. @section realtime, arealtime
  15851. Slow down filtering to match real time approximately.
  15852. These filters will pause the filtering for a variable amount of time to
  15853. match the output rate with the input timestamps.
  15854. They are similar to the @option{re} option to @code{ffmpeg}.
  15855. They accept the following options:
  15856. @table @option
  15857. @item limit
  15858. Time limit for the pauses. Any pause longer than that will be considered
  15859. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  15860. @end table
  15861. @anchor{select}
  15862. @section select, aselect
  15863. Select frames to pass in output.
  15864. This filter accepts the following options:
  15865. @table @option
  15866. @item expr, e
  15867. Set expression, which is evaluated for each input frame.
  15868. If the expression is evaluated to zero, the frame is discarded.
  15869. If the evaluation result is negative or NaN, the frame is sent to the
  15870. first output; otherwise it is sent to the output with index
  15871. @code{ceil(val)-1}, assuming that the input index starts from 0.
  15872. For example a value of @code{1.2} corresponds to the output with index
  15873. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  15874. @item outputs, n
  15875. Set the number of outputs. The output to which to send the selected
  15876. frame is based on the result of the evaluation. Default value is 1.
  15877. @end table
  15878. The expression can contain the following constants:
  15879. @table @option
  15880. @item n
  15881. The (sequential) number of the filtered frame, starting from 0.
  15882. @item selected_n
  15883. The (sequential) number of the selected frame, starting from 0.
  15884. @item prev_selected_n
  15885. The sequential number of the last selected frame. It's NAN if undefined.
  15886. @item TB
  15887. The timebase of the input timestamps.
  15888. @item pts
  15889. The PTS (Presentation TimeStamp) of the filtered video frame,
  15890. expressed in @var{TB} units. It's NAN if undefined.
  15891. @item t
  15892. The PTS of the filtered video frame,
  15893. expressed in seconds. It's NAN if undefined.
  15894. @item prev_pts
  15895. The PTS of the previously filtered video frame. It's NAN if undefined.
  15896. @item prev_selected_pts
  15897. The PTS of the last previously filtered video frame. It's NAN if undefined.
  15898. @item prev_selected_t
  15899. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  15900. @item start_pts
  15901. The PTS of the first video frame in the video. It's NAN if undefined.
  15902. @item start_t
  15903. The time of the first video frame in the video. It's NAN if undefined.
  15904. @item pict_type @emph{(video only)}
  15905. The type of the filtered frame. It can assume one of the following
  15906. values:
  15907. @table @option
  15908. @item I
  15909. @item P
  15910. @item B
  15911. @item S
  15912. @item SI
  15913. @item SP
  15914. @item BI
  15915. @end table
  15916. @item interlace_type @emph{(video only)}
  15917. The frame interlace type. It can assume one of the following values:
  15918. @table @option
  15919. @item PROGRESSIVE
  15920. The frame is progressive (not interlaced).
  15921. @item TOPFIRST
  15922. The frame is top-field-first.
  15923. @item BOTTOMFIRST
  15924. The frame is bottom-field-first.
  15925. @end table
  15926. @item consumed_sample_n @emph{(audio only)}
  15927. the number of selected samples before the current frame
  15928. @item samples_n @emph{(audio only)}
  15929. the number of samples in the current frame
  15930. @item sample_rate @emph{(audio only)}
  15931. the input sample rate
  15932. @item key
  15933. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  15934. @item pos
  15935. the position in the file of the filtered frame, -1 if the information
  15936. is not available (e.g. for synthetic video)
  15937. @item scene @emph{(video only)}
  15938. value between 0 and 1 to indicate a new scene; a low value reflects a low
  15939. probability for the current frame to introduce a new scene, while a higher
  15940. value means the current frame is more likely to be one (see the example below)
  15941. @item concatdec_select
  15942. The concat demuxer can select only part of a concat input file by setting an
  15943. inpoint and an outpoint, but the output packets may not be entirely contained
  15944. in the selected interval. By using this variable, it is possible to skip frames
  15945. generated by the concat demuxer which are not exactly contained in the selected
  15946. interval.
  15947. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  15948. and the @var{lavf.concat.duration} packet metadata values which are also
  15949. present in the decoded frames.
  15950. The @var{concatdec_select} variable is -1 if the frame pts is at least
  15951. start_time and either the duration metadata is missing or the frame pts is less
  15952. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  15953. missing.
  15954. That basically means that an input frame is selected if its pts is within the
  15955. interval set by the concat demuxer.
  15956. @end table
  15957. The default value of the select expression is "1".
  15958. @subsection Examples
  15959. @itemize
  15960. @item
  15961. Select all frames in input:
  15962. @example
  15963. select
  15964. @end example
  15965. The example above is the same as:
  15966. @example
  15967. select=1
  15968. @end example
  15969. @item
  15970. Skip all frames:
  15971. @example
  15972. select=0
  15973. @end example
  15974. @item
  15975. Select only I-frames:
  15976. @example
  15977. select='eq(pict_type\,I)'
  15978. @end example
  15979. @item
  15980. Select one frame every 100:
  15981. @example
  15982. select='not(mod(n\,100))'
  15983. @end example
  15984. @item
  15985. Select only frames contained in the 10-20 time interval:
  15986. @example
  15987. select=between(t\,10\,20)
  15988. @end example
  15989. @item
  15990. Select only I-frames contained in the 10-20 time interval:
  15991. @example
  15992. select=between(t\,10\,20)*eq(pict_type\,I)
  15993. @end example
  15994. @item
  15995. Select frames with a minimum distance of 10 seconds:
  15996. @example
  15997. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  15998. @end example
  15999. @item
  16000. Use aselect to select only audio frames with samples number > 100:
  16001. @example
  16002. aselect='gt(samples_n\,100)'
  16003. @end example
  16004. @item
  16005. Create a mosaic of the first scenes:
  16006. @example
  16007. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16008. @end example
  16009. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16010. choice.
  16011. @item
  16012. Send even and odd frames to separate outputs, and compose them:
  16013. @example
  16014. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16015. @end example
  16016. @item
  16017. Select useful frames from an ffconcat file which is using inpoints and
  16018. outpoints but where the source files are not intra frame only.
  16019. @example
  16020. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16021. @end example
  16022. @end itemize
  16023. @section sendcmd, asendcmd
  16024. Send commands to filters in the filtergraph.
  16025. These filters read commands to be sent to other filters in the
  16026. filtergraph.
  16027. @code{sendcmd} must be inserted between two video filters,
  16028. @code{asendcmd} must be inserted between two audio filters, but apart
  16029. from that they act the same way.
  16030. The specification of commands can be provided in the filter arguments
  16031. with the @var{commands} option, or in a file specified by the
  16032. @var{filename} option.
  16033. These filters accept the following options:
  16034. @table @option
  16035. @item commands, c
  16036. Set the commands to be read and sent to the other filters.
  16037. @item filename, f
  16038. Set the filename of the commands to be read and sent to the other
  16039. filters.
  16040. @end table
  16041. @subsection Commands syntax
  16042. A commands description consists of a sequence of interval
  16043. specifications, comprising a list of commands to be executed when a
  16044. particular event related to that interval occurs. The occurring event
  16045. is typically the current frame time entering or leaving a given time
  16046. interval.
  16047. An interval is specified by the following syntax:
  16048. @example
  16049. @var{START}[-@var{END}] @var{COMMANDS};
  16050. @end example
  16051. The time interval is specified by the @var{START} and @var{END} times.
  16052. @var{END} is optional and defaults to the maximum time.
  16053. The current frame time is considered within the specified interval if
  16054. it is included in the interval [@var{START}, @var{END}), that is when
  16055. the time is greater or equal to @var{START} and is lesser than
  16056. @var{END}.
  16057. @var{COMMANDS} consists of a sequence of one or more command
  16058. specifications, separated by ",", relating to that interval. The
  16059. syntax of a command specification is given by:
  16060. @example
  16061. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16062. @end example
  16063. @var{FLAGS} is optional and specifies the type of events relating to
  16064. the time interval which enable sending the specified command, and must
  16065. be a non-null sequence of identifier flags separated by "+" or "|" and
  16066. enclosed between "[" and "]".
  16067. The following flags are recognized:
  16068. @table @option
  16069. @item enter
  16070. The command is sent when the current frame timestamp enters the
  16071. specified interval. In other words, the command is sent when the
  16072. previous frame timestamp was not in the given interval, and the
  16073. current is.
  16074. @item leave
  16075. The command is sent when the current frame timestamp leaves the
  16076. specified interval. In other words, the command is sent when the
  16077. previous frame timestamp was in the given interval, and the
  16078. current is not.
  16079. @end table
  16080. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16081. assumed.
  16082. @var{TARGET} specifies the target of the command, usually the name of
  16083. the filter class or a specific filter instance name.
  16084. @var{COMMAND} specifies the name of the command for the target filter.
  16085. @var{ARG} is optional and specifies the optional list of argument for
  16086. the given @var{COMMAND}.
  16087. Between one interval specification and another, whitespaces, or
  16088. sequences of characters starting with @code{#} until the end of line,
  16089. are ignored and can be used to annotate comments.
  16090. A simplified BNF description of the commands specification syntax
  16091. follows:
  16092. @example
  16093. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16094. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16095. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16096. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16097. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16098. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16099. @end example
  16100. @subsection Examples
  16101. @itemize
  16102. @item
  16103. Specify audio tempo change at second 4:
  16104. @example
  16105. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16106. @end example
  16107. @item
  16108. Target a specific filter instance:
  16109. @example
  16110. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  16111. @end example
  16112. @item
  16113. Specify a list of drawtext and hue commands in a file.
  16114. @example
  16115. # show text in the interval 5-10
  16116. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  16117. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  16118. # desaturate the image in the interval 15-20
  16119. 15.0-20.0 [enter] hue s 0,
  16120. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16121. [leave] hue s 1,
  16122. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16123. # apply an exponential saturation fade-out effect, starting from time 25
  16124. 25 [enter] hue s exp(25-t)
  16125. @end example
  16126. A filtergraph allowing to read and process the above command list
  16127. stored in a file @file{test.cmd}, can be specified with:
  16128. @example
  16129. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16130. @end example
  16131. @end itemize
  16132. @anchor{setpts}
  16133. @section setpts, asetpts
  16134. Change the PTS (presentation timestamp) of the input frames.
  16135. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16136. This filter accepts the following options:
  16137. @table @option
  16138. @item expr
  16139. The expression which is evaluated for each frame to construct its timestamp.
  16140. @end table
  16141. The expression is evaluated through the eval API and can contain the following
  16142. constants:
  16143. @table @option
  16144. @item FRAME_RATE, FR
  16145. frame rate, only defined for constant frame-rate video
  16146. @item PTS
  16147. The presentation timestamp in input
  16148. @item N
  16149. The count of the input frame for video or the number of consumed samples,
  16150. not including the current frame for audio, starting from 0.
  16151. @item NB_CONSUMED_SAMPLES
  16152. The number of consumed samples, not including the current frame (only
  16153. audio)
  16154. @item NB_SAMPLES, S
  16155. The number of samples in the current frame (only audio)
  16156. @item SAMPLE_RATE, SR
  16157. The audio sample rate.
  16158. @item STARTPTS
  16159. The PTS of the first frame.
  16160. @item STARTT
  16161. the time in seconds of the first frame
  16162. @item INTERLACED
  16163. State whether the current frame is interlaced.
  16164. @item T
  16165. the time in seconds of the current frame
  16166. @item POS
  16167. original position in the file of the frame, or undefined if undefined
  16168. for the current frame
  16169. @item PREV_INPTS
  16170. The previous input PTS.
  16171. @item PREV_INT
  16172. previous input time in seconds
  16173. @item PREV_OUTPTS
  16174. The previous output PTS.
  16175. @item PREV_OUTT
  16176. previous output time in seconds
  16177. @item RTCTIME
  16178. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16179. instead.
  16180. @item RTCSTART
  16181. The wallclock (RTC) time at the start of the movie in microseconds.
  16182. @item TB
  16183. The timebase of the input timestamps.
  16184. @end table
  16185. @subsection Examples
  16186. @itemize
  16187. @item
  16188. Start counting PTS from zero
  16189. @example
  16190. setpts=PTS-STARTPTS
  16191. @end example
  16192. @item
  16193. Apply fast motion effect:
  16194. @example
  16195. setpts=0.5*PTS
  16196. @end example
  16197. @item
  16198. Apply slow motion effect:
  16199. @example
  16200. setpts=2.0*PTS
  16201. @end example
  16202. @item
  16203. Set fixed rate of 25 frames per second:
  16204. @example
  16205. setpts=N/(25*TB)
  16206. @end example
  16207. @item
  16208. Set fixed rate 25 fps with some jitter:
  16209. @example
  16210. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16211. @end example
  16212. @item
  16213. Apply an offset of 10 seconds to the input PTS:
  16214. @example
  16215. setpts=PTS+10/TB
  16216. @end example
  16217. @item
  16218. Generate timestamps from a "live source" and rebase onto the current timebase:
  16219. @example
  16220. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16221. @end example
  16222. @item
  16223. Generate timestamps by counting samples:
  16224. @example
  16225. asetpts=N/SR/TB
  16226. @end example
  16227. @end itemize
  16228. @section setrange
  16229. Force color range for the output video frame.
  16230. The @code{setrange} filter marks the color range property for the
  16231. output frames. It does not change the input frame, but only sets the
  16232. corresponding property, which affects how the frame is treated by
  16233. following filters.
  16234. The filter accepts the following options:
  16235. @table @option
  16236. @item range
  16237. Available values are:
  16238. @table @samp
  16239. @item auto
  16240. Keep the same color range property.
  16241. @item unspecified, unknown
  16242. Set the color range as unspecified.
  16243. @item limited, tv, mpeg
  16244. Set the color range as limited.
  16245. @item full, pc, jpeg
  16246. Set the color range as full.
  16247. @end table
  16248. @end table
  16249. @section settb, asettb
  16250. Set the timebase to use for the output frames timestamps.
  16251. It is mainly useful for testing timebase configuration.
  16252. It accepts the following parameters:
  16253. @table @option
  16254. @item expr, tb
  16255. The expression which is evaluated into the output timebase.
  16256. @end table
  16257. The value for @option{tb} is an arithmetic expression representing a
  16258. rational. The expression can contain the constants "AVTB" (the default
  16259. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16260. audio only). Default value is "intb".
  16261. @subsection Examples
  16262. @itemize
  16263. @item
  16264. Set the timebase to 1/25:
  16265. @example
  16266. settb=expr=1/25
  16267. @end example
  16268. @item
  16269. Set the timebase to 1/10:
  16270. @example
  16271. settb=expr=0.1
  16272. @end example
  16273. @item
  16274. Set the timebase to 1001/1000:
  16275. @example
  16276. settb=1+0.001
  16277. @end example
  16278. @item
  16279. Set the timebase to 2*intb:
  16280. @example
  16281. settb=2*intb
  16282. @end example
  16283. @item
  16284. Set the default timebase value:
  16285. @example
  16286. settb=AVTB
  16287. @end example
  16288. @end itemize
  16289. @section showcqt
  16290. Convert input audio to a video output representing frequency spectrum
  16291. logarithmically using Brown-Puckette constant Q transform algorithm with
  16292. direct frequency domain coefficient calculation (but the transform itself
  16293. is not really constant Q, instead the Q factor is actually variable/clamped),
  16294. with musical tone scale, from E0 to D#10.
  16295. The filter accepts the following options:
  16296. @table @option
  16297. @item size, s
  16298. Specify the video size for the output. It must be even. For the syntax of this option,
  16299. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16300. Default value is @code{1920x1080}.
  16301. @item fps, rate, r
  16302. Set the output frame rate. Default value is @code{25}.
  16303. @item bar_h
  16304. Set the bargraph height. It must be even. Default value is @code{-1} which
  16305. computes the bargraph height automatically.
  16306. @item axis_h
  16307. Set the axis height. It must be even. Default value is @code{-1} which computes
  16308. the axis height automatically.
  16309. @item sono_h
  16310. Set the sonogram height. It must be even. Default value is @code{-1} which
  16311. computes the sonogram height automatically.
  16312. @item fullhd
  16313. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  16314. instead. Default value is @code{1}.
  16315. @item sono_v, volume
  16316. Specify the sonogram volume expression. It can contain variables:
  16317. @table @option
  16318. @item bar_v
  16319. the @var{bar_v} evaluated expression
  16320. @item frequency, freq, f
  16321. the frequency where it is evaluated
  16322. @item timeclamp, tc
  16323. the value of @var{timeclamp} option
  16324. @end table
  16325. and functions:
  16326. @table @option
  16327. @item a_weighting(f)
  16328. A-weighting of equal loudness
  16329. @item b_weighting(f)
  16330. B-weighting of equal loudness
  16331. @item c_weighting(f)
  16332. C-weighting of equal loudness.
  16333. @end table
  16334. Default value is @code{16}.
  16335. @item bar_v, volume2
  16336. Specify the bargraph volume expression. It can contain variables:
  16337. @table @option
  16338. @item sono_v
  16339. the @var{sono_v} evaluated expression
  16340. @item frequency, freq, f
  16341. the frequency where it is evaluated
  16342. @item timeclamp, tc
  16343. the value of @var{timeclamp} option
  16344. @end table
  16345. and functions:
  16346. @table @option
  16347. @item a_weighting(f)
  16348. A-weighting of equal loudness
  16349. @item b_weighting(f)
  16350. B-weighting of equal loudness
  16351. @item c_weighting(f)
  16352. C-weighting of equal loudness.
  16353. @end table
  16354. Default value is @code{sono_v}.
  16355. @item sono_g, gamma
  16356. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  16357. higher gamma makes the spectrum having more range. Default value is @code{3}.
  16358. Acceptable range is @code{[1, 7]}.
  16359. @item bar_g, gamma2
  16360. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  16361. @code{[1, 7]}.
  16362. @item bar_t
  16363. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  16364. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  16365. @item timeclamp, tc
  16366. Specify the transform timeclamp. At low frequency, there is trade-off between
  16367. accuracy in time domain and frequency domain. If timeclamp is lower,
  16368. event in time domain is represented more accurately (such as fast bass drum),
  16369. otherwise event in frequency domain is represented more accurately
  16370. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  16371. @item attack
  16372. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  16373. limits future samples by applying asymmetric windowing in time domain, useful
  16374. when low latency is required. Accepted range is @code{[0, 1]}.
  16375. @item basefreq
  16376. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  16377. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  16378. @item endfreq
  16379. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  16380. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  16381. @item coeffclamp
  16382. This option is deprecated and ignored.
  16383. @item tlength
  16384. Specify the transform length in time domain. Use this option to control accuracy
  16385. trade-off between time domain and frequency domain at every frequency sample.
  16386. It can contain variables:
  16387. @table @option
  16388. @item frequency, freq, f
  16389. the frequency where it is evaluated
  16390. @item timeclamp, tc
  16391. the value of @var{timeclamp} option.
  16392. @end table
  16393. Default value is @code{384*tc/(384+tc*f)}.
  16394. @item count
  16395. Specify the transform count for every video frame. Default value is @code{6}.
  16396. Acceptable range is @code{[1, 30]}.
  16397. @item fcount
  16398. Specify the transform count for every single pixel. Default value is @code{0},
  16399. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  16400. @item fontfile
  16401. Specify font file for use with freetype to draw the axis. If not specified,
  16402. use embedded font. Note that drawing with font file or embedded font is not
  16403. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  16404. option instead.
  16405. @item font
  16406. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  16407. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  16408. @item fontcolor
  16409. Specify font color expression. This is arithmetic expression that should return
  16410. integer value 0xRRGGBB. It can contain variables:
  16411. @table @option
  16412. @item frequency, freq, f
  16413. the frequency where it is evaluated
  16414. @item timeclamp, tc
  16415. the value of @var{timeclamp} option
  16416. @end table
  16417. and functions:
  16418. @table @option
  16419. @item midi(f)
  16420. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  16421. @item r(x), g(x), b(x)
  16422. red, green, and blue value of intensity x.
  16423. @end table
  16424. Default value is @code{st(0, (midi(f)-59.5)/12);
  16425. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  16426. r(1-ld(1)) + b(ld(1))}.
  16427. @item axisfile
  16428. Specify image file to draw the axis. This option override @var{fontfile} and
  16429. @var{fontcolor} option.
  16430. @item axis, text
  16431. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  16432. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  16433. Default value is @code{1}.
  16434. @item csp
  16435. Set colorspace. The accepted values are:
  16436. @table @samp
  16437. @item unspecified
  16438. Unspecified (default)
  16439. @item bt709
  16440. BT.709
  16441. @item fcc
  16442. FCC
  16443. @item bt470bg
  16444. BT.470BG or BT.601-6 625
  16445. @item smpte170m
  16446. SMPTE-170M or BT.601-6 525
  16447. @item smpte240m
  16448. SMPTE-240M
  16449. @item bt2020ncl
  16450. BT.2020 with non-constant luminance
  16451. @end table
  16452. @item cscheme
  16453. Set spectrogram color scheme. This is list of floating point values with format
  16454. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  16455. The default is @code{1|0.5|0|0|0.5|1}.
  16456. @end table
  16457. @subsection Examples
  16458. @itemize
  16459. @item
  16460. Playing audio while showing the spectrum:
  16461. @example
  16462. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  16463. @end example
  16464. @item
  16465. Same as above, but with frame rate 30 fps:
  16466. @example
  16467. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  16468. @end example
  16469. @item
  16470. Playing at 1280x720:
  16471. @example
  16472. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  16473. @end example
  16474. @item
  16475. Disable sonogram display:
  16476. @example
  16477. sono_h=0
  16478. @end example
  16479. @item
  16480. A1 and its harmonics: A1, A2, (near)E3, A3:
  16481. @example
  16482. 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),
  16483. asplit[a][out1]; [a] showcqt [out0]'
  16484. @end example
  16485. @item
  16486. Same as above, but with more accuracy in frequency domain:
  16487. @example
  16488. 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),
  16489. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  16490. @end example
  16491. @item
  16492. Custom volume:
  16493. @example
  16494. bar_v=10:sono_v=bar_v*a_weighting(f)
  16495. @end example
  16496. @item
  16497. Custom gamma, now spectrum is linear to the amplitude.
  16498. @example
  16499. bar_g=2:sono_g=2
  16500. @end example
  16501. @item
  16502. Custom tlength equation:
  16503. @example
  16504. 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)))'
  16505. @end example
  16506. @item
  16507. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  16508. @example
  16509. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  16510. @end example
  16511. @item
  16512. Custom font using fontconfig:
  16513. @example
  16514. font='Courier New,Monospace,mono|bold'
  16515. @end example
  16516. @item
  16517. Custom frequency range with custom axis using image file:
  16518. @example
  16519. axisfile=myaxis.png:basefreq=40:endfreq=10000
  16520. @end example
  16521. @end itemize
  16522. @section showfreqs
  16523. Convert input audio to video output representing the audio power spectrum.
  16524. Audio amplitude is on Y-axis while frequency is on X-axis.
  16525. The filter accepts the following options:
  16526. @table @option
  16527. @item size, s
  16528. Specify size of video. For the syntax of this option, check the
  16529. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16530. Default is @code{1024x512}.
  16531. @item mode
  16532. Set display mode.
  16533. This set how each frequency bin will be represented.
  16534. It accepts the following values:
  16535. @table @samp
  16536. @item line
  16537. @item bar
  16538. @item dot
  16539. @end table
  16540. Default is @code{bar}.
  16541. @item ascale
  16542. Set amplitude scale.
  16543. It accepts the following values:
  16544. @table @samp
  16545. @item lin
  16546. Linear scale.
  16547. @item sqrt
  16548. Square root scale.
  16549. @item cbrt
  16550. Cubic root scale.
  16551. @item log
  16552. Logarithmic scale.
  16553. @end table
  16554. Default is @code{log}.
  16555. @item fscale
  16556. Set frequency scale.
  16557. It accepts the following values:
  16558. @table @samp
  16559. @item lin
  16560. Linear scale.
  16561. @item log
  16562. Logarithmic scale.
  16563. @item rlog
  16564. Reverse logarithmic scale.
  16565. @end table
  16566. Default is @code{lin}.
  16567. @item win_size
  16568. Set window size.
  16569. It accepts the following values:
  16570. @table @samp
  16571. @item w16
  16572. @item w32
  16573. @item w64
  16574. @item w128
  16575. @item w256
  16576. @item w512
  16577. @item w1024
  16578. @item w2048
  16579. @item w4096
  16580. @item w8192
  16581. @item w16384
  16582. @item w32768
  16583. @item w65536
  16584. @end table
  16585. Default is @code{w2048}
  16586. @item win_func
  16587. Set windowing function.
  16588. It accepts the following values:
  16589. @table @samp
  16590. @item rect
  16591. @item bartlett
  16592. @item hanning
  16593. @item hamming
  16594. @item blackman
  16595. @item welch
  16596. @item flattop
  16597. @item bharris
  16598. @item bnuttall
  16599. @item bhann
  16600. @item sine
  16601. @item nuttall
  16602. @item lanczos
  16603. @item gauss
  16604. @item tukey
  16605. @item dolph
  16606. @item cauchy
  16607. @item parzen
  16608. @item poisson
  16609. @item bohman
  16610. @end table
  16611. Default is @code{hanning}.
  16612. @item overlap
  16613. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16614. which means optimal overlap for selected window function will be picked.
  16615. @item averaging
  16616. Set time averaging. Setting this to 0 will display current maximal peaks.
  16617. Default is @code{1}, which means time averaging is disabled.
  16618. @item colors
  16619. Specify list of colors separated by space or by '|' which will be used to
  16620. draw channel frequencies. Unrecognized or missing colors will be replaced
  16621. by white color.
  16622. @item cmode
  16623. Set channel display mode.
  16624. It accepts the following values:
  16625. @table @samp
  16626. @item combined
  16627. @item separate
  16628. @end table
  16629. Default is @code{combined}.
  16630. @item minamp
  16631. Set minimum amplitude used in @code{log} amplitude scaler.
  16632. @end table
  16633. @anchor{showspectrum}
  16634. @section showspectrum
  16635. Convert input audio to a video output, representing the audio frequency
  16636. spectrum.
  16637. The filter accepts the following options:
  16638. @table @option
  16639. @item size, s
  16640. Specify the video size for the output. For the syntax of this option, check the
  16641. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16642. Default value is @code{640x512}.
  16643. @item slide
  16644. Specify how the spectrum should slide along the window.
  16645. It accepts the following values:
  16646. @table @samp
  16647. @item replace
  16648. the samples start again on the left when they reach the right
  16649. @item scroll
  16650. the samples scroll from right to left
  16651. @item fullframe
  16652. frames are only produced when the samples reach the right
  16653. @item rscroll
  16654. the samples scroll from left to right
  16655. @end table
  16656. Default value is @code{replace}.
  16657. @item mode
  16658. Specify display mode.
  16659. It accepts the following values:
  16660. @table @samp
  16661. @item combined
  16662. all channels are displayed in the same row
  16663. @item separate
  16664. all channels are displayed in separate rows
  16665. @end table
  16666. Default value is @samp{combined}.
  16667. @item color
  16668. Specify display color mode.
  16669. It accepts the following values:
  16670. @table @samp
  16671. @item channel
  16672. each channel is displayed in a separate color
  16673. @item intensity
  16674. each channel is displayed using the same color scheme
  16675. @item rainbow
  16676. each channel is displayed using the rainbow color scheme
  16677. @item moreland
  16678. each channel is displayed using the moreland color scheme
  16679. @item nebulae
  16680. each channel is displayed using the nebulae color scheme
  16681. @item fire
  16682. each channel is displayed using the fire color scheme
  16683. @item fiery
  16684. each channel is displayed using the fiery color scheme
  16685. @item fruit
  16686. each channel is displayed using the fruit color scheme
  16687. @item cool
  16688. each channel is displayed using the cool color scheme
  16689. @item magma
  16690. each channel is displayed using the magma color scheme
  16691. @item green
  16692. each channel is displayed using the green color scheme
  16693. @item viridis
  16694. each channel is displayed using the viridis color scheme
  16695. @item plasma
  16696. each channel is displayed using the plasma color scheme
  16697. @item cividis
  16698. each channel is displayed using the cividis color scheme
  16699. @item terrain
  16700. each channel is displayed using the terrain color scheme
  16701. @end table
  16702. Default value is @samp{channel}.
  16703. @item scale
  16704. Specify scale used for calculating intensity color values.
  16705. It accepts the following values:
  16706. @table @samp
  16707. @item lin
  16708. linear
  16709. @item sqrt
  16710. square root, default
  16711. @item cbrt
  16712. cubic root
  16713. @item log
  16714. logarithmic
  16715. @item 4thrt
  16716. 4th root
  16717. @item 5thrt
  16718. 5th root
  16719. @end table
  16720. Default value is @samp{sqrt}.
  16721. @item saturation
  16722. Set saturation modifier for displayed colors. Negative values provide
  16723. alternative color scheme. @code{0} is no saturation at all.
  16724. Saturation must be in [-10.0, 10.0] range.
  16725. Default value is @code{1}.
  16726. @item win_func
  16727. Set window function.
  16728. It accepts the following values:
  16729. @table @samp
  16730. @item rect
  16731. @item bartlett
  16732. @item hann
  16733. @item hanning
  16734. @item hamming
  16735. @item blackman
  16736. @item welch
  16737. @item flattop
  16738. @item bharris
  16739. @item bnuttall
  16740. @item bhann
  16741. @item sine
  16742. @item nuttall
  16743. @item lanczos
  16744. @item gauss
  16745. @item tukey
  16746. @item dolph
  16747. @item cauchy
  16748. @item parzen
  16749. @item poisson
  16750. @item bohman
  16751. @end table
  16752. Default value is @code{hann}.
  16753. @item orientation
  16754. Set orientation of time vs frequency axis. Can be @code{vertical} or
  16755. @code{horizontal}. Default is @code{vertical}.
  16756. @item overlap
  16757. Set ratio of overlap window. Default value is @code{0}.
  16758. When value is @code{1} overlap is set to recommended size for specific
  16759. window function currently used.
  16760. @item gain
  16761. Set scale gain for calculating intensity color values.
  16762. Default value is @code{1}.
  16763. @item data
  16764. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  16765. @item rotation
  16766. Set color rotation, must be in [-1.0, 1.0] range.
  16767. Default value is @code{0}.
  16768. @item start
  16769. Set start frequency from which to display spectrogram. Default is @code{0}.
  16770. @item stop
  16771. Set stop frequency to which to display spectrogram. Default is @code{0}.
  16772. @item fps
  16773. Set upper frame rate limit. Default is @code{auto}, unlimited.
  16774. @item legend
  16775. Draw time and frequency axes and legends. Default is disabled.
  16776. @end table
  16777. The usage is very similar to the showwaves filter; see the examples in that
  16778. section.
  16779. @subsection Examples
  16780. @itemize
  16781. @item
  16782. Large window with logarithmic color scaling:
  16783. @example
  16784. showspectrum=s=1280x480:scale=log
  16785. @end example
  16786. @item
  16787. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  16788. @example
  16789. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16790. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  16791. @end example
  16792. @end itemize
  16793. @section showspectrumpic
  16794. Convert input audio to a single video frame, representing the audio frequency
  16795. spectrum.
  16796. The filter accepts the following options:
  16797. @table @option
  16798. @item size, s
  16799. Specify the video size for the output. For the syntax of this option, check the
  16800. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16801. Default value is @code{4096x2048}.
  16802. @item mode
  16803. Specify display mode.
  16804. It accepts the following values:
  16805. @table @samp
  16806. @item combined
  16807. all channels are displayed in the same row
  16808. @item separate
  16809. all channels are displayed in separate rows
  16810. @end table
  16811. Default value is @samp{combined}.
  16812. @item color
  16813. Specify display color mode.
  16814. It accepts the following values:
  16815. @table @samp
  16816. @item channel
  16817. each channel is displayed in a separate color
  16818. @item intensity
  16819. each channel is displayed using the same color scheme
  16820. @item rainbow
  16821. each channel is displayed using the rainbow color scheme
  16822. @item moreland
  16823. each channel is displayed using the moreland color scheme
  16824. @item nebulae
  16825. each channel is displayed using the nebulae color scheme
  16826. @item fire
  16827. each channel is displayed using the fire color scheme
  16828. @item fiery
  16829. each channel is displayed using the fiery color scheme
  16830. @item fruit
  16831. each channel is displayed using the fruit color scheme
  16832. @item cool
  16833. each channel is displayed using the cool color scheme
  16834. @item magma
  16835. each channel is displayed using the magma color scheme
  16836. @item green
  16837. each channel is displayed using the green color scheme
  16838. @item viridis
  16839. each channel is displayed using the viridis color scheme
  16840. @item plasma
  16841. each channel is displayed using the plasma color scheme
  16842. @item cividis
  16843. each channel is displayed using the cividis color scheme
  16844. @item terrain
  16845. each channel is displayed using the terrain color scheme
  16846. @end table
  16847. Default value is @samp{intensity}.
  16848. @item scale
  16849. Specify scale used for calculating intensity color values.
  16850. It accepts the following values:
  16851. @table @samp
  16852. @item lin
  16853. linear
  16854. @item sqrt
  16855. square root, default
  16856. @item cbrt
  16857. cubic root
  16858. @item log
  16859. logarithmic
  16860. @item 4thrt
  16861. 4th root
  16862. @item 5thrt
  16863. 5th root
  16864. @end table
  16865. Default value is @samp{log}.
  16866. @item saturation
  16867. Set saturation modifier for displayed colors. Negative values provide
  16868. alternative color scheme. @code{0} is no saturation at all.
  16869. Saturation must be in [-10.0, 10.0] range.
  16870. Default value is @code{1}.
  16871. @item win_func
  16872. Set window function.
  16873. It accepts the following values:
  16874. @table @samp
  16875. @item rect
  16876. @item bartlett
  16877. @item hann
  16878. @item hanning
  16879. @item hamming
  16880. @item blackman
  16881. @item welch
  16882. @item flattop
  16883. @item bharris
  16884. @item bnuttall
  16885. @item bhann
  16886. @item sine
  16887. @item nuttall
  16888. @item lanczos
  16889. @item gauss
  16890. @item tukey
  16891. @item dolph
  16892. @item cauchy
  16893. @item parzen
  16894. @item poisson
  16895. @item bohman
  16896. @end table
  16897. Default value is @code{hann}.
  16898. @item orientation
  16899. Set orientation of time vs frequency axis. Can be @code{vertical} or
  16900. @code{horizontal}. Default is @code{vertical}.
  16901. @item gain
  16902. Set scale gain for calculating intensity color values.
  16903. Default value is @code{1}.
  16904. @item legend
  16905. Draw time and frequency axes and legends. Default is enabled.
  16906. @item rotation
  16907. Set color rotation, must be in [-1.0, 1.0] range.
  16908. Default value is @code{0}.
  16909. @item start
  16910. Set start frequency from which to display spectrogram. Default is @code{0}.
  16911. @item stop
  16912. Set stop frequency to which to display spectrogram. Default is @code{0}.
  16913. @end table
  16914. @subsection Examples
  16915. @itemize
  16916. @item
  16917. Extract an audio spectrogram of a whole audio track
  16918. in a 1024x1024 picture using @command{ffmpeg}:
  16919. @example
  16920. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  16921. @end example
  16922. @end itemize
  16923. @section showvolume
  16924. Convert input audio volume to a video output.
  16925. The filter accepts the following options:
  16926. @table @option
  16927. @item rate, r
  16928. Set video rate.
  16929. @item b
  16930. Set border width, allowed range is [0, 5]. Default is 1.
  16931. @item w
  16932. Set channel width, allowed range is [80, 8192]. Default is 400.
  16933. @item h
  16934. Set channel height, allowed range is [1, 900]. Default is 20.
  16935. @item f
  16936. Set fade, allowed range is [0, 1]. Default is 0.95.
  16937. @item c
  16938. Set volume color expression.
  16939. The expression can use the following variables:
  16940. @table @option
  16941. @item VOLUME
  16942. Current max volume of channel in dB.
  16943. @item PEAK
  16944. Current peak.
  16945. @item CHANNEL
  16946. Current channel number, starting from 0.
  16947. @end table
  16948. @item t
  16949. If set, displays channel names. Default is enabled.
  16950. @item v
  16951. If set, displays volume values. Default is enabled.
  16952. @item o
  16953. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  16954. default is @code{h}.
  16955. @item s
  16956. Set step size, allowed range is [0, 5]. Default is 0, which means
  16957. step is disabled.
  16958. @item p
  16959. Set background opacity, allowed range is [0, 1]. Default is 0.
  16960. @item m
  16961. Set metering mode, can be peak: @code{p} or rms: @code{r},
  16962. default is @code{p}.
  16963. @item ds
  16964. Set display scale, can be linear: @code{lin} or log: @code{log},
  16965. default is @code{lin}.
  16966. @item dm
  16967. In second.
  16968. If set to > 0., display a line for the max level
  16969. in the previous seconds.
  16970. default is disabled: @code{0.}
  16971. @item dmc
  16972. The color of the max line. Use when @code{dm} option is set to > 0.
  16973. default is: @code{orange}
  16974. @end table
  16975. @section showwaves
  16976. Convert input audio to a video output, representing the samples waves.
  16977. The filter accepts the following options:
  16978. @table @option
  16979. @item size, s
  16980. Specify the video size for the output. For the syntax of this option, check the
  16981. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16982. Default value is @code{600x240}.
  16983. @item mode
  16984. Set display mode.
  16985. Available values are:
  16986. @table @samp
  16987. @item point
  16988. Draw a point for each sample.
  16989. @item line
  16990. Draw a vertical line for each sample.
  16991. @item p2p
  16992. Draw a point for each sample and a line between them.
  16993. @item cline
  16994. Draw a centered vertical line for each sample.
  16995. @end table
  16996. Default value is @code{point}.
  16997. @item n
  16998. Set the number of samples which are printed on the same column. A
  16999. larger value will decrease the frame rate. Must be a positive
  17000. integer. This option can be set only if the value for @var{rate}
  17001. is not explicitly specified.
  17002. @item rate, r
  17003. Set the (approximate) output frame rate. This is done by setting the
  17004. option @var{n}. Default value is "25".
  17005. @item split_channels
  17006. Set if channels should be drawn separately or overlap. Default value is 0.
  17007. @item colors
  17008. Set colors separated by '|' which are going to be used for drawing of each channel.
  17009. @item scale
  17010. Set amplitude scale.
  17011. Available values are:
  17012. @table @samp
  17013. @item lin
  17014. Linear.
  17015. @item log
  17016. Logarithmic.
  17017. @item sqrt
  17018. Square root.
  17019. @item cbrt
  17020. Cubic root.
  17021. @end table
  17022. Default is linear.
  17023. @item draw
  17024. Set the draw mode. This is mostly useful to set for high @var{n}.
  17025. Available values are:
  17026. @table @samp
  17027. @item scale
  17028. Scale pixel values for each drawn sample.
  17029. @item full
  17030. Draw every sample directly.
  17031. @end table
  17032. Default value is @code{scale}.
  17033. @end table
  17034. @subsection Examples
  17035. @itemize
  17036. @item
  17037. Output the input file audio and the corresponding video representation
  17038. at the same time:
  17039. @example
  17040. amovie=a.mp3,asplit[out0],showwaves[out1]
  17041. @end example
  17042. @item
  17043. Create a synthetic signal and show it with showwaves, forcing a
  17044. frame rate of 30 frames per second:
  17045. @example
  17046. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17047. @end example
  17048. @end itemize
  17049. @section showwavespic
  17050. Convert input audio to a single video frame, representing the samples waves.
  17051. The filter accepts the following options:
  17052. @table @option
  17053. @item size, s
  17054. Specify the video size for the output. For the syntax of this option, check the
  17055. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17056. Default value is @code{600x240}.
  17057. @item split_channels
  17058. Set if channels should be drawn separately or overlap. Default value is 0.
  17059. @item colors
  17060. Set colors separated by '|' which are going to be used for drawing of each channel.
  17061. @item scale
  17062. Set amplitude scale.
  17063. Available values are:
  17064. @table @samp
  17065. @item lin
  17066. Linear.
  17067. @item log
  17068. Logarithmic.
  17069. @item sqrt
  17070. Square root.
  17071. @item cbrt
  17072. Cubic root.
  17073. @end table
  17074. Default is linear.
  17075. @end table
  17076. @subsection Examples
  17077. @itemize
  17078. @item
  17079. Extract a channel split representation of the wave form of a whole audio track
  17080. in a 1024x800 picture using @command{ffmpeg}:
  17081. @example
  17082. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  17083. @end example
  17084. @end itemize
  17085. @section sidedata, asidedata
  17086. Delete frame side data, or select frames based on it.
  17087. This filter accepts the following options:
  17088. @table @option
  17089. @item mode
  17090. Set mode of operation of the filter.
  17091. Can be one of the following:
  17092. @table @samp
  17093. @item select
  17094. Select every frame with side data of @code{type}.
  17095. @item delete
  17096. Delete side data of @code{type}. If @code{type} is not set, delete all side
  17097. data in the frame.
  17098. @end table
  17099. @item type
  17100. Set side data type used with all modes. Must be set for @code{select} mode. For
  17101. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  17102. in @file{libavutil/frame.h}. For example, to choose
  17103. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  17104. @end table
  17105. @section spectrumsynth
  17106. Sythesize audio from 2 input video spectrums, first input stream represents
  17107. magnitude across time and second represents phase across time.
  17108. The filter will transform from frequency domain as displayed in videos back
  17109. to time domain as presented in audio output.
  17110. This filter is primarily created for reversing processed @ref{showspectrum}
  17111. filter outputs, but can synthesize sound from other spectrograms too.
  17112. But in such case results are going to be poor if the phase data is not
  17113. available, because in such cases phase data need to be recreated, usually
  17114. its just recreated from random noise.
  17115. For best results use gray only output (@code{channel} color mode in
  17116. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  17117. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  17118. @code{data} option. Inputs videos should generally use @code{fullframe}
  17119. slide mode as that saves resources needed for decoding video.
  17120. The filter accepts the following options:
  17121. @table @option
  17122. @item sample_rate
  17123. Specify sample rate of output audio, the sample rate of audio from which
  17124. spectrum was generated may differ.
  17125. @item channels
  17126. Set number of channels represented in input video spectrums.
  17127. @item scale
  17128. Set scale which was used when generating magnitude input spectrum.
  17129. Can be @code{lin} or @code{log}. Default is @code{log}.
  17130. @item slide
  17131. Set slide which was used when generating inputs spectrums.
  17132. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17133. Default is @code{fullframe}.
  17134. @item win_func
  17135. Set window function used for resynthesis.
  17136. @item overlap
  17137. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17138. which means optimal overlap for selected window function will be picked.
  17139. @item orientation
  17140. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17141. Default is @code{vertical}.
  17142. @end table
  17143. @subsection Examples
  17144. @itemize
  17145. @item
  17146. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17147. then resynthesize videos back to audio with spectrumsynth:
  17148. @example
  17149. 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
  17150. 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
  17151. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17152. @end example
  17153. @end itemize
  17154. @section split, asplit
  17155. Split input into several identical outputs.
  17156. @code{asplit} works with audio input, @code{split} with video.
  17157. The filter accepts a single parameter which specifies the number of outputs. If
  17158. unspecified, it defaults to 2.
  17159. @subsection Examples
  17160. @itemize
  17161. @item
  17162. Create two separate outputs from the same input:
  17163. @example
  17164. [in] split [out0][out1]
  17165. @end example
  17166. @item
  17167. To create 3 or more outputs, you need to specify the number of
  17168. outputs, like in:
  17169. @example
  17170. [in] asplit=3 [out0][out1][out2]
  17171. @end example
  17172. @item
  17173. Create two separate outputs from the same input, one cropped and
  17174. one padded:
  17175. @example
  17176. [in] split [splitout1][splitout2];
  17177. [splitout1] crop=100:100:0:0 [cropout];
  17178. [splitout2] pad=200:200:100:100 [padout];
  17179. @end example
  17180. @item
  17181. Create 5 copies of the input audio with @command{ffmpeg}:
  17182. @example
  17183. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17184. @end example
  17185. @end itemize
  17186. @section zmq, azmq
  17187. Receive commands sent through a libzmq client, and forward them to
  17188. filters in the filtergraph.
  17189. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17190. must be inserted between two video filters, @code{azmq} between two
  17191. audio filters. Both are capable to send messages to any filter type.
  17192. To enable these filters you need to install the libzmq library and
  17193. headers and configure FFmpeg with @code{--enable-libzmq}.
  17194. For more information about libzmq see:
  17195. @url{http://www.zeromq.org/}
  17196. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17197. receives messages sent through a network interface defined by the
  17198. @option{bind_address} (or the abbreviation "@option{b}") option.
  17199. Default value of this option is @file{tcp://localhost:5555}. You may
  17200. want to alter this value to your needs, but do not forget to escape any
  17201. ':' signs (see @ref{filtergraph escaping}).
  17202. The received message must be in the form:
  17203. @example
  17204. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17205. @end example
  17206. @var{TARGET} specifies the target of the command, usually the name of
  17207. the filter class or a specific filter instance name. The default
  17208. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17209. but you can override this by using the @samp{filter_name@@id} syntax
  17210. (see @ref{Filtergraph syntax}).
  17211. @var{COMMAND} specifies the name of the command for the target filter.
  17212. @var{ARG} is optional and specifies the optional argument list for the
  17213. given @var{COMMAND}.
  17214. Upon reception, the message is processed and the corresponding command
  17215. is injected into the filtergraph. Depending on the result, the filter
  17216. will send a reply to the client, adopting the format:
  17217. @example
  17218. @var{ERROR_CODE} @var{ERROR_REASON}
  17219. @var{MESSAGE}
  17220. @end example
  17221. @var{MESSAGE} is optional.
  17222. @subsection Examples
  17223. Look at @file{tools/zmqsend} for an example of a zmq client which can
  17224. be used to send commands processed by these filters.
  17225. Consider the following filtergraph generated by @command{ffplay}.
  17226. In this example the last overlay filter has an instance name. All other
  17227. filters will have default instance names.
  17228. @example
  17229. ffplay -dumpgraph 1 -f lavfi "
  17230. color=s=100x100:c=red [l];
  17231. color=s=100x100:c=blue [r];
  17232. nullsrc=s=200x100, zmq [bg];
  17233. [bg][l] overlay [bg+l];
  17234. [bg+l][r] overlay@@my=x=100 "
  17235. @end example
  17236. To change the color of the left side of the video, the following
  17237. command can be used:
  17238. @example
  17239. echo Parsed_color_0 c yellow | tools/zmqsend
  17240. @end example
  17241. To change the right side:
  17242. @example
  17243. echo Parsed_color_1 c pink | tools/zmqsend
  17244. @end example
  17245. To change the position of the right side:
  17246. @example
  17247. echo overlay@@my x 150 | tools/zmqsend
  17248. @end example
  17249. @c man end MULTIMEDIA FILTERS
  17250. @chapter Multimedia Sources
  17251. @c man begin MULTIMEDIA SOURCES
  17252. Below is a description of the currently available multimedia sources.
  17253. @section amovie
  17254. This is the same as @ref{movie} source, except it selects an audio
  17255. stream by default.
  17256. @anchor{movie}
  17257. @section movie
  17258. Read audio and/or video stream(s) from a movie container.
  17259. It accepts the following parameters:
  17260. @table @option
  17261. @item filename
  17262. The name of the resource to read (not necessarily a file; it can also be a
  17263. device or a stream accessed through some protocol).
  17264. @item format_name, f
  17265. Specifies the format assumed for the movie to read, and can be either
  17266. the name of a container or an input device. If not specified, the
  17267. format is guessed from @var{movie_name} or by probing.
  17268. @item seek_point, sp
  17269. Specifies the seek point in seconds. The frames will be output
  17270. starting from this seek point. The parameter is evaluated with
  17271. @code{av_strtod}, so the numerical value may be suffixed by an IS
  17272. postfix. The default value is "0".
  17273. @item streams, s
  17274. Specifies the streams to read. Several streams can be specified,
  17275. separated by "+". The source will then have as many outputs, in the
  17276. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  17277. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  17278. respectively the default (best suited) video and audio stream. Default
  17279. is "dv", or "da" if the filter is called as "amovie".
  17280. @item stream_index, si
  17281. Specifies the index of the video stream to read. If the value is -1,
  17282. the most suitable video stream will be automatically selected. The default
  17283. value is "-1". Deprecated. If the filter is called "amovie", it will select
  17284. audio instead of video.
  17285. @item loop
  17286. Specifies how many times to read the stream in sequence.
  17287. If the value is 0, the stream will be looped infinitely.
  17288. Default value is "1".
  17289. Note that when the movie is looped the source timestamps are not
  17290. changed, so it will generate non monotonically increasing timestamps.
  17291. @item discontinuity
  17292. Specifies the time difference between frames above which the point is
  17293. considered a timestamp discontinuity which is removed by adjusting the later
  17294. timestamps.
  17295. @end table
  17296. It allows overlaying a second video on top of the main input of
  17297. a filtergraph, as shown in this graph:
  17298. @example
  17299. input -----------> deltapts0 --> overlay --> output
  17300. ^
  17301. |
  17302. movie --> scale--> deltapts1 -------+
  17303. @end example
  17304. @subsection Examples
  17305. @itemize
  17306. @item
  17307. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  17308. on top of the input labelled "in":
  17309. @example
  17310. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17311. [in] setpts=PTS-STARTPTS [main];
  17312. [main][over] overlay=16:16 [out]
  17313. @end example
  17314. @item
  17315. Read from a video4linux2 device, and overlay it on top of the input
  17316. labelled "in":
  17317. @example
  17318. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17319. [in] setpts=PTS-STARTPTS [main];
  17320. [main][over] overlay=16:16 [out]
  17321. @end example
  17322. @item
  17323. Read the first video stream and the audio stream with id 0x81 from
  17324. dvd.vob; the video is connected to the pad named "video" and the audio is
  17325. connected to the pad named "audio":
  17326. @example
  17327. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  17328. @end example
  17329. @end itemize
  17330. @subsection Commands
  17331. Both movie and amovie support the following commands:
  17332. @table @option
  17333. @item seek
  17334. Perform seek using "av_seek_frame".
  17335. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  17336. @itemize
  17337. @item
  17338. @var{stream_index}: If stream_index is -1, a default
  17339. stream is selected, and @var{timestamp} is automatically converted
  17340. from AV_TIME_BASE units to the stream specific time_base.
  17341. @item
  17342. @var{timestamp}: Timestamp in AVStream.time_base units
  17343. or, if no stream is specified, in AV_TIME_BASE units.
  17344. @item
  17345. @var{flags}: Flags which select direction and seeking mode.
  17346. @end itemize
  17347. @item get_duration
  17348. Get movie duration in AV_TIME_BASE units.
  17349. @end table
  17350. @c man end MULTIMEDIA SOURCES