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.

21037 lines
559KB

  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 acrusher
  392. Reduce audio bit resolution.
  393. This filter is bit crusher with enhanced functionality. A bit crusher
  394. is used to audibly reduce number of bits an audio signal is sampled
  395. with. This doesn't change the bit depth at all, it just produces the
  396. effect. Material reduced in bit depth sounds more harsh and "digital".
  397. This filter is able to even round to continuous values instead of discrete
  398. bit depths.
  399. Additionally it has a D/C offset which results in different crushing of
  400. the lower and the upper half of the signal.
  401. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  402. Another feature of this filter is the logarithmic mode.
  403. This setting switches from linear distances between bits to logarithmic ones.
  404. The result is a much more "natural" sounding crusher which doesn't gate low
  405. signals for example. The human ear has a logarithmic perception,
  406. so this kind of crushing is much more pleasant.
  407. Logarithmic crushing is also able to get anti-aliased.
  408. The filter accepts the following options:
  409. @table @option
  410. @item level_in
  411. Set level in.
  412. @item level_out
  413. Set level out.
  414. @item bits
  415. Set bit reduction.
  416. @item mix
  417. Set mixing amount.
  418. @item mode
  419. Can be linear: @code{lin} or logarithmic: @code{log}.
  420. @item dc
  421. Set DC.
  422. @item aa
  423. Set anti-aliasing.
  424. @item samples
  425. Set sample reduction.
  426. @item lfo
  427. Enable LFO. By default disabled.
  428. @item lforange
  429. Set LFO range.
  430. @item lforate
  431. Set LFO rate.
  432. @end table
  433. @section adeclick
  434. Remove impulsive noise from input audio.
  435. Samples detected as impulsive noise are replaced by interpolated samples using
  436. autoregressive modelling.
  437. @table @option
  438. @item w
  439. Set window size, in milliseconds. Allowed range is from @code{10} to
  440. @code{100}. Default value is @code{55} milliseconds.
  441. This sets size of window which will be processed at once.
  442. @item o
  443. Set window overlap, in percentage of window size. Allowed range is from
  444. @code{50} to @code{95}. Default value is @code{75} percent.
  445. Setting this to a very high value increases impulsive noise removal but makes
  446. whole process much slower.
  447. @item a
  448. Set autoregression order, in percentage of window size. Allowed range is from
  449. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  450. controls quality of interpolated samples using neighbour good samples.
  451. @item t
  452. Set threshold value. Allowed range is from @code{1} to @code{100}.
  453. Default value is @code{2}.
  454. This controls the strength of impulsive noise which is going to be removed.
  455. The lower value, the more samples will be detected as impulsive noise.
  456. @item b
  457. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  458. @code{10}. Default value is @code{2}.
  459. If any two samples deteced as noise are spaced less than this value then any
  460. sample inbetween those two samples will be also detected as noise.
  461. @item m
  462. Set overlap method.
  463. It accepts the following values:
  464. @table @option
  465. @item a
  466. Select overlap-add method. Even not interpolated samples are slightly
  467. changed with this method.
  468. @item s
  469. Select overlap-save method. Not interpolated samples remain unchanged.
  470. @end table
  471. Default value is @code{a}.
  472. @end table
  473. @section adeclip
  474. Remove clipped samples from input audio.
  475. Samples detected as clipped are replaced by interpolated samples using
  476. autoregressive modelling.
  477. @table @option
  478. @item w
  479. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  480. Default value is @code{55} milliseconds.
  481. This sets size of window which will be processed at once.
  482. @item o
  483. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  484. to @code{95}. Default value is @code{75} percent.
  485. @item a
  486. Set autoregression order, in percentage of window size. Allowed range is from
  487. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  488. quality of interpolated samples using neighbour good samples.
  489. @item t
  490. Set threshold value. Allowed range is from @code{1} to @code{100}.
  491. Default value is @code{10}. Higher values make clip detection less aggressive.
  492. @item n
  493. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  494. Default value is @code{1000}. Higher values make clip detection less aggressive.
  495. @item m
  496. Set overlap method.
  497. It accepts the following values:
  498. @table @option
  499. @item a
  500. Select overlap-add method. Even not interpolated samples are slightly changed
  501. with this method.
  502. @item s
  503. Select overlap-save method. Not interpolated samples remain unchanged.
  504. @end table
  505. Default value is @code{a}.
  506. @end table
  507. @section adelay
  508. Delay one or more audio channels.
  509. Samples in delayed channel are filled with silence.
  510. The filter accepts the following option:
  511. @table @option
  512. @item delays
  513. Set list of delays in milliseconds for each channel separated by '|'.
  514. Unused delays will be silently ignored. If number of given delays is
  515. smaller than number of channels all remaining channels will not be delayed.
  516. If you want to delay exact number of samples, append 'S' to number.
  517. @end table
  518. @subsection Examples
  519. @itemize
  520. @item
  521. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  522. the second channel (and any other channels that may be present) unchanged.
  523. @example
  524. adelay=1500|0|500
  525. @end example
  526. @item
  527. Delay second channel by 500 samples, the third channel by 700 samples and leave
  528. the first channel (and any other channels that may be present) unchanged.
  529. @example
  530. adelay=0|500S|700S
  531. @end example
  532. @end itemize
  533. @section aderivative, aintegral
  534. Compute derivative/integral of audio stream.
  535. Applying both filters one after another produces original audio.
  536. @section aecho
  537. Apply echoing to the input audio.
  538. Echoes are reflected sound and can occur naturally amongst mountains
  539. (and sometimes large buildings) when talking or shouting; digital echo
  540. effects emulate this behaviour and are often used to help fill out the
  541. sound of a single instrument or vocal. The time difference between the
  542. original signal and the reflection is the @code{delay}, and the
  543. loudness of the reflected signal is the @code{decay}.
  544. Multiple echoes can have different delays and decays.
  545. A description of the accepted parameters follows.
  546. @table @option
  547. @item in_gain
  548. Set input gain of reflected signal. Default is @code{0.6}.
  549. @item out_gain
  550. Set output gain of reflected signal. Default is @code{0.3}.
  551. @item delays
  552. Set list of time intervals in milliseconds between original signal and reflections
  553. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  554. Default is @code{1000}.
  555. @item decays
  556. Set list of loudness of reflected signals separated by '|'.
  557. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  558. Default is @code{0.5}.
  559. @end table
  560. @subsection Examples
  561. @itemize
  562. @item
  563. Make it sound as if there are twice as many instruments as are actually playing:
  564. @example
  565. aecho=0.8:0.88:60:0.4
  566. @end example
  567. @item
  568. If delay is very short, then it sound like a (metallic) robot playing music:
  569. @example
  570. aecho=0.8:0.88:6:0.4
  571. @end example
  572. @item
  573. A longer delay will sound like an open air concert in the mountains:
  574. @example
  575. aecho=0.8:0.9:1000:0.3
  576. @end example
  577. @item
  578. Same as above but with one more mountain:
  579. @example
  580. aecho=0.8:0.9:1000|1800:0.3|0.25
  581. @end example
  582. @end itemize
  583. @section aemphasis
  584. Audio emphasis filter creates or restores material directly taken from LPs or
  585. emphased CDs with different filter curves. E.g. to store music on vinyl the
  586. signal has to be altered by a filter first to even out the disadvantages of
  587. this recording medium.
  588. Once the material is played back the inverse filter has to be applied to
  589. restore the distortion of the frequency response.
  590. The filter accepts the following options:
  591. @table @option
  592. @item level_in
  593. Set input gain.
  594. @item level_out
  595. Set output gain.
  596. @item mode
  597. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  598. use @code{production} mode. Default is @code{reproduction} mode.
  599. @item type
  600. Set filter type. Selects medium. Can be one of the following:
  601. @table @option
  602. @item col
  603. select Columbia.
  604. @item emi
  605. select EMI.
  606. @item bsi
  607. select BSI (78RPM).
  608. @item riaa
  609. select RIAA.
  610. @item cd
  611. select Compact Disc (CD).
  612. @item 50fm
  613. select 50µs (FM).
  614. @item 75fm
  615. select 75µs (FM).
  616. @item 50kf
  617. select 50µs (FM-KF).
  618. @item 75kf
  619. select 75µs (FM-KF).
  620. @end table
  621. @end table
  622. @section aeval
  623. Modify an audio signal according to the specified expressions.
  624. This filter accepts one or more expressions (one for each channel),
  625. which are evaluated and used to modify a corresponding audio signal.
  626. It accepts the following parameters:
  627. @table @option
  628. @item exprs
  629. Set the '|'-separated expressions list for each separate channel. If
  630. the number of input channels is greater than the number of
  631. expressions, the last specified expression is used for the remaining
  632. output channels.
  633. @item channel_layout, c
  634. Set output channel layout. If not specified, the channel layout is
  635. specified by the number of expressions. If set to @samp{same}, it will
  636. use by default the same input channel layout.
  637. @end table
  638. Each expression in @var{exprs} can contain the following constants and functions:
  639. @table @option
  640. @item ch
  641. channel number of the current expression
  642. @item n
  643. number of the evaluated sample, starting from 0
  644. @item s
  645. sample rate
  646. @item t
  647. time of the evaluated sample expressed in seconds
  648. @item nb_in_channels
  649. @item nb_out_channels
  650. input and output number of channels
  651. @item val(CH)
  652. the value of input channel with number @var{CH}
  653. @end table
  654. Note: this filter is slow. For faster processing you should use a
  655. dedicated filter.
  656. @subsection Examples
  657. @itemize
  658. @item
  659. Half volume:
  660. @example
  661. aeval=val(ch)/2:c=same
  662. @end example
  663. @item
  664. Invert phase of the second channel:
  665. @example
  666. aeval=val(0)|-val(1)
  667. @end example
  668. @end itemize
  669. @anchor{afade}
  670. @section afade
  671. Apply fade-in/out effect to input audio.
  672. A description of the accepted parameters follows.
  673. @table @option
  674. @item type, t
  675. Specify the effect type, can be either @code{in} for fade-in, or
  676. @code{out} for a fade-out effect. Default is @code{in}.
  677. @item start_sample, ss
  678. Specify the number of the start sample for starting to apply the fade
  679. effect. Default is 0.
  680. @item nb_samples, ns
  681. Specify the number of samples for which the fade effect has to last. At
  682. the end of the fade-in effect the output audio will have the same
  683. volume as the input audio, at the end of the fade-out transition
  684. the output audio will be silence. Default is 44100.
  685. @item start_time, st
  686. Specify the start time of the fade effect. Default is 0.
  687. The value must be specified as a time duration; see
  688. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  689. for the accepted syntax.
  690. If set this option is used instead of @var{start_sample}.
  691. @item duration, d
  692. Specify the duration of the fade effect. See
  693. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  694. for the accepted syntax.
  695. At the end of the fade-in effect the output audio will have the same
  696. volume as the input audio, at the end of the fade-out transition
  697. the output audio will be silence.
  698. By default the duration is determined by @var{nb_samples}.
  699. If set this option is used instead of @var{nb_samples}.
  700. @item curve
  701. Set curve for fade transition.
  702. It accepts the following values:
  703. @table @option
  704. @item tri
  705. select triangular, linear slope (default)
  706. @item qsin
  707. select quarter of sine wave
  708. @item hsin
  709. select half of sine wave
  710. @item esin
  711. select exponential sine wave
  712. @item log
  713. select logarithmic
  714. @item ipar
  715. select inverted parabola
  716. @item qua
  717. select quadratic
  718. @item cub
  719. select cubic
  720. @item squ
  721. select square root
  722. @item cbr
  723. select cubic root
  724. @item par
  725. select parabola
  726. @item exp
  727. select exponential
  728. @item iqsin
  729. select inverted quarter of sine wave
  730. @item ihsin
  731. select inverted half of sine wave
  732. @item dese
  733. select double-exponential seat
  734. @item desi
  735. select double-exponential sigmoid
  736. @end table
  737. @end table
  738. @subsection Examples
  739. @itemize
  740. @item
  741. Fade in first 15 seconds of audio:
  742. @example
  743. afade=t=in:ss=0:d=15
  744. @end example
  745. @item
  746. Fade out last 25 seconds of a 900 seconds audio:
  747. @example
  748. afade=t=out:st=875:d=25
  749. @end example
  750. @end itemize
  751. @section afftfilt
  752. Apply arbitrary expressions to samples in frequency domain.
  753. @table @option
  754. @item real
  755. Set frequency domain real expression for each separate channel separated
  756. by '|'. Default is "1".
  757. If the number of input channels is greater than the number of
  758. expressions, the last specified expression is used for the remaining
  759. output channels.
  760. @item imag
  761. Set frequency domain imaginary expression for each separate channel
  762. separated by '|'. If not set, @var{real} option is used.
  763. Each expression in @var{real} and @var{imag} can contain the following
  764. constants:
  765. @table @option
  766. @item sr
  767. sample rate
  768. @item b
  769. current frequency bin number
  770. @item nb
  771. number of available bins
  772. @item ch
  773. channel number of the current expression
  774. @item chs
  775. number of channels
  776. @item pts
  777. current frame pts
  778. @end table
  779. @item win_size
  780. Set window size.
  781. It accepts the following values:
  782. @table @samp
  783. @item w16
  784. @item w32
  785. @item w64
  786. @item w128
  787. @item w256
  788. @item w512
  789. @item w1024
  790. @item w2048
  791. @item w4096
  792. @item w8192
  793. @item w16384
  794. @item w32768
  795. @item w65536
  796. @end table
  797. Default is @code{w4096}
  798. @item win_func
  799. Set window function. Default is @code{hann}.
  800. @item overlap
  801. Set window overlap. If set to 1, the recommended overlap for selected
  802. window function will be picked. Default is @code{0.75}.
  803. @end table
  804. @subsection Examples
  805. @itemize
  806. @item
  807. Leave almost only low frequencies in audio:
  808. @example
  809. afftfilt="1-clip((b/nb)*b,0,1)"
  810. @end example
  811. @end itemize
  812. @anchor{afir}
  813. @section afir
  814. Apply an arbitrary Frequency Impulse Response filter.
  815. This filter is designed for applying long FIR filters,
  816. up to 30 seconds long.
  817. It can be used as component for digital crossover filters,
  818. room equalization, cross talk cancellation, wavefield synthesis,
  819. auralization, ambiophonics and ambisonics.
  820. This filter uses second stream as FIR coefficients.
  821. If second stream holds single channel, it will be used
  822. for all input channels in first stream, otherwise
  823. number of channels in second stream must be same as
  824. number of channels in first stream.
  825. It accepts the following parameters:
  826. @table @option
  827. @item dry
  828. Set dry gain. This sets input gain.
  829. @item wet
  830. Set wet gain. This sets final output gain.
  831. @item length
  832. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  833. @item again
  834. Enable applying gain measured from power of IR.
  835. @item maxir
  836. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  837. Allowed range is 0.1 to 60 seconds.
  838. @item response
  839. Show IR frequency reponse, magnitude and phase in additional video stream.
  840. By default it is disabled.
  841. @item channel
  842. Set for which IR channel to display frequency response. By default is first channel
  843. displayed. This option is used only when @var{response} is enabled.
  844. @item size
  845. Set video stream size. This option is used only when @var{response} is enabled.
  846. @end table
  847. @subsection Examples
  848. @itemize
  849. @item
  850. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  851. @example
  852. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  853. @end example
  854. @end itemize
  855. @anchor{aformat}
  856. @section aformat
  857. Set output format constraints for the input audio. The framework will
  858. negotiate the most appropriate format to minimize conversions.
  859. It accepts the following parameters:
  860. @table @option
  861. @item sample_fmts
  862. A '|'-separated list of requested sample formats.
  863. @item sample_rates
  864. A '|'-separated list of requested sample rates.
  865. @item channel_layouts
  866. A '|'-separated list of requested channel layouts.
  867. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  868. for the required syntax.
  869. @end table
  870. If a parameter is omitted, all values are allowed.
  871. Force the output to either unsigned 8-bit or signed 16-bit stereo
  872. @example
  873. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  874. @end example
  875. @section agate
  876. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  877. processing reduces disturbing noise between useful signals.
  878. Gating is done by detecting the volume below a chosen level @var{threshold}
  879. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  880. floor is set via @var{range}. Because an exact manipulation of the signal
  881. would cause distortion of the waveform the reduction can be levelled over
  882. time. This is done by setting @var{attack} and @var{release}.
  883. @var{attack} determines how long the signal has to fall below the threshold
  884. before any reduction will occur and @var{release} sets the time the signal
  885. has to rise above the threshold to reduce the reduction again.
  886. Shorter signals than the chosen attack time will be left untouched.
  887. @table @option
  888. @item level_in
  889. Set input level before filtering.
  890. Default is 1. Allowed range is from 0.015625 to 64.
  891. @item range
  892. Set the level of gain reduction when the signal is below the threshold.
  893. Default is 0.06125. Allowed range is from 0 to 1.
  894. @item threshold
  895. If a signal rises above this level the gain reduction is released.
  896. Default is 0.125. Allowed range is from 0 to 1.
  897. @item ratio
  898. Set a ratio by which the signal is reduced.
  899. Default is 2. Allowed range is from 1 to 9000.
  900. @item attack
  901. Amount of milliseconds the signal has to rise above the threshold before gain
  902. reduction stops.
  903. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  904. @item release
  905. Amount of milliseconds the signal has to fall below the threshold before the
  906. reduction is increased again. Default is 250 milliseconds.
  907. Allowed range is from 0.01 to 9000.
  908. @item makeup
  909. Set amount of amplification of signal after processing.
  910. Default is 1. Allowed range is from 1 to 64.
  911. @item knee
  912. Curve the sharp knee around the threshold to enter gain reduction more softly.
  913. Default is 2.828427125. Allowed range is from 1 to 8.
  914. @item detection
  915. Choose if exact signal should be taken for detection or an RMS like one.
  916. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  917. @item link
  918. Choose if the average level between all channels or the louder channel affects
  919. the reduction.
  920. Default is @code{average}. Can be @code{average} or @code{maximum}.
  921. @end table
  922. @section aiir
  923. Apply an arbitrary Infinite Impulse Response filter.
  924. It accepts the following parameters:
  925. @table @option
  926. @item z
  927. Set numerator/zeros coefficients.
  928. @item p
  929. Set denominator/poles coefficients.
  930. @item k
  931. Set channels gains.
  932. @item dry_gain
  933. Set input gain.
  934. @item wet_gain
  935. Set output gain.
  936. @item f
  937. Set coefficients format.
  938. @table @samp
  939. @item tf
  940. transfer function
  941. @item zp
  942. Z-plane zeros/poles, cartesian (default)
  943. @item pr
  944. Z-plane zeros/poles, polar radians
  945. @item pd
  946. Z-plane zeros/poles, polar degrees
  947. @end table
  948. @item r
  949. Set kind of processing.
  950. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  951. @item e
  952. Set filtering precision.
  953. @table @samp
  954. @item dbl
  955. double-precision floating-point (default)
  956. @item flt
  957. single-precision floating-point
  958. @item i32
  959. 32-bit integers
  960. @item i16
  961. 16-bit integers
  962. @end table
  963. @item response
  964. Show IR frequency reponse, magnitude and phase in additional video stream.
  965. By default it is disabled.
  966. @item channel
  967. Set for which IR channel to display frequency response. By default is first channel
  968. displayed. This option is used only when @var{response} is enabled.
  969. @item size
  970. Set video stream size. This option is used only when @var{response} is enabled.
  971. @end table
  972. Coefficients in @code{tf} format are separated by spaces and are in ascending
  973. order.
  974. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  975. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  976. imaginary unit.
  977. Different coefficients and gains can be provided for every channel, in such case
  978. use '|' to separate coefficients or gains. Last provided coefficients will be
  979. used for all remaining channels.
  980. @subsection Examples
  981. @itemize
  982. @item
  983. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  984. @example
  985. 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
  986. @end example
  987. @item
  988. Same as above but in @code{zp} format:
  989. @example
  990. 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
  991. @end example
  992. @end itemize
  993. @section alimiter
  994. The limiter prevents an input signal from rising over a desired threshold.
  995. This limiter uses lookahead technology to prevent your signal from distorting.
  996. It means that there is a small delay after the signal is processed. Keep in mind
  997. that the delay it produces is the attack time you set.
  998. The filter accepts the following options:
  999. @table @option
  1000. @item level_in
  1001. Set input gain. Default is 1.
  1002. @item level_out
  1003. Set output gain. Default is 1.
  1004. @item limit
  1005. Don't let signals above this level pass the limiter. Default is 1.
  1006. @item attack
  1007. The limiter will reach its attenuation level in this amount of time in
  1008. milliseconds. Default is 5 milliseconds.
  1009. @item release
  1010. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1011. Default is 50 milliseconds.
  1012. @item asc
  1013. When gain reduction is always needed ASC takes care of releasing to an
  1014. average reduction level rather than reaching a reduction of 0 in the release
  1015. time.
  1016. @item asc_level
  1017. Select how much the release time is affected by ASC, 0 means nearly no changes
  1018. in release time while 1 produces higher release times.
  1019. @item level
  1020. Auto level output signal. Default is enabled.
  1021. This normalizes audio back to 0dB if enabled.
  1022. @end table
  1023. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1024. with @ref{aresample} before applying this filter.
  1025. @section allpass
  1026. Apply a two-pole all-pass filter with central frequency (in Hz)
  1027. @var{frequency}, and filter-width @var{width}.
  1028. An all-pass filter changes the audio's frequency to phase relationship
  1029. without changing its frequency to amplitude relationship.
  1030. The filter accepts the following options:
  1031. @table @option
  1032. @item frequency, f
  1033. Set frequency in Hz.
  1034. @item width_type, t
  1035. Set method to specify band-width of filter.
  1036. @table @option
  1037. @item h
  1038. Hz
  1039. @item q
  1040. Q-Factor
  1041. @item o
  1042. octave
  1043. @item s
  1044. slope
  1045. @item k
  1046. kHz
  1047. @end table
  1048. @item width, w
  1049. Specify the band-width of a filter in width_type units.
  1050. @item channels, c
  1051. Specify which channels to filter, by default all available are filtered.
  1052. @end table
  1053. @subsection Commands
  1054. This filter supports the following commands:
  1055. @table @option
  1056. @item frequency, f
  1057. Change allpass frequency.
  1058. Syntax for the command is : "@var{frequency}"
  1059. @item width_type, t
  1060. Change allpass width_type.
  1061. Syntax for the command is : "@var{width_type}"
  1062. @item width, w
  1063. Change allpass width.
  1064. Syntax for the command is : "@var{width}"
  1065. @end table
  1066. @section aloop
  1067. Loop audio samples.
  1068. The filter accepts the following options:
  1069. @table @option
  1070. @item loop
  1071. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1072. Default is 0.
  1073. @item size
  1074. Set maximal number of samples. Default is 0.
  1075. @item start
  1076. Set first sample of loop. Default is 0.
  1077. @end table
  1078. @anchor{amerge}
  1079. @section amerge
  1080. Merge two or more audio streams into a single multi-channel stream.
  1081. The filter accepts the following options:
  1082. @table @option
  1083. @item inputs
  1084. Set the number of inputs. Default is 2.
  1085. @end table
  1086. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1087. the channel layout of the output will be set accordingly and the channels
  1088. will be reordered as necessary. If the channel layouts of the inputs are not
  1089. disjoint, the output will have all the channels of the first input then all
  1090. the channels of the second input, in that order, and the channel layout of
  1091. the output will be the default value corresponding to the total number of
  1092. channels.
  1093. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1094. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1095. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1096. first input, b1 is the first channel of the second input).
  1097. On the other hand, if both input are in stereo, the output channels will be
  1098. in the default order: a1, a2, b1, b2, and the channel layout will be
  1099. arbitrarily set to 4.0, which may or may not be the expected value.
  1100. All inputs must have the same sample rate, and format.
  1101. If inputs do not have the same duration, the output will stop with the
  1102. shortest.
  1103. @subsection Examples
  1104. @itemize
  1105. @item
  1106. Merge two mono files into a stereo stream:
  1107. @example
  1108. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1109. @end example
  1110. @item
  1111. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1112. @example
  1113. 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
  1114. @end example
  1115. @end itemize
  1116. @section amix
  1117. Mixes multiple audio inputs into a single output.
  1118. Note that this filter only supports float samples (the @var{amerge}
  1119. and @var{pan} audio filters support many formats). If the @var{amix}
  1120. input has integer samples then @ref{aresample} will be automatically
  1121. inserted to perform the conversion to float samples.
  1122. For example
  1123. @example
  1124. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1125. @end example
  1126. will mix 3 input audio streams to a single output with the same duration as the
  1127. first input and a dropout transition time of 3 seconds.
  1128. It accepts the following parameters:
  1129. @table @option
  1130. @item inputs
  1131. The number of inputs. If unspecified, it defaults to 2.
  1132. @item duration
  1133. How to determine the end-of-stream.
  1134. @table @option
  1135. @item longest
  1136. The duration of the longest input. (default)
  1137. @item shortest
  1138. The duration of the shortest input.
  1139. @item first
  1140. The duration of the first input.
  1141. @end table
  1142. @item dropout_transition
  1143. The transition time, in seconds, for volume renormalization when an input
  1144. stream ends. The default value is 2 seconds.
  1145. @item weights
  1146. Specify weight of each input audio stream as sequence.
  1147. Each weight is separated by space. By default all inputs have same weight.
  1148. @end table
  1149. @section anequalizer
  1150. High-order parametric multiband equalizer for each channel.
  1151. It accepts the following parameters:
  1152. @table @option
  1153. @item params
  1154. This option string is in format:
  1155. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1156. Each equalizer band is separated by '|'.
  1157. @table @option
  1158. @item chn
  1159. Set channel number to which equalization will be applied.
  1160. If input doesn't have that channel the entry is ignored.
  1161. @item f
  1162. Set central frequency for band.
  1163. If input doesn't have that frequency the entry is ignored.
  1164. @item w
  1165. Set band width in hertz.
  1166. @item g
  1167. Set band gain in dB.
  1168. @item t
  1169. Set filter type for band, optional, can be:
  1170. @table @samp
  1171. @item 0
  1172. Butterworth, this is default.
  1173. @item 1
  1174. Chebyshev type 1.
  1175. @item 2
  1176. Chebyshev type 2.
  1177. @end table
  1178. @end table
  1179. @item curves
  1180. With this option activated frequency response of anequalizer is displayed
  1181. in video stream.
  1182. @item size
  1183. Set video stream size. Only useful if curves option is activated.
  1184. @item mgain
  1185. Set max gain that will be displayed. Only useful if curves option is activated.
  1186. Setting this to a reasonable value makes it possible to display gain which is derived from
  1187. neighbour bands which are too close to each other and thus produce higher gain
  1188. when both are activated.
  1189. @item fscale
  1190. Set frequency scale used to draw frequency response in video output.
  1191. Can be linear or logarithmic. Default is logarithmic.
  1192. @item colors
  1193. Set color for each channel curve which is going to be displayed in video stream.
  1194. This is list of color names separated by space or by '|'.
  1195. Unrecognised or missing colors will be replaced by white color.
  1196. @end table
  1197. @subsection Examples
  1198. @itemize
  1199. @item
  1200. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1201. for first 2 channels using Chebyshev type 1 filter:
  1202. @example
  1203. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1204. @end example
  1205. @end itemize
  1206. @subsection Commands
  1207. This filter supports the following commands:
  1208. @table @option
  1209. @item change
  1210. Alter existing filter parameters.
  1211. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1212. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1213. error is returned.
  1214. @var{freq} set new frequency parameter.
  1215. @var{width} set new width parameter in herz.
  1216. @var{gain} set new gain parameter in dB.
  1217. Full filter invocation with asendcmd may look like this:
  1218. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1219. @end table
  1220. @section anull
  1221. Pass the audio source unchanged to the output.
  1222. @section apad
  1223. Pad the end of an audio stream with silence.
  1224. This can be used together with @command{ffmpeg} @option{-shortest} to
  1225. extend audio streams to the same length as the video stream.
  1226. A description of the accepted options follows.
  1227. @table @option
  1228. @item packet_size
  1229. Set silence packet size. Default value is 4096.
  1230. @item pad_len
  1231. Set the number of samples of silence to add to the end. After the
  1232. value is reached, the stream is terminated. This option is mutually
  1233. exclusive with @option{whole_len}.
  1234. @item whole_len
  1235. Set the minimum total number of samples in the output audio stream. If
  1236. the value is longer than the input audio length, silence is added to
  1237. the end, until the value is reached. This option is mutually exclusive
  1238. with @option{pad_len}.
  1239. @end table
  1240. If neither the @option{pad_len} nor the @option{whole_len} option is
  1241. set, the filter will add silence to the end of the input stream
  1242. indefinitely.
  1243. @subsection Examples
  1244. @itemize
  1245. @item
  1246. Add 1024 samples of silence to the end of the input:
  1247. @example
  1248. apad=pad_len=1024
  1249. @end example
  1250. @item
  1251. Make sure the audio output will contain at least 10000 samples, pad
  1252. the input with silence if required:
  1253. @example
  1254. apad=whole_len=10000
  1255. @end example
  1256. @item
  1257. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1258. video stream will always result the shortest and will be converted
  1259. until the end in the output file when using the @option{shortest}
  1260. option:
  1261. @example
  1262. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1263. @end example
  1264. @end itemize
  1265. @section aphaser
  1266. Add a phasing effect to the input audio.
  1267. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1268. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1269. A description of the accepted parameters follows.
  1270. @table @option
  1271. @item in_gain
  1272. Set input gain. Default is 0.4.
  1273. @item out_gain
  1274. Set output gain. Default is 0.74
  1275. @item delay
  1276. Set delay in milliseconds. Default is 3.0.
  1277. @item decay
  1278. Set decay. Default is 0.4.
  1279. @item speed
  1280. Set modulation speed in Hz. Default is 0.5.
  1281. @item type
  1282. Set modulation type. Default is triangular.
  1283. It accepts the following values:
  1284. @table @samp
  1285. @item triangular, t
  1286. @item sinusoidal, s
  1287. @end table
  1288. @end table
  1289. @section apulsator
  1290. Audio pulsator is something between an autopanner and a tremolo.
  1291. But it can produce funny stereo effects as well. Pulsator changes the volume
  1292. of the left and right channel based on a LFO (low frequency oscillator) with
  1293. different waveforms and shifted phases.
  1294. This filter have the ability to define an offset between left and right
  1295. channel. An offset of 0 means that both LFO shapes match each other.
  1296. The left and right channel are altered equally - a conventional tremolo.
  1297. An offset of 50% means that the shape of the right channel is exactly shifted
  1298. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1299. an autopanner. At 1 both curves match again. Every setting in between moves the
  1300. phase shift gapless between all stages and produces some "bypassing" sounds with
  1301. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1302. the 0.5) the faster the signal passes from the left to the right speaker.
  1303. The filter accepts the following options:
  1304. @table @option
  1305. @item level_in
  1306. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1307. @item level_out
  1308. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1309. @item mode
  1310. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1311. sawup or sawdown. Default is sine.
  1312. @item amount
  1313. Set modulation. Define how much of original signal is affected by the LFO.
  1314. @item offset_l
  1315. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1316. @item offset_r
  1317. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1318. @item width
  1319. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1320. @item timing
  1321. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1322. @item bpm
  1323. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1324. is set to bpm.
  1325. @item ms
  1326. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1327. is set to ms.
  1328. @item hz
  1329. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1330. if timing is set to hz.
  1331. @end table
  1332. @anchor{aresample}
  1333. @section aresample
  1334. Resample the input audio to the specified parameters, using the
  1335. libswresample library. If none are specified then the filter will
  1336. automatically convert between its input and output.
  1337. This filter is also able to stretch/squeeze the audio data to make it match
  1338. the timestamps or to inject silence / cut out audio to make it match the
  1339. timestamps, do a combination of both or do neither.
  1340. The filter accepts the syntax
  1341. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1342. expresses a sample rate and @var{resampler_options} is a list of
  1343. @var{key}=@var{value} pairs, separated by ":". See the
  1344. @ref{Resampler Options,,"Resampler Options" section in the
  1345. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1346. for the complete list of supported options.
  1347. @subsection Examples
  1348. @itemize
  1349. @item
  1350. Resample the input audio to 44100Hz:
  1351. @example
  1352. aresample=44100
  1353. @end example
  1354. @item
  1355. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1356. samples per second compensation:
  1357. @example
  1358. aresample=async=1000
  1359. @end example
  1360. @end itemize
  1361. @section areverse
  1362. Reverse an audio clip.
  1363. Warning: This filter requires memory to buffer the entire clip, so trimming
  1364. is suggested.
  1365. @subsection Examples
  1366. @itemize
  1367. @item
  1368. Take the first 5 seconds of a clip, and reverse it.
  1369. @example
  1370. atrim=end=5,areverse
  1371. @end example
  1372. @end itemize
  1373. @section asetnsamples
  1374. Set the number of samples per each output audio frame.
  1375. The last output packet may contain a different number of samples, as
  1376. the filter will flush all the remaining samples when the input audio
  1377. signals its end.
  1378. The filter accepts the following options:
  1379. @table @option
  1380. @item nb_out_samples, n
  1381. Set the number of frames per each output audio frame. The number is
  1382. intended as the number of samples @emph{per each channel}.
  1383. Default value is 1024.
  1384. @item pad, p
  1385. If set to 1, the filter will pad the last audio frame with zeroes, so
  1386. that the last frame will contain the same number of samples as the
  1387. previous ones. Default value is 1.
  1388. @end table
  1389. For example, to set the number of per-frame samples to 1234 and
  1390. disable padding for the last frame, use:
  1391. @example
  1392. asetnsamples=n=1234:p=0
  1393. @end example
  1394. @section asetrate
  1395. Set the sample rate without altering the PCM data.
  1396. This will result in a change of speed and pitch.
  1397. The filter accepts the following options:
  1398. @table @option
  1399. @item sample_rate, r
  1400. Set the output sample rate. Default is 44100 Hz.
  1401. @end table
  1402. @section ashowinfo
  1403. Show a line containing various information for each input audio frame.
  1404. The input audio is not modified.
  1405. The shown line contains a sequence of key/value pairs of the form
  1406. @var{key}:@var{value}.
  1407. The following values are shown in the output:
  1408. @table @option
  1409. @item n
  1410. The (sequential) number of the input frame, starting from 0.
  1411. @item pts
  1412. The presentation timestamp of the input frame, in time base units; the time base
  1413. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1414. @item pts_time
  1415. The presentation timestamp of the input frame in seconds.
  1416. @item pos
  1417. position of the frame in the input stream, -1 if this information in
  1418. unavailable and/or meaningless (for example in case of synthetic audio)
  1419. @item fmt
  1420. The sample format.
  1421. @item chlayout
  1422. The channel layout.
  1423. @item rate
  1424. The sample rate for the audio frame.
  1425. @item nb_samples
  1426. The number of samples (per channel) in the frame.
  1427. @item checksum
  1428. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1429. audio, the data is treated as if all the planes were concatenated.
  1430. @item plane_checksums
  1431. A list of Adler-32 checksums for each data plane.
  1432. @end table
  1433. @anchor{astats}
  1434. @section astats
  1435. Display time domain statistical information about the audio channels.
  1436. Statistics are calculated and displayed for each audio channel and,
  1437. where applicable, an overall figure is also given.
  1438. It accepts the following option:
  1439. @table @option
  1440. @item length
  1441. Short window length in seconds, used for peak and trough RMS measurement.
  1442. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1443. @item metadata
  1444. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1445. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1446. disabled.
  1447. Available keys for each channel are:
  1448. DC_offset
  1449. Min_level
  1450. Max_level
  1451. Min_difference
  1452. Max_difference
  1453. Mean_difference
  1454. RMS_difference
  1455. Peak_level
  1456. RMS_peak
  1457. RMS_trough
  1458. Crest_factor
  1459. Flat_factor
  1460. Peak_count
  1461. Bit_depth
  1462. Dynamic_range
  1463. and for Overall:
  1464. DC_offset
  1465. Min_level
  1466. Max_level
  1467. Min_difference
  1468. Max_difference
  1469. Mean_difference
  1470. RMS_difference
  1471. Peak_level
  1472. RMS_level
  1473. RMS_peak
  1474. RMS_trough
  1475. Flat_factor
  1476. Peak_count
  1477. Bit_depth
  1478. Number_of_samples
  1479. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1480. this @code{lavfi.astats.Overall.Peak_count}.
  1481. For description what each key means read below.
  1482. @item reset
  1483. Set number of frame after which stats are going to be recalculated.
  1484. Default is disabled.
  1485. @end table
  1486. A description of each shown parameter follows:
  1487. @table @option
  1488. @item DC offset
  1489. Mean amplitude displacement from zero.
  1490. @item Min level
  1491. Minimal sample level.
  1492. @item Max level
  1493. Maximal sample level.
  1494. @item Min difference
  1495. Minimal difference between two consecutive samples.
  1496. @item Max difference
  1497. Maximal difference between two consecutive samples.
  1498. @item Mean difference
  1499. Mean difference between two consecutive samples.
  1500. The average of each difference between two consecutive samples.
  1501. @item RMS difference
  1502. Root Mean Square difference between two consecutive samples.
  1503. @item Peak level dB
  1504. @item RMS level dB
  1505. Standard peak and RMS level measured in dBFS.
  1506. @item RMS peak dB
  1507. @item RMS trough dB
  1508. Peak and trough values for RMS level measured over a short window.
  1509. @item Crest factor
  1510. Standard ratio of peak to RMS level (note: not in dB).
  1511. @item Flat factor
  1512. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1513. (i.e. either @var{Min level} or @var{Max level}).
  1514. @item Peak count
  1515. Number of occasions (not the number of samples) that the signal attained either
  1516. @var{Min level} or @var{Max level}.
  1517. @item Bit depth
  1518. Overall bit depth of audio. Number of bits used for each sample.
  1519. @item Dynamic range
  1520. Measured dynamic range of audio in dB.
  1521. @end table
  1522. @section atempo
  1523. Adjust audio tempo.
  1524. The filter accepts exactly one parameter, the audio tempo. If not
  1525. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1526. be in the [0.5, 100.0] range.
  1527. Note that tempo greater than 2 will skip some samples rather than
  1528. blend them in. If for any reason this is a concern it is always
  1529. possible to daisy-chain several instances of atempo to achieve the
  1530. desired product tempo.
  1531. @subsection Examples
  1532. @itemize
  1533. @item
  1534. Slow down audio to 80% tempo:
  1535. @example
  1536. atempo=0.8
  1537. @end example
  1538. @item
  1539. To speed up audio to 300% tempo:
  1540. @example
  1541. atempo=3
  1542. @end example
  1543. @item
  1544. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1545. @example
  1546. atempo=sqrt(3),atempo=sqrt(3)
  1547. @end example
  1548. @end itemize
  1549. @section atrim
  1550. Trim the input so that the output contains one continuous subpart of the input.
  1551. It accepts the following parameters:
  1552. @table @option
  1553. @item start
  1554. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1555. sample with the timestamp @var{start} will be the first sample in the output.
  1556. @item end
  1557. Specify time of the first audio sample that will be dropped, i.e. the
  1558. audio sample immediately preceding the one with the timestamp @var{end} will be
  1559. the last sample in the output.
  1560. @item start_pts
  1561. Same as @var{start}, except this option sets the start timestamp in samples
  1562. instead of seconds.
  1563. @item end_pts
  1564. Same as @var{end}, except this option sets the end timestamp in samples instead
  1565. of seconds.
  1566. @item duration
  1567. The maximum duration of the output in seconds.
  1568. @item start_sample
  1569. The number of the first sample that should be output.
  1570. @item end_sample
  1571. The number of the first sample that should be dropped.
  1572. @end table
  1573. @option{start}, @option{end}, and @option{duration} are expressed as time
  1574. duration specifications; see
  1575. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1576. Note that the first two sets of the start/end options and the @option{duration}
  1577. option look at the frame timestamp, while the _sample options simply count the
  1578. samples that pass through the filter. So start/end_pts and start/end_sample will
  1579. give different results when the timestamps are wrong, inexact or do not start at
  1580. zero. Also note that this filter does not modify the timestamps. If you wish
  1581. to have the output timestamps start at zero, insert the asetpts filter after the
  1582. atrim filter.
  1583. If multiple start or end options are set, this filter tries to be greedy and
  1584. keep all samples that match at least one of the specified constraints. To keep
  1585. only the part that matches all the constraints at once, chain multiple atrim
  1586. filters.
  1587. The defaults are such that all the input is kept. So it is possible to set e.g.
  1588. just the end values to keep everything before the specified time.
  1589. Examples:
  1590. @itemize
  1591. @item
  1592. Drop everything except the second minute of input:
  1593. @example
  1594. ffmpeg -i INPUT -af atrim=60:120
  1595. @end example
  1596. @item
  1597. Keep only the first 1000 samples:
  1598. @example
  1599. ffmpeg -i INPUT -af atrim=end_sample=1000
  1600. @end example
  1601. @end itemize
  1602. @section bandpass
  1603. Apply a two-pole Butterworth band-pass filter with central
  1604. frequency @var{frequency}, and (3dB-point) band-width width.
  1605. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1606. instead of the default: constant 0dB peak gain.
  1607. The filter roll off at 6dB per octave (20dB per decade).
  1608. The filter accepts the following options:
  1609. @table @option
  1610. @item frequency, f
  1611. Set the filter's central frequency. Default is @code{3000}.
  1612. @item csg
  1613. Constant skirt gain if set to 1. Defaults to 0.
  1614. @item width_type, t
  1615. Set method to specify band-width of filter.
  1616. @table @option
  1617. @item h
  1618. Hz
  1619. @item q
  1620. Q-Factor
  1621. @item o
  1622. octave
  1623. @item s
  1624. slope
  1625. @item k
  1626. kHz
  1627. @end table
  1628. @item width, w
  1629. Specify the band-width of a filter in width_type units.
  1630. @item channels, c
  1631. Specify which channels to filter, by default all available are filtered.
  1632. @end table
  1633. @subsection Commands
  1634. This filter supports the following commands:
  1635. @table @option
  1636. @item frequency, f
  1637. Change bandpass frequency.
  1638. Syntax for the command is : "@var{frequency}"
  1639. @item width_type, t
  1640. Change bandpass width_type.
  1641. Syntax for the command is : "@var{width_type}"
  1642. @item width, w
  1643. Change bandpass width.
  1644. Syntax for the command is : "@var{width}"
  1645. @end table
  1646. @section bandreject
  1647. Apply a two-pole Butterworth band-reject filter with central
  1648. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1649. The filter roll off at 6dB per octave (20dB per decade).
  1650. The filter accepts the following options:
  1651. @table @option
  1652. @item frequency, f
  1653. Set the filter's central frequency. Default is @code{3000}.
  1654. @item width_type, t
  1655. Set method to specify band-width of filter.
  1656. @table @option
  1657. @item h
  1658. Hz
  1659. @item q
  1660. Q-Factor
  1661. @item o
  1662. octave
  1663. @item s
  1664. slope
  1665. @item k
  1666. kHz
  1667. @end table
  1668. @item width, w
  1669. Specify the band-width of a filter in width_type units.
  1670. @item channels, c
  1671. Specify which channels to filter, by default all available are filtered.
  1672. @end table
  1673. @subsection Commands
  1674. This filter supports the following commands:
  1675. @table @option
  1676. @item frequency, f
  1677. Change bandreject frequency.
  1678. Syntax for the command is : "@var{frequency}"
  1679. @item width_type, t
  1680. Change bandreject width_type.
  1681. Syntax for the command is : "@var{width_type}"
  1682. @item width, w
  1683. Change bandreject width.
  1684. Syntax for the command is : "@var{width}"
  1685. @end table
  1686. @section bass, lowshelf
  1687. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1688. shelving filter with a response similar to that of a standard
  1689. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1690. The filter accepts the following options:
  1691. @table @option
  1692. @item gain, g
  1693. Give the gain at 0 Hz. Its useful range is about -20
  1694. (for a large cut) to +20 (for a large boost).
  1695. Beware of clipping when using a positive gain.
  1696. @item frequency, f
  1697. Set the filter's central frequency and so can be used
  1698. to extend or reduce the frequency range to be boosted or cut.
  1699. The default value is @code{100} Hz.
  1700. @item width_type, t
  1701. Set method to specify band-width of filter.
  1702. @table @option
  1703. @item h
  1704. Hz
  1705. @item q
  1706. Q-Factor
  1707. @item o
  1708. octave
  1709. @item s
  1710. slope
  1711. @item k
  1712. kHz
  1713. @end table
  1714. @item width, w
  1715. Determine how steep is the filter's shelf transition.
  1716. @item channels, c
  1717. Specify which channels to filter, by default all available are filtered.
  1718. @end table
  1719. @subsection Commands
  1720. This filter supports the following commands:
  1721. @table @option
  1722. @item frequency, f
  1723. Change bass frequency.
  1724. Syntax for the command is : "@var{frequency}"
  1725. @item width_type, t
  1726. Change bass width_type.
  1727. Syntax for the command is : "@var{width_type}"
  1728. @item width, w
  1729. Change bass width.
  1730. Syntax for the command is : "@var{width}"
  1731. @item gain, g
  1732. Change bass gain.
  1733. Syntax for the command is : "@var{gain}"
  1734. @end table
  1735. @section biquad
  1736. Apply a biquad IIR filter with the given coefficients.
  1737. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1738. are the numerator and denominator coefficients respectively.
  1739. and @var{channels}, @var{c} specify which channels to filter, by default all
  1740. available are filtered.
  1741. @subsection Commands
  1742. This filter supports the following commands:
  1743. @table @option
  1744. @item a0
  1745. @item a1
  1746. @item a2
  1747. @item b0
  1748. @item b1
  1749. @item b2
  1750. Change biquad parameter.
  1751. Syntax for the command is : "@var{value}"
  1752. @end table
  1753. @section bs2b
  1754. Bauer stereo to binaural transformation, which improves headphone listening of
  1755. stereo audio records.
  1756. To enable compilation of this filter you need to configure FFmpeg with
  1757. @code{--enable-libbs2b}.
  1758. It accepts the following parameters:
  1759. @table @option
  1760. @item profile
  1761. Pre-defined crossfeed level.
  1762. @table @option
  1763. @item default
  1764. Default level (fcut=700, feed=50).
  1765. @item cmoy
  1766. Chu Moy circuit (fcut=700, feed=60).
  1767. @item jmeier
  1768. Jan Meier circuit (fcut=650, feed=95).
  1769. @end table
  1770. @item fcut
  1771. Cut frequency (in Hz).
  1772. @item feed
  1773. Feed level (in Hz).
  1774. @end table
  1775. @section channelmap
  1776. Remap input channels to new locations.
  1777. It accepts the following parameters:
  1778. @table @option
  1779. @item map
  1780. Map channels from input to output. The argument is a '|'-separated list of
  1781. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1782. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1783. channel (e.g. FL for front left) or its index in the input channel layout.
  1784. @var{out_channel} is the name of the output channel or its index in the output
  1785. channel layout. If @var{out_channel} is not given then it is implicitly an
  1786. index, starting with zero and increasing by one for each mapping.
  1787. @item channel_layout
  1788. The channel layout of the output stream.
  1789. @end table
  1790. If no mapping is present, the filter will implicitly map input channels to
  1791. output channels, preserving indices.
  1792. @subsection Examples
  1793. @itemize
  1794. @item
  1795. For example, assuming a 5.1+downmix input MOV file,
  1796. @example
  1797. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1798. @end example
  1799. will create an output WAV file tagged as stereo from the downmix channels of
  1800. the input.
  1801. @item
  1802. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1803. @example
  1804. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1805. @end example
  1806. @end itemize
  1807. @section channelsplit
  1808. Split each channel from an input audio stream into a separate output stream.
  1809. It accepts the following parameters:
  1810. @table @option
  1811. @item channel_layout
  1812. The channel layout of the input stream. The default is "stereo".
  1813. @item channels
  1814. A channel layout describing the channels to be extracted as separate output streams
  1815. or "all" to extract each input channel as a separate stream. The default is "all".
  1816. Choosing channels not present in channel layout in the input will result in an error.
  1817. @end table
  1818. @subsection Examples
  1819. @itemize
  1820. @item
  1821. For example, assuming a stereo input MP3 file,
  1822. @example
  1823. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1824. @end example
  1825. will create an output Matroska file with two audio streams, one containing only
  1826. the left channel and the other the right channel.
  1827. @item
  1828. Split a 5.1 WAV file into per-channel files:
  1829. @example
  1830. ffmpeg -i in.wav -filter_complex
  1831. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1832. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1833. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1834. side_right.wav
  1835. @end example
  1836. @item
  1837. Extract only LFE from a 5.1 WAV file:
  1838. @example
  1839. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1840. -map '[LFE]' lfe.wav
  1841. @end example
  1842. @end itemize
  1843. @section chorus
  1844. Add a chorus effect to the audio.
  1845. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1846. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1847. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1848. The modulation depth defines the range the modulated delay is played before or after
  1849. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1850. sound tuned around the original one, like in a chorus where some vocals are slightly
  1851. off key.
  1852. It accepts the following parameters:
  1853. @table @option
  1854. @item in_gain
  1855. Set input gain. Default is 0.4.
  1856. @item out_gain
  1857. Set output gain. Default is 0.4.
  1858. @item delays
  1859. Set delays. A typical delay is around 40ms to 60ms.
  1860. @item decays
  1861. Set decays.
  1862. @item speeds
  1863. Set speeds.
  1864. @item depths
  1865. Set depths.
  1866. @end table
  1867. @subsection Examples
  1868. @itemize
  1869. @item
  1870. A single delay:
  1871. @example
  1872. chorus=0.7:0.9:55:0.4:0.25:2
  1873. @end example
  1874. @item
  1875. Two delays:
  1876. @example
  1877. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1878. @end example
  1879. @item
  1880. Fuller sounding chorus with three delays:
  1881. @example
  1882. 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
  1883. @end example
  1884. @end itemize
  1885. @section compand
  1886. Compress or expand the audio's dynamic range.
  1887. It accepts the following parameters:
  1888. @table @option
  1889. @item attacks
  1890. @item decays
  1891. A list of times in seconds for each channel over which the instantaneous level
  1892. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1893. increase of volume and @var{decays} refers to decrease of volume. For most
  1894. situations, the attack time (response to the audio getting louder) should be
  1895. shorter than the decay time, because the human ear is more sensitive to sudden
  1896. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1897. a typical value for decay is 0.8 seconds.
  1898. If specified number of attacks & decays is lower than number of channels, the last
  1899. set attack/decay will be used for all remaining channels.
  1900. @item points
  1901. A list of points for the transfer function, specified in dB relative to the
  1902. maximum possible signal amplitude. Each key points list must be defined using
  1903. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1904. @code{x0/y0 x1/y1 x2/y2 ....}
  1905. The input values must be in strictly increasing order but the transfer function
  1906. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1907. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1908. function are @code{-70/-70|-60/-20|1/0}.
  1909. @item soft-knee
  1910. Set the curve radius in dB for all joints. It defaults to 0.01.
  1911. @item gain
  1912. Set the additional gain in dB to be applied at all points on the transfer
  1913. function. This allows for easy adjustment of the overall gain.
  1914. It defaults to 0.
  1915. @item volume
  1916. Set an initial volume, in dB, to be assumed for each channel when filtering
  1917. starts. This permits the user to supply a nominal level initially, so that, for
  1918. example, a very large gain is not applied to initial signal levels before the
  1919. companding has begun to operate. A typical value for audio which is initially
  1920. quiet is -90 dB. It defaults to 0.
  1921. @item delay
  1922. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1923. delayed before being fed to the volume adjuster. Specifying a delay
  1924. approximately equal to the attack/decay times allows the filter to effectively
  1925. operate in predictive rather than reactive mode. It defaults to 0.
  1926. @end table
  1927. @subsection Examples
  1928. @itemize
  1929. @item
  1930. Make music with both quiet and loud passages suitable for listening to in a
  1931. noisy environment:
  1932. @example
  1933. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1934. @end example
  1935. Another example for audio with whisper and explosion parts:
  1936. @example
  1937. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1938. @end example
  1939. @item
  1940. A noise gate for when the noise is at a lower level than the signal:
  1941. @example
  1942. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1943. @end example
  1944. @item
  1945. Here is another noise gate, this time for when the noise is at a higher level
  1946. than the signal (making it, in some ways, similar to squelch):
  1947. @example
  1948. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1949. @end example
  1950. @item
  1951. 2:1 compression starting at -6dB:
  1952. @example
  1953. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1954. @end example
  1955. @item
  1956. 2:1 compression starting at -9dB:
  1957. @example
  1958. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1959. @end example
  1960. @item
  1961. 2:1 compression starting at -12dB:
  1962. @example
  1963. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1964. @end example
  1965. @item
  1966. 2:1 compression starting at -18dB:
  1967. @example
  1968. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1969. @end example
  1970. @item
  1971. 3:1 compression starting at -15dB:
  1972. @example
  1973. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1974. @end example
  1975. @item
  1976. Compressor/Gate:
  1977. @example
  1978. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1979. @end example
  1980. @item
  1981. Expander:
  1982. @example
  1983. 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
  1984. @end example
  1985. @item
  1986. Hard limiter at -6dB:
  1987. @example
  1988. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1989. @end example
  1990. @item
  1991. Hard limiter at -12dB:
  1992. @example
  1993. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1994. @end example
  1995. @item
  1996. Hard noise gate at -35 dB:
  1997. @example
  1998. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1999. @end example
  2000. @item
  2001. Soft limiter:
  2002. @example
  2003. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2004. @end example
  2005. @end itemize
  2006. @section compensationdelay
  2007. Compensation Delay Line is a metric based delay to compensate differing
  2008. positions of microphones or speakers.
  2009. For example, you have recorded guitar with two microphones placed in
  2010. different location. Because the front of sound wave has fixed speed in
  2011. normal conditions, the phasing of microphones can vary and depends on
  2012. their location and interposition. The best sound mix can be achieved when
  2013. these microphones are in phase (synchronized). Note that distance of
  2014. ~30 cm between microphones makes one microphone to capture signal in
  2015. antiphase to another microphone. That makes the final mix sounding moody.
  2016. This filter helps to solve phasing problems by adding different delays
  2017. to each microphone track and make them synchronized.
  2018. The best result can be reached when you take one track as base and
  2019. synchronize other tracks one by one with it.
  2020. Remember that synchronization/delay tolerance depends on sample rate, too.
  2021. Higher sample rates will give more tolerance.
  2022. It accepts the following parameters:
  2023. @table @option
  2024. @item mm
  2025. Set millimeters distance. This is compensation distance for fine tuning.
  2026. Default is 0.
  2027. @item cm
  2028. Set cm distance. This is compensation distance for tightening distance setup.
  2029. Default is 0.
  2030. @item m
  2031. Set meters distance. This is compensation distance for hard distance setup.
  2032. Default is 0.
  2033. @item dry
  2034. Set dry amount. Amount of unprocessed (dry) signal.
  2035. Default is 0.
  2036. @item wet
  2037. Set wet amount. Amount of processed (wet) signal.
  2038. Default is 1.
  2039. @item temp
  2040. Set temperature degree in Celsius. This is the temperature of the environment.
  2041. Default is 20.
  2042. @end table
  2043. @section crossfeed
  2044. Apply headphone crossfeed filter.
  2045. Crossfeed is the process of blending the left and right channels of stereo
  2046. audio recording.
  2047. It is mainly used to reduce extreme stereo separation of low frequencies.
  2048. The intent is to produce more speaker like sound to the listener.
  2049. The filter accepts the following options:
  2050. @table @option
  2051. @item strength
  2052. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2053. This sets gain of low shelf filter for side part of stereo image.
  2054. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2055. @item range
  2056. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2057. This sets cut off frequency of low shelf filter. Default is cut off near
  2058. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2059. @item level_in
  2060. Set input gain. Default is 0.9.
  2061. @item level_out
  2062. Set output gain. Default is 1.
  2063. @end table
  2064. @section crystalizer
  2065. Simple algorithm to expand audio dynamic range.
  2066. The filter accepts the following options:
  2067. @table @option
  2068. @item i
  2069. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2070. (unchanged sound) to 10.0 (maximum effect).
  2071. @item c
  2072. Enable clipping. By default is enabled.
  2073. @end table
  2074. @section dcshift
  2075. Apply a DC shift to the audio.
  2076. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2077. in the recording chain) from the audio. The effect of a DC offset is reduced
  2078. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2079. a signal has a DC offset.
  2080. @table @option
  2081. @item shift
  2082. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2083. the audio.
  2084. @item limitergain
  2085. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2086. used to prevent clipping.
  2087. @end table
  2088. @section drmeter
  2089. Measure audio dynamic range.
  2090. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2091. is found in transition material. And anything less that 8 have very poor dynamics
  2092. and is very compressed.
  2093. The filter accepts the following options:
  2094. @table @option
  2095. @item length
  2096. Set window length in seconds used to split audio into segments of equal length.
  2097. Default is 3 seconds.
  2098. @end table
  2099. @section dynaudnorm
  2100. Dynamic Audio Normalizer.
  2101. This filter applies a certain amount of gain to the input audio in order
  2102. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2103. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2104. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2105. This allows for applying extra gain to the "quiet" sections of the audio
  2106. while avoiding distortions or clipping the "loud" sections. In other words:
  2107. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2108. sections, in the sense that the volume of each section is brought to the
  2109. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2110. this goal *without* applying "dynamic range compressing". It will retain 100%
  2111. of the dynamic range *within* each section of the audio file.
  2112. @table @option
  2113. @item f
  2114. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2115. Default is 500 milliseconds.
  2116. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2117. referred to as frames. This is required, because a peak magnitude has no
  2118. meaning for just a single sample value. Instead, we need to determine the
  2119. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2120. normalizer would simply use the peak magnitude of the complete file, the
  2121. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2122. frame. The length of a frame is specified in milliseconds. By default, the
  2123. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2124. been found to give good results with most files.
  2125. Note that the exact frame length, in number of samples, will be determined
  2126. automatically, based on the sampling rate of the individual input audio file.
  2127. @item g
  2128. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2129. number. Default is 31.
  2130. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2131. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2132. is specified in frames, centered around the current frame. For the sake of
  2133. simplicity, this must be an odd number. Consequently, the default value of 31
  2134. takes into account the current frame, as well as the 15 preceding frames and
  2135. the 15 subsequent frames. Using a larger window results in a stronger
  2136. smoothing effect and thus in less gain variation, i.e. slower gain
  2137. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2138. effect and thus in more gain variation, i.e. faster gain adaptation.
  2139. In other words, the more you increase this value, the more the Dynamic Audio
  2140. Normalizer will behave like a "traditional" normalization filter. On the
  2141. contrary, the more you decrease this value, the more the Dynamic Audio
  2142. Normalizer will behave like a dynamic range compressor.
  2143. @item p
  2144. Set the target peak value. This specifies the highest permissible magnitude
  2145. level for the normalized audio input. This filter will try to approach the
  2146. target peak magnitude as closely as possible, but at the same time it also
  2147. makes sure that the normalized signal will never exceed the peak magnitude.
  2148. A frame's maximum local gain factor is imposed directly by the target peak
  2149. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2150. It is not recommended to go above this value.
  2151. @item m
  2152. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2153. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2154. factor for each input frame, i.e. the maximum gain factor that does not
  2155. result in clipping or distortion. The maximum gain factor is determined by
  2156. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2157. additionally bounds the frame's maximum gain factor by a predetermined
  2158. (global) maximum gain factor. This is done in order to avoid excessive gain
  2159. factors in "silent" or almost silent frames. By default, the maximum gain
  2160. factor is 10.0, For most inputs the default value should be sufficient and
  2161. it usually is not recommended to increase this value. Though, for input
  2162. with an extremely low overall volume level, it may be necessary to allow even
  2163. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2164. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2165. Instead, a "sigmoid" threshold function will be applied. This way, the
  2166. gain factors will smoothly approach the threshold value, but never exceed that
  2167. value.
  2168. @item r
  2169. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2170. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2171. This means that the maximum local gain factor for each frame is defined
  2172. (only) by the frame's highest magnitude sample. This way, the samples can
  2173. be amplified as much as possible without exceeding the maximum signal
  2174. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2175. Normalizer can also take into account the frame's root mean square,
  2176. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2177. determine the power of a time-varying signal. It is therefore considered
  2178. that the RMS is a better approximation of the "perceived loudness" than
  2179. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2180. frames to a constant RMS value, a uniform "perceived loudness" can be
  2181. established. If a target RMS value has been specified, a frame's local gain
  2182. factor is defined as the factor that would result in exactly that RMS value.
  2183. Note, however, that the maximum local gain factor is still restricted by the
  2184. frame's highest magnitude sample, in order to prevent clipping.
  2185. @item n
  2186. Enable channels coupling. By default is enabled.
  2187. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2188. amount. This means the same gain factor will be applied to all channels, i.e.
  2189. the maximum possible gain factor is determined by the "loudest" channel.
  2190. However, in some recordings, it may happen that the volume of the different
  2191. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2192. In this case, this option can be used to disable the channel coupling. This way,
  2193. the gain factor will be determined independently for each channel, depending
  2194. only on the individual channel's highest magnitude sample. This allows for
  2195. harmonizing the volume of the different channels.
  2196. @item c
  2197. Enable DC bias correction. By default is disabled.
  2198. An audio signal (in the time domain) is a sequence of sample values.
  2199. In the Dynamic Audio Normalizer these sample values are represented in the
  2200. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2201. audio signal, or "waveform", should be centered around the zero point.
  2202. That means if we calculate the mean value of all samples in a file, or in a
  2203. single frame, then the result should be 0.0 or at least very close to that
  2204. value. If, however, there is a significant deviation of the mean value from
  2205. 0.0, in either positive or negative direction, this is referred to as a
  2206. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2207. Audio Normalizer provides optional DC bias correction.
  2208. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2209. the mean value, or "DC correction" offset, of each input frame and subtract
  2210. that value from all of the frame's sample values which ensures those samples
  2211. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2212. boundaries, the DC correction offset values will be interpolated smoothly
  2213. between neighbouring frames.
  2214. @item b
  2215. Enable alternative boundary mode. By default is disabled.
  2216. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2217. around each frame. This includes the preceding frames as well as the
  2218. subsequent frames. However, for the "boundary" frames, located at the very
  2219. beginning and at the very end of the audio file, not all neighbouring
  2220. frames are available. In particular, for the first few frames in the audio
  2221. file, the preceding frames are not known. And, similarly, for the last few
  2222. frames in the audio file, the subsequent frames are not known. Thus, the
  2223. question arises which gain factors should be assumed for the missing frames
  2224. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2225. to deal with this situation. The default boundary mode assumes a gain factor
  2226. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2227. "fade out" at the beginning and at the end of the input, respectively.
  2228. @item s
  2229. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2230. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2231. compression. This means that signal peaks will not be pruned and thus the
  2232. full dynamic range will be retained within each local neighbourhood. However,
  2233. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2234. normalization algorithm with a more "traditional" compression.
  2235. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2236. (thresholding) function. If (and only if) the compression feature is enabled,
  2237. all input frames will be processed by a soft knee thresholding function prior
  2238. to the actual normalization process. Put simply, the thresholding function is
  2239. going to prune all samples whose magnitude exceeds a certain threshold value.
  2240. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2241. value. Instead, the threshold value will be adjusted for each individual
  2242. frame.
  2243. In general, smaller parameters result in stronger compression, and vice versa.
  2244. Values below 3.0 are not recommended, because audible distortion may appear.
  2245. @end table
  2246. @section earwax
  2247. Make audio easier to listen to on headphones.
  2248. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2249. so that when listened to on headphones the stereo image is moved from
  2250. inside your head (standard for headphones) to outside and in front of
  2251. the listener (standard for speakers).
  2252. Ported from SoX.
  2253. @section equalizer
  2254. Apply a two-pole peaking equalisation (EQ) filter. With this
  2255. filter, the signal-level at and around a selected frequency can
  2256. be increased or decreased, whilst (unlike bandpass and bandreject
  2257. filters) that at all other frequencies is unchanged.
  2258. In order to produce complex equalisation curves, this filter can
  2259. be given several times, each with a different central frequency.
  2260. The filter accepts the following options:
  2261. @table @option
  2262. @item frequency, f
  2263. Set the filter's central frequency in Hz.
  2264. @item width_type, t
  2265. Set method to specify band-width of filter.
  2266. @table @option
  2267. @item h
  2268. Hz
  2269. @item q
  2270. Q-Factor
  2271. @item o
  2272. octave
  2273. @item s
  2274. slope
  2275. @item k
  2276. kHz
  2277. @end table
  2278. @item width, w
  2279. Specify the band-width of a filter in width_type units.
  2280. @item gain, g
  2281. Set the required gain or attenuation in dB.
  2282. Beware of clipping when using a positive gain.
  2283. @item channels, c
  2284. Specify which channels to filter, by default all available are filtered.
  2285. @end table
  2286. @subsection Examples
  2287. @itemize
  2288. @item
  2289. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2290. @example
  2291. equalizer=f=1000:t=h:width=200:g=-10
  2292. @end example
  2293. @item
  2294. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2295. @example
  2296. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2297. @end example
  2298. @end itemize
  2299. @subsection Commands
  2300. This filter supports the following commands:
  2301. @table @option
  2302. @item frequency, f
  2303. Change equalizer frequency.
  2304. Syntax for the command is : "@var{frequency}"
  2305. @item width_type, t
  2306. Change equalizer width_type.
  2307. Syntax for the command is : "@var{width_type}"
  2308. @item width, w
  2309. Change equalizer width.
  2310. Syntax for the command is : "@var{width}"
  2311. @item gain, g
  2312. Change equalizer gain.
  2313. Syntax for the command is : "@var{gain}"
  2314. @end table
  2315. @section extrastereo
  2316. Linearly increases the difference between left and right channels which
  2317. adds some sort of "live" effect to playback.
  2318. The filter accepts the following options:
  2319. @table @option
  2320. @item m
  2321. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2322. (average of both channels), with 1.0 sound will be unchanged, with
  2323. -1.0 left and right channels will be swapped.
  2324. @item c
  2325. Enable clipping. By default is enabled.
  2326. @end table
  2327. @section firequalizer
  2328. Apply FIR Equalization using arbitrary frequency response.
  2329. The filter accepts the following option:
  2330. @table @option
  2331. @item gain
  2332. Set gain curve equation (in dB). The expression can contain variables:
  2333. @table @option
  2334. @item f
  2335. the evaluated frequency
  2336. @item sr
  2337. sample rate
  2338. @item ch
  2339. channel number, set to 0 when multichannels evaluation is disabled
  2340. @item chid
  2341. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2342. multichannels evaluation is disabled
  2343. @item chs
  2344. number of channels
  2345. @item chlayout
  2346. channel_layout, see libavutil/channel_layout.h
  2347. @end table
  2348. and functions:
  2349. @table @option
  2350. @item gain_interpolate(f)
  2351. interpolate gain on frequency f based on gain_entry
  2352. @item cubic_interpolate(f)
  2353. same as gain_interpolate, but smoother
  2354. @end table
  2355. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2356. @item gain_entry
  2357. Set gain entry for gain_interpolate function. The expression can
  2358. contain functions:
  2359. @table @option
  2360. @item entry(f, g)
  2361. store gain entry at frequency f with value g
  2362. @end table
  2363. This option is also available as command.
  2364. @item delay
  2365. Set filter delay in seconds. Higher value means more accurate.
  2366. Default is @code{0.01}.
  2367. @item accuracy
  2368. Set filter accuracy in Hz. Lower value means more accurate.
  2369. Default is @code{5}.
  2370. @item wfunc
  2371. Set window function. Acceptable values are:
  2372. @table @option
  2373. @item rectangular
  2374. rectangular window, useful when gain curve is already smooth
  2375. @item hann
  2376. hann window (default)
  2377. @item hamming
  2378. hamming window
  2379. @item blackman
  2380. blackman window
  2381. @item nuttall3
  2382. 3-terms continuous 1st derivative nuttall window
  2383. @item mnuttall3
  2384. minimum 3-terms discontinuous nuttall window
  2385. @item nuttall
  2386. 4-terms continuous 1st derivative nuttall window
  2387. @item bnuttall
  2388. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2389. @item bharris
  2390. blackman-harris window
  2391. @item tukey
  2392. tukey window
  2393. @end table
  2394. @item fixed
  2395. If enabled, use fixed number of audio samples. This improves speed when
  2396. filtering with large delay. Default is disabled.
  2397. @item multi
  2398. Enable multichannels evaluation on gain. Default is disabled.
  2399. @item zero_phase
  2400. Enable zero phase mode by subtracting timestamp to compensate delay.
  2401. Default is disabled.
  2402. @item scale
  2403. Set scale used by gain. Acceptable values are:
  2404. @table @option
  2405. @item linlin
  2406. linear frequency, linear gain
  2407. @item linlog
  2408. linear frequency, logarithmic (in dB) gain (default)
  2409. @item loglin
  2410. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2411. @item loglog
  2412. logarithmic frequency, logarithmic gain
  2413. @end table
  2414. @item dumpfile
  2415. Set file for dumping, suitable for gnuplot.
  2416. @item dumpscale
  2417. Set scale for dumpfile. Acceptable values are same with scale option.
  2418. Default is linlog.
  2419. @item fft2
  2420. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2421. Default is disabled.
  2422. @item min_phase
  2423. Enable minimum phase impulse response. Default is disabled.
  2424. @end table
  2425. @subsection Examples
  2426. @itemize
  2427. @item
  2428. lowpass at 1000 Hz:
  2429. @example
  2430. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2431. @end example
  2432. @item
  2433. lowpass at 1000 Hz with gain_entry:
  2434. @example
  2435. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2436. @end example
  2437. @item
  2438. custom equalization:
  2439. @example
  2440. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2441. @end example
  2442. @item
  2443. higher delay with zero phase to compensate delay:
  2444. @example
  2445. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2446. @end example
  2447. @item
  2448. lowpass on left channel, highpass on right channel:
  2449. @example
  2450. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2451. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2452. @end example
  2453. @end itemize
  2454. @section flanger
  2455. Apply a flanging effect to the audio.
  2456. The filter accepts the following options:
  2457. @table @option
  2458. @item delay
  2459. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2460. @item depth
  2461. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2462. @item regen
  2463. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2464. Default value is 0.
  2465. @item width
  2466. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2467. Default value is 71.
  2468. @item speed
  2469. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2470. @item shape
  2471. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2472. Default value is @var{sinusoidal}.
  2473. @item phase
  2474. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2475. Default value is 25.
  2476. @item interp
  2477. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2478. Default is @var{linear}.
  2479. @end table
  2480. @section haas
  2481. Apply Haas effect to audio.
  2482. Note that this makes most sense to apply on mono signals.
  2483. With this filter applied to mono signals it give some directionality and
  2484. stretches its stereo image.
  2485. The filter accepts the following options:
  2486. @table @option
  2487. @item level_in
  2488. Set input level. By default is @var{1}, or 0dB
  2489. @item level_out
  2490. Set output level. By default is @var{1}, or 0dB.
  2491. @item side_gain
  2492. Set gain applied to side part of signal. By default is @var{1}.
  2493. @item middle_source
  2494. Set kind of middle source. Can be one of the following:
  2495. @table @samp
  2496. @item left
  2497. Pick left channel.
  2498. @item right
  2499. Pick right channel.
  2500. @item mid
  2501. Pick middle part signal of stereo image.
  2502. @item side
  2503. Pick side part signal of stereo image.
  2504. @end table
  2505. @item middle_phase
  2506. Change middle phase. By default is disabled.
  2507. @item left_delay
  2508. Set left channel delay. By default is @var{2.05} milliseconds.
  2509. @item left_balance
  2510. Set left channel balance. By default is @var{-1}.
  2511. @item left_gain
  2512. Set left channel gain. By default is @var{1}.
  2513. @item left_phase
  2514. Change left phase. By default is disabled.
  2515. @item right_delay
  2516. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2517. @item right_balance
  2518. Set right channel balance. By default is @var{1}.
  2519. @item right_gain
  2520. Set right channel gain. By default is @var{1}.
  2521. @item right_phase
  2522. Change right phase. By default is enabled.
  2523. @end table
  2524. @section hdcd
  2525. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2526. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2527. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2528. of HDCD, and detects the Transient Filter flag.
  2529. @example
  2530. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2531. @end example
  2532. When using the filter with wav, note the default encoding for wav is 16-bit,
  2533. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2534. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2535. @example
  2536. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2537. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2538. @end example
  2539. The filter accepts the following options:
  2540. @table @option
  2541. @item disable_autoconvert
  2542. Disable any automatic format conversion or resampling in the filter graph.
  2543. @item process_stereo
  2544. Process the stereo channels together. If target_gain does not match between
  2545. channels, consider it invalid and use the last valid target_gain.
  2546. @item cdt_ms
  2547. Set the code detect timer period in ms.
  2548. @item force_pe
  2549. Always extend peaks above -3dBFS even if PE isn't signaled.
  2550. @item analyze_mode
  2551. Replace audio with a solid tone and adjust the amplitude to signal some
  2552. specific aspect of the decoding process. The output file can be loaded in
  2553. an audio editor alongside the original to aid analysis.
  2554. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2555. Modes are:
  2556. @table @samp
  2557. @item 0, off
  2558. Disabled
  2559. @item 1, lle
  2560. Gain adjustment level at each sample
  2561. @item 2, pe
  2562. Samples where peak extend occurs
  2563. @item 3, cdt
  2564. Samples where the code detect timer is active
  2565. @item 4, tgm
  2566. Samples where the target gain does not match between channels
  2567. @end table
  2568. @end table
  2569. @section headphone
  2570. Apply head-related transfer functions (HRTFs) to create virtual
  2571. loudspeakers around the user for binaural listening via headphones.
  2572. The HRIRs are provided via additional streams, for each channel
  2573. one stereo input stream is needed.
  2574. The filter accepts the following options:
  2575. @table @option
  2576. @item map
  2577. Set mapping of input streams for convolution.
  2578. The argument is a '|'-separated list of channel names in order as they
  2579. are given as additional stream inputs for filter.
  2580. This also specify number of input streams. Number of input streams
  2581. must be not less than number of channels in first stream plus one.
  2582. @item gain
  2583. Set gain applied to audio. Value is in dB. Default is 0.
  2584. @item type
  2585. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2586. processing audio in time domain which is slow.
  2587. @var{freq} is processing audio in frequency domain which is fast.
  2588. Default is @var{freq}.
  2589. @item lfe
  2590. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2591. @item size
  2592. Set size of frame in number of samples which will be processed at once.
  2593. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2594. @item hrir
  2595. Set format of hrir stream.
  2596. Default value is @var{stereo}. Alternative value is @var{multich}.
  2597. If value is set to @var{stereo}, number of additional streams should
  2598. be greater or equal to number of input channels in first input stream.
  2599. Also each additional stream should have stereo number of channels.
  2600. If value is set to @var{multich}, number of additional streams should
  2601. be exactly one. Also number of input channels of additional stream
  2602. should be equal or greater than twice number of channels of first input
  2603. stream.
  2604. @end table
  2605. @subsection Examples
  2606. @itemize
  2607. @item
  2608. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2609. each amovie filter use stereo file with IR coefficients as input.
  2610. The files give coefficients for each position of virtual loudspeaker:
  2611. @example
  2612. 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"
  2613. output.wav
  2614. @end example
  2615. @item
  2616. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2617. but now in @var{multich} @var{hrir} format.
  2618. @example
  2619. 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"
  2620. output.wav
  2621. @end example
  2622. @end itemize
  2623. @section highpass
  2624. Apply a high-pass filter with 3dB point frequency.
  2625. The filter can be either single-pole, or double-pole (the default).
  2626. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2627. The filter accepts the following options:
  2628. @table @option
  2629. @item frequency, f
  2630. Set frequency in Hz. Default is 3000.
  2631. @item poles, p
  2632. Set number of poles. Default is 2.
  2633. @item width_type, t
  2634. Set method to specify band-width of filter.
  2635. @table @option
  2636. @item h
  2637. Hz
  2638. @item q
  2639. Q-Factor
  2640. @item o
  2641. octave
  2642. @item s
  2643. slope
  2644. @item k
  2645. kHz
  2646. @end table
  2647. @item width, w
  2648. Specify the band-width of a filter in width_type units.
  2649. Applies only to double-pole filter.
  2650. The default is 0.707q and gives a Butterworth response.
  2651. @item channels, c
  2652. Specify which channels to filter, by default all available are filtered.
  2653. @end table
  2654. @subsection Commands
  2655. This filter supports the following commands:
  2656. @table @option
  2657. @item frequency, f
  2658. Change highpass frequency.
  2659. Syntax for the command is : "@var{frequency}"
  2660. @item width_type, t
  2661. Change highpass width_type.
  2662. Syntax for the command is : "@var{width_type}"
  2663. @item width, w
  2664. Change highpass width.
  2665. Syntax for the command is : "@var{width}"
  2666. @end table
  2667. @section join
  2668. Join multiple input streams into one multi-channel stream.
  2669. It accepts the following parameters:
  2670. @table @option
  2671. @item inputs
  2672. The number of input streams. It defaults to 2.
  2673. @item channel_layout
  2674. The desired output channel layout. It defaults to stereo.
  2675. @item map
  2676. Map channels from inputs to output. The argument is a '|'-separated list of
  2677. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2678. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2679. can be either the name of the input channel (e.g. FL for front left) or its
  2680. index in the specified input stream. @var{out_channel} is the name of the output
  2681. channel.
  2682. @end table
  2683. The filter will attempt to guess the mappings when they are not specified
  2684. explicitly. It does so by first trying to find an unused matching input channel
  2685. and if that fails it picks the first unused input channel.
  2686. Join 3 inputs (with properly set channel layouts):
  2687. @example
  2688. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2689. @end example
  2690. Build a 5.1 output from 6 single-channel streams:
  2691. @example
  2692. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2693. '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'
  2694. out
  2695. @end example
  2696. @section ladspa
  2697. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2698. To enable compilation of this filter you need to configure FFmpeg with
  2699. @code{--enable-ladspa}.
  2700. @table @option
  2701. @item file, f
  2702. Specifies the name of LADSPA plugin library to load. If the environment
  2703. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2704. each one of the directories specified by the colon separated list in
  2705. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2706. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2707. @file{/usr/lib/ladspa/}.
  2708. @item plugin, p
  2709. Specifies the plugin within the library. Some libraries contain only
  2710. one plugin, but others contain many of them. If this is not set filter
  2711. will list all available plugins within the specified library.
  2712. @item controls, c
  2713. Set the '|' separated list of controls which are zero or more floating point
  2714. values that determine the behavior of the loaded plugin (for example delay,
  2715. threshold or gain).
  2716. Controls need to be defined using the following syntax:
  2717. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2718. @var{valuei} is the value set on the @var{i}-th control.
  2719. Alternatively they can be also defined using the following syntax:
  2720. @var{value0}|@var{value1}|@var{value2}|..., where
  2721. @var{valuei} is the value set on the @var{i}-th control.
  2722. If @option{controls} is set to @code{help}, all available controls and
  2723. their valid ranges are printed.
  2724. @item sample_rate, s
  2725. Specify the sample rate, default to 44100. Only used if plugin have
  2726. zero inputs.
  2727. @item nb_samples, n
  2728. Set the number of samples per channel per each output frame, default
  2729. is 1024. Only used if plugin have zero inputs.
  2730. @item duration, d
  2731. Set the minimum duration of the sourced audio. See
  2732. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2733. for the accepted syntax.
  2734. Note that the resulting duration may be greater than the specified duration,
  2735. as the generated audio is always cut at the end of a complete frame.
  2736. If not specified, or the expressed duration is negative, the audio is
  2737. supposed to be generated forever.
  2738. Only used if plugin have zero inputs.
  2739. @end table
  2740. @subsection Examples
  2741. @itemize
  2742. @item
  2743. List all available plugins within amp (LADSPA example plugin) library:
  2744. @example
  2745. ladspa=file=amp
  2746. @end example
  2747. @item
  2748. List all available controls and their valid ranges for @code{vcf_notch}
  2749. plugin from @code{VCF} library:
  2750. @example
  2751. ladspa=f=vcf:p=vcf_notch:c=help
  2752. @end example
  2753. @item
  2754. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2755. plugin library:
  2756. @example
  2757. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2758. @end example
  2759. @item
  2760. Add reverberation to the audio using TAP-plugins
  2761. (Tom's Audio Processing plugins):
  2762. @example
  2763. ladspa=file=tap_reverb:tap_reverb
  2764. @end example
  2765. @item
  2766. Generate white noise, with 0.2 amplitude:
  2767. @example
  2768. ladspa=file=cmt:noise_source_white:c=c0=.2
  2769. @end example
  2770. @item
  2771. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2772. @code{C* Audio Plugin Suite} (CAPS) library:
  2773. @example
  2774. ladspa=file=caps:Click:c=c1=20'
  2775. @end example
  2776. @item
  2777. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2778. @example
  2779. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2780. @end example
  2781. @item
  2782. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2783. @code{SWH Plugins} collection:
  2784. @example
  2785. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2786. @end example
  2787. @item
  2788. Attenuate low frequencies using Multiband EQ from Steve Harris
  2789. @code{SWH Plugins} collection:
  2790. @example
  2791. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2792. @end example
  2793. @item
  2794. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2795. (CAPS) library:
  2796. @example
  2797. ladspa=caps:Narrower
  2798. @end example
  2799. @item
  2800. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2801. @example
  2802. ladspa=caps:White:.2
  2803. @end example
  2804. @item
  2805. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2806. @example
  2807. ladspa=caps:Fractal:c=c1=1
  2808. @end example
  2809. @item
  2810. Dynamic volume normalization using @code{VLevel} plugin:
  2811. @example
  2812. ladspa=vlevel-ladspa:vlevel_mono
  2813. @end example
  2814. @end itemize
  2815. @subsection Commands
  2816. This filter supports the following commands:
  2817. @table @option
  2818. @item cN
  2819. Modify the @var{N}-th control value.
  2820. If the specified value is not valid, it is ignored and prior one is kept.
  2821. @end table
  2822. @section loudnorm
  2823. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2824. Support for both single pass (livestreams, files) and double pass (files) modes.
  2825. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2826. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2827. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2828. The filter accepts the following options:
  2829. @table @option
  2830. @item I, i
  2831. Set integrated loudness target.
  2832. Range is -70.0 - -5.0. Default value is -24.0.
  2833. @item LRA, lra
  2834. Set loudness range target.
  2835. Range is 1.0 - 20.0. Default value is 7.0.
  2836. @item TP, tp
  2837. Set maximum true peak.
  2838. Range is -9.0 - +0.0. Default value is -2.0.
  2839. @item measured_I, measured_i
  2840. Measured IL of input file.
  2841. Range is -99.0 - +0.0.
  2842. @item measured_LRA, measured_lra
  2843. Measured LRA of input file.
  2844. Range is 0.0 - 99.0.
  2845. @item measured_TP, measured_tp
  2846. Measured true peak of input file.
  2847. Range is -99.0 - +99.0.
  2848. @item measured_thresh
  2849. Measured threshold of input file.
  2850. Range is -99.0 - +0.0.
  2851. @item offset
  2852. Set offset gain. Gain is applied before the true-peak limiter.
  2853. Range is -99.0 - +99.0. Default is +0.0.
  2854. @item linear
  2855. Normalize linearly if possible.
  2856. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2857. to be specified in order to use this mode.
  2858. Options are true or false. Default is true.
  2859. @item dual_mono
  2860. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2861. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2862. If set to @code{true}, this option will compensate for this effect.
  2863. Multi-channel input files are not affected by this option.
  2864. Options are true or false. Default is false.
  2865. @item print_format
  2866. Set print format for stats. Options are summary, json, or none.
  2867. Default value is none.
  2868. @end table
  2869. @section lowpass
  2870. Apply a low-pass filter with 3dB point frequency.
  2871. The filter can be either single-pole or double-pole (the default).
  2872. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2873. The filter accepts the following options:
  2874. @table @option
  2875. @item frequency, f
  2876. Set frequency in Hz. Default is 500.
  2877. @item poles, p
  2878. Set number of poles. Default is 2.
  2879. @item width_type, t
  2880. Set method to specify band-width of filter.
  2881. @table @option
  2882. @item h
  2883. Hz
  2884. @item q
  2885. Q-Factor
  2886. @item o
  2887. octave
  2888. @item s
  2889. slope
  2890. @item k
  2891. kHz
  2892. @end table
  2893. @item width, w
  2894. Specify the band-width of a filter in width_type units.
  2895. Applies only to double-pole filter.
  2896. The default is 0.707q and gives a Butterworth response.
  2897. @item channels, c
  2898. Specify which channels to filter, by default all available are filtered.
  2899. @end table
  2900. @subsection Examples
  2901. @itemize
  2902. @item
  2903. Lowpass only LFE channel, it LFE is not present it does nothing:
  2904. @example
  2905. lowpass=c=LFE
  2906. @end example
  2907. @end itemize
  2908. @subsection Commands
  2909. This filter supports the following commands:
  2910. @table @option
  2911. @item frequency, f
  2912. Change lowpass frequency.
  2913. Syntax for the command is : "@var{frequency}"
  2914. @item width_type, t
  2915. Change lowpass width_type.
  2916. Syntax for the command is : "@var{width_type}"
  2917. @item width, w
  2918. Change lowpass width.
  2919. Syntax for the command is : "@var{width}"
  2920. @end table
  2921. @section lv2
  2922. Load a LV2 (LADSPA Version 2) plugin.
  2923. To enable compilation of this filter you need to configure FFmpeg with
  2924. @code{--enable-lv2}.
  2925. @table @option
  2926. @item plugin, p
  2927. Specifies the plugin URI. You may need to escape ':'.
  2928. @item controls, c
  2929. Set the '|' separated list of controls which are zero or more floating point
  2930. values that determine the behavior of the loaded plugin (for example delay,
  2931. threshold or gain).
  2932. If @option{controls} is set to @code{help}, all available controls and
  2933. their valid ranges are printed.
  2934. @item sample_rate, s
  2935. Specify the sample rate, default to 44100. Only used if plugin have
  2936. zero inputs.
  2937. @item nb_samples, n
  2938. Set the number of samples per channel per each output frame, default
  2939. is 1024. Only used if plugin have zero inputs.
  2940. @item duration, d
  2941. Set the minimum duration of the sourced audio. See
  2942. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2943. for the accepted syntax.
  2944. Note that the resulting duration may be greater than the specified duration,
  2945. as the generated audio is always cut at the end of a complete frame.
  2946. If not specified, or the expressed duration is negative, the audio is
  2947. supposed to be generated forever.
  2948. Only used if plugin have zero inputs.
  2949. @end table
  2950. @subsection Examples
  2951. @itemize
  2952. @item
  2953. Apply bass enhancer plugin from Calf:
  2954. @example
  2955. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2956. @end example
  2957. @item
  2958. Apply vinyl plugin from Calf:
  2959. @example
  2960. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2961. @end example
  2962. @item
  2963. Apply bit crusher plugin from ArtyFX:
  2964. @example
  2965. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2966. @end example
  2967. @end itemize
  2968. @section mcompand
  2969. Multiband Compress or expand the audio's dynamic range.
  2970. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2971. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2972. response when absent compander action.
  2973. It accepts the following parameters:
  2974. @table @option
  2975. @item args
  2976. This option syntax is:
  2977. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2978. For explanation of each item refer to compand filter documentation.
  2979. @end table
  2980. @anchor{pan}
  2981. @section pan
  2982. Mix channels with specific gain levels. The filter accepts the output
  2983. channel layout followed by a set of channels definitions.
  2984. This filter is also designed to efficiently remap the channels of an audio
  2985. stream.
  2986. The filter accepts parameters of the form:
  2987. "@var{l}|@var{outdef}|@var{outdef}|..."
  2988. @table @option
  2989. @item l
  2990. output channel layout or number of channels
  2991. @item outdef
  2992. output channel specification, of the form:
  2993. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2994. @item out_name
  2995. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2996. number (c0, c1, etc.)
  2997. @item gain
  2998. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2999. @item in_name
  3000. input channel to use, see out_name for details; it is not possible to mix
  3001. named and numbered input channels
  3002. @end table
  3003. If the `=' in a channel specification is replaced by `<', then the gains for
  3004. that specification will be renormalized so that the total is 1, thus
  3005. avoiding clipping noise.
  3006. @subsection Mixing examples
  3007. For example, if you want to down-mix from stereo to mono, but with a bigger
  3008. factor for the left channel:
  3009. @example
  3010. pan=1c|c0=0.9*c0+0.1*c1
  3011. @end example
  3012. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3013. 7-channels surround:
  3014. @example
  3015. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3016. @end example
  3017. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3018. that should be preferred (see "-ac" option) unless you have very specific
  3019. needs.
  3020. @subsection Remapping examples
  3021. The channel remapping will be effective if, and only if:
  3022. @itemize
  3023. @item gain coefficients are zeroes or ones,
  3024. @item only one input per channel output,
  3025. @end itemize
  3026. If all these conditions are satisfied, the filter will notify the user ("Pure
  3027. channel mapping detected"), and use an optimized and lossless method to do the
  3028. remapping.
  3029. For example, if you have a 5.1 source and want a stereo audio stream by
  3030. dropping the extra channels:
  3031. @example
  3032. pan="stereo| c0=FL | c1=FR"
  3033. @end example
  3034. Given the same source, you can also switch front left and front right channels
  3035. and keep the input channel layout:
  3036. @example
  3037. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3038. @end example
  3039. If the input is a stereo audio stream, you can mute the front left channel (and
  3040. still keep the stereo channel layout) with:
  3041. @example
  3042. pan="stereo|c1=c1"
  3043. @end example
  3044. Still with a stereo audio stream input, you can copy the right channel in both
  3045. front left and right:
  3046. @example
  3047. pan="stereo| c0=FR | c1=FR"
  3048. @end example
  3049. @section replaygain
  3050. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3051. outputs it unchanged.
  3052. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3053. @section resample
  3054. Convert the audio sample format, sample rate and channel layout. It is
  3055. not meant to be used directly.
  3056. @section rubberband
  3057. Apply time-stretching and pitch-shifting with librubberband.
  3058. To enable compilation of this filter, you need to configure FFmpeg with
  3059. @code{--enable-librubberband}.
  3060. The filter accepts the following options:
  3061. @table @option
  3062. @item tempo
  3063. Set tempo scale factor.
  3064. @item pitch
  3065. Set pitch scale factor.
  3066. @item transients
  3067. Set transients detector.
  3068. Possible values are:
  3069. @table @var
  3070. @item crisp
  3071. @item mixed
  3072. @item smooth
  3073. @end table
  3074. @item detector
  3075. Set detector.
  3076. Possible values are:
  3077. @table @var
  3078. @item compound
  3079. @item percussive
  3080. @item soft
  3081. @end table
  3082. @item phase
  3083. Set phase.
  3084. Possible values are:
  3085. @table @var
  3086. @item laminar
  3087. @item independent
  3088. @end table
  3089. @item window
  3090. Set processing window size.
  3091. Possible values are:
  3092. @table @var
  3093. @item standard
  3094. @item short
  3095. @item long
  3096. @end table
  3097. @item smoothing
  3098. Set smoothing.
  3099. Possible values are:
  3100. @table @var
  3101. @item off
  3102. @item on
  3103. @end table
  3104. @item formant
  3105. Enable formant preservation when shift pitching.
  3106. Possible values are:
  3107. @table @var
  3108. @item shifted
  3109. @item preserved
  3110. @end table
  3111. @item pitchq
  3112. Set pitch quality.
  3113. Possible values are:
  3114. @table @var
  3115. @item quality
  3116. @item speed
  3117. @item consistency
  3118. @end table
  3119. @item channels
  3120. Set channels.
  3121. Possible values are:
  3122. @table @var
  3123. @item apart
  3124. @item together
  3125. @end table
  3126. @end table
  3127. @section sidechaincompress
  3128. This filter acts like normal compressor but has the ability to compress
  3129. detected signal using second input signal.
  3130. It needs two input streams and returns one output stream.
  3131. First input stream will be processed depending on second stream signal.
  3132. The filtered signal then can be filtered with other filters in later stages of
  3133. processing. See @ref{pan} and @ref{amerge} filter.
  3134. The filter accepts the following options:
  3135. @table @option
  3136. @item level_in
  3137. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3138. @item threshold
  3139. If a signal of second stream raises above this level it will affect the gain
  3140. reduction of first stream.
  3141. By default is 0.125. Range is between 0.00097563 and 1.
  3142. @item ratio
  3143. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3144. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3145. Default is 2. Range is between 1 and 20.
  3146. @item attack
  3147. Amount of milliseconds the signal has to rise above the threshold before gain
  3148. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3149. @item release
  3150. Amount of milliseconds the signal has to fall below the threshold before
  3151. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3152. @item makeup
  3153. Set the amount by how much signal will be amplified after processing.
  3154. Default is 1. Range is from 1 to 64.
  3155. @item knee
  3156. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3157. Default is 2.82843. Range is between 1 and 8.
  3158. @item link
  3159. Choose if the @code{average} level between all channels of side-chain stream
  3160. or the louder(@code{maximum}) channel of side-chain stream affects the
  3161. reduction. Default is @code{average}.
  3162. @item detection
  3163. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3164. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3165. @item level_sc
  3166. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3167. @item mix
  3168. How much to use compressed signal in output. Default is 1.
  3169. Range is between 0 and 1.
  3170. @end table
  3171. @subsection Examples
  3172. @itemize
  3173. @item
  3174. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3175. depending on the signal of 2nd input and later compressed signal to be
  3176. merged with 2nd input:
  3177. @example
  3178. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3179. @end example
  3180. @end itemize
  3181. @section sidechaingate
  3182. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3183. filter the detected signal before sending it to the gain reduction stage.
  3184. Normally a gate uses the full range signal to detect a level above the
  3185. threshold.
  3186. For example: If you cut all lower frequencies from your sidechain signal
  3187. the gate will decrease the volume of your track only if not enough highs
  3188. appear. With this technique you are able to reduce the resonation of a
  3189. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3190. guitar.
  3191. It needs two input streams and returns one output stream.
  3192. First input stream will be processed depending on second stream signal.
  3193. The filter accepts the following options:
  3194. @table @option
  3195. @item level_in
  3196. Set input level before filtering.
  3197. Default is 1. Allowed range is from 0.015625 to 64.
  3198. @item range
  3199. Set the level of gain reduction when the signal is below the threshold.
  3200. Default is 0.06125. Allowed range is from 0 to 1.
  3201. @item threshold
  3202. If a signal rises above this level the gain reduction is released.
  3203. Default is 0.125. Allowed range is from 0 to 1.
  3204. @item ratio
  3205. Set a ratio about which the signal is reduced.
  3206. Default is 2. Allowed range is from 1 to 9000.
  3207. @item attack
  3208. Amount of milliseconds the signal has to rise above the threshold before gain
  3209. reduction stops.
  3210. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3211. @item release
  3212. Amount of milliseconds the signal has to fall below the threshold before the
  3213. reduction is increased again. Default is 250 milliseconds.
  3214. Allowed range is from 0.01 to 9000.
  3215. @item makeup
  3216. Set amount of amplification of signal after processing.
  3217. Default is 1. Allowed range is from 1 to 64.
  3218. @item knee
  3219. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3220. Default is 2.828427125. Allowed range is from 1 to 8.
  3221. @item detection
  3222. Choose if exact signal should be taken for detection or an RMS like one.
  3223. Default is rms. Can be peak or rms.
  3224. @item link
  3225. Choose if the average level between all channels or the louder channel affects
  3226. the reduction.
  3227. Default is average. Can be average or maximum.
  3228. @item level_sc
  3229. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3230. @end table
  3231. @section silencedetect
  3232. Detect silence in an audio stream.
  3233. This filter logs a message when it detects that the input audio volume is less
  3234. or equal to a noise tolerance value for a duration greater or equal to the
  3235. minimum detected noise duration.
  3236. The printed times and duration are expressed in seconds.
  3237. The filter accepts the following options:
  3238. @table @option
  3239. @item duration, d
  3240. Set silence duration until notification (default is 2 seconds).
  3241. @item noise, n
  3242. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3243. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3244. @end table
  3245. @subsection Examples
  3246. @itemize
  3247. @item
  3248. Detect 5 seconds of silence with -50dB noise tolerance:
  3249. @example
  3250. silencedetect=n=-50dB:d=5
  3251. @end example
  3252. @item
  3253. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3254. tolerance in @file{silence.mp3}:
  3255. @example
  3256. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3257. @end example
  3258. @end itemize
  3259. @section silenceremove
  3260. Remove silence from the beginning, middle or end of the audio.
  3261. The filter accepts the following options:
  3262. @table @option
  3263. @item start_periods
  3264. This value is used to indicate if audio should be trimmed at beginning of
  3265. the audio. A value of zero indicates no silence should be trimmed from the
  3266. beginning. When specifying a non-zero value, it trims audio up until it
  3267. finds non-silence. Normally, when trimming silence from beginning of audio
  3268. the @var{start_periods} will be @code{1} but it can be increased to higher
  3269. values to trim all audio up to specific count of non-silence periods.
  3270. Default value is @code{0}.
  3271. @item start_duration
  3272. Specify the amount of time that non-silence must be detected before it stops
  3273. trimming audio. By increasing the duration, bursts of noises can be treated
  3274. as silence and trimmed off. Default value is @code{0}.
  3275. @item start_threshold
  3276. This indicates what sample value should be treated as silence. For digital
  3277. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3278. you may wish to increase the value to account for background noise.
  3279. Can be specified in dB (in case "dB" is appended to the specified value)
  3280. or amplitude ratio. Default value is @code{0}.
  3281. @item stop_periods
  3282. Set the count for trimming silence from the end of audio.
  3283. To remove silence from the middle of a file, specify a @var{stop_periods}
  3284. that is negative. This value is then treated as a positive value and is
  3285. used to indicate the effect should restart processing as specified by
  3286. @var{start_periods}, making it suitable for removing periods of silence
  3287. in the middle of the audio.
  3288. Default value is @code{0}.
  3289. @item stop_duration
  3290. Specify a duration of silence that must exist before audio is not copied any
  3291. more. By specifying a higher duration, silence that is wanted can be left in
  3292. the audio.
  3293. Default value is @code{0}.
  3294. @item stop_threshold
  3295. This is the same as @option{start_threshold} but for trimming silence from
  3296. the end of audio.
  3297. Can be specified in dB (in case "dB" is appended to the specified value)
  3298. or amplitude ratio. Default value is @code{0}.
  3299. @item leave_silence
  3300. This indicates that @var{stop_duration} length of audio should be left intact
  3301. at the beginning of each period of silence.
  3302. For example, if you want to remove long pauses between words but do not want
  3303. to remove the pauses completely. Default value is @code{0}.
  3304. @item detection
  3305. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3306. and works better with digital silence which is exactly 0.
  3307. Default value is @code{rms}.
  3308. @item window
  3309. Set ratio used to calculate size of window for detecting silence.
  3310. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3311. @end table
  3312. @subsection Examples
  3313. @itemize
  3314. @item
  3315. The following example shows how this filter can be used to start a recording
  3316. that does not contain the delay at the start which usually occurs between
  3317. pressing the record button and the start of the performance:
  3318. @example
  3319. silenceremove=1:5:0.02
  3320. @end example
  3321. @item
  3322. Trim all silence encountered from beginning to end where there is more than 1
  3323. second of silence in audio:
  3324. @example
  3325. silenceremove=0:0:0:-1:1:-90dB
  3326. @end example
  3327. @end itemize
  3328. @section sofalizer
  3329. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3330. loudspeakers around the user for binaural listening via headphones (audio
  3331. formats up to 9 channels supported).
  3332. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3333. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3334. Austrian Academy of Sciences.
  3335. To enable compilation of this filter you need to configure FFmpeg with
  3336. @code{--enable-libmysofa}.
  3337. The filter accepts the following options:
  3338. @table @option
  3339. @item sofa
  3340. Set the SOFA file used for rendering.
  3341. @item gain
  3342. Set gain applied to audio. Value is in dB. Default is 0.
  3343. @item rotation
  3344. Set rotation of virtual loudspeakers in deg. Default is 0.
  3345. @item elevation
  3346. Set elevation of virtual speakers in deg. Default is 0.
  3347. @item radius
  3348. Set distance in meters between loudspeakers and the listener with near-field
  3349. HRTFs. Default is 1.
  3350. @item type
  3351. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3352. processing audio in time domain which is slow.
  3353. @var{freq} is processing audio in frequency domain which is fast.
  3354. Default is @var{freq}.
  3355. @item speakers
  3356. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3357. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3358. Each virtual loudspeaker is described with short channel name following with
  3359. azimuth and elevation in degrees.
  3360. Each virtual loudspeaker description is separated by '|'.
  3361. For example to override front left and front right channel positions use:
  3362. 'speakers=FL 45 15|FR 345 15'.
  3363. Descriptions with unrecognised channel names are ignored.
  3364. @item lfegain
  3365. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3366. @end table
  3367. @subsection Examples
  3368. @itemize
  3369. @item
  3370. Using ClubFritz6 sofa file:
  3371. @example
  3372. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3373. @end example
  3374. @item
  3375. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3376. @example
  3377. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3378. @end example
  3379. @item
  3380. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3381. and also with custom gain:
  3382. @example
  3383. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3384. @end example
  3385. @end itemize
  3386. @section stereotools
  3387. This filter has some handy utilities to manage stereo signals, for converting
  3388. M/S stereo recordings to L/R signal while having control over the parameters
  3389. or spreading the stereo image of master track.
  3390. The filter accepts the following options:
  3391. @table @option
  3392. @item level_in
  3393. Set input level before filtering for both channels. Defaults is 1.
  3394. Allowed range is from 0.015625 to 64.
  3395. @item level_out
  3396. Set output level after filtering for both channels. Defaults is 1.
  3397. Allowed range is from 0.015625 to 64.
  3398. @item balance_in
  3399. Set input balance between both channels. Default is 0.
  3400. Allowed range is from -1 to 1.
  3401. @item balance_out
  3402. Set output balance between both channels. Default is 0.
  3403. Allowed range is from -1 to 1.
  3404. @item softclip
  3405. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3406. clipping. Disabled by default.
  3407. @item mutel
  3408. Mute the left channel. Disabled by default.
  3409. @item muter
  3410. Mute the right channel. Disabled by default.
  3411. @item phasel
  3412. Change the phase of the left channel. Disabled by default.
  3413. @item phaser
  3414. Change the phase of the right channel. Disabled by default.
  3415. @item mode
  3416. Set stereo mode. Available values are:
  3417. @table @samp
  3418. @item lr>lr
  3419. Left/Right to Left/Right, this is default.
  3420. @item lr>ms
  3421. Left/Right to Mid/Side.
  3422. @item ms>lr
  3423. Mid/Side to Left/Right.
  3424. @item lr>ll
  3425. Left/Right to Left/Left.
  3426. @item lr>rr
  3427. Left/Right to Right/Right.
  3428. @item lr>l+r
  3429. Left/Right to Left + Right.
  3430. @item lr>rl
  3431. Left/Right to Right/Left.
  3432. @item ms>ll
  3433. Mid/Side to Left/Left.
  3434. @item ms>rr
  3435. Mid/Side to Right/Right.
  3436. @end table
  3437. @item slev
  3438. Set level of side signal. Default is 1.
  3439. Allowed range is from 0.015625 to 64.
  3440. @item sbal
  3441. Set balance of side signal. Default is 0.
  3442. Allowed range is from -1 to 1.
  3443. @item mlev
  3444. Set level of the middle signal. Default is 1.
  3445. Allowed range is from 0.015625 to 64.
  3446. @item mpan
  3447. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3448. @item base
  3449. Set stereo base between mono and inversed channels. Default is 0.
  3450. Allowed range is from -1 to 1.
  3451. @item delay
  3452. Set delay in milliseconds how much to delay left from right channel and
  3453. vice versa. Default is 0. Allowed range is from -20 to 20.
  3454. @item sclevel
  3455. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3456. @item phase
  3457. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3458. @item bmode_in, bmode_out
  3459. Set balance mode for balance_in/balance_out option.
  3460. Can be one of the following:
  3461. @table @samp
  3462. @item balance
  3463. Classic balance mode. Attenuate one channel at time.
  3464. Gain is raised up to 1.
  3465. @item amplitude
  3466. Similar as classic mode above but gain is raised up to 2.
  3467. @item power
  3468. Equal power distribution, from -6dB to +6dB range.
  3469. @end table
  3470. @end table
  3471. @subsection Examples
  3472. @itemize
  3473. @item
  3474. Apply karaoke like effect:
  3475. @example
  3476. stereotools=mlev=0.015625
  3477. @end example
  3478. @item
  3479. Convert M/S signal to L/R:
  3480. @example
  3481. "stereotools=mode=ms>lr"
  3482. @end example
  3483. @end itemize
  3484. @section stereowiden
  3485. This filter enhance the stereo effect by suppressing signal common to both
  3486. channels and by delaying the signal of left into right and vice versa,
  3487. thereby widening the stereo effect.
  3488. The filter accepts the following options:
  3489. @table @option
  3490. @item delay
  3491. Time in milliseconds of the delay of left signal into right and vice versa.
  3492. Default is 20 milliseconds.
  3493. @item feedback
  3494. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3495. effect of left signal in right output and vice versa which gives widening
  3496. effect. Default is 0.3.
  3497. @item crossfeed
  3498. Cross feed of left into right with inverted phase. This helps in suppressing
  3499. the mono. If the value is 1 it will cancel all the signal common to both
  3500. channels. Default is 0.3.
  3501. @item drymix
  3502. Set level of input signal of original channel. Default is 0.8.
  3503. @end table
  3504. @section superequalizer
  3505. Apply 18 band equalizer.
  3506. The filter accepts the following options:
  3507. @table @option
  3508. @item 1b
  3509. Set 65Hz band gain.
  3510. @item 2b
  3511. Set 92Hz band gain.
  3512. @item 3b
  3513. Set 131Hz band gain.
  3514. @item 4b
  3515. Set 185Hz band gain.
  3516. @item 5b
  3517. Set 262Hz band gain.
  3518. @item 6b
  3519. Set 370Hz band gain.
  3520. @item 7b
  3521. Set 523Hz band gain.
  3522. @item 8b
  3523. Set 740Hz band gain.
  3524. @item 9b
  3525. Set 1047Hz band gain.
  3526. @item 10b
  3527. Set 1480Hz band gain.
  3528. @item 11b
  3529. Set 2093Hz band gain.
  3530. @item 12b
  3531. Set 2960Hz band gain.
  3532. @item 13b
  3533. Set 4186Hz band gain.
  3534. @item 14b
  3535. Set 5920Hz band gain.
  3536. @item 15b
  3537. Set 8372Hz band gain.
  3538. @item 16b
  3539. Set 11840Hz band gain.
  3540. @item 17b
  3541. Set 16744Hz band gain.
  3542. @item 18b
  3543. Set 20000Hz band gain.
  3544. @end table
  3545. @section surround
  3546. Apply audio surround upmix filter.
  3547. This filter allows to produce multichannel output from audio stream.
  3548. The filter accepts the following options:
  3549. @table @option
  3550. @item chl_out
  3551. Set output channel layout. By default, this is @var{5.1}.
  3552. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3553. for the required syntax.
  3554. @item chl_in
  3555. Set input channel layout. By default, this is @var{stereo}.
  3556. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3557. for the required syntax.
  3558. @item level_in
  3559. Set input volume level. By default, this is @var{1}.
  3560. @item level_out
  3561. Set output volume level. By default, this is @var{1}.
  3562. @item lfe
  3563. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3564. @item lfe_low
  3565. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3566. @item lfe_high
  3567. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3568. @item fc_in
  3569. Set front center input volume. By default, this is @var{1}.
  3570. @item fc_out
  3571. Set front center output volume. By default, this is @var{1}.
  3572. @item lfe_in
  3573. Set LFE input volume. By default, this is @var{1}.
  3574. @item lfe_out
  3575. Set LFE output volume. By default, this is @var{1}.
  3576. @end table
  3577. @section treble, highshelf
  3578. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3579. shelving filter with a response similar to that of a standard
  3580. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3581. The filter accepts the following options:
  3582. @table @option
  3583. @item gain, g
  3584. Give the gain at whichever is the lower of ~22 kHz and the
  3585. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3586. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3587. @item frequency, f
  3588. Set the filter's central frequency and so can be used
  3589. to extend or reduce the frequency range to be boosted or cut.
  3590. The default value is @code{3000} Hz.
  3591. @item width_type, t
  3592. Set method to specify band-width of filter.
  3593. @table @option
  3594. @item h
  3595. Hz
  3596. @item q
  3597. Q-Factor
  3598. @item o
  3599. octave
  3600. @item s
  3601. slope
  3602. @item k
  3603. kHz
  3604. @end table
  3605. @item width, w
  3606. Determine how steep is the filter's shelf transition.
  3607. @item channels, c
  3608. Specify which channels to filter, by default all available are filtered.
  3609. @end table
  3610. @subsection Commands
  3611. This filter supports the following commands:
  3612. @table @option
  3613. @item frequency, f
  3614. Change treble frequency.
  3615. Syntax for the command is : "@var{frequency}"
  3616. @item width_type, t
  3617. Change treble width_type.
  3618. Syntax for the command is : "@var{width_type}"
  3619. @item width, w
  3620. Change treble width.
  3621. Syntax for the command is : "@var{width}"
  3622. @item gain, g
  3623. Change treble gain.
  3624. Syntax for the command is : "@var{gain}"
  3625. @end table
  3626. @section tremolo
  3627. Sinusoidal amplitude modulation.
  3628. The filter accepts the following options:
  3629. @table @option
  3630. @item f
  3631. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3632. (20 Hz or lower) will result in a tremolo effect.
  3633. This filter may also be used as a ring modulator by specifying
  3634. a modulation frequency higher than 20 Hz.
  3635. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3636. @item d
  3637. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3638. Default value is 0.5.
  3639. @end table
  3640. @section vibrato
  3641. Sinusoidal phase modulation.
  3642. The filter accepts the following options:
  3643. @table @option
  3644. @item f
  3645. Modulation frequency in Hertz.
  3646. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3647. @item d
  3648. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3649. Default value is 0.5.
  3650. @end table
  3651. @section volume
  3652. Adjust the input audio volume.
  3653. It accepts the following parameters:
  3654. @table @option
  3655. @item volume
  3656. Set audio volume expression.
  3657. Output values are clipped to the maximum value.
  3658. The output audio volume is given by the relation:
  3659. @example
  3660. @var{output_volume} = @var{volume} * @var{input_volume}
  3661. @end example
  3662. The default value for @var{volume} is "1.0".
  3663. @item precision
  3664. This parameter represents the mathematical precision.
  3665. It determines which input sample formats will be allowed, which affects the
  3666. precision of the volume scaling.
  3667. @table @option
  3668. @item fixed
  3669. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3670. @item float
  3671. 32-bit floating-point; this limits input sample format to FLT. (default)
  3672. @item double
  3673. 64-bit floating-point; this limits input sample format to DBL.
  3674. @end table
  3675. @item replaygain
  3676. Choose the behaviour on encountering ReplayGain side data in input frames.
  3677. @table @option
  3678. @item drop
  3679. Remove ReplayGain side data, ignoring its contents (the default).
  3680. @item ignore
  3681. Ignore ReplayGain side data, but leave it in the frame.
  3682. @item track
  3683. Prefer the track gain, if present.
  3684. @item album
  3685. Prefer the album gain, if present.
  3686. @end table
  3687. @item replaygain_preamp
  3688. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3689. Default value for @var{replaygain_preamp} is 0.0.
  3690. @item eval
  3691. Set when the volume expression is evaluated.
  3692. It accepts the following values:
  3693. @table @samp
  3694. @item once
  3695. only evaluate expression once during the filter initialization, or
  3696. when the @samp{volume} command is sent
  3697. @item frame
  3698. evaluate expression for each incoming frame
  3699. @end table
  3700. Default value is @samp{once}.
  3701. @end table
  3702. The volume expression can contain the following parameters.
  3703. @table @option
  3704. @item n
  3705. frame number (starting at zero)
  3706. @item nb_channels
  3707. number of channels
  3708. @item nb_consumed_samples
  3709. number of samples consumed by the filter
  3710. @item nb_samples
  3711. number of samples in the current frame
  3712. @item pos
  3713. original frame position in the file
  3714. @item pts
  3715. frame PTS
  3716. @item sample_rate
  3717. sample rate
  3718. @item startpts
  3719. PTS at start of stream
  3720. @item startt
  3721. time at start of stream
  3722. @item t
  3723. frame time
  3724. @item tb
  3725. timestamp timebase
  3726. @item volume
  3727. last set volume value
  3728. @end table
  3729. Note that when @option{eval} is set to @samp{once} only the
  3730. @var{sample_rate} and @var{tb} variables are available, all other
  3731. variables will evaluate to NAN.
  3732. @subsection Commands
  3733. This filter supports the following commands:
  3734. @table @option
  3735. @item volume
  3736. Modify the volume expression.
  3737. The command accepts the same syntax of the corresponding option.
  3738. If the specified expression is not valid, it is kept at its current
  3739. value.
  3740. @item replaygain_noclip
  3741. Prevent clipping by limiting the gain applied.
  3742. Default value for @var{replaygain_noclip} is 1.
  3743. @end table
  3744. @subsection Examples
  3745. @itemize
  3746. @item
  3747. Halve the input audio volume:
  3748. @example
  3749. volume=volume=0.5
  3750. volume=volume=1/2
  3751. volume=volume=-6.0206dB
  3752. @end example
  3753. In all the above example the named key for @option{volume} can be
  3754. omitted, for example like in:
  3755. @example
  3756. volume=0.5
  3757. @end example
  3758. @item
  3759. Increase input audio power by 6 decibels using fixed-point precision:
  3760. @example
  3761. volume=volume=6dB:precision=fixed
  3762. @end example
  3763. @item
  3764. Fade volume after time 10 with an annihilation period of 5 seconds:
  3765. @example
  3766. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3767. @end example
  3768. @end itemize
  3769. @section volumedetect
  3770. Detect the volume of the input video.
  3771. The filter has no parameters. The input is not modified. Statistics about
  3772. the volume will be printed in the log when the input stream end is reached.
  3773. In particular it will show the mean volume (root mean square), maximum
  3774. volume (on a per-sample basis), and the beginning of a histogram of the
  3775. registered volume values (from the maximum value to a cumulated 1/1000 of
  3776. the samples).
  3777. All volumes are in decibels relative to the maximum PCM value.
  3778. @subsection Examples
  3779. Here is an excerpt of the output:
  3780. @example
  3781. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3782. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3783. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3784. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3785. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3786. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3787. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3788. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3789. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3790. @end example
  3791. It means that:
  3792. @itemize
  3793. @item
  3794. The mean square energy is approximately -27 dB, or 10^-2.7.
  3795. @item
  3796. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3797. @item
  3798. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3799. @end itemize
  3800. In other words, raising the volume by +4 dB does not cause any clipping,
  3801. raising it by +5 dB causes clipping for 6 samples, etc.
  3802. @c man end AUDIO FILTERS
  3803. @chapter Audio Sources
  3804. @c man begin AUDIO SOURCES
  3805. Below is a description of the currently available audio sources.
  3806. @section abuffer
  3807. Buffer audio frames, and make them available to the filter chain.
  3808. This source is mainly intended for a programmatic use, in particular
  3809. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3810. It accepts the following parameters:
  3811. @table @option
  3812. @item time_base
  3813. The timebase which will be used for timestamps of submitted frames. It must be
  3814. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3815. @item sample_rate
  3816. The sample rate of the incoming audio buffers.
  3817. @item sample_fmt
  3818. The sample format of the incoming audio buffers.
  3819. Either a sample format name or its corresponding integer representation from
  3820. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3821. @item channel_layout
  3822. The channel layout of the incoming audio buffers.
  3823. Either a channel layout name from channel_layout_map in
  3824. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3825. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3826. @item channels
  3827. The number of channels of the incoming audio buffers.
  3828. If both @var{channels} and @var{channel_layout} are specified, then they
  3829. must be consistent.
  3830. @end table
  3831. @subsection Examples
  3832. @example
  3833. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3834. @end example
  3835. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3836. Since the sample format with name "s16p" corresponds to the number
  3837. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3838. equivalent to:
  3839. @example
  3840. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3841. @end example
  3842. @section aevalsrc
  3843. Generate an audio signal specified by an expression.
  3844. This source accepts in input one or more expressions (one for each
  3845. channel), which are evaluated and used to generate a corresponding
  3846. audio signal.
  3847. This source accepts the following options:
  3848. @table @option
  3849. @item exprs
  3850. Set the '|'-separated expressions list for each separate channel. In case the
  3851. @option{channel_layout} option is not specified, the selected channel layout
  3852. depends on the number of provided expressions. Otherwise the last
  3853. specified expression is applied to the remaining output channels.
  3854. @item channel_layout, c
  3855. Set the channel layout. The number of channels in the specified layout
  3856. must be equal to the number of specified expressions.
  3857. @item duration, d
  3858. Set the minimum duration of the sourced audio. See
  3859. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3860. for the accepted syntax.
  3861. Note that the resulting duration may be greater than the specified
  3862. duration, as the generated audio is always cut at the end of a
  3863. complete frame.
  3864. If not specified, or the expressed duration is negative, the audio is
  3865. supposed to be generated forever.
  3866. @item nb_samples, n
  3867. Set the number of samples per channel per each output frame,
  3868. default to 1024.
  3869. @item sample_rate, s
  3870. Specify the sample rate, default to 44100.
  3871. @end table
  3872. Each expression in @var{exprs} can contain the following constants:
  3873. @table @option
  3874. @item n
  3875. number of the evaluated sample, starting from 0
  3876. @item t
  3877. time of the evaluated sample expressed in seconds, starting from 0
  3878. @item s
  3879. sample rate
  3880. @end table
  3881. @subsection Examples
  3882. @itemize
  3883. @item
  3884. Generate silence:
  3885. @example
  3886. aevalsrc=0
  3887. @end example
  3888. @item
  3889. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3890. 8000 Hz:
  3891. @example
  3892. aevalsrc="sin(440*2*PI*t):s=8000"
  3893. @end example
  3894. @item
  3895. Generate a two channels signal, specify the channel layout (Front
  3896. Center + Back Center) explicitly:
  3897. @example
  3898. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3899. @end example
  3900. @item
  3901. Generate white noise:
  3902. @example
  3903. aevalsrc="-2+random(0)"
  3904. @end example
  3905. @item
  3906. Generate an amplitude modulated signal:
  3907. @example
  3908. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3909. @end example
  3910. @item
  3911. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3912. @example
  3913. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3914. @end example
  3915. @end itemize
  3916. @section anullsrc
  3917. The null audio source, return unprocessed audio frames. It is mainly useful
  3918. as a template and to be employed in analysis / debugging tools, or as
  3919. the source for filters which ignore the input data (for example the sox
  3920. synth filter).
  3921. This source accepts the following options:
  3922. @table @option
  3923. @item channel_layout, cl
  3924. Specifies the channel layout, and can be either an integer or a string
  3925. representing a channel layout. The default value of @var{channel_layout}
  3926. is "stereo".
  3927. Check the channel_layout_map definition in
  3928. @file{libavutil/channel_layout.c} for the mapping between strings and
  3929. channel layout values.
  3930. @item sample_rate, r
  3931. Specifies the sample rate, and defaults to 44100.
  3932. @item nb_samples, n
  3933. Set the number of samples per requested frames.
  3934. @end table
  3935. @subsection Examples
  3936. @itemize
  3937. @item
  3938. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3939. @example
  3940. anullsrc=r=48000:cl=4
  3941. @end example
  3942. @item
  3943. Do the same operation with a more obvious syntax:
  3944. @example
  3945. anullsrc=r=48000:cl=mono
  3946. @end example
  3947. @end itemize
  3948. All the parameters need to be explicitly defined.
  3949. @section flite
  3950. Synthesize a voice utterance using the libflite library.
  3951. To enable compilation of this filter you need to configure FFmpeg with
  3952. @code{--enable-libflite}.
  3953. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3954. The filter accepts the following options:
  3955. @table @option
  3956. @item list_voices
  3957. If set to 1, list the names of the available voices and exit
  3958. immediately. Default value is 0.
  3959. @item nb_samples, n
  3960. Set the maximum number of samples per frame. Default value is 512.
  3961. @item textfile
  3962. Set the filename containing the text to speak.
  3963. @item text
  3964. Set the text to speak.
  3965. @item voice, v
  3966. Set the voice to use for the speech synthesis. Default value is
  3967. @code{kal}. See also the @var{list_voices} option.
  3968. @end table
  3969. @subsection Examples
  3970. @itemize
  3971. @item
  3972. Read from file @file{speech.txt}, and synthesize the text using the
  3973. standard flite voice:
  3974. @example
  3975. flite=textfile=speech.txt
  3976. @end example
  3977. @item
  3978. Read the specified text selecting the @code{slt} voice:
  3979. @example
  3980. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3981. @end example
  3982. @item
  3983. Input text to ffmpeg:
  3984. @example
  3985. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3986. @end example
  3987. @item
  3988. Make @file{ffplay} speak the specified text, using @code{flite} and
  3989. the @code{lavfi} device:
  3990. @example
  3991. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3992. @end example
  3993. @end itemize
  3994. For more information about libflite, check:
  3995. @url{http://www.festvox.org/flite/}
  3996. @section anoisesrc
  3997. Generate a noise audio signal.
  3998. The filter accepts the following options:
  3999. @table @option
  4000. @item sample_rate, r
  4001. Specify the sample rate. Default value is 48000 Hz.
  4002. @item amplitude, a
  4003. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4004. is 1.0.
  4005. @item duration, d
  4006. Specify the duration of the generated audio stream. Not specifying this option
  4007. results in noise with an infinite length.
  4008. @item color, colour, c
  4009. Specify the color of noise. Available noise colors are white, pink, brown,
  4010. blue and violet. Default color is white.
  4011. @item seed, s
  4012. Specify a value used to seed the PRNG.
  4013. @item nb_samples, n
  4014. Set the number of samples per each output frame, default is 1024.
  4015. @end table
  4016. @subsection Examples
  4017. @itemize
  4018. @item
  4019. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4020. @example
  4021. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4022. @end example
  4023. @end itemize
  4024. @section hilbert
  4025. Generate odd-tap Hilbert transform FIR coefficients.
  4026. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4027. the signal by 90 degrees.
  4028. This is used in many matrix coding schemes and for analytic signal generation.
  4029. The process is often written as a multiplication by i (or j), the imaginary unit.
  4030. The filter accepts the following options:
  4031. @table @option
  4032. @item sample_rate, s
  4033. Set sample rate, default is 44100.
  4034. @item taps, t
  4035. Set length of FIR filter, default is 22051.
  4036. @item nb_samples, n
  4037. Set number of samples per each frame.
  4038. @item win_func, w
  4039. Set window function to be used when generating FIR coefficients.
  4040. @end table
  4041. @section sine
  4042. Generate an audio signal made of a sine wave with amplitude 1/8.
  4043. The audio signal is bit-exact.
  4044. The filter accepts the following options:
  4045. @table @option
  4046. @item frequency, f
  4047. Set the carrier frequency. Default is 440 Hz.
  4048. @item beep_factor, b
  4049. Enable a periodic beep every second with frequency @var{beep_factor} times
  4050. the carrier frequency. Default is 0, meaning the beep is disabled.
  4051. @item sample_rate, r
  4052. Specify the sample rate, default is 44100.
  4053. @item duration, d
  4054. Specify the duration of the generated audio stream.
  4055. @item samples_per_frame
  4056. Set the number of samples per output frame.
  4057. The expression can contain the following constants:
  4058. @table @option
  4059. @item n
  4060. The (sequential) number of the output audio frame, starting from 0.
  4061. @item pts
  4062. The PTS (Presentation TimeStamp) of the output audio frame,
  4063. expressed in @var{TB} units.
  4064. @item t
  4065. The PTS of the output audio frame, expressed in seconds.
  4066. @item TB
  4067. The timebase of the output audio frames.
  4068. @end table
  4069. Default is @code{1024}.
  4070. @end table
  4071. @subsection Examples
  4072. @itemize
  4073. @item
  4074. Generate a simple 440 Hz sine wave:
  4075. @example
  4076. sine
  4077. @end example
  4078. @item
  4079. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4080. @example
  4081. sine=220:4:d=5
  4082. sine=f=220:b=4:d=5
  4083. sine=frequency=220:beep_factor=4:duration=5
  4084. @end example
  4085. @item
  4086. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4087. pattern:
  4088. @example
  4089. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4090. @end example
  4091. @end itemize
  4092. @c man end AUDIO SOURCES
  4093. @chapter Audio Sinks
  4094. @c man begin AUDIO SINKS
  4095. Below is a description of the currently available audio sinks.
  4096. @section abuffersink
  4097. Buffer audio frames, and make them available to the end of filter chain.
  4098. This sink is mainly intended for programmatic use, in particular
  4099. through the interface defined in @file{libavfilter/buffersink.h}
  4100. or the options system.
  4101. It accepts a pointer to an AVABufferSinkContext structure, which
  4102. defines the incoming buffers' formats, to be passed as the opaque
  4103. parameter to @code{avfilter_init_filter} for initialization.
  4104. @section anullsink
  4105. Null audio sink; do absolutely nothing with the input audio. It is
  4106. mainly useful as a template and for use in analysis / debugging
  4107. tools.
  4108. @c man end AUDIO SINKS
  4109. @chapter Video Filters
  4110. @c man begin VIDEO FILTERS
  4111. When you configure your FFmpeg build, you can disable any of the
  4112. existing filters using @code{--disable-filters}.
  4113. The configure output will show the video filters included in your
  4114. build.
  4115. Below is a description of the currently available video filters.
  4116. @section alphaextract
  4117. Extract the alpha component from the input as a grayscale video. This
  4118. is especially useful with the @var{alphamerge} filter.
  4119. @section alphamerge
  4120. Add or replace the alpha component of the primary input with the
  4121. grayscale value of a second input. This is intended for use with
  4122. @var{alphaextract} to allow the transmission or storage of frame
  4123. sequences that have alpha in a format that doesn't support an alpha
  4124. channel.
  4125. For example, to reconstruct full frames from a normal YUV-encoded video
  4126. and a separate video created with @var{alphaextract}, you might use:
  4127. @example
  4128. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4129. @end example
  4130. Since this filter is designed for reconstruction, it operates on frame
  4131. sequences without considering timestamps, and terminates when either
  4132. input reaches end of stream. This will cause problems if your encoding
  4133. pipeline drops frames. If you're trying to apply an image as an
  4134. overlay to a video stream, consider the @var{overlay} filter instead.
  4135. @section amplify
  4136. Amplify differences between current pixel and pixels of adjacent frames in
  4137. same pixel location.
  4138. This filter accepts the following options:
  4139. @table @option
  4140. @item radius
  4141. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4142. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4143. @item factor
  4144. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4145. @item threshold
  4146. Set threshold for difference amplification. Any differrence greater or equal to
  4147. this value will not alter source pixel. Default is 10.
  4148. Allowed range is from 0 to 65535.
  4149. @item low
  4150. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4151. This option controls maximum possible value that will decrease source pixel value.
  4152. @item high
  4153. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4154. This option controls maximum possible value that will increase source pixel value.
  4155. @item planes
  4156. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4157. @end table
  4158. @section ass
  4159. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4160. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4161. Substation Alpha) subtitles files.
  4162. This filter accepts the following option in addition to the common options from
  4163. the @ref{subtitles} filter:
  4164. @table @option
  4165. @item shaping
  4166. Set the shaping engine
  4167. Available values are:
  4168. @table @samp
  4169. @item auto
  4170. The default libass shaping engine, which is the best available.
  4171. @item simple
  4172. Fast, font-agnostic shaper that can do only substitutions
  4173. @item complex
  4174. Slower shaper using OpenType for substitutions and positioning
  4175. @end table
  4176. The default is @code{auto}.
  4177. @end table
  4178. @section atadenoise
  4179. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4180. The filter accepts the following options:
  4181. @table @option
  4182. @item 0a
  4183. Set threshold A for 1st plane. Default is 0.02.
  4184. Valid range is 0 to 0.3.
  4185. @item 0b
  4186. Set threshold B for 1st plane. Default is 0.04.
  4187. Valid range is 0 to 5.
  4188. @item 1a
  4189. Set threshold A for 2nd plane. Default is 0.02.
  4190. Valid range is 0 to 0.3.
  4191. @item 1b
  4192. Set threshold B for 2nd plane. Default is 0.04.
  4193. Valid range is 0 to 5.
  4194. @item 2a
  4195. Set threshold A for 3rd plane. Default is 0.02.
  4196. Valid range is 0 to 0.3.
  4197. @item 2b
  4198. Set threshold B for 3rd plane. Default is 0.04.
  4199. Valid range is 0 to 5.
  4200. Threshold A is designed to react on abrupt changes in the input signal and
  4201. threshold B is designed to react on continuous changes in the input signal.
  4202. @item s
  4203. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4204. number in range [5, 129].
  4205. @item p
  4206. Set what planes of frame filter will use for averaging. Default is all.
  4207. @end table
  4208. @section avgblur
  4209. Apply average blur filter.
  4210. The filter accepts the following options:
  4211. @table @option
  4212. @item sizeX
  4213. Set horizontal radius size.
  4214. @item planes
  4215. Set which planes to filter. By default all planes are filtered.
  4216. @item sizeY
  4217. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4218. Default is @code{0}.
  4219. @end table
  4220. @section bbox
  4221. Compute the bounding box for the non-black pixels in the input frame
  4222. luminance plane.
  4223. This filter computes the bounding box containing all the pixels with a
  4224. luminance value greater than the minimum allowed value.
  4225. The parameters describing the bounding box are printed on the filter
  4226. log.
  4227. The filter accepts the following option:
  4228. @table @option
  4229. @item min_val
  4230. Set the minimal luminance value. Default is @code{16}.
  4231. @end table
  4232. @section bitplanenoise
  4233. Show and measure bit plane noise.
  4234. The filter accepts the following options:
  4235. @table @option
  4236. @item bitplane
  4237. Set which plane to analyze. Default is @code{1}.
  4238. @item filter
  4239. Filter out noisy pixels from @code{bitplane} set above.
  4240. Default is disabled.
  4241. @end table
  4242. @section blackdetect
  4243. Detect video intervals that are (almost) completely black. Can be
  4244. useful to detect chapter transitions, commercials, or invalid
  4245. recordings. Output lines contains the time for the start, end and
  4246. duration of the detected black interval expressed in seconds.
  4247. In order to display the output lines, you need to set the loglevel at
  4248. least to the AV_LOG_INFO value.
  4249. The filter accepts the following options:
  4250. @table @option
  4251. @item black_min_duration, d
  4252. Set the minimum detected black duration expressed in seconds. It must
  4253. be a non-negative floating point number.
  4254. Default value is 2.0.
  4255. @item picture_black_ratio_th, pic_th
  4256. Set the threshold for considering a picture "black".
  4257. Express the minimum value for the ratio:
  4258. @example
  4259. @var{nb_black_pixels} / @var{nb_pixels}
  4260. @end example
  4261. for which a picture is considered black.
  4262. Default value is 0.98.
  4263. @item pixel_black_th, pix_th
  4264. Set the threshold for considering a pixel "black".
  4265. The threshold expresses the maximum pixel luminance value for which a
  4266. pixel is considered "black". The provided value is scaled according to
  4267. the following equation:
  4268. @example
  4269. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4270. @end example
  4271. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4272. the input video format, the range is [0-255] for YUV full-range
  4273. formats and [16-235] for YUV non full-range formats.
  4274. Default value is 0.10.
  4275. @end table
  4276. The following example sets the maximum pixel threshold to the minimum
  4277. value, and detects only black intervals of 2 or more seconds:
  4278. @example
  4279. blackdetect=d=2:pix_th=0.00
  4280. @end example
  4281. @section blackframe
  4282. Detect frames that are (almost) completely black. Can be useful to
  4283. detect chapter transitions or commercials. Output lines consist of
  4284. the frame number of the detected frame, the percentage of blackness,
  4285. the position in the file if known or -1 and the timestamp in seconds.
  4286. In order to display the output lines, you need to set the loglevel at
  4287. least to the AV_LOG_INFO value.
  4288. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4289. The value represents the percentage of pixels in the picture that
  4290. are below the threshold value.
  4291. It accepts the following parameters:
  4292. @table @option
  4293. @item amount
  4294. The percentage of the pixels that have to be below the threshold; it defaults to
  4295. @code{98}.
  4296. @item threshold, thresh
  4297. The threshold below which a pixel value is considered black; it defaults to
  4298. @code{32}.
  4299. @end table
  4300. @section blend, tblend
  4301. Blend two video frames into each other.
  4302. The @code{blend} filter takes two input streams and outputs one
  4303. stream, the first input is the "top" layer and second input is
  4304. "bottom" layer. By default, the output terminates when the longest input terminates.
  4305. The @code{tblend} (time blend) filter takes two consecutive frames
  4306. from one single stream, and outputs the result obtained by blending
  4307. the new frame on top of the old frame.
  4308. A description of the accepted options follows.
  4309. @table @option
  4310. @item c0_mode
  4311. @item c1_mode
  4312. @item c2_mode
  4313. @item c3_mode
  4314. @item all_mode
  4315. Set blend mode for specific pixel component or all pixel components in case
  4316. of @var{all_mode}. Default value is @code{normal}.
  4317. Available values for component modes are:
  4318. @table @samp
  4319. @item addition
  4320. @item grainmerge
  4321. @item and
  4322. @item average
  4323. @item burn
  4324. @item darken
  4325. @item difference
  4326. @item grainextract
  4327. @item divide
  4328. @item dodge
  4329. @item freeze
  4330. @item exclusion
  4331. @item extremity
  4332. @item glow
  4333. @item hardlight
  4334. @item hardmix
  4335. @item heat
  4336. @item lighten
  4337. @item linearlight
  4338. @item multiply
  4339. @item multiply128
  4340. @item negation
  4341. @item normal
  4342. @item or
  4343. @item overlay
  4344. @item phoenix
  4345. @item pinlight
  4346. @item reflect
  4347. @item screen
  4348. @item softlight
  4349. @item subtract
  4350. @item vividlight
  4351. @item xor
  4352. @end table
  4353. @item c0_opacity
  4354. @item c1_opacity
  4355. @item c2_opacity
  4356. @item c3_opacity
  4357. @item all_opacity
  4358. Set blend opacity for specific pixel component or all pixel components in case
  4359. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4360. @item c0_expr
  4361. @item c1_expr
  4362. @item c2_expr
  4363. @item c3_expr
  4364. @item all_expr
  4365. Set blend expression for specific pixel component or all pixel components in case
  4366. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4367. The expressions can use the following variables:
  4368. @table @option
  4369. @item N
  4370. The sequential number of the filtered frame, starting from @code{0}.
  4371. @item X
  4372. @item Y
  4373. the coordinates of the current sample
  4374. @item W
  4375. @item H
  4376. the width and height of currently filtered plane
  4377. @item SW
  4378. @item SH
  4379. Width and height scale for the plane being filtered. It is the
  4380. ratio between the dimensions of the current plane to the luma plane,
  4381. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4382. the luma plane and @code{0.5,0.5} for the chroma planes.
  4383. @item T
  4384. Time of the current frame, expressed in seconds.
  4385. @item TOP, A
  4386. Value of pixel component at current location for first video frame (top layer).
  4387. @item BOTTOM, B
  4388. Value of pixel component at current location for second video frame (bottom layer).
  4389. @end table
  4390. @end table
  4391. The @code{blend} filter also supports the @ref{framesync} options.
  4392. @subsection Examples
  4393. @itemize
  4394. @item
  4395. Apply transition from bottom layer to top layer in first 10 seconds:
  4396. @example
  4397. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4398. @end example
  4399. @item
  4400. Apply linear horizontal transition from top layer to bottom layer:
  4401. @example
  4402. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4403. @end example
  4404. @item
  4405. Apply 1x1 checkerboard effect:
  4406. @example
  4407. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4408. @end example
  4409. @item
  4410. Apply uncover left effect:
  4411. @example
  4412. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4413. @end example
  4414. @item
  4415. Apply uncover down effect:
  4416. @example
  4417. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4418. @end example
  4419. @item
  4420. Apply uncover up-left effect:
  4421. @example
  4422. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4423. @end example
  4424. @item
  4425. Split diagonally video and shows top and bottom layer on each side:
  4426. @example
  4427. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4428. @end example
  4429. @item
  4430. Display differences between the current and the previous frame:
  4431. @example
  4432. tblend=all_mode=grainextract
  4433. @end example
  4434. @end itemize
  4435. @section boxblur
  4436. Apply a boxblur algorithm to the input video.
  4437. It accepts the following parameters:
  4438. @table @option
  4439. @item luma_radius, lr
  4440. @item luma_power, lp
  4441. @item chroma_radius, cr
  4442. @item chroma_power, cp
  4443. @item alpha_radius, ar
  4444. @item alpha_power, ap
  4445. @end table
  4446. A description of the accepted options follows.
  4447. @table @option
  4448. @item luma_radius, lr
  4449. @item chroma_radius, cr
  4450. @item alpha_radius, ar
  4451. Set an expression for the box radius in pixels used for blurring the
  4452. corresponding input plane.
  4453. The radius value must be a non-negative number, and must not be
  4454. greater than the value of the expression @code{min(w,h)/2} for the
  4455. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4456. planes.
  4457. Default value for @option{luma_radius} is "2". If not specified,
  4458. @option{chroma_radius} and @option{alpha_radius} default to the
  4459. corresponding value set for @option{luma_radius}.
  4460. The expressions can contain the following constants:
  4461. @table @option
  4462. @item w
  4463. @item h
  4464. The input width and height in pixels.
  4465. @item cw
  4466. @item ch
  4467. The input chroma image width and height in pixels.
  4468. @item hsub
  4469. @item vsub
  4470. The horizontal and vertical chroma subsample values. For example, for the
  4471. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4472. @end table
  4473. @item luma_power, lp
  4474. @item chroma_power, cp
  4475. @item alpha_power, ap
  4476. Specify how many times the boxblur filter is applied to the
  4477. corresponding plane.
  4478. Default value for @option{luma_power} is 2. If not specified,
  4479. @option{chroma_power} and @option{alpha_power} default to the
  4480. corresponding value set for @option{luma_power}.
  4481. A value of 0 will disable the effect.
  4482. @end table
  4483. @subsection Examples
  4484. @itemize
  4485. @item
  4486. Apply a boxblur filter with the luma, chroma, and alpha radii
  4487. set to 2:
  4488. @example
  4489. boxblur=luma_radius=2:luma_power=1
  4490. boxblur=2:1
  4491. @end example
  4492. @item
  4493. Set the luma radius to 2, and alpha and chroma radius to 0:
  4494. @example
  4495. boxblur=2:1:cr=0:ar=0
  4496. @end example
  4497. @item
  4498. Set the luma and chroma radii to a fraction of the video dimension:
  4499. @example
  4500. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4501. @end example
  4502. @end itemize
  4503. @section bwdif
  4504. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4505. Deinterlacing Filter").
  4506. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4507. interpolation algorithms.
  4508. It accepts the following parameters:
  4509. @table @option
  4510. @item mode
  4511. The interlacing mode to adopt. It accepts one of the following values:
  4512. @table @option
  4513. @item 0, send_frame
  4514. Output one frame for each frame.
  4515. @item 1, send_field
  4516. Output one frame for each field.
  4517. @end table
  4518. The default value is @code{send_field}.
  4519. @item parity
  4520. The picture field parity assumed for the input interlaced video. It accepts one
  4521. of the following values:
  4522. @table @option
  4523. @item 0, tff
  4524. Assume the top field is first.
  4525. @item 1, bff
  4526. Assume the bottom field is first.
  4527. @item -1, auto
  4528. Enable automatic detection of field parity.
  4529. @end table
  4530. The default value is @code{auto}.
  4531. If the interlacing is unknown or the decoder does not export this information,
  4532. top field first will be assumed.
  4533. @item deint
  4534. Specify which frames to deinterlace. Accept one of the following
  4535. values:
  4536. @table @option
  4537. @item 0, all
  4538. Deinterlace all frames.
  4539. @item 1, interlaced
  4540. Only deinterlace frames marked as interlaced.
  4541. @end table
  4542. The default value is @code{all}.
  4543. @end table
  4544. @section chromakey
  4545. YUV colorspace color/chroma keying.
  4546. The filter accepts the following options:
  4547. @table @option
  4548. @item color
  4549. The color which will be replaced with transparency.
  4550. @item similarity
  4551. Similarity percentage with the key color.
  4552. 0.01 matches only the exact key color, while 1.0 matches everything.
  4553. @item blend
  4554. Blend percentage.
  4555. 0.0 makes pixels either fully transparent, or not transparent at all.
  4556. Higher values result in semi-transparent pixels, with a higher transparency
  4557. the more similar the pixels color is to the key color.
  4558. @item yuv
  4559. Signals that the color passed is already in YUV instead of RGB.
  4560. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4561. This can be used to pass exact YUV values as hexadecimal numbers.
  4562. @end table
  4563. @subsection Examples
  4564. @itemize
  4565. @item
  4566. Make every green pixel in the input image transparent:
  4567. @example
  4568. ffmpeg -i input.png -vf chromakey=green out.png
  4569. @end example
  4570. @item
  4571. Overlay a greenscreen-video on top of a static black background.
  4572. @example
  4573. 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
  4574. @end example
  4575. @end itemize
  4576. @section ciescope
  4577. Display CIE color diagram with pixels overlaid onto it.
  4578. The filter accepts the following options:
  4579. @table @option
  4580. @item system
  4581. Set color system.
  4582. @table @samp
  4583. @item ntsc, 470m
  4584. @item ebu, 470bg
  4585. @item smpte
  4586. @item 240m
  4587. @item apple
  4588. @item widergb
  4589. @item cie1931
  4590. @item rec709, hdtv
  4591. @item uhdtv, rec2020
  4592. @end table
  4593. @item cie
  4594. Set CIE system.
  4595. @table @samp
  4596. @item xyy
  4597. @item ucs
  4598. @item luv
  4599. @end table
  4600. @item gamuts
  4601. Set what gamuts to draw.
  4602. See @code{system} option for available values.
  4603. @item size, s
  4604. Set ciescope size, by default set to 512.
  4605. @item intensity, i
  4606. Set intensity used to map input pixel values to CIE diagram.
  4607. @item contrast
  4608. Set contrast used to draw tongue colors that are out of active color system gamut.
  4609. @item corrgamma
  4610. Correct gamma displayed on scope, by default enabled.
  4611. @item showwhite
  4612. Show white point on CIE diagram, by default disabled.
  4613. @item gamma
  4614. Set input gamma. Used only with XYZ input color space.
  4615. @end table
  4616. @section codecview
  4617. Visualize information exported by some codecs.
  4618. Some codecs can export information through frames using side-data or other
  4619. means. For example, some MPEG based codecs export motion vectors through the
  4620. @var{export_mvs} flag in the codec @option{flags2} option.
  4621. The filter accepts the following option:
  4622. @table @option
  4623. @item mv
  4624. Set motion vectors to visualize.
  4625. Available flags for @var{mv} are:
  4626. @table @samp
  4627. @item pf
  4628. forward predicted MVs of P-frames
  4629. @item bf
  4630. forward predicted MVs of B-frames
  4631. @item bb
  4632. backward predicted MVs of B-frames
  4633. @end table
  4634. @item qp
  4635. Display quantization parameters using the chroma planes.
  4636. @item mv_type, mvt
  4637. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4638. Available flags for @var{mv_type} are:
  4639. @table @samp
  4640. @item fp
  4641. forward predicted MVs
  4642. @item bp
  4643. backward predicted MVs
  4644. @end table
  4645. @item frame_type, ft
  4646. Set frame type to visualize motion vectors of.
  4647. Available flags for @var{frame_type} are:
  4648. @table @samp
  4649. @item if
  4650. intra-coded frames (I-frames)
  4651. @item pf
  4652. predicted frames (P-frames)
  4653. @item bf
  4654. bi-directionally predicted frames (B-frames)
  4655. @end table
  4656. @end table
  4657. @subsection Examples
  4658. @itemize
  4659. @item
  4660. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4661. @example
  4662. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4663. @end example
  4664. @item
  4665. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4666. @example
  4667. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4668. @end example
  4669. @end itemize
  4670. @section colorbalance
  4671. Modify intensity of primary colors (red, green and blue) of input frames.
  4672. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4673. regions for the red-cyan, green-magenta or blue-yellow balance.
  4674. A positive adjustment value shifts the balance towards the primary color, a negative
  4675. value towards the complementary color.
  4676. The filter accepts the following options:
  4677. @table @option
  4678. @item rs
  4679. @item gs
  4680. @item bs
  4681. Adjust red, green and blue shadows (darkest pixels).
  4682. @item rm
  4683. @item gm
  4684. @item bm
  4685. Adjust red, green and blue midtones (medium pixels).
  4686. @item rh
  4687. @item gh
  4688. @item bh
  4689. Adjust red, green and blue highlights (brightest pixels).
  4690. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4691. @end table
  4692. @subsection Examples
  4693. @itemize
  4694. @item
  4695. Add red color cast to shadows:
  4696. @example
  4697. colorbalance=rs=.3
  4698. @end example
  4699. @end itemize
  4700. @section colorkey
  4701. RGB colorspace color keying.
  4702. The filter accepts the following options:
  4703. @table @option
  4704. @item color
  4705. The color which will be replaced with transparency.
  4706. @item similarity
  4707. Similarity percentage with the key color.
  4708. 0.01 matches only the exact key color, while 1.0 matches everything.
  4709. @item blend
  4710. Blend percentage.
  4711. 0.0 makes pixels either fully transparent, or not transparent at all.
  4712. Higher values result in semi-transparent pixels, with a higher transparency
  4713. the more similar the pixels color is to the key color.
  4714. @end table
  4715. @subsection Examples
  4716. @itemize
  4717. @item
  4718. Make every green pixel in the input image transparent:
  4719. @example
  4720. ffmpeg -i input.png -vf colorkey=green out.png
  4721. @end example
  4722. @item
  4723. Overlay a greenscreen-video on top of a static background image.
  4724. @example
  4725. 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
  4726. @end example
  4727. @end itemize
  4728. @section colorlevels
  4729. Adjust video input frames using levels.
  4730. The filter accepts the following options:
  4731. @table @option
  4732. @item rimin
  4733. @item gimin
  4734. @item bimin
  4735. @item aimin
  4736. Adjust red, green, blue and alpha input black point.
  4737. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4738. @item rimax
  4739. @item gimax
  4740. @item bimax
  4741. @item aimax
  4742. Adjust red, green, blue and alpha input white point.
  4743. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4744. Input levels are used to lighten highlights (bright tones), darken shadows
  4745. (dark tones), change the balance of bright and dark tones.
  4746. @item romin
  4747. @item gomin
  4748. @item bomin
  4749. @item aomin
  4750. Adjust red, green, blue and alpha output black point.
  4751. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4752. @item romax
  4753. @item gomax
  4754. @item bomax
  4755. @item aomax
  4756. Adjust red, green, blue and alpha output white point.
  4757. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4758. Output levels allows manual selection of a constrained output level range.
  4759. @end table
  4760. @subsection Examples
  4761. @itemize
  4762. @item
  4763. Make video output darker:
  4764. @example
  4765. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4766. @end example
  4767. @item
  4768. Increase contrast:
  4769. @example
  4770. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4771. @end example
  4772. @item
  4773. Make video output lighter:
  4774. @example
  4775. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4776. @end example
  4777. @item
  4778. Increase brightness:
  4779. @example
  4780. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4781. @end example
  4782. @end itemize
  4783. @section colorchannelmixer
  4784. Adjust video input frames by re-mixing color channels.
  4785. This filter modifies a color channel by adding the values associated to
  4786. the other channels of the same pixels. For example if the value to
  4787. modify is red, the output value will be:
  4788. @example
  4789. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4790. @end example
  4791. The filter accepts the following options:
  4792. @table @option
  4793. @item rr
  4794. @item rg
  4795. @item rb
  4796. @item ra
  4797. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4798. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4799. @item gr
  4800. @item gg
  4801. @item gb
  4802. @item ga
  4803. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4804. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4805. @item br
  4806. @item bg
  4807. @item bb
  4808. @item ba
  4809. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4810. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4811. @item ar
  4812. @item ag
  4813. @item ab
  4814. @item aa
  4815. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4816. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4817. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4818. @end table
  4819. @subsection Examples
  4820. @itemize
  4821. @item
  4822. Convert source to grayscale:
  4823. @example
  4824. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4825. @end example
  4826. @item
  4827. Simulate sepia tones:
  4828. @example
  4829. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4830. @end example
  4831. @end itemize
  4832. @section colormatrix
  4833. Convert color matrix.
  4834. The filter accepts the following options:
  4835. @table @option
  4836. @item src
  4837. @item dst
  4838. Specify the source and destination color matrix. Both values must be
  4839. specified.
  4840. The accepted values are:
  4841. @table @samp
  4842. @item bt709
  4843. BT.709
  4844. @item fcc
  4845. FCC
  4846. @item bt601
  4847. BT.601
  4848. @item bt470
  4849. BT.470
  4850. @item bt470bg
  4851. BT.470BG
  4852. @item smpte170m
  4853. SMPTE-170M
  4854. @item smpte240m
  4855. SMPTE-240M
  4856. @item bt2020
  4857. BT.2020
  4858. @end table
  4859. @end table
  4860. For example to convert from BT.601 to SMPTE-240M, use the command:
  4861. @example
  4862. colormatrix=bt601:smpte240m
  4863. @end example
  4864. @section colorspace
  4865. Convert colorspace, transfer characteristics or color primaries.
  4866. Input video needs to have an even size.
  4867. The filter accepts the following options:
  4868. @table @option
  4869. @anchor{all}
  4870. @item all
  4871. Specify all color properties at once.
  4872. The accepted values are:
  4873. @table @samp
  4874. @item bt470m
  4875. BT.470M
  4876. @item bt470bg
  4877. BT.470BG
  4878. @item bt601-6-525
  4879. BT.601-6 525
  4880. @item bt601-6-625
  4881. BT.601-6 625
  4882. @item bt709
  4883. BT.709
  4884. @item smpte170m
  4885. SMPTE-170M
  4886. @item smpte240m
  4887. SMPTE-240M
  4888. @item bt2020
  4889. BT.2020
  4890. @end table
  4891. @anchor{space}
  4892. @item space
  4893. Specify output colorspace.
  4894. The accepted values are:
  4895. @table @samp
  4896. @item bt709
  4897. BT.709
  4898. @item fcc
  4899. FCC
  4900. @item bt470bg
  4901. BT.470BG or BT.601-6 625
  4902. @item smpte170m
  4903. SMPTE-170M or BT.601-6 525
  4904. @item smpte240m
  4905. SMPTE-240M
  4906. @item ycgco
  4907. YCgCo
  4908. @item bt2020ncl
  4909. BT.2020 with non-constant luminance
  4910. @end table
  4911. @anchor{trc}
  4912. @item trc
  4913. Specify output transfer characteristics.
  4914. The accepted values are:
  4915. @table @samp
  4916. @item bt709
  4917. BT.709
  4918. @item bt470m
  4919. BT.470M
  4920. @item bt470bg
  4921. BT.470BG
  4922. @item gamma22
  4923. Constant gamma of 2.2
  4924. @item gamma28
  4925. Constant gamma of 2.8
  4926. @item smpte170m
  4927. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4928. @item smpte240m
  4929. SMPTE-240M
  4930. @item srgb
  4931. SRGB
  4932. @item iec61966-2-1
  4933. iec61966-2-1
  4934. @item iec61966-2-4
  4935. iec61966-2-4
  4936. @item xvycc
  4937. xvycc
  4938. @item bt2020-10
  4939. BT.2020 for 10-bits content
  4940. @item bt2020-12
  4941. BT.2020 for 12-bits content
  4942. @end table
  4943. @anchor{primaries}
  4944. @item primaries
  4945. Specify output color primaries.
  4946. The accepted values are:
  4947. @table @samp
  4948. @item bt709
  4949. BT.709
  4950. @item bt470m
  4951. BT.470M
  4952. @item bt470bg
  4953. BT.470BG or BT.601-6 625
  4954. @item smpte170m
  4955. SMPTE-170M or BT.601-6 525
  4956. @item smpte240m
  4957. SMPTE-240M
  4958. @item film
  4959. film
  4960. @item smpte431
  4961. SMPTE-431
  4962. @item smpte432
  4963. SMPTE-432
  4964. @item bt2020
  4965. BT.2020
  4966. @item jedec-p22
  4967. JEDEC P22 phosphors
  4968. @end table
  4969. @anchor{range}
  4970. @item range
  4971. Specify output color range.
  4972. The accepted values are:
  4973. @table @samp
  4974. @item tv
  4975. TV (restricted) range
  4976. @item mpeg
  4977. MPEG (restricted) range
  4978. @item pc
  4979. PC (full) range
  4980. @item jpeg
  4981. JPEG (full) range
  4982. @end table
  4983. @item format
  4984. Specify output color format.
  4985. The accepted values are:
  4986. @table @samp
  4987. @item yuv420p
  4988. YUV 4:2:0 planar 8-bits
  4989. @item yuv420p10
  4990. YUV 4:2:0 planar 10-bits
  4991. @item yuv420p12
  4992. YUV 4:2:0 planar 12-bits
  4993. @item yuv422p
  4994. YUV 4:2:2 planar 8-bits
  4995. @item yuv422p10
  4996. YUV 4:2:2 planar 10-bits
  4997. @item yuv422p12
  4998. YUV 4:2:2 planar 12-bits
  4999. @item yuv444p
  5000. YUV 4:4:4 planar 8-bits
  5001. @item yuv444p10
  5002. YUV 4:4:4 planar 10-bits
  5003. @item yuv444p12
  5004. YUV 4:4:4 planar 12-bits
  5005. @end table
  5006. @item fast
  5007. Do a fast conversion, which skips gamma/primary correction. This will take
  5008. significantly less CPU, but will be mathematically incorrect. To get output
  5009. compatible with that produced by the colormatrix filter, use fast=1.
  5010. @item dither
  5011. Specify dithering mode.
  5012. The accepted values are:
  5013. @table @samp
  5014. @item none
  5015. No dithering
  5016. @item fsb
  5017. Floyd-Steinberg dithering
  5018. @end table
  5019. @item wpadapt
  5020. Whitepoint adaptation mode.
  5021. The accepted values are:
  5022. @table @samp
  5023. @item bradford
  5024. Bradford whitepoint adaptation
  5025. @item vonkries
  5026. von Kries whitepoint adaptation
  5027. @item identity
  5028. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5029. @end table
  5030. @item iall
  5031. Override all input properties at once. Same accepted values as @ref{all}.
  5032. @item ispace
  5033. Override input colorspace. Same accepted values as @ref{space}.
  5034. @item iprimaries
  5035. Override input color primaries. Same accepted values as @ref{primaries}.
  5036. @item itrc
  5037. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5038. @item irange
  5039. Override input color range. Same accepted values as @ref{range}.
  5040. @end table
  5041. The filter converts the transfer characteristics, color space and color
  5042. primaries to the specified user values. The output value, if not specified,
  5043. is set to a default value based on the "all" property. If that property is
  5044. also not specified, the filter will log an error. The output color range and
  5045. format default to the same value as the input color range and format. The
  5046. input transfer characteristics, color space, color primaries and color range
  5047. should be set on the input data. If any of these are missing, the filter will
  5048. log an error and no conversion will take place.
  5049. For example to convert the input to SMPTE-240M, use the command:
  5050. @example
  5051. colorspace=smpte240m
  5052. @end example
  5053. @section convolution
  5054. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5055. The filter accepts the following options:
  5056. @table @option
  5057. @item 0m
  5058. @item 1m
  5059. @item 2m
  5060. @item 3m
  5061. Set matrix for each plane.
  5062. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5063. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5064. @item 0rdiv
  5065. @item 1rdiv
  5066. @item 2rdiv
  5067. @item 3rdiv
  5068. Set multiplier for calculated value for each plane.
  5069. If unset or 0, it will be sum of all matrix elements.
  5070. @item 0bias
  5071. @item 1bias
  5072. @item 2bias
  5073. @item 3bias
  5074. Set bias for each plane. This value is added to the result of the multiplication.
  5075. Useful for making the overall image brighter or darker. Default is 0.0.
  5076. @item 0mode
  5077. @item 1mode
  5078. @item 2mode
  5079. @item 3mode
  5080. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5081. Default is @var{square}.
  5082. @end table
  5083. @subsection Examples
  5084. @itemize
  5085. @item
  5086. Apply sharpen:
  5087. @example
  5088. 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"
  5089. @end example
  5090. @item
  5091. Apply blur:
  5092. @example
  5093. 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"
  5094. @end example
  5095. @item
  5096. Apply edge enhance:
  5097. @example
  5098. 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"
  5099. @end example
  5100. @item
  5101. Apply edge detect:
  5102. @example
  5103. 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"
  5104. @end example
  5105. @item
  5106. Apply laplacian edge detector which includes diagonals:
  5107. @example
  5108. 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"
  5109. @end example
  5110. @item
  5111. Apply emboss:
  5112. @example
  5113. 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"
  5114. @end example
  5115. @end itemize
  5116. @section convolve
  5117. Apply 2D convolution of video stream in frequency domain using second stream
  5118. as impulse.
  5119. The filter accepts the following options:
  5120. @table @option
  5121. @item planes
  5122. Set which planes to process.
  5123. @item impulse
  5124. Set which impulse video frames will be processed, can be @var{first}
  5125. or @var{all}. Default is @var{all}.
  5126. @end table
  5127. The @code{convolve} filter also supports the @ref{framesync} options.
  5128. @section copy
  5129. Copy the input video source unchanged to the output. This is mainly useful for
  5130. testing purposes.
  5131. @anchor{coreimage}
  5132. @section coreimage
  5133. Video filtering on GPU using Apple's CoreImage API on OSX.
  5134. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5135. processed by video hardware. However, software-based OpenGL implementations
  5136. exist which means there is no guarantee for hardware processing. It depends on
  5137. the respective OSX.
  5138. There are many filters and image generators provided by Apple that come with a
  5139. large variety of options. The filter has to be referenced by its name along
  5140. with its options.
  5141. The coreimage filter accepts the following options:
  5142. @table @option
  5143. @item list_filters
  5144. List all available filters and generators along with all their respective
  5145. options as well as possible minimum and maximum values along with the default
  5146. values.
  5147. @example
  5148. list_filters=true
  5149. @end example
  5150. @item filter
  5151. Specify all filters by their respective name and options.
  5152. Use @var{list_filters} to determine all valid filter names and options.
  5153. Numerical options are specified by a float value and are automatically clamped
  5154. to their respective value range. Vector and color options have to be specified
  5155. by a list of space separated float values. Character escaping has to be done.
  5156. A special option name @code{default} is available to use default options for a
  5157. filter.
  5158. It is required to specify either @code{default} or at least one of the filter options.
  5159. All omitted options are used with their default values.
  5160. The syntax of the filter string is as follows:
  5161. @example
  5162. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5163. @end example
  5164. @item output_rect
  5165. Specify a rectangle where the output of the filter chain is copied into the
  5166. input image. It is given by a list of space separated float values:
  5167. @example
  5168. output_rect=x\ y\ width\ height
  5169. @end example
  5170. If not given, the output rectangle equals the dimensions of the input image.
  5171. The output rectangle is automatically cropped at the borders of the input
  5172. image. Negative values are valid for each component.
  5173. @example
  5174. output_rect=25\ 25\ 100\ 100
  5175. @end example
  5176. @end table
  5177. Several filters can be chained for successive processing without GPU-HOST
  5178. transfers allowing for fast processing of complex filter chains.
  5179. Currently, only filters with zero (generators) or exactly one (filters) input
  5180. image and one output image are supported. Also, transition filters are not yet
  5181. usable as intended.
  5182. Some filters generate output images with additional padding depending on the
  5183. respective filter kernel. The padding is automatically removed to ensure the
  5184. filter output has the same size as the input image.
  5185. For image generators, the size of the output image is determined by the
  5186. previous output image of the filter chain or the input image of the whole
  5187. filterchain, respectively. The generators do not use the pixel information of
  5188. this image to generate their output. However, the generated output is
  5189. blended onto this image, resulting in partial or complete coverage of the
  5190. output image.
  5191. The @ref{coreimagesrc} video source can be used for generating input images
  5192. which are directly fed into the filter chain. By using it, providing input
  5193. images by another video source or an input video is not required.
  5194. @subsection Examples
  5195. @itemize
  5196. @item
  5197. List all filters available:
  5198. @example
  5199. coreimage=list_filters=true
  5200. @end example
  5201. @item
  5202. Use the CIBoxBlur filter with default options to blur an image:
  5203. @example
  5204. coreimage=filter=CIBoxBlur@@default
  5205. @end example
  5206. @item
  5207. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5208. its center at 100x100 and a radius of 50 pixels:
  5209. @example
  5210. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5211. @end example
  5212. @item
  5213. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5214. given as complete and escaped command-line for Apple's standard bash shell:
  5215. @example
  5216. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5217. @end example
  5218. @end itemize
  5219. @section crop
  5220. Crop the input video to given dimensions.
  5221. It accepts the following parameters:
  5222. @table @option
  5223. @item w, out_w
  5224. The width of the output video. It defaults to @code{iw}.
  5225. This expression is evaluated only once during the filter
  5226. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5227. @item h, out_h
  5228. The height of the output video. It defaults to @code{ih}.
  5229. This expression is evaluated only once during the filter
  5230. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5231. @item x
  5232. The horizontal position, in the input video, of the left edge of the output
  5233. video. It defaults to @code{(in_w-out_w)/2}.
  5234. This expression is evaluated per-frame.
  5235. @item y
  5236. The vertical position, in the input video, of the top edge of the output video.
  5237. It defaults to @code{(in_h-out_h)/2}.
  5238. This expression is evaluated per-frame.
  5239. @item keep_aspect
  5240. If set to 1 will force the output display aspect ratio
  5241. to be the same of the input, by changing the output sample aspect
  5242. ratio. It defaults to 0.
  5243. @item exact
  5244. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5245. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5246. It defaults to 0.
  5247. @end table
  5248. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5249. expressions containing the following constants:
  5250. @table @option
  5251. @item x
  5252. @item y
  5253. The computed values for @var{x} and @var{y}. They are evaluated for
  5254. each new frame.
  5255. @item in_w
  5256. @item in_h
  5257. The input width and height.
  5258. @item iw
  5259. @item ih
  5260. These are the same as @var{in_w} and @var{in_h}.
  5261. @item out_w
  5262. @item out_h
  5263. The output (cropped) width and height.
  5264. @item ow
  5265. @item oh
  5266. These are the same as @var{out_w} and @var{out_h}.
  5267. @item a
  5268. same as @var{iw} / @var{ih}
  5269. @item sar
  5270. input sample aspect ratio
  5271. @item dar
  5272. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5273. @item hsub
  5274. @item vsub
  5275. horizontal and vertical chroma subsample values. For example for the
  5276. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5277. @item n
  5278. The number of the input frame, starting from 0.
  5279. @item pos
  5280. the position in the file of the input frame, NAN if unknown
  5281. @item t
  5282. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5283. @end table
  5284. The expression for @var{out_w} may depend on the value of @var{out_h},
  5285. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5286. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5287. evaluated after @var{out_w} and @var{out_h}.
  5288. The @var{x} and @var{y} parameters specify the expressions for the
  5289. position of the top-left corner of the output (non-cropped) area. They
  5290. are evaluated for each frame. If the evaluated value is not valid, it
  5291. is approximated to the nearest valid value.
  5292. The expression for @var{x} may depend on @var{y}, and the expression
  5293. for @var{y} may depend on @var{x}.
  5294. @subsection Examples
  5295. @itemize
  5296. @item
  5297. Crop area with size 100x100 at position (12,34).
  5298. @example
  5299. crop=100:100:12:34
  5300. @end example
  5301. Using named options, the example above becomes:
  5302. @example
  5303. crop=w=100:h=100:x=12:y=34
  5304. @end example
  5305. @item
  5306. Crop the central input area with size 100x100:
  5307. @example
  5308. crop=100:100
  5309. @end example
  5310. @item
  5311. Crop the central input area with size 2/3 of the input video:
  5312. @example
  5313. crop=2/3*in_w:2/3*in_h
  5314. @end example
  5315. @item
  5316. Crop the input video central square:
  5317. @example
  5318. crop=out_w=in_h
  5319. crop=in_h
  5320. @end example
  5321. @item
  5322. Delimit the rectangle with the top-left corner placed at position
  5323. 100:100 and the right-bottom corner corresponding to the right-bottom
  5324. corner of the input image.
  5325. @example
  5326. crop=in_w-100:in_h-100:100:100
  5327. @end example
  5328. @item
  5329. Crop 10 pixels from the left and right borders, and 20 pixels from
  5330. the top and bottom borders
  5331. @example
  5332. crop=in_w-2*10:in_h-2*20
  5333. @end example
  5334. @item
  5335. Keep only the bottom right quarter of the input image:
  5336. @example
  5337. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5338. @end example
  5339. @item
  5340. Crop height for getting Greek harmony:
  5341. @example
  5342. crop=in_w:1/PHI*in_w
  5343. @end example
  5344. @item
  5345. Apply trembling effect:
  5346. @example
  5347. 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)
  5348. @end example
  5349. @item
  5350. Apply erratic camera effect depending on timestamp:
  5351. @example
  5352. 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)"
  5353. @end example
  5354. @item
  5355. Set x depending on the value of y:
  5356. @example
  5357. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5358. @end example
  5359. @end itemize
  5360. @subsection Commands
  5361. This filter supports the following commands:
  5362. @table @option
  5363. @item w, out_w
  5364. @item h, out_h
  5365. @item x
  5366. @item y
  5367. Set width/height of the output video and the horizontal/vertical position
  5368. in the input video.
  5369. The command accepts the same syntax of the corresponding option.
  5370. If the specified expression is not valid, it is kept at its current
  5371. value.
  5372. @end table
  5373. @section cropdetect
  5374. Auto-detect the crop size.
  5375. It calculates the necessary cropping parameters and prints the
  5376. recommended parameters via the logging system. The detected dimensions
  5377. correspond to the non-black area of the input video.
  5378. It accepts the following parameters:
  5379. @table @option
  5380. @item limit
  5381. Set higher black value threshold, which can be optionally specified
  5382. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5383. value greater to the set value is considered non-black. It defaults to 24.
  5384. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5385. on the bitdepth of the pixel format.
  5386. @item round
  5387. The value which the width/height should be divisible by. It defaults to
  5388. 16. The offset is automatically adjusted to center the video. Use 2 to
  5389. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5390. encoding to most video codecs.
  5391. @item reset_count, reset
  5392. Set the counter that determines after how many frames cropdetect will
  5393. reset the previously detected largest video area and start over to
  5394. detect the current optimal crop area. Default value is 0.
  5395. This can be useful when channel logos distort the video area. 0
  5396. indicates 'never reset', and returns the largest area encountered during
  5397. playback.
  5398. @end table
  5399. @anchor{curves}
  5400. @section curves
  5401. Apply color adjustments using curves.
  5402. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5403. component (red, green and blue) has its values defined by @var{N} key points
  5404. tied from each other using a smooth curve. The x-axis represents the pixel
  5405. values from the input frame, and the y-axis the new pixel values to be set for
  5406. the output frame.
  5407. By default, a component curve is defined by the two points @var{(0;0)} and
  5408. @var{(1;1)}. This creates a straight line where each original pixel value is
  5409. "adjusted" to its own value, which means no change to the image.
  5410. The filter allows you to redefine these two points and add some more. A new
  5411. curve (using a natural cubic spline interpolation) will be define to pass
  5412. smoothly through all these new coordinates. The new defined points needs to be
  5413. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5414. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5415. the vector spaces, the values will be clipped accordingly.
  5416. The filter accepts the following options:
  5417. @table @option
  5418. @item preset
  5419. Select one of the available color presets. This option can be used in addition
  5420. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5421. options takes priority on the preset values.
  5422. Available presets are:
  5423. @table @samp
  5424. @item none
  5425. @item color_negative
  5426. @item cross_process
  5427. @item darker
  5428. @item increase_contrast
  5429. @item lighter
  5430. @item linear_contrast
  5431. @item medium_contrast
  5432. @item negative
  5433. @item strong_contrast
  5434. @item vintage
  5435. @end table
  5436. Default is @code{none}.
  5437. @item master, m
  5438. Set the master key points. These points will define a second pass mapping. It
  5439. is sometimes called a "luminance" or "value" mapping. It can be used with
  5440. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5441. post-processing LUT.
  5442. @item red, r
  5443. Set the key points for the red component.
  5444. @item green, g
  5445. Set the key points for the green component.
  5446. @item blue, b
  5447. Set the key points for the blue component.
  5448. @item all
  5449. Set the key points for all components (not including master).
  5450. Can be used in addition to the other key points component
  5451. options. In this case, the unset component(s) will fallback on this
  5452. @option{all} setting.
  5453. @item psfile
  5454. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5455. @item plot
  5456. Save Gnuplot script of the curves in specified file.
  5457. @end table
  5458. To avoid some filtergraph syntax conflicts, each key points list need to be
  5459. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5460. @subsection Examples
  5461. @itemize
  5462. @item
  5463. Increase slightly the middle level of blue:
  5464. @example
  5465. curves=blue='0/0 0.5/0.58 1/1'
  5466. @end example
  5467. @item
  5468. Vintage effect:
  5469. @example
  5470. 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'
  5471. @end example
  5472. Here we obtain the following coordinates for each components:
  5473. @table @var
  5474. @item red
  5475. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5476. @item green
  5477. @code{(0;0) (0.50;0.48) (1;1)}
  5478. @item blue
  5479. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5480. @end table
  5481. @item
  5482. The previous example can also be achieved with the associated built-in preset:
  5483. @example
  5484. curves=preset=vintage
  5485. @end example
  5486. @item
  5487. Or simply:
  5488. @example
  5489. curves=vintage
  5490. @end example
  5491. @item
  5492. Use a Photoshop preset and redefine the points of the green component:
  5493. @example
  5494. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5495. @end example
  5496. @item
  5497. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5498. and @command{gnuplot}:
  5499. @example
  5500. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5501. gnuplot -p /tmp/curves.plt
  5502. @end example
  5503. @end itemize
  5504. @section datascope
  5505. Video data analysis filter.
  5506. This filter shows hexadecimal pixel values of part of video.
  5507. The filter accepts the following options:
  5508. @table @option
  5509. @item size, s
  5510. Set output video size.
  5511. @item x
  5512. Set x offset from where to pick pixels.
  5513. @item y
  5514. Set y offset from where to pick pixels.
  5515. @item mode
  5516. Set scope mode, can be one of the following:
  5517. @table @samp
  5518. @item mono
  5519. Draw hexadecimal pixel values with white color on black background.
  5520. @item color
  5521. Draw hexadecimal pixel values with input video pixel color on black
  5522. background.
  5523. @item color2
  5524. Draw hexadecimal pixel values on color background picked from input video,
  5525. the text color is picked in such way so its always visible.
  5526. @end table
  5527. @item axis
  5528. Draw rows and columns numbers on left and top of video.
  5529. @item opacity
  5530. Set background opacity.
  5531. @end table
  5532. @section dctdnoiz
  5533. Denoise frames using 2D DCT (frequency domain filtering).
  5534. This filter is not designed for real time.
  5535. The filter accepts the following options:
  5536. @table @option
  5537. @item sigma, s
  5538. Set the noise sigma constant.
  5539. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5540. coefficient (absolute value) below this threshold with be dropped.
  5541. If you need a more advanced filtering, see @option{expr}.
  5542. Default is @code{0}.
  5543. @item overlap
  5544. Set number overlapping pixels for each block. Since the filter can be slow, you
  5545. may want to reduce this value, at the cost of a less effective filter and the
  5546. risk of various artefacts.
  5547. If the overlapping value doesn't permit processing the whole input width or
  5548. height, a warning will be displayed and according borders won't be denoised.
  5549. Default value is @var{blocksize}-1, which is the best possible setting.
  5550. @item expr, e
  5551. Set the coefficient factor expression.
  5552. For each coefficient of a DCT block, this expression will be evaluated as a
  5553. multiplier value for the coefficient.
  5554. If this is option is set, the @option{sigma} option will be ignored.
  5555. The absolute value of the coefficient can be accessed through the @var{c}
  5556. variable.
  5557. @item n
  5558. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5559. @var{blocksize}, which is the width and height of the processed blocks.
  5560. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5561. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5562. on the speed processing. Also, a larger block size does not necessarily means a
  5563. better de-noising.
  5564. @end table
  5565. @subsection Examples
  5566. Apply a denoise with a @option{sigma} of @code{4.5}:
  5567. @example
  5568. dctdnoiz=4.5
  5569. @end example
  5570. The same operation can be achieved using the expression system:
  5571. @example
  5572. dctdnoiz=e='gte(c, 4.5*3)'
  5573. @end example
  5574. Violent denoise using a block size of @code{16x16}:
  5575. @example
  5576. dctdnoiz=15:n=4
  5577. @end example
  5578. @section deband
  5579. Remove banding artifacts from input video.
  5580. It works by replacing banded pixels with average value of referenced pixels.
  5581. The filter accepts the following options:
  5582. @table @option
  5583. @item 1thr
  5584. @item 2thr
  5585. @item 3thr
  5586. @item 4thr
  5587. Set banding detection threshold for each plane. Default is 0.02.
  5588. Valid range is 0.00003 to 0.5.
  5589. If difference between current pixel and reference pixel is less than threshold,
  5590. it will be considered as banded.
  5591. @item range, r
  5592. Banding detection range in pixels. Default is 16. If positive, random number
  5593. in range 0 to set value will be used. If negative, exact absolute value
  5594. will be used.
  5595. The range defines square of four pixels around current pixel.
  5596. @item direction, d
  5597. Set direction in radians from which four pixel will be compared. If positive,
  5598. random direction from 0 to set direction will be picked. If negative, exact of
  5599. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5600. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5601. column.
  5602. @item blur, b
  5603. If enabled, current pixel is compared with average value of all four
  5604. surrounding pixels. The default is enabled. If disabled current pixel is
  5605. compared with all four surrounding pixels. The pixel is considered banded
  5606. if only all four differences with surrounding pixels are less than threshold.
  5607. @item coupling, c
  5608. If enabled, current pixel is changed if and only if all pixel components are banded,
  5609. e.g. banding detection threshold is triggered for all color components.
  5610. The default is disabled.
  5611. @end table
  5612. @section deblock
  5613. Remove blocking artifacts from input video.
  5614. The filter accepts the following options:
  5615. @table @option
  5616. @item filter
  5617. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  5618. This controls what kind of deblocking is applied.
  5619. @item block
  5620. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  5621. @item alpha
  5622. @item beta
  5623. @item gamma
  5624. @item delta
  5625. Set blocking detection thresholds. Allowed range is 0 to 1.
  5626. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  5627. Using higher threshold gives more deblocking strength.
  5628. Setting @var{alpha} controls threshold detection at exact edge of block.
  5629. Remaining options controls threshold detection near the edge. Each one for
  5630. below/above or left/right. Setting any of those to @var{0} disables
  5631. deblocking.
  5632. @item planes
  5633. Set planes to filter. Default is to filter all available planes.
  5634. @end table
  5635. @subsection Examples
  5636. @itemize
  5637. @item
  5638. Deblock using weak filter and block size of 4 pixels.
  5639. @example
  5640. deblock=filter=weak:block=4
  5641. @end example
  5642. @item
  5643. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  5644. deblocking more edges.
  5645. @example
  5646. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  5647. @end example
  5648. @item
  5649. Similar as above, but filter only first plane.
  5650. @example
  5651. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  5652. @end example
  5653. @item
  5654. Similar as above, but filter only second and third plane.
  5655. @example
  5656. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  5657. @end example
  5658. @end itemize
  5659. @anchor{decimate}
  5660. @section decimate
  5661. Drop duplicated frames at regular intervals.
  5662. The filter accepts the following options:
  5663. @table @option
  5664. @item cycle
  5665. Set the number of frames from which one will be dropped. Setting this to
  5666. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5667. Default is @code{5}.
  5668. @item dupthresh
  5669. Set the threshold for duplicate detection. If the difference metric for a frame
  5670. is less than or equal to this value, then it is declared as duplicate. Default
  5671. is @code{1.1}
  5672. @item scthresh
  5673. Set scene change threshold. Default is @code{15}.
  5674. @item blockx
  5675. @item blocky
  5676. Set the size of the x and y-axis blocks used during metric calculations.
  5677. Larger blocks give better noise suppression, but also give worse detection of
  5678. small movements. Must be a power of two. Default is @code{32}.
  5679. @item ppsrc
  5680. Mark main input as a pre-processed input and activate clean source input
  5681. stream. This allows the input to be pre-processed with various filters to help
  5682. the metrics calculation while keeping the frame selection lossless. When set to
  5683. @code{1}, the first stream is for the pre-processed input, and the second
  5684. stream is the clean source from where the kept frames are chosen. Default is
  5685. @code{0}.
  5686. @item chroma
  5687. Set whether or not chroma is considered in the metric calculations. Default is
  5688. @code{1}.
  5689. @end table
  5690. @section deconvolve
  5691. Apply 2D deconvolution of video stream in frequency domain using second stream
  5692. as impulse.
  5693. The filter accepts the following options:
  5694. @table @option
  5695. @item planes
  5696. Set which planes to process.
  5697. @item impulse
  5698. Set which impulse video frames will be processed, can be @var{first}
  5699. or @var{all}. Default is @var{all}.
  5700. @item noise
  5701. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5702. and height are not same and not power of 2 or if stream prior to convolving
  5703. had noise.
  5704. @end table
  5705. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5706. @section deflate
  5707. Apply deflate effect to the video.
  5708. This filter replaces the pixel by the local(3x3) average by taking into account
  5709. only values lower than the pixel.
  5710. It accepts the following options:
  5711. @table @option
  5712. @item threshold0
  5713. @item threshold1
  5714. @item threshold2
  5715. @item threshold3
  5716. Limit the maximum change for each plane, default is 65535.
  5717. If 0, plane will remain unchanged.
  5718. @end table
  5719. @section deflicker
  5720. Remove temporal frame luminance variations.
  5721. It accepts the following options:
  5722. @table @option
  5723. @item size, s
  5724. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5725. @item mode, m
  5726. Set averaging mode to smooth temporal luminance variations.
  5727. Available values are:
  5728. @table @samp
  5729. @item am
  5730. Arithmetic mean
  5731. @item gm
  5732. Geometric mean
  5733. @item hm
  5734. Harmonic mean
  5735. @item qm
  5736. Quadratic mean
  5737. @item cm
  5738. Cubic mean
  5739. @item pm
  5740. Power mean
  5741. @item median
  5742. Median
  5743. @end table
  5744. @item bypass
  5745. Do not actually modify frame. Useful when one only wants metadata.
  5746. @end table
  5747. @section dejudder
  5748. Remove judder produced by partially interlaced telecined content.
  5749. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5750. source was partially telecined content then the output of @code{pullup,dejudder}
  5751. will have a variable frame rate. May change the recorded frame rate of the
  5752. container. Aside from that change, this filter will not affect constant frame
  5753. rate video.
  5754. The option available in this filter is:
  5755. @table @option
  5756. @item cycle
  5757. Specify the length of the window over which the judder repeats.
  5758. Accepts any integer greater than 1. Useful values are:
  5759. @table @samp
  5760. @item 4
  5761. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5762. @item 5
  5763. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5764. @item 20
  5765. If a mixture of the two.
  5766. @end table
  5767. The default is @samp{4}.
  5768. @end table
  5769. @section delogo
  5770. Suppress a TV station logo by a simple interpolation of the surrounding
  5771. pixels. Just set a rectangle covering the logo and watch it disappear
  5772. (and sometimes something even uglier appear - your mileage may vary).
  5773. It accepts the following parameters:
  5774. @table @option
  5775. @item x
  5776. @item y
  5777. Specify the top left corner coordinates of the logo. They must be
  5778. specified.
  5779. @item w
  5780. @item h
  5781. Specify the width and height of the logo to clear. They must be
  5782. specified.
  5783. @item band, t
  5784. Specify the thickness of the fuzzy edge of the rectangle (added to
  5785. @var{w} and @var{h}). The default value is 1. This option is
  5786. deprecated, setting higher values should no longer be necessary and
  5787. is not recommended.
  5788. @item show
  5789. When set to 1, a green rectangle is drawn on the screen to simplify
  5790. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5791. The default value is 0.
  5792. The rectangle is drawn on the outermost pixels which will be (partly)
  5793. replaced with interpolated values. The values of the next pixels
  5794. immediately outside this rectangle in each direction will be used to
  5795. compute the interpolated pixel values inside the rectangle.
  5796. @end table
  5797. @subsection Examples
  5798. @itemize
  5799. @item
  5800. Set a rectangle covering the area with top left corner coordinates 0,0
  5801. and size 100x77, and a band of size 10:
  5802. @example
  5803. delogo=x=0:y=0:w=100:h=77:band=10
  5804. @end example
  5805. @end itemize
  5806. @section deshake
  5807. Attempt to fix small changes in horizontal and/or vertical shift. This
  5808. filter helps remove camera shake from hand-holding a camera, bumping a
  5809. tripod, moving on a vehicle, etc.
  5810. The filter accepts the following options:
  5811. @table @option
  5812. @item x
  5813. @item y
  5814. @item w
  5815. @item h
  5816. Specify a rectangular area where to limit the search for motion
  5817. vectors.
  5818. If desired the search for motion vectors can be limited to a
  5819. rectangular area of the frame defined by its top left corner, width
  5820. and height. These parameters have the same meaning as the drawbox
  5821. filter which can be used to visualise the position of the bounding
  5822. box.
  5823. This is useful when simultaneous movement of subjects within the frame
  5824. might be confused for camera motion by the motion vector search.
  5825. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5826. then the full frame is used. This allows later options to be set
  5827. without specifying the bounding box for the motion vector search.
  5828. Default - search the whole frame.
  5829. @item rx
  5830. @item ry
  5831. Specify the maximum extent of movement in x and y directions in the
  5832. range 0-64 pixels. Default 16.
  5833. @item edge
  5834. Specify how to generate pixels to fill blanks at the edge of the
  5835. frame. Available values are:
  5836. @table @samp
  5837. @item blank, 0
  5838. Fill zeroes at blank locations
  5839. @item original, 1
  5840. Original image at blank locations
  5841. @item clamp, 2
  5842. Extruded edge value at blank locations
  5843. @item mirror, 3
  5844. Mirrored edge at blank locations
  5845. @end table
  5846. Default value is @samp{mirror}.
  5847. @item blocksize
  5848. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5849. default 8.
  5850. @item contrast
  5851. Specify the contrast threshold for blocks. Only blocks with more than
  5852. the specified contrast (difference between darkest and lightest
  5853. pixels) will be considered. Range 1-255, default 125.
  5854. @item search
  5855. Specify the search strategy. Available values are:
  5856. @table @samp
  5857. @item exhaustive, 0
  5858. Set exhaustive search
  5859. @item less, 1
  5860. Set less exhaustive search.
  5861. @end table
  5862. Default value is @samp{exhaustive}.
  5863. @item filename
  5864. If set then a detailed log of the motion search is written to the
  5865. specified file.
  5866. @end table
  5867. @section despill
  5868. Remove unwanted contamination of foreground colors, caused by reflected color of
  5869. greenscreen or bluescreen.
  5870. This filter accepts the following options:
  5871. @table @option
  5872. @item type
  5873. Set what type of despill to use.
  5874. @item mix
  5875. Set how spillmap will be generated.
  5876. @item expand
  5877. Set how much to get rid of still remaining spill.
  5878. @item red
  5879. Controls amount of red in spill area.
  5880. @item green
  5881. Controls amount of green in spill area.
  5882. Should be -1 for greenscreen.
  5883. @item blue
  5884. Controls amount of blue in spill area.
  5885. Should be -1 for bluescreen.
  5886. @item brightness
  5887. Controls brightness of spill area, preserving colors.
  5888. @item alpha
  5889. Modify alpha from generated spillmap.
  5890. @end table
  5891. @section detelecine
  5892. Apply an exact inverse of the telecine operation. It requires a predefined
  5893. pattern specified using the pattern option which must be the same as that passed
  5894. to the telecine filter.
  5895. This filter accepts the following options:
  5896. @table @option
  5897. @item first_field
  5898. @table @samp
  5899. @item top, t
  5900. top field first
  5901. @item bottom, b
  5902. bottom field first
  5903. The default value is @code{top}.
  5904. @end table
  5905. @item pattern
  5906. A string of numbers representing the pulldown pattern you wish to apply.
  5907. The default value is @code{23}.
  5908. @item start_frame
  5909. A number representing position of the first frame with respect to the telecine
  5910. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5911. @end table
  5912. @section dilation
  5913. Apply dilation effect to the video.
  5914. This filter replaces the pixel by the local(3x3) maximum.
  5915. It accepts the following options:
  5916. @table @option
  5917. @item threshold0
  5918. @item threshold1
  5919. @item threshold2
  5920. @item threshold3
  5921. Limit the maximum change for each plane, default is 65535.
  5922. If 0, plane will remain unchanged.
  5923. @item coordinates
  5924. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5925. pixels are used.
  5926. Flags to local 3x3 coordinates maps like this:
  5927. 1 2 3
  5928. 4 5
  5929. 6 7 8
  5930. @end table
  5931. @section displace
  5932. Displace pixels as indicated by second and third input stream.
  5933. It takes three input streams and outputs one stream, the first input is the
  5934. source, and second and third input are displacement maps.
  5935. The second input specifies how much to displace pixels along the
  5936. x-axis, while the third input specifies how much to displace pixels
  5937. along the y-axis.
  5938. If one of displacement map streams terminates, last frame from that
  5939. displacement map will be used.
  5940. Note that once generated, displacements maps can be reused over and over again.
  5941. A description of the accepted options follows.
  5942. @table @option
  5943. @item edge
  5944. Set displace behavior for pixels that are out of range.
  5945. Available values are:
  5946. @table @samp
  5947. @item blank
  5948. Missing pixels are replaced by black pixels.
  5949. @item smear
  5950. Adjacent pixels will spread out to replace missing pixels.
  5951. @item wrap
  5952. Out of range pixels are wrapped so they point to pixels of other side.
  5953. @item mirror
  5954. Out of range pixels will be replaced with mirrored pixels.
  5955. @end table
  5956. Default is @samp{smear}.
  5957. @end table
  5958. @subsection Examples
  5959. @itemize
  5960. @item
  5961. Add ripple effect to rgb input of video size hd720:
  5962. @example
  5963. 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
  5964. @end example
  5965. @item
  5966. Add wave effect to rgb input of video size hd720:
  5967. @example
  5968. 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
  5969. @end example
  5970. @end itemize
  5971. @section drawbox
  5972. Draw a colored box on the input image.
  5973. It accepts the following parameters:
  5974. @table @option
  5975. @item x
  5976. @item y
  5977. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5978. @item width, w
  5979. @item height, h
  5980. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5981. the input width and height. It defaults to 0.
  5982. @item color, c
  5983. Specify the color of the box to write. For the general syntax of this option,
  5984. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5985. value @code{invert} is used, the box edge color is the same as the
  5986. video with inverted luma.
  5987. @item thickness, t
  5988. The expression which sets the thickness of the box edge.
  5989. A value of @code{fill} will create a filled box. Default value is @code{3}.
  5990. See below for the list of accepted constants.
  5991. @item replace
  5992. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  5993. will overwrite the video's color and alpha pixels.
  5994. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  5995. @end table
  5996. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5997. following constants:
  5998. @table @option
  5999. @item dar
  6000. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6001. @item hsub
  6002. @item vsub
  6003. horizontal and vertical chroma subsample values. For example for the
  6004. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6005. @item in_h, ih
  6006. @item in_w, iw
  6007. The input width and height.
  6008. @item sar
  6009. The input sample aspect ratio.
  6010. @item x
  6011. @item y
  6012. The x and y offset coordinates where the box is drawn.
  6013. @item w
  6014. @item h
  6015. The width and height of the drawn box.
  6016. @item t
  6017. The thickness of the drawn box.
  6018. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6019. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6020. @end table
  6021. @subsection Examples
  6022. @itemize
  6023. @item
  6024. Draw a black box around the edge of the input image:
  6025. @example
  6026. drawbox
  6027. @end example
  6028. @item
  6029. Draw a box with color red and an opacity of 50%:
  6030. @example
  6031. drawbox=10:20:200:60:red@@0.5
  6032. @end example
  6033. The previous example can be specified as:
  6034. @example
  6035. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6036. @end example
  6037. @item
  6038. Fill the box with pink color:
  6039. @example
  6040. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6041. @end example
  6042. @item
  6043. Draw a 2-pixel red 2.40:1 mask:
  6044. @example
  6045. 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
  6046. @end example
  6047. @end itemize
  6048. @section drawgrid
  6049. Draw a grid on the input image.
  6050. It accepts the following parameters:
  6051. @table @option
  6052. @item x
  6053. @item y
  6054. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6055. @item width, w
  6056. @item height, h
  6057. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6058. input width and height, respectively, minus @code{thickness}, so image gets
  6059. framed. Default to 0.
  6060. @item color, c
  6061. Specify the color of the grid. For the general syntax of this option,
  6062. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6063. value @code{invert} is used, the grid color is the same as the
  6064. video with inverted luma.
  6065. @item thickness, t
  6066. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6067. See below for the list of accepted constants.
  6068. @item replace
  6069. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6070. will overwrite the video's color and alpha pixels.
  6071. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6072. @end table
  6073. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6074. following constants:
  6075. @table @option
  6076. @item dar
  6077. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6078. @item hsub
  6079. @item vsub
  6080. horizontal and vertical chroma subsample values. For example for the
  6081. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6082. @item in_h, ih
  6083. @item in_w, iw
  6084. The input grid cell width and height.
  6085. @item sar
  6086. The input sample aspect ratio.
  6087. @item x
  6088. @item y
  6089. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6090. @item w
  6091. @item h
  6092. The width and height of the drawn cell.
  6093. @item t
  6094. The thickness of the drawn cell.
  6095. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6096. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6097. @end table
  6098. @subsection Examples
  6099. @itemize
  6100. @item
  6101. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6102. @example
  6103. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6104. @end example
  6105. @item
  6106. Draw a white 3x3 grid with an opacity of 50%:
  6107. @example
  6108. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6109. @end example
  6110. @end itemize
  6111. @anchor{drawtext}
  6112. @section drawtext
  6113. Draw a text string or text from a specified file on top of a video, using the
  6114. libfreetype library.
  6115. To enable compilation of this filter, you need to configure FFmpeg with
  6116. @code{--enable-libfreetype}.
  6117. To enable default font fallback and the @var{font} option you need to
  6118. configure FFmpeg with @code{--enable-libfontconfig}.
  6119. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6120. @code{--enable-libfribidi}.
  6121. @subsection Syntax
  6122. It accepts the following parameters:
  6123. @table @option
  6124. @item box
  6125. Used to draw a box around text using the background color.
  6126. The value must be either 1 (enable) or 0 (disable).
  6127. The default value of @var{box} is 0.
  6128. @item boxborderw
  6129. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6130. The default value of @var{boxborderw} is 0.
  6131. @item boxcolor
  6132. The color to be used for drawing box around text. For the syntax of this
  6133. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6134. The default value of @var{boxcolor} is "white".
  6135. @item line_spacing
  6136. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6137. The default value of @var{line_spacing} is 0.
  6138. @item borderw
  6139. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6140. The default value of @var{borderw} is 0.
  6141. @item bordercolor
  6142. Set the color to be used for drawing border around text. For the syntax of this
  6143. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6144. The default value of @var{bordercolor} is "black".
  6145. @item expansion
  6146. Select how the @var{text} is expanded. Can be either @code{none},
  6147. @code{strftime} (deprecated) or
  6148. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6149. below for details.
  6150. @item basetime
  6151. Set a start time for the count. Value is in microseconds. Only applied
  6152. in the deprecated strftime expansion mode. To emulate in normal expansion
  6153. mode use the @code{pts} function, supplying the start time (in seconds)
  6154. as the second argument.
  6155. @item fix_bounds
  6156. If true, check and fix text coords to avoid clipping.
  6157. @item fontcolor
  6158. The color to be used for drawing fonts. For the syntax of this option, check
  6159. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6160. The default value of @var{fontcolor} is "black".
  6161. @item fontcolor_expr
  6162. String which is expanded the same way as @var{text} to obtain dynamic
  6163. @var{fontcolor} value. By default this option has empty value and is not
  6164. processed. When this option is set, it overrides @var{fontcolor} option.
  6165. @item font
  6166. The font family to be used for drawing text. By default Sans.
  6167. @item fontfile
  6168. The font file to be used for drawing text. The path must be included.
  6169. This parameter is mandatory if the fontconfig support is disabled.
  6170. @item alpha
  6171. Draw the text applying alpha blending. The value can
  6172. be a number between 0.0 and 1.0.
  6173. The expression accepts the same variables @var{x, y} as well.
  6174. The default value is 1.
  6175. Please see @var{fontcolor_expr}.
  6176. @item fontsize
  6177. The font size to be used for drawing text.
  6178. The default value of @var{fontsize} is 16.
  6179. @item text_shaping
  6180. If set to 1, attempt to shape the text (for example, reverse the order of
  6181. right-to-left text and join Arabic characters) before drawing it.
  6182. Otherwise, just draw the text exactly as given.
  6183. By default 1 (if supported).
  6184. @item ft_load_flags
  6185. The flags to be used for loading the fonts.
  6186. The flags map the corresponding flags supported by libfreetype, and are
  6187. a combination of the following values:
  6188. @table @var
  6189. @item default
  6190. @item no_scale
  6191. @item no_hinting
  6192. @item render
  6193. @item no_bitmap
  6194. @item vertical_layout
  6195. @item force_autohint
  6196. @item crop_bitmap
  6197. @item pedantic
  6198. @item ignore_global_advance_width
  6199. @item no_recurse
  6200. @item ignore_transform
  6201. @item monochrome
  6202. @item linear_design
  6203. @item no_autohint
  6204. @end table
  6205. Default value is "default".
  6206. For more information consult the documentation for the FT_LOAD_*
  6207. libfreetype flags.
  6208. @item shadowcolor
  6209. The color to be used for drawing a shadow behind the drawn text. For the
  6210. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6211. ffmpeg-utils manual,ffmpeg-utils}.
  6212. The default value of @var{shadowcolor} is "black".
  6213. @item shadowx
  6214. @item shadowy
  6215. The x and y offsets for the text shadow position with respect to the
  6216. position of the text. They can be either positive or negative
  6217. values. The default value for both is "0".
  6218. @item start_number
  6219. The starting frame number for the n/frame_num variable. The default value
  6220. is "0".
  6221. @item tabsize
  6222. The size in number of spaces to use for rendering the tab.
  6223. Default value is 4.
  6224. @item timecode
  6225. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6226. format. It can be used with or without text parameter. @var{timecode_rate}
  6227. option must be specified.
  6228. @item timecode_rate, rate, r
  6229. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6230. integer. Minimum value is "1".
  6231. Drop-frame timecode is supported for frame rates 30 & 60.
  6232. @item tc24hmax
  6233. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6234. Default is 0 (disabled).
  6235. @item text
  6236. The text string to be drawn. The text must be a sequence of UTF-8
  6237. encoded characters.
  6238. This parameter is mandatory if no file is specified with the parameter
  6239. @var{textfile}.
  6240. @item textfile
  6241. A text file containing text to be drawn. The text must be a sequence
  6242. of UTF-8 encoded characters.
  6243. This parameter is mandatory if no text string is specified with the
  6244. parameter @var{text}.
  6245. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6246. @item reload
  6247. If set to 1, the @var{textfile} will be reloaded before each frame.
  6248. Be sure to update it atomically, or it may be read partially, or even fail.
  6249. @item x
  6250. @item y
  6251. The expressions which specify the offsets where text will be drawn
  6252. within the video frame. They are relative to the top/left border of the
  6253. output image.
  6254. The default value of @var{x} and @var{y} is "0".
  6255. See below for the list of accepted constants and functions.
  6256. @end table
  6257. The parameters for @var{x} and @var{y} are expressions containing the
  6258. following constants and functions:
  6259. @table @option
  6260. @item dar
  6261. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6262. @item hsub
  6263. @item vsub
  6264. horizontal and vertical chroma subsample values. For example for the
  6265. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6266. @item line_h, lh
  6267. the height of each text line
  6268. @item main_h, h, H
  6269. the input height
  6270. @item main_w, w, W
  6271. the input width
  6272. @item max_glyph_a, ascent
  6273. the maximum distance from the baseline to the highest/upper grid
  6274. coordinate used to place a glyph outline point, for all the rendered
  6275. glyphs.
  6276. It is a positive value, due to the grid's orientation with the Y axis
  6277. upwards.
  6278. @item max_glyph_d, descent
  6279. the maximum distance from the baseline to the lowest grid coordinate
  6280. used to place a glyph outline point, for all the rendered glyphs.
  6281. This is a negative value, due to the grid's orientation, with the Y axis
  6282. upwards.
  6283. @item max_glyph_h
  6284. maximum glyph height, that is the maximum height for all the glyphs
  6285. contained in the rendered text, it is equivalent to @var{ascent} -
  6286. @var{descent}.
  6287. @item max_glyph_w
  6288. maximum glyph width, that is the maximum width for all the glyphs
  6289. contained in the rendered text
  6290. @item n
  6291. the number of input frame, starting from 0
  6292. @item rand(min, max)
  6293. return a random number included between @var{min} and @var{max}
  6294. @item sar
  6295. The input sample aspect ratio.
  6296. @item t
  6297. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6298. @item text_h, th
  6299. the height of the rendered text
  6300. @item text_w, tw
  6301. the width of the rendered text
  6302. @item x
  6303. @item y
  6304. the x and y offset coordinates where the text is drawn.
  6305. These parameters allow the @var{x} and @var{y} expressions to refer
  6306. each other, so you can for example specify @code{y=x/dar}.
  6307. @end table
  6308. @anchor{drawtext_expansion}
  6309. @subsection Text expansion
  6310. If @option{expansion} is set to @code{strftime},
  6311. the filter recognizes strftime() sequences in the provided text and
  6312. expands them accordingly. Check the documentation of strftime(). This
  6313. feature is deprecated.
  6314. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6315. If @option{expansion} is set to @code{normal} (which is the default),
  6316. the following expansion mechanism is used.
  6317. The backslash character @samp{\}, followed by any character, always expands to
  6318. the second character.
  6319. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6320. braces is a function name, possibly followed by arguments separated by ':'.
  6321. If the arguments contain special characters or delimiters (':' or '@}'),
  6322. they should be escaped.
  6323. Note that they probably must also be escaped as the value for the
  6324. @option{text} option in the filter argument string and as the filter
  6325. argument in the filtergraph description, and possibly also for the shell,
  6326. that makes up to four levels of escaping; using a text file avoids these
  6327. problems.
  6328. The following functions are available:
  6329. @table @command
  6330. @item expr, e
  6331. The expression evaluation result.
  6332. It must take one argument specifying the expression to be evaluated,
  6333. which accepts the same constants and functions as the @var{x} and
  6334. @var{y} values. Note that not all constants should be used, for
  6335. example the text size is not known when evaluating the expression, so
  6336. the constants @var{text_w} and @var{text_h} will have an undefined
  6337. value.
  6338. @item expr_int_format, eif
  6339. Evaluate the expression's value and output as formatted integer.
  6340. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6341. The second argument specifies the output format. Allowed values are @samp{x},
  6342. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6343. @code{printf} function.
  6344. The third parameter is optional and sets the number of positions taken by the output.
  6345. It can be used to add padding with zeros from the left.
  6346. @item gmtime
  6347. The time at which the filter is running, expressed in UTC.
  6348. It can accept an argument: a strftime() format string.
  6349. @item localtime
  6350. The time at which the filter is running, expressed in the local time zone.
  6351. It can accept an argument: a strftime() format string.
  6352. @item metadata
  6353. Frame metadata. Takes one or two arguments.
  6354. The first argument is mandatory and specifies the metadata key.
  6355. The second argument is optional and specifies a default value, used when the
  6356. metadata key is not found or empty.
  6357. @item n, frame_num
  6358. The frame number, starting from 0.
  6359. @item pict_type
  6360. A 1 character description of the current picture type.
  6361. @item pts
  6362. The timestamp of the current frame.
  6363. It can take up to three arguments.
  6364. The first argument is the format of the timestamp; it defaults to @code{flt}
  6365. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6366. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6367. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6368. @code{localtime} stands for the timestamp of the frame formatted as
  6369. local time zone time.
  6370. The second argument is an offset added to the timestamp.
  6371. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6372. supplied to present the hour part of the formatted timestamp in 24h format
  6373. (00-23).
  6374. If the format is set to @code{localtime} or @code{gmtime},
  6375. a third argument may be supplied: a strftime() format string.
  6376. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6377. @end table
  6378. @subsection Examples
  6379. @itemize
  6380. @item
  6381. Draw "Test Text" with font FreeSerif, using the default values for the
  6382. optional parameters.
  6383. @example
  6384. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6385. @end example
  6386. @item
  6387. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6388. and y=50 (counting from the top-left corner of the screen), text is
  6389. yellow with a red box around it. Both the text and the box have an
  6390. opacity of 20%.
  6391. @example
  6392. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6393. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6394. @end example
  6395. Note that the double quotes are not necessary if spaces are not used
  6396. within the parameter list.
  6397. @item
  6398. Show the text at the center of the video frame:
  6399. @example
  6400. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6401. @end example
  6402. @item
  6403. Show the text at a random position, switching to a new position every 30 seconds:
  6404. @example
  6405. 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)"
  6406. @end example
  6407. @item
  6408. Show a text line sliding from right to left in the last row of the video
  6409. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6410. with no newlines.
  6411. @example
  6412. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6413. @end example
  6414. @item
  6415. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6416. @example
  6417. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6418. @end example
  6419. @item
  6420. Draw a single green letter "g", at the center of the input video.
  6421. The glyph baseline is placed at half screen height.
  6422. @example
  6423. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6424. @end example
  6425. @item
  6426. Show text for 1 second every 3 seconds:
  6427. @example
  6428. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6429. @end example
  6430. @item
  6431. Use fontconfig to set the font. Note that the colons need to be escaped.
  6432. @example
  6433. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6434. @end example
  6435. @item
  6436. Print the date of a real-time encoding (see strftime(3)):
  6437. @example
  6438. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6439. @end example
  6440. @item
  6441. Show text fading in and out (appearing/disappearing):
  6442. @example
  6443. #!/bin/sh
  6444. DS=1.0 # display start
  6445. DE=10.0 # display end
  6446. FID=1.5 # fade in duration
  6447. FOD=5 # fade out duration
  6448. 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 @}"
  6449. @end example
  6450. @item
  6451. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6452. and the @option{fontsize} value are included in the @option{y} offset.
  6453. @example
  6454. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6455. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6456. @end example
  6457. @end itemize
  6458. For more information about libfreetype, check:
  6459. @url{http://www.freetype.org/}.
  6460. For more information about fontconfig, check:
  6461. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6462. For more information about libfribidi, check:
  6463. @url{http://fribidi.org/}.
  6464. @section edgedetect
  6465. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6466. The filter accepts the following options:
  6467. @table @option
  6468. @item low
  6469. @item high
  6470. Set low and high threshold values used by the Canny thresholding
  6471. algorithm.
  6472. The high threshold selects the "strong" edge pixels, which are then
  6473. connected through 8-connectivity with the "weak" edge pixels selected
  6474. by the low threshold.
  6475. @var{low} and @var{high} threshold values must be chosen in the range
  6476. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6477. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6478. is @code{50/255}.
  6479. @item mode
  6480. Define the drawing mode.
  6481. @table @samp
  6482. @item wires
  6483. Draw white/gray wires on black background.
  6484. @item colormix
  6485. Mix the colors to create a paint/cartoon effect.
  6486. @item canny
  6487. Apply Canny edge detector on all selected planes.
  6488. @end table
  6489. Default value is @var{wires}.
  6490. @item planes
  6491. Select planes for filtering. By default all available planes are filtered.
  6492. @end table
  6493. @subsection Examples
  6494. @itemize
  6495. @item
  6496. Standard edge detection with custom values for the hysteresis thresholding:
  6497. @example
  6498. edgedetect=low=0.1:high=0.4
  6499. @end example
  6500. @item
  6501. Painting effect without thresholding:
  6502. @example
  6503. edgedetect=mode=colormix:high=0
  6504. @end example
  6505. @end itemize
  6506. @section eq
  6507. Set brightness, contrast, saturation and approximate gamma adjustment.
  6508. The filter accepts the following options:
  6509. @table @option
  6510. @item contrast
  6511. Set the contrast expression. The value must be a float value in range
  6512. @code{-2.0} to @code{2.0}. The default value is "1".
  6513. @item brightness
  6514. Set the brightness expression. The value must be a float value in
  6515. range @code{-1.0} to @code{1.0}. The default value is "0".
  6516. @item saturation
  6517. Set the saturation expression. The value must be a float in
  6518. range @code{0.0} to @code{3.0}. The default value is "1".
  6519. @item gamma
  6520. Set the gamma expression. The value must be a float in range
  6521. @code{0.1} to @code{10.0}. The default value is "1".
  6522. @item gamma_r
  6523. Set the gamma expression for red. The value must be a float in
  6524. range @code{0.1} to @code{10.0}. The default value is "1".
  6525. @item gamma_g
  6526. Set the gamma expression for green. The value must be a float in range
  6527. @code{0.1} to @code{10.0}. The default value is "1".
  6528. @item gamma_b
  6529. Set the gamma expression for blue. The value must be a float in range
  6530. @code{0.1} to @code{10.0}. The default value is "1".
  6531. @item gamma_weight
  6532. Set the gamma weight expression. It can be used to reduce the effect
  6533. of a high gamma value on bright image areas, e.g. keep them from
  6534. getting overamplified and just plain white. The value must be a float
  6535. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6536. gamma correction all the way down while @code{1.0} leaves it at its
  6537. full strength. Default is "1".
  6538. @item eval
  6539. Set when the expressions for brightness, contrast, saturation and
  6540. gamma expressions are evaluated.
  6541. It accepts the following values:
  6542. @table @samp
  6543. @item init
  6544. only evaluate expressions once during the filter initialization or
  6545. when a command is processed
  6546. @item frame
  6547. evaluate expressions for each incoming frame
  6548. @end table
  6549. Default value is @samp{init}.
  6550. @end table
  6551. The expressions accept the following parameters:
  6552. @table @option
  6553. @item n
  6554. frame count of the input frame starting from 0
  6555. @item pos
  6556. byte position of the corresponding packet in the input file, NAN if
  6557. unspecified
  6558. @item r
  6559. frame rate of the input video, NAN if the input frame rate is unknown
  6560. @item t
  6561. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6562. @end table
  6563. @subsection Commands
  6564. The filter supports the following commands:
  6565. @table @option
  6566. @item contrast
  6567. Set the contrast expression.
  6568. @item brightness
  6569. Set the brightness expression.
  6570. @item saturation
  6571. Set the saturation expression.
  6572. @item gamma
  6573. Set the gamma expression.
  6574. @item gamma_r
  6575. Set the gamma_r expression.
  6576. @item gamma_g
  6577. Set gamma_g expression.
  6578. @item gamma_b
  6579. Set gamma_b expression.
  6580. @item gamma_weight
  6581. Set gamma_weight expression.
  6582. The command accepts the same syntax of the corresponding option.
  6583. If the specified expression is not valid, it is kept at its current
  6584. value.
  6585. @end table
  6586. @section erosion
  6587. Apply erosion effect to the video.
  6588. This filter replaces the pixel by the local(3x3) minimum.
  6589. It accepts the following options:
  6590. @table @option
  6591. @item threshold0
  6592. @item threshold1
  6593. @item threshold2
  6594. @item threshold3
  6595. Limit the maximum change for each plane, default is 65535.
  6596. If 0, plane will remain unchanged.
  6597. @item coordinates
  6598. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6599. pixels are used.
  6600. Flags to local 3x3 coordinates maps like this:
  6601. 1 2 3
  6602. 4 5
  6603. 6 7 8
  6604. @end table
  6605. @section extractplanes
  6606. Extract color channel components from input video stream into
  6607. separate grayscale video streams.
  6608. The filter accepts the following option:
  6609. @table @option
  6610. @item planes
  6611. Set plane(s) to extract.
  6612. Available values for planes are:
  6613. @table @samp
  6614. @item y
  6615. @item u
  6616. @item v
  6617. @item a
  6618. @item r
  6619. @item g
  6620. @item b
  6621. @end table
  6622. Choosing planes not available in the input will result in an error.
  6623. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6624. with @code{y}, @code{u}, @code{v} planes at same time.
  6625. @end table
  6626. @subsection Examples
  6627. @itemize
  6628. @item
  6629. Extract luma, u and v color channel component from input video frame
  6630. into 3 grayscale outputs:
  6631. @example
  6632. 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
  6633. @end example
  6634. @end itemize
  6635. @section elbg
  6636. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6637. For each input image, the filter will compute the optimal mapping from
  6638. the input to the output given the codebook length, that is the number
  6639. of distinct output colors.
  6640. This filter accepts the following options.
  6641. @table @option
  6642. @item codebook_length, l
  6643. Set codebook length. The value must be a positive integer, and
  6644. represents the number of distinct output colors. Default value is 256.
  6645. @item nb_steps, n
  6646. Set the maximum number of iterations to apply for computing the optimal
  6647. mapping. The higher the value the better the result and the higher the
  6648. computation time. Default value is 1.
  6649. @item seed, s
  6650. Set a random seed, must be an integer included between 0 and
  6651. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6652. will try to use a good random seed on a best effort basis.
  6653. @item pal8
  6654. Set pal8 output pixel format. This option does not work with codebook
  6655. length greater than 256.
  6656. @end table
  6657. @section entropy
  6658. Measure graylevel entropy in histogram of color channels of video frames.
  6659. It accepts the following parameters:
  6660. @table @option
  6661. @item mode
  6662. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6663. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6664. between neighbour histogram values.
  6665. @end table
  6666. @section fade
  6667. Apply a fade-in/out effect to the input video.
  6668. It accepts the following parameters:
  6669. @table @option
  6670. @item type, t
  6671. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6672. effect.
  6673. Default is @code{in}.
  6674. @item start_frame, s
  6675. Specify the number of the frame to start applying the fade
  6676. effect at. Default is 0.
  6677. @item nb_frames, n
  6678. The number of frames that the fade effect lasts. At the end of the
  6679. fade-in effect, the output video will have the same intensity as the input video.
  6680. At the end of the fade-out transition, the output video will be filled with the
  6681. selected @option{color}.
  6682. Default is 25.
  6683. @item alpha
  6684. If set to 1, fade only alpha channel, if one exists on the input.
  6685. Default value is 0.
  6686. @item start_time, st
  6687. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6688. effect. If both start_frame and start_time are specified, the fade will start at
  6689. whichever comes last. Default is 0.
  6690. @item duration, d
  6691. The number of seconds for which the fade effect has to last. At the end of the
  6692. fade-in effect the output video will have the same intensity as the input video,
  6693. at the end of the fade-out transition the output video will be filled with the
  6694. selected @option{color}.
  6695. If both duration and nb_frames are specified, duration is used. Default is 0
  6696. (nb_frames is used by default).
  6697. @item color, c
  6698. Specify the color of the fade. Default is "black".
  6699. @end table
  6700. @subsection Examples
  6701. @itemize
  6702. @item
  6703. Fade in the first 30 frames of video:
  6704. @example
  6705. fade=in:0:30
  6706. @end example
  6707. The command above is equivalent to:
  6708. @example
  6709. fade=t=in:s=0:n=30
  6710. @end example
  6711. @item
  6712. Fade out the last 45 frames of a 200-frame video:
  6713. @example
  6714. fade=out:155:45
  6715. fade=type=out:start_frame=155:nb_frames=45
  6716. @end example
  6717. @item
  6718. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6719. @example
  6720. fade=in:0:25, fade=out:975:25
  6721. @end example
  6722. @item
  6723. Make the first 5 frames yellow, then fade in from frame 5-24:
  6724. @example
  6725. fade=in:5:20:color=yellow
  6726. @end example
  6727. @item
  6728. Fade in alpha over first 25 frames of video:
  6729. @example
  6730. fade=in:0:25:alpha=1
  6731. @end example
  6732. @item
  6733. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6734. @example
  6735. fade=t=in:st=5.5:d=0.5
  6736. @end example
  6737. @end itemize
  6738. @section fftfilt
  6739. Apply arbitrary expressions to samples in frequency domain
  6740. @table @option
  6741. @item dc_Y
  6742. Adjust the dc value (gain) of the luma plane of the image. The filter
  6743. accepts an integer value in range @code{0} to @code{1000}. The default
  6744. value is set to @code{0}.
  6745. @item dc_U
  6746. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6747. filter accepts an integer value in range @code{0} to @code{1000}. The
  6748. default value is set to @code{0}.
  6749. @item dc_V
  6750. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6751. filter accepts an integer value in range @code{0} to @code{1000}. The
  6752. default value is set to @code{0}.
  6753. @item weight_Y
  6754. Set the frequency domain weight expression for the luma plane.
  6755. @item weight_U
  6756. Set the frequency domain weight expression for the 1st chroma plane.
  6757. @item weight_V
  6758. Set the frequency domain weight expression for the 2nd chroma plane.
  6759. @item eval
  6760. Set when the expressions are evaluated.
  6761. It accepts the following values:
  6762. @table @samp
  6763. @item init
  6764. Only evaluate expressions once during the filter initialization.
  6765. @item frame
  6766. Evaluate expressions for each incoming frame.
  6767. @end table
  6768. Default value is @samp{init}.
  6769. The filter accepts the following variables:
  6770. @item X
  6771. @item Y
  6772. The coordinates of the current sample.
  6773. @item W
  6774. @item H
  6775. The width and height of the image.
  6776. @item N
  6777. The number of input frame, starting from 0.
  6778. @end table
  6779. @subsection Examples
  6780. @itemize
  6781. @item
  6782. High-pass:
  6783. @example
  6784. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6785. @end example
  6786. @item
  6787. Low-pass:
  6788. @example
  6789. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6790. @end example
  6791. @item
  6792. Sharpen:
  6793. @example
  6794. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6795. @end example
  6796. @item
  6797. Blur:
  6798. @example
  6799. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6800. @end example
  6801. @end itemize
  6802. @section fftdnoiz
  6803. Denoise frames using 3D FFT (frequency domain filtering).
  6804. The filter accepts the following options:
  6805. @table @option
  6806. @item sigma
  6807. Set the noise sigma constant. This sets denoising strength.
  6808. Default value is 1. Allowed range is from 0 to 30.
  6809. Using very high sigma with low overlap may give blocking artifacts.
  6810. @item amount
  6811. Set amount of denoising. By default all detected noise is reduced.
  6812. Default value is 1. Allowed range is from 0 to 1.
  6813. @item block
  6814. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  6815. Actual size of block in pixels is 2 to power of @var{block}, so by default
  6816. block size in pixels is 2^4 which is 16.
  6817. @item overlap
  6818. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  6819. @item prev
  6820. Set number of previous frames to use for denoising. By default is set to 0.
  6821. @item next
  6822. Set number of next frames to to use for denoising. By default is set to 0.
  6823. @item planes
  6824. Set planes which will be filtered, by default are all available filtered
  6825. except alpha.
  6826. @end table
  6827. @section field
  6828. Extract a single field from an interlaced image using stride
  6829. arithmetic to avoid wasting CPU time. The output frames are marked as
  6830. non-interlaced.
  6831. The filter accepts the following options:
  6832. @table @option
  6833. @item type
  6834. Specify whether to extract the top (if the value is @code{0} or
  6835. @code{top}) or the bottom field (if the value is @code{1} or
  6836. @code{bottom}).
  6837. @end table
  6838. @section fieldhint
  6839. Create new frames by copying the top and bottom fields from surrounding frames
  6840. supplied as numbers by the hint file.
  6841. @table @option
  6842. @item hint
  6843. Set file containing hints: absolute/relative frame numbers.
  6844. There must be one line for each frame in a clip. Each line must contain two
  6845. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6846. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6847. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6848. for @code{relative} mode. First number tells from which frame to pick up top
  6849. field and second number tells from which frame to pick up bottom field.
  6850. If optionally followed by @code{+} output frame will be marked as interlaced,
  6851. else if followed by @code{-} output frame will be marked as progressive, else
  6852. it will be marked same as input frame.
  6853. If line starts with @code{#} or @code{;} that line is skipped.
  6854. @item mode
  6855. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6856. @end table
  6857. Example of first several lines of @code{hint} file for @code{relative} mode:
  6858. @example
  6859. 0,0 - # first frame
  6860. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6861. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6862. 1,0 -
  6863. 0,0 -
  6864. 0,0 -
  6865. 1,0 -
  6866. 1,0 -
  6867. 1,0 -
  6868. 0,0 -
  6869. 0,0 -
  6870. 1,0 -
  6871. 1,0 -
  6872. 1,0 -
  6873. 0,0 -
  6874. @end example
  6875. @section fieldmatch
  6876. Field matching filter for inverse telecine. It is meant to reconstruct the
  6877. progressive frames from a telecined stream. The filter does not drop duplicated
  6878. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6879. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6880. The separation of the field matching and the decimation is notably motivated by
  6881. the possibility of inserting a de-interlacing filter fallback between the two.
  6882. If the source has mixed telecined and real interlaced content,
  6883. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6884. But these remaining combed frames will be marked as interlaced, and thus can be
  6885. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6886. In addition to the various configuration options, @code{fieldmatch} can take an
  6887. optional second stream, activated through the @option{ppsrc} option. If
  6888. enabled, the frames reconstruction will be based on the fields and frames from
  6889. this second stream. This allows the first input to be pre-processed in order to
  6890. help the various algorithms of the filter, while keeping the output lossless
  6891. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6892. or brightness/contrast adjustments can help.
  6893. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6894. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6895. which @code{fieldmatch} is based on. While the semantic and usage are very
  6896. close, some behaviour and options names can differ.
  6897. The @ref{decimate} filter currently only works for constant frame rate input.
  6898. If your input has mixed telecined (30fps) and progressive content with a lower
  6899. framerate like 24fps use the following filterchain to produce the necessary cfr
  6900. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6901. The filter accepts the following options:
  6902. @table @option
  6903. @item order
  6904. Specify the assumed field order of the input stream. Available values are:
  6905. @table @samp
  6906. @item auto
  6907. Auto detect parity (use FFmpeg's internal parity value).
  6908. @item bff
  6909. Assume bottom field first.
  6910. @item tff
  6911. Assume top field first.
  6912. @end table
  6913. Note that it is sometimes recommended not to trust the parity announced by the
  6914. stream.
  6915. Default value is @var{auto}.
  6916. @item mode
  6917. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6918. sense that it won't risk creating jerkiness due to duplicate frames when
  6919. possible, but if there are bad edits or blended fields it will end up
  6920. outputting combed frames when a good match might actually exist. On the other
  6921. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6922. but will almost always find a good frame if there is one. The other values are
  6923. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6924. jerkiness and creating duplicate frames versus finding good matches in sections
  6925. with bad edits, orphaned fields, blended fields, etc.
  6926. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6927. Available values are:
  6928. @table @samp
  6929. @item pc
  6930. 2-way matching (p/c)
  6931. @item pc_n
  6932. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6933. @item pc_u
  6934. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6935. @item pc_n_ub
  6936. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6937. still combed (p/c + n + u/b)
  6938. @item pcn
  6939. 3-way matching (p/c/n)
  6940. @item pcn_ub
  6941. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6942. detected as combed (p/c/n + u/b)
  6943. @end table
  6944. The parenthesis at the end indicate the matches that would be used for that
  6945. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6946. @var{top}).
  6947. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6948. the slowest.
  6949. Default value is @var{pc_n}.
  6950. @item ppsrc
  6951. Mark the main input stream as a pre-processed input, and enable the secondary
  6952. input stream as the clean source to pick the fields from. See the filter
  6953. introduction for more details. It is similar to the @option{clip2} feature from
  6954. VFM/TFM.
  6955. Default value is @code{0} (disabled).
  6956. @item field
  6957. Set the field to match from. It is recommended to set this to the same value as
  6958. @option{order} unless you experience matching failures with that setting. In
  6959. certain circumstances changing the field that is used to match from can have a
  6960. large impact on matching performance. Available values are:
  6961. @table @samp
  6962. @item auto
  6963. Automatic (same value as @option{order}).
  6964. @item bottom
  6965. Match from the bottom field.
  6966. @item top
  6967. Match from the top field.
  6968. @end table
  6969. Default value is @var{auto}.
  6970. @item mchroma
  6971. Set whether or not chroma is included during the match comparisons. In most
  6972. cases it is recommended to leave this enabled. You should set this to @code{0}
  6973. only if your clip has bad chroma problems such as heavy rainbowing or other
  6974. artifacts. Setting this to @code{0} could also be used to speed things up at
  6975. the cost of some accuracy.
  6976. Default value is @code{1}.
  6977. @item y0
  6978. @item y1
  6979. These define an exclusion band which excludes the lines between @option{y0} and
  6980. @option{y1} from being included in the field matching decision. An exclusion
  6981. band can be used to ignore subtitles, a logo, or other things that may
  6982. interfere with the matching. @option{y0} sets the starting scan line and
  6983. @option{y1} sets the ending line; all lines in between @option{y0} and
  6984. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6985. @option{y0} and @option{y1} to the same value will disable the feature.
  6986. @option{y0} and @option{y1} defaults to @code{0}.
  6987. @item scthresh
  6988. Set the scene change detection threshold as a percentage of maximum change on
  6989. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6990. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6991. @option{scthresh} is @code{[0.0, 100.0]}.
  6992. Default value is @code{12.0}.
  6993. @item combmatch
  6994. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6995. account the combed scores of matches when deciding what match to use as the
  6996. final match. Available values are:
  6997. @table @samp
  6998. @item none
  6999. No final matching based on combed scores.
  7000. @item sc
  7001. Combed scores are only used when a scene change is detected.
  7002. @item full
  7003. Use combed scores all the time.
  7004. @end table
  7005. Default is @var{sc}.
  7006. @item combdbg
  7007. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7008. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7009. Available values are:
  7010. @table @samp
  7011. @item none
  7012. No forced calculation.
  7013. @item pcn
  7014. Force p/c/n calculations.
  7015. @item pcnub
  7016. Force p/c/n/u/b calculations.
  7017. @end table
  7018. Default value is @var{none}.
  7019. @item cthresh
  7020. This is the area combing threshold used for combed frame detection. This
  7021. essentially controls how "strong" or "visible" combing must be to be detected.
  7022. Larger values mean combing must be more visible and smaller values mean combing
  7023. can be less visible or strong and still be detected. Valid settings are from
  7024. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7025. be detected as combed). This is basically a pixel difference value. A good
  7026. range is @code{[8, 12]}.
  7027. Default value is @code{9}.
  7028. @item chroma
  7029. Sets whether or not chroma is considered in the combed frame decision. Only
  7030. disable this if your source has chroma problems (rainbowing, etc.) that are
  7031. causing problems for the combed frame detection with chroma enabled. Actually,
  7032. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7033. where there is chroma only combing in the source.
  7034. Default value is @code{0}.
  7035. @item blockx
  7036. @item blocky
  7037. Respectively set the x-axis and y-axis size of the window used during combed
  7038. frame detection. This has to do with the size of the area in which
  7039. @option{combpel} pixels are required to be detected as combed for a frame to be
  7040. declared combed. See the @option{combpel} parameter description for more info.
  7041. Possible values are any number that is a power of 2 starting at 4 and going up
  7042. to 512.
  7043. Default value is @code{16}.
  7044. @item combpel
  7045. The number of combed pixels inside any of the @option{blocky} by
  7046. @option{blockx} size blocks on the frame for the frame to be detected as
  7047. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7048. setting controls "how much" combing there must be in any localized area (a
  7049. window defined by the @option{blockx} and @option{blocky} settings) on the
  7050. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7051. which point no frames will ever be detected as combed). This setting is known
  7052. as @option{MI} in TFM/VFM vocabulary.
  7053. Default value is @code{80}.
  7054. @end table
  7055. @anchor{p/c/n/u/b meaning}
  7056. @subsection p/c/n/u/b meaning
  7057. @subsubsection p/c/n
  7058. We assume the following telecined stream:
  7059. @example
  7060. Top fields: 1 2 2 3 4
  7061. Bottom fields: 1 2 3 4 4
  7062. @end example
  7063. The numbers correspond to the progressive frame the fields relate to. Here, the
  7064. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7065. When @code{fieldmatch} is configured to run a matching from bottom
  7066. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7067. @example
  7068. Input stream:
  7069. T 1 2 2 3 4
  7070. B 1 2 3 4 4 <-- matching reference
  7071. Matches: c c n n c
  7072. Output stream:
  7073. T 1 2 3 4 4
  7074. B 1 2 3 4 4
  7075. @end example
  7076. As a result of the field matching, we can see that some frames get duplicated.
  7077. To perform a complete inverse telecine, you need to rely on a decimation filter
  7078. after this operation. See for instance the @ref{decimate} filter.
  7079. The same operation now matching from top fields (@option{field}=@var{top})
  7080. looks like this:
  7081. @example
  7082. Input stream:
  7083. T 1 2 2 3 4 <-- matching reference
  7084. B 1 2 3 4 4
  7085. Matches: c c p p c
  7086. Output stream:
  7087. T 1 2 2 3 4
  7088. B 1 2 2 3 4
  7089. @end example
  7090. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7091. basically, they refer to the frame and field of the opposite parity:
  7092. @itemize
  7093. @item @var{p} matches the field of the opposite parity in the previous frame
  7094. @item @var{c} matches the field of the opposite parity in the current frame
  7095. @item @var{n} matches the field of the opposite parity in the next frame
  7096. @end itemize
  7097. @subsubsection u/b
  7098. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7099. from the opposite parity flag. In the following examples, we assume that we are
  7100. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7101. 'x' is placed above and below each matched fields.
  7102. With bottom matching (@option{field}=@var{bottom}):
  7103. @example
  7104. Match: c p n b u
  7105. x x x x x
  7106. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7107. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7108. x x x x x
  7109. Output frames:
  7110. 2 1 2 2 2
  7111. 2 2 2 1 3
  7112. @end example
  7113. With top matching (@option{field}=@var{top}):
  7114. @example
  7115. Match: c p n b u
  7116. x x x x x
  7117. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7118. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7119. x x x x x
  7120. Output frames:
  7121. 2 2 2 1 2
  7122. 2 1 3 2 2
  7123. @end example
  7124. @subsection Examples
  7125. Simple IVTC of a top field first telecined stream:
  7126. @example
  7127. fieldmatch=order=tff:combmatch=none, decimate
  7128. @end example
  7129. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7130. @example
  7131. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7132. @end example
  7133. @section fieldorder
  7134. Transform the field order of the input video.
  7135. It accepts the following parameters:
  7136. @table @option
  7137. @item order
  7138. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7139. for bottom field first.
  7140. @end table
  7141. The default value is @samp{tff}.
  7142. The transformation is done by shifting the picture content up or down
  7143. by one line, and filling the remaining line with appropriate picture content.
  7144. This method is consistent with most broadcast field order converters.
  7145. If the input video is not flagged as being interlaced, or it is already
  7146. flagged as being of the required output field order, then this filter does
  7147. not alter the incoming video.
  7148. It is very useful when converting to or from PAL DV material,
  7149. which is bottom field first.
  7150. For example:
  7151. @example
  7152. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7153. @end example
  7154. @section fifo, afifo
  7155. Buffer input images and send them when they are requested.
  7156. It is mainly useful when auto-inserted by the libavfilter
  7157. framework.
  7158. It does not take parameters.
  7159. @section fillborders
  7160. Fill borders of the input video, without changing video stream dimensions.
  7161. Sometimes video can have garbage at the four edges and you may not want to
  7162. crop video input to keep size multiple of some number.
  7163. This filter accepts the following options:
  7164. @table @option
  7165. @item left
  7166. Number of pixels to fill from left border.
  7167. @item right
  7168. Number of pixels to fill from right border.
  7169. @item top
  7170. Number of pixels to fill from top border.
  7171. @item bottom
  7172. Number of pixels to fill from bottom border.
  7173. @item mode
  7174. Set fill mode.
  7175. It accepts the following values:
  7176. @table @samp
  7177. @item smear
  7178. fill pixels using outermost pixels
  7179. @item mirror
  7180. fill pixels using mirroring
  7181. @item fixed
  7182. fill pixels with constant value
  7183. @end table
  7184. Default is @var{smear}.
  7185. @item color
  7186. Set color for pixels in fixed mode. Default is @var{black}.
  7187. @end table
  7188. @section find_rect
  7189. Find a rectangular object
  7190. It accepts the following options:
  7191. @table @option
  7192. @item object
  7193. Filepath of the object image, needs to be in gray8.
  7194. @item threshold
  7195. Detection threshold, default is 0.5.
  7196. @item mipmaps
  7197. Number of mipmaps, default is 3.
  7198. @item xmin, ymin, xmax, ymax
  7199. Specifies the rectangle in which to search.
  7200. @end table
  7201. @subsection Examples
  7202. @itemize
  7203. @item
  7204. Generate a representative palette of a given video using @command{ffmpeg}:
  7205. @example
  7206. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7207. @end example
  7208. @end itemize
  7209. @section cover_rect
  7210. Cover a rectangular object
  7211. It accepts the following options:
  7212. @table @option
  7213. @item cover
  7214. Filepath of the optional cover image, needs to be in yuv420.
  7215. @item mode
  7216. Set covering mode.
  7217. It accepts the following values:
  7218. @table @samp
  7219. @item cover
  7220. cover it by the supplied image
  7221. @item blur
  7222. cover it by interpolating the surrounding pixels
  7223. @end table
  7224. Default value is @var{blur}.
  7225. @end table
  7226. @subsection Examples
  7227. @itemize
  7228. @item
  7229. Generate a representative palette of a given video using @command{ffmpeg}:
  7230. @example
  7231. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7232. @end example
  7233. @end itemize
  7234. @section floodfill
  7235. Flood area with values of same pixel components with another values.
  7236. It accepts the following options:
  7237. @table @option
  7238. @item x
  7239. Set pixel x coordinate.
  7240. @item y
  7241. Set pixel y coordinate.
  7242. @item s0
  7243. Set source #0 component value.
  7244. @item s1
  7245. Set source #1 component value.
  7246. @item s2
  7247. Set source #2 component value.
  7248. @item s3
  7249. Set source #3 component value.
  7250. @item d0
  7251. Set destination #0 component value.
  7252. @item d1
  7253. Set destination #1 component value.
  7254. @item d2
  7255. Set destination #2 component value.
  7256. @item d3
  7257. Set destination #3 component value.
  7258. @end table
  7259. @anchor{format}
  7260. @section format
  7261. Convert the input video to one of the specified pixel formats.
  7262. Libavfilter will try to pick one that is suitable as input to
  7263. the next filter.
  7264. It accepts the following parameters:
  7265. @table @option
  7266. @item pix_fmts
  7267. A '|'-separated list of pixel format names, such as
  7268. "pix_fmts=yuv420p|monow|rgb24".
  7269. @end table
  7270. @subsection Examples
  7271. @itemize
  7272. @item
  7273. Convert the input video to the @var{yuv420p} format
  7274. @example
  7275. format=pix_fmts=yuv420p
  7276. @end example
  7277. Convert the input video to any of the formats in the list
  7278. @example
  7279. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7280. @end example
  7281. @end itemize
  7282. @anchor{fps}
  7283. @section fps
  7284. Convert the video to specified constant frame rate by duplicating or dropping
  7285. frames as necessary.
  7286. It accepts the following parameters:
  7287. @table @option
  7288. @item fps
  7289. The desired output frame rate. The default is @code{25}.
  7290. @item start_time
  7291. Assume the first PTS should be the given value, in seconds. This allows for
  7292. padding/trimming at the start of stream. By default, no assumption is made
  7293. about the first frame's expected PTS, so no padding or trimming is done.
  7294. For example, this could be set to 0 to pad the beginning with duplicates of
  7295. the first frame if a video stream starts after the audio stream or to trim any
  7296. frames with a negative PTS.
  7297. @item round
  7298. Timestamp (PTS) rounding method.
  7299. Possible values are:
  7300. @table @option
  7301. @item zero
  7302. round towards 0
  7303. @item inf
  7304. round away from 0
  7305. @item down
  7306. round towards -infinity
  7307. @item up
  7308. round towards +infinity
  7309. @item near
  7310. round to nearest
  7311. @end table
  7312. The default is @code{near}.
  7313. @item eof_action
  7314. Action performed when reading the last frame.
  7315. Possible values are:
  7316. @table @option
  7317. @item round
  7318. Use same timestamp rounding method as used for other frames.
  7319. @item pass
  7320. Pass through last frame if input duration has not been reached yet.
  7321. @end table
  7322. The default is @code{round}.
  7323. @end table
  7324. Alternatively, the options can be specified as a flat string:
  7325. @var{fps}[:@var{start_time}[:@var{round}]].
  7326. See also the @ref{setpts} filter.
  7327. @subsection Examples
  7328. @itemize
  7329. @item
  7330. A typical usage in order to set the fps to 25:
  7331. @example
  7332. fps=fps=25
  7333. @end example
  7334. @item
  7335. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7336. @example
  7337. fps=fps=film:round=near
  7338. @end example
  7339. @end itemize
  7340. @section framepack
  7341. Pack two different video streams into a stereoscopic video, setting proper
  7342. metadata on supported codecs. The two views should have the same size and
  7343. framerate and processing will stop when the shorter video ends. Please note
  7344. that you may conveniently adjust view properties with the @ref{scale} and
  7345. @ref{fps} filters.
  7346. It accepts the following parameters:
  7347. @table @option
  7348. @item format
  7349. The desired packing format. Supported values are:
  7350. @table @option
  7351. @item sbs
  7352. The views are next to each other (default).
  7353. @item tab
  7354. The views are on top of each other.
  7355. @item lines
  7356. The views are packed by line.
  7357. @item columns
  7358. The views are packed by column.
  7359. @item frameseq
  7360. The views are temporally interleaved.
  7361. @end table
  7362. @end table
  7363. Some examples:
  7364. @example
  7365. # Convert left and right views into a frame-sequential video
  7366. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7367. # Convert views into a side-by-side video with the same output resolution as the input
  7368. 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
  7369. @end example
  7370. @section framerate
  7371. Change the frame rate by interpolating new video output frames from the source
  7372. frames.
  7373. This filter is not designed to function correctly with interlaced media. If
  7374. you wish to change the frame rate of interlaced media then you are required
  7375. to deinterlace before this filter and re-interlace after this filter.
  7376. A description of the accepted options follows.
  7377. @table @option
  7378. @item fps
  7379. Specify the output frames per second. This option can also be specified
  7380. as a value alone. The default is @code{50}.
  7381. @item interp_start
  7382. Specify the start of a range where the output frame will be created as a
  7383. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7384. the default is @code{15}.
  7385. @item interp_end
  7386. Specify the end of a range where the output frame will be created as a
  7387. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7388. the default is @code{240}.
  7389. @item scene
  7390. Specify the level at which a scene change is detected as a value between
  7391. 0 and 100 to indicate a new scene; a low value reflects a low
  7392. probability for the current frame to introduce a new scene, while a higher
  7393. value means the current frame is more likely to be one.
  7394. The default is @code{8.2}.
  7395. @item flags
  7396. Specify flags influencing the filter process.
  7397. Available value for @var{flags} is:
  7398. @table @option
  7399. @item scene_change_detect, scd
  7400. Enable scene change detection using the value of the option @var{scene}.
  7401. This flag is enabled by default.
  7402. @end table
  7403. @end table
  7404. @section framestep
  7405. Select one frame every N-th frame.
  7406. This filter accepts the following option:
  7407. @table @option
  7408. @item step
  7409. Select frame after every @code{step} frames.
  7410. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7411. @end table
  7412. @anchor{frei0r}
  7413. @section frei0r
  7414. Apply a frei0r effect to the input video.
  7415. To enable the compilation of this filter, you need to install the frei0r
  7416. header and configure FFmpeg with @code{--enable-frei0r}.
  7417. It accepts the following parameters:
  7418. @table @option
  7419. @item filter_name
  7420. The name of the frei0r effect to load. If the environment variable
  7421. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7422. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7423. Otherwise, the standard frei0r paths are searched, in this order:
  7424. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7425. @file{/usr/lib/frei0r-1/}.
  7426. @item filter_params
  7427. A '|'-separated list of parameters to pass to the frei0r effect.
  7428. @end table
  7429. A frei0r effect parameter can be a boolean (its value is either
  7430. "y" or "n"), a double, a color (specified as
  7431. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7432. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7433. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7434. a position (specified as @var{X}/@var{Y}, where
  7435. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7436. The number and types of parameters depend on the loaded effect. If an
  7437. effect parameter is not specified, the default value is set.
  7438. @subsection Examples
  7439. @itemize
  7440. @item
  7441. Apply the distort0r effect, setting the first two double parameters:
  7442. @example
  7443. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7444. @end example
  7445. @item
  7446. Apply the colordistance effect, taking a color as the first parameter:
  7447. @example
  7448. frei0r=colordistance:0.2/0.3/0.4
  7449. frei0r=colordistance:violet
  7450. frei0r=colordistance:0x112233
  7451. @end example
  7452. @item
  7453. Apply the perspective effect, specifying the top left and top right image
  7454. positions:
  7455. @example
  7456. frei0r=perspective:0.2/0.2|0.8/0.2
  7457. @end example
  7458. @end itemize
  7459. For more information, see
  7460. @url{http://frei0r.dyne.org}
  7461. @section fspp
  7462. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7463. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7464. processing filter, one of them is performed once per block, not per pixel.
  7465. This allows for much higher speed.
  7466. The filter accepts the following options:
  7467. @table @option
  7468. @item quality
  7469. Set quality. This option defines the number of levels for averaging. It accepts
  7470. an integer in the range 4-5. Default value is @code{4}.
  7471. @item qp
  7472. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7473. If not set, the filter will use the QP from the video stream (if available).
  7474. @item strength
  7475. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7476. more details but also more artifacts, while higher values make the image smoother
  7477. but also blurrier. Default value is @code{0} − PSNR optimal.
  7478. @item use_bframe_qp
  7479. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7480. option may cause flicker since the B-Frames have often larger QP. Default is
  7481. @code{0} (not enabled).
  7482. @end table
  7483. @section gblur
  7484. Apply Gaussian blur filter.
  7485. The filter accepts the following options:
  7486. @table @option
  7487. @item sigma
  7488. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7489. @item steps
  7490. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7491. @item planes
  7492. Set which planes to filter. By default all planes are filtered.
  7493. @item sigmaV
  7494. Set vertical sigma, if negative it will be same as @code{sigma}.
  7495. Default is @code{-1}.
  7496. @end table
  7497. @section geq
  7498. The filter accepts the following options:
  7499. @table @option
  7500. @item lum_expr, lum
  7501. Set the luminance expression.
  7502. @item cb_expr, cb
  7503. Set the chrominance blue expression.
  7504. @item cr_expr, cr
  7505. Set the chrominance red expression.
  7506. @item alpha_expr, a
  7507. Set the alpha expression.
  7508. @item red_expr, r
  7509. Set the red expression.
  7510. @item green_expr, g
  7511. Set the green expression.
  7512. @item blue_expr, b
  7513. Set the blue expression.
  7514. @end table
  7515. The colorspace is selected according to the specified options. If one
  7516. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7517. options is specified, the filter will automatically select a YCbCr
  7518. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7519. @option{blue_expr} options is specified, it will select an RGB
  7520. colorspace.
  7521. If one of the chrominance expression is not defined, it falls back on the other
  7522. one. If no alpha expression is specified it will evaluate to opaque value.
  7523. If none of chrominance expressions are specified, they will evaluate
  7524. to the luminance expression.
  7525. The expressions can use the following variables and functions:
  7526. @table @option
  7527. @item N
  7528. The sequential number of the filtered frame, starting from @code{0}.
  7529. @item X
  7530. @item Y
  7531. The coordinates of the current sample.
  7532. @item W
  7533. @item H
  7534. The width and height of the image.
  7535. @item SW
  7536. @item SH
  7537. Width and height scale depending on the currently filtered plane. It is the
  7538. ratio between the corresponding luma plane number of pixels and the current
  7539. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7540. @code{0.5,0.5} for chroma planes.
  7541. @item T
  7542. Time of the current frame, expressed in seconds.
  7543. @item p(x, y)
  7544. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7545. plane.
  7546. @item lum(x, y)
  7547. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7548. plane.
  7549. @item cb(x, y)
  7550. Return the value of the pixel at location (@var{x},@var{y}) of the
  7551. blue-difference chroma plane. Return 0 if there is no such plane.
  7552. @item cr(x, y)
  7553. Return the value of the pixel at location (@var{x},@var{y}) of the
  7554. red-difference chroma plane. Return 0 if there is no such plane.
  7555. @item r(x, y)
  7556. @item g(x, y)
  7557. @item b(x, y)
  7558. Return the value of the pixel at location (@var{x},@var{y}) of the
  7559. red/green/blue component. Return 0 if there is no such component.
  7560. @item alpha(x, y)
  7561. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7562. plane. Return 0 if there is no such plane.
  7563. @end table
  7564. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7565. automatically clipped to the closer edge.
  7566. @subsection Examples
  7567. @itemize
  7568. @item
  7569. Flip the image horizontally:
  7570. @example
  7571. geq=p(W-X\,Y)
  7572. @end example
  7573. @item
  7574. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7575. wavelength of 100 pixels:
  7576. @example
  7577. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7578. @end example
  7579. @item
  7580. Generate a fancy enigmatic moving light:
  7581. @example
  7582. 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
  7583. @end example
  7584. @item
  7585. Generate a quick emboss effect:
  7586. @example
  7587. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7588. @end example
  7589. @item
  7590. Modify RGB components depending on pixel position:
  7591. @example
  7592. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7593. @end example
  7594. @item
  7595. Create a radial gradient that is the same size as the input (also see
  7596. the @ref{vignette} filter):
  7597. @example
  7598. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7599. @end example
  7600. @end itemize
  7601. @section gradfun
  7602. Fix the banding artifacts that are sometimes introduced into nearly flat
  7603. regions by truncation to 8-bit color depth.
  7604. Interpolate the gradients that should go where the bands are, and
  7605. dither them.
  7606. It is designed for playback only. Do not use it prior to
  7607. lossy compression, because compression tends to lose the dither and
  7608. bring back the bands.
  7609. It accepts the following parameters:
  7610. @table @option
  7611. @item strength
  7612. The maximum amount by which the filter will change any one pixel. This is also
  7613. the threshold for detecting nearly flat regions. Acceptable values range from
  7614. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7615. valid range.
  7616. @item radius
  7617. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7618. gradients, but also prevents the filter from modifying the pixels near detailed
  7619. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7620. values will be clipped to the valid range.
  7621. @end table
  7622. Alternatively, the options can be specified as a flat string:
  7623. @var{strength}[:@var{radius}]
  7624. @subsection Examples
  7625. @itemize
  7626. @item
  7627. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7628. @example
  7629. gradfun=3.5:8
  7630. @end example
  7631. @item
  7632. Specify radius, omitting the strength (which will fall-back to the default
  7633. value):
  7634. @example
  7635. gradfun=radius=8
  7636. @end example
  7637. @end itemize
  7638. @section greyedge
  7639. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  7640. and corrects the scene colors accordingly.
  7641. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  7642. The filter accepts the following options:
  7643. @table @option
  7644. @item difford
  7645. The order of differentiation to be applied on the scene. Must be chosen in the range
  7646. [0,2] and default value is 1.
  7647. @item minknorm
  7648. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  7649. be chosen in the range [0,65535] and default value is 1. Set to 0 for getting
  7650. max value instead of calculating Minkowski distance.
  7651. @item sigma
  7652. The standard deviation of Gaussian blur to be applied on the scene. Must be
  7653. chosen in the range [0,1024.0] and default value = 1. Sigma can't be set to 0
  7654. if @var{difford} is greater than 0.
  7655. @end table
  7656. @subsection Examples
  7657. @itemize
  7658. @item
  7659. Grey Edge:
  7660. @example
  7661. greyedge=difford=1:minknorm=5:sigma=2
  7662. @end example
  7663. @item
  7664. Max Edge:
  7665. @example
  7666. greyedge=difford=1:minknorm=0:sigma=2
  7667. @end example
  7668. @end itemize
  7669. @anchor{haldclut}
  7670. @section haldclut
  7671. Apply a Hald CLUT to a video stream.
  7672. First input is the video stream to process, and second one is the Hald CLUT.
  7673. The Hald CLUT input can be a simple picture or a complete video stream.
  7674. The filter accepts the following options:
  7675. @table @option
  7676. @item shortest
  7677. Force termination when the shortest input terminates. Default is @code{0}.
  7678. @item repeatlast
  7679. Continue applying the last CLUT after the end of the stream. A value of
  7680. @code{0} disable the filter after the last frame of the CLUT is reached.
  7681. Default is @code{1}.
  7682. @end table
  7683. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7684. filters share the same internals).
  7685. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7686. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7687. @subsection Workflow examples
  7688. @subsubsection Hald CLUT video stream
  7689. Generate an identity Hald CLUT stream altered with various effects:
  7690. @example
  7691. 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
  7692. @end example
  7693. Note: make sure you use a lossless codec.
  7694. Then use it with @code{haldclut} to apply it on some random stream:
  7695. @example
  7696. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7697. @end example
  7698. The Hald CLUT will be applied to the 10 first seconds (duration of
  7699. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7700. to the remaining frames of the @code{mandelbrot} stream.
  7701. @subsubsection Hald CLUT with preview
  7702. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7703. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7704. biggest possible square starting at the top left of the picture. The remaining
  7705. padding pixels (bottom or right) will be ignored. This area can be used to add
  7706. a preview of the Hald CLUT.
  7707. Typically, the following generated Hald CLUT will be supported by the
  7708. @code{haldclut} filter:
  7709. @example
  7710. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7711. pad=iw+320 [padded_clut];
  7712. smptebars=s=320x256, split [a][b];
  7713. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7714. [main][b] overlay=W-320" -frames:v 1 clut.png
  7715. @end example
  7716. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7717. bars are displayed on the right-top, and below the same color bars processed by
  7718. the color changes.
  7719. Then, the effect of this Hald CLUT can be visualized with:
  7720. @example
  7721. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7722. @end example
  7723. @section hflip
  7724. Flip the input video horizontally.
  7725. For example, to horizontally flip the input video with @command{ffmpeg}:
  7726. @example
  7727. ffmpeg -i in.avi -vf "hflip" out.avi
  7728. @end example
  7729. @section histeq
  7730. This filter applies a global color histogram equalization on a
  7731. per-frame basis.
  7732. It can be used to correct video that has a compressed range of pixel
  7733. intensities. The filter redistributes the pixel intensities to
  7734. equalize their distribution across the intensity range. It may be
  7735. viewed as an "automatically adjusting contrast filter". This filter is
  7736. useful only for correcting degraded or poorly captured source
  7737. video.
  7738. The filter accepts the following options:
  7739. @table @option
  7740. @item strength
  7741. Determine the amount of equalization to be applied. As the strength
  7742. is reduced, the distribution of pixel intensities more-and-more
  7743. approaches that of the input frame. The value must be a float number
  7744. in the range [0,1] and defaults to 0.200.
  7745. @item intensity
  7746. Set the maximum intensity that can generated and scale the output
  7747. values appropriately. The strength should be set as desired and then
  7748. the intensity can be limited if needed to avoid washing-out. The value
  7749. must be a float number in the range [0,1] and defaults to 0.210.
  7750. @item antibanding
  7751. Set the antibanding level. If enabled the filter will randomly vary
  7752. the luminance of output pixels by a small amount to avoid banding of
  7753. the histogram. Possible values are @code{none}, @code{weak} or
  7754. @code{strong}. It defaults to @code{none}.
  7755. @end table
  7756. @section histogram
  7757. Compute and draw a color distribution histogram for the input video.
  7758. The computed histogram is a representation of the color component
  7759. distribution in an image.
  7760. Standard histogram displays the color components distribution in an image.
  7761. Displays color graph for each color component. Shows distribution of
  7762. the Y, U, V, A or R, G, B components, depending on input format, in the
  7763. current frame. Below each graph a color component scale meter is shown.
  7764. The filter accepts the following options:
  7765. @table @option
  7766. @item level_height
  7767. Set height of level. Default value is @code{200}.
  7768. Allowed range is [50, 2048].
  7769. @item scale_height
  7770. Set height of color scale. Default value is @code{12}.
  7771. Allowed range is [0, 40].
  7772. @item display_mode
  7773. Set display mode.
  7774. It accepts the following values:
  7775. @table @samp
  7776. @item stack
  7777. Per color component graphs are placed below each other.
  7778. @item parade
  7779. Per color component graphs are placed side by side.
  7780. @item overlay
  7781. Presents information identical to that in the @code{parade}, except
  7782. that the graphs representing color components are superimposed directly
  7783. over one another.
  7784. @end table
  7785. Default is @code{stack}.
  7786. @item levels_mode
  7787. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7788. Default is @code{linear}.
  7789. @item components
  7790. Set what color components to display.
  7791. Default is @code{7}.
  7792. @item fgopacity
  7793. Set foreground opacity. Default is @code{0.7}.
  7794. @item bgopacity
  7795. Set background opacity. Default is @code{0.5}.
  7796. @end table
  7797. @subsection Examples
  7798. @itemize
  7799. @item
  7800. Calculate and draw histogram:
  7801. @example
  7802. ffplay -i input -vf histogram
  7803. @end example
  7804. @end itemize
  7805. @anchor{hqdn3d}
  7806. @section hqdn3d
  7807. This is a high precision/quality 3d denoise filter. It aims to reduce
  7808. image noise, producing smooth images and making still images really
  7809. still. It should enhance compressibility.
  7810. It accepts the following optional parameters:
  7811. @table @option
  7812. @item luma_spatial
  7813. A non-negative floating point number which specifies spatial luma strength.
  7814. It defaults to 4.0.
  7815. @item chroma_spatial
  7816. A non-negative floating point number which specifies spatial chroma strength.
  7817. It defaults to 3.0*@var{luma_spatial}/4.0.
  7818. @item luma_tmp
  7819. A floating point number which specifies luma temporal strength. It defaults to
  7820. 6.0*@var{luma_spatial}/4.0.
  7821. @item chroma_tmp
  7822. A floating point number which specifies chroma temporal strength. It defaults to
  7823. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7824. @end table
  7825. @section hwdownload
  7826. Download hardware frames to system memory.
  7827. The input must be in hardware frames, and the output a non-hardware format.
  7828. Not all formats will be supported on the output - it may be necessary to insert
  7829. an additional @option{format} filter immediately following in the graph to get
  7830. the output in a supported format.
  7831. @section hwmap
  7832. Map hardware frames to system memory or to another device.
  7833. This filter has several different modes of operation; which one is used depends
  7834. on the input and output formats:
  7835. @itemize
  7836. @item
  7837. Hardware frame input, normal frame output
  7838. Map the input frames to system memory and pass them to the output. If the
  7839. original hardware frame is later required (for example, after overlaying
  7840. something else on part of it), the @option{hwmap} filter can be used again
  7841. in the next mode to retrieve it.
  7842. @item
  7843. Normal frame input, hardware frame output
  7844. If the input is actually a software-mapped hardware frame, then unmap it -
  7845. that is, return the original hardware frame.
  7846. Otherwise, a device must be provided. Create new hardware surfaces on that
  7847. device for the output, then map them back to the software format at the input
  7848. and give those frames to the preceding filter. This will then act like the
  7849. @option{hwupload} filter, but may be able to avoid an additional copy when
  7850. the input is already in a compatible format.
  7851. @item
  7852. Hardware frame input and output
  7853. A device must be supplied for the output, either directly or with the
  7854. @option{derive_device} option. The input and output devices must be of
  7855. different types and compatible - the exact meaning of this is
  7856. system-dependent, but typically it means that they must refer to the same
  7857. underlying hardware context (for example, refer to the same graphics card).
  7858. If the input frames were originally created on the output device, then unmap
  7859. to retrieve the original frames.
  7860. Otherwise, map the frames to the output device - create new hardware frames
  7861. on the output corresponding to the frames on the input.
  7862. @end itemize
  7863. The following additional parameters are accepted:
  7864. @table @option
  7865. @item mode
  7866. Set the frame mapping mode. Some combination of:
  7867. @table @var
  7868. @item read
  7869. The mapped frame should be readable.
  7870. @item write
  7871. The mapped frame should be writeable.
  7872. @item overwrite
  7873. The mapping will always overwrite the entire frame.
  7874. This may improve performance in some cases, as the original contents of the
  7875. frame need not be loaded.
  7876. @item direct
  7877. The mapping must not involve any copying.
  7878. Indirect mappings to copies of frames are created in some cases where either
  7879. direct mapping is not possible or it would have unexpected properties.
  7880. Setting this flag ensures that the mapping is direct and will fail if that is
  7881. not possible.
  7882. @end table
  7883. Defaults to @var{read+write} if not specified.
  7884. @item derive_device @var{type}
  7885. Rather than using the device supplied at initialisation, instead derive a new
  7886. device of type @var{type} from the device the input frames exist on.
  7887. @item reverse
  7888. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7889. and map them back to the source. This may be necessary in some cases where
  7890. a mapping in one direction is required but only the opposite direction is
  7891. supported by the devices being used.
  7892. This option is dangerous - it may break the preceding filter in undefined
  7893. ways if there are any additional constraints on that filter's output.
  7894. Do not use it without fully understanding the implications of its use.
  7895. @end table
  7896. @section hwupload
  7897. Upload system memory frames to hardware surfaces.
  7898. The device to upload to must be supplied when the filter is initialised. If
  7899. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7900. option.
  7901. @anchor{hwupload_cuda}
  7902. @section hwupload_cuda
  7903. Upload system memory frames to a CUDA device.
  7904. It accepts the following optional parameters:
  7905. @table @option
  7906. @item device
  7907. The number of the CUDA device to use
  7908. @end table
  7909. @section hqx
  7910. Apply a high-quality magnification filter designed for pixel art. This filter
  7911. was originally created by Maxim Stepin.
  7912. It accepts the following option:
  7913. @table @option
  7914. @item n
  7915. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7916. @code{hq3x} and @code{4} for @code{hq4x}.
  7917. Default is @code{3}.
  7918. @end table
  7919. @section hstack
  7920. Stack input videos horizontally.
  7921. All streams must be of same pixel format and of same height.
  7922. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7923. to create same output.
  7924. The filter accept the following option:
  7925. @table @option
  7926. @item inputs
  7927. Set number of input streams. Default is 2.
  7928. @item shortest
  7929. If set to 1, force the output to terminate when the shortest input
  7930. terminates. Default value is 0.
  7931. @end table
  7932. @section hue
  7933. Modify the hue and/or the saturation of the input.
  7934. It accepts the following parameters:
  7935. @table @option
  7936. @item h
  7937. Specify the hue angle as a number of degrees. It accepts an expression,
  7938. and defaults to "0".
  7939. @item s
  7940. Specify the saturation in the [-10,10] range. It accepts an expression and
  7941. defaults to "1".
  7942. @item H
  7943. Specify the hue angle as a number of radians. It accepts an
  7944. expression, and defaults to "0".
  7945. @item b
  7946. Specify the brightness in the [-10,10] range. It accepts an expression and
  7947. defaults to "0".
  7948. @end table
  7949. @option{h} and @option{H} are mutually exclusive, and can't be
  7950. specified at the same time.
  7951. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7952. expressions containing the following constants:
  7953. @table @option
  7954. @item n
  7955. frame count of the input frame starting from 0
  7956. @item pts
  7957. presentation timestamp of the input frame expressed in time base units
  7958. @item r
  7959. frame rate of the input video, NAN if the input frame rate is unknown
  7960. @item t
  7961. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7962. @item tb
  7963. time base of the input video
  7964. @end table
  7965. @subsection Examples
  7966. @itemize
  7967. @item
  7968. Set the hue to 90 degrees and the saturation to 1.0:
  7969. @example
  7970. hue=h=90:s=1
  7971. @end example
  7972. @item
  7973. Same command but expressing the hue in radians:
  7974. @example
  7975. hue=H=PI/2:s=1
  7976. @end example
  7977. @item
  7978. Rotate hue and make the saturation swing between 0
  7979. and 2 over a period of 1 second:
  7980. @example
  7981. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7982. @end example
  7983. @item
  7984. Apply a 3 seconds saturation fade-in effect starting at 0:
  7985. @example
  7986. hue="s=min(t/3\,1)"
  7987. @end example
  7988. The general fade-in expression can be written as:
  7989. @example
  7990. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7991. @end example
  7992. @item
  7993. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7994. @example
  7995. hue="s=max(0\, min(1\, (8-t)/3))"
  7996. @end example
  7997. The general fade-out expression can be written as:
  7998. @example
  7999. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8000. @end example
  8001. @end itemize
  8002. @subsection Commands
  8003. This filter supports the following commands:
  8004. @table @option
  8005. @item b
  8006. @item s
  8007. @item h
  8008. @item H
  8009. Modify the hue and/or the saturation and/or brightness of the input video.
  8010. The command accepts the same syntax of the corresponding option.
  8011. If the specified expression is not valid, it is kept at its current
  8012. value.
  8013. @end table
  8014. @section hysteresis
  8015. Grow first stream into second stream by connecting components.
  8016. This makes it possible to build more robust edge masks.
  8017. This filter accepts the following options:
  8018. @table @option
  8019. @item planes
  8020. Set which planes will be processed as bitmap, unprocessed planes will be
  8021. copied from first stream.
  8022. By default value 0xf, all planes will be processed.
  8023. @item threshold
  8024. Set threshold which is used in filtering. If pixel component value is higher than
  8025. this value filter algorithm for connecting components is activated.
  8026. By default value is 0.
  8027. @end table
  8028. @section idet
  8029. Detect video interlacing type.
  8030. This filter tries to detect if the input frames are interlaced, progressive,
  8031. top or bottom field first. It will also try to detect fields that are
  8032. repeated between adjacent frames (a sign of telecine).
  8033. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8034. Multiple frame detection incorporates the classification history of previous frames.
  8035. The filter will log these metadata values:
  8036. @table @option
  8037. @item single.current_frame
  8038. Detected type of current frame using single-frame detection. One of:
  8039. ``tff'' (top field first), ``bff'' (bottom field first),
  8040. ``progressive'', or ``undetermined''
  8041. @item single.tff
  8042. Cumulative number of frames detected as top field first using single-frame detection.
  8043. @item multiple.tff
  8044. Cumulative number of frames detected as top field first using multiple-frame detection.
  8045. @item single.bff
  8046. Cumulative number of frames detected as bottom field first using single-frame detection.
  8047. @item multiple.current_frame
  8048. Detected type of current frame using multiple-frame detection. One of:
  8049. ``tff'' (top field first), ``bff'' (bottom field first),
  8050. ``progressive'', or ``undetermined''
  8051. @item multiple.bff
  8052. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8053. @item single.progressive
  8054. Cumulative number of frames detected as progressive using single-frame detection.
  8055. @item multiple.progressive
  8056. Cumulative number of frames detected as progressive using multiple-frame detection.
  8057. @item single.undetermined
  8058. Cumulative number of frames that could not be classified using single-frame detection.
  8059. @item multiple.undetermined
  8060. Cumulative number of frames that could not be classified using multiple-frame detection.
  8061. @item repeated.current_frame
  8062. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8063. @item repeated.neither
  8064. Cumulative number of frames with no repeated field.
  8065. @item repeated.top
  8066. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8067. @item repeated.bottom
  8068. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8069. @end table
  8070. The filter accepts the following options:
  8071. @table @option
  8072. @item intl_thres
  8073. Set interlacing threshold.
  8074. @item prog_thres
  8075. Set progressive threshold.
  8076. @item rep_thres
  8077. Threshold for repeated field detection.
  8078. @item half_life
  8079. Number of frames after which a given frame's contribution to the
  8080. statistics is halved (i.e., it contributes only 0.5 to its
  8081. classification). The default of 0 means that all frames seen are given
  8082. full weight of 1.0 forever.
  8083. @item analyze_interlaced_flag
  8084. When this is not 0 then idet will use the specified number of frames to determine
  8085. if the interlaced flag is accurate, it will not count undetermined frames.
  8086. If the flag is found to be accurate it will be used without any further
  8087. computations, if it is found to be inaccurate it will be cleared without any
  8088. further computations. This allows inserting the idet filter as a low computational
  8089. method to clean up the interlaced flag
  8090. @end table
  8091. @section il
  8092. Deinterleave or interleave fields.
  8093. This filter allows one to process interlaced images fields without
  8094. deinterlacing them. Deinterleaving splits the input frame into 2
  8095. fields (so called half pictures). Odd lines are moved to the top
  8096. half of the output image, even lines to the bottom half.
  8097. You can process (filter) them independently and then re-interleave them.
  8098. The filter accepts the following options:
  8099. @table @option
  8100. @item luma_mode, l
  8101. @item chroma_mode, c
  8102. @item alpha_mode, a
  8103. Available values for @var{luma_mode}, @var{chroma_mode} and
  8104. @var{alpha_mode} are:
  8105. @table @samp
  8106. @item none
  8107. Do nothing.
  8108. @item deinterleave, d
  8109. Deinterleave fields, placing one above the other.
  8110. @item interleave, i
  8111. Interleave fields. Reverse the effect of deinterleaving.
  8112. @end table
  8113. Default value is @code{none}.
  8114. @item luma_swap, ls
  8115. @item chroma_swap, cs
  8116. @item alpha_swap, as
  8117. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8118. @end table
  8119. @section inflate
  8120. Apply inflate effect to the video.
  8121. This filter replaces the pixel by the local(3x3) average by taking into account
  8122. only values higher than the pixel.
  8123. It accepts the following options:
  8124. @table @option
  8125. @item threshold0
  8126. @item threshold1
  8127. @item threshold2
  8128. @item threshold3
  8129. Limit the maximum change for each plane, default is 65535.
  8130. If 0, plane will remain unchanged.
  8131. @end table
  8132. @section interlace
  8133. Simple interlacing filter from progressive contents. This interleaves upper (or
  8134. lower) lines from odd frames with lower (or upper) lines from even frames,
  8135. halving the frame rate and preserving image height.
  8136. @example
  8137. Original Original New Frame
  8138. Frame 'j' Frame 'j+1' (tff)
  8139. ========== =========== ==================
  8140. Line 0 --------------------> Frame 'j' Line 0
  8141. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8142. Line 2 ---------------------> Frame 'j' Line 2
  8143. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8144. ... ... ...
  8145. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8146. @end example
  8147. It accepts the following optional parameters:
  8148. @table @option
  8149. @item scan
  8150. This determines whether the interlaced frame is taken from the even
  8151. (tff - default) or odd (bff) lines of the progressive frame.
  8152. @item lowpass
  8153. Vertical lowpass filter to avoid twitter interlacing and
  8154. reduce moire patterns.
  8155. @table @samp
  8156. @item 0, off
  8157. Disable vertical lowpass filter
  8158. @item 1, linear
  8159. Enable linear filter (default)
  8160. @item 2, complex
  8161. Enable complex filter. This will slightly less reduce twitter and moire
  8162. but better retain detail and subjective sharpness impression.
  8163. @end table
  8164. @end table
  8165. @section kerndeint
  8166. Deinterlace input video by applying Donald Graft's adaptive kernel
  8167. deinterling. Work on interlaced parts of a video to produce
  8168. progressive frames.
  8169. The description of the accepted parameters follows.
  8170. @table @option
  8171. @item thresh
  8172. Set the threshold which affects the filter's tolerance when
  8173. determining if a pixel line must be processed. It must be an integer
  8174. in the range [0,255] and defaults to 10. A value of 0 will result in
  8175. applying the process on every pixels.
  8176. @item map
  8177. Paint pixels exceeding the threshold value to white if set to 1.
  8178. Default is 0.
  8179. @item order
  8180. Set the fields order. Swap fields if set to 1, leave fields alone if
  8181. 0. Default is 0.
  8182. @item sharp
  8183. Enable additional sharpening if set to 1. Default is 0.
  8184. @item twoway
  8185. Enable twoway sharpening if set to 1. Default is 0.
  8186. @end table
  8187. @subsection Examples
  8188. @itemize
  8189. @item
  8190. Apply default values:
  8191. @example
  8192. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8193. @end example
  8194. @item
  8195. Enable additional sharpening:
  8196. @example
  8197. kerndeint=sharp=1
  8198. @end example
  8199. @item
  8200. Paint processed pixels in white:
  8201. @example
  8202. kerndeint=map=1
  8203. @end example
  8204. @end itemize
  8205. @section lenscorrection
  8206. Correct radial lens distortion
  8207. This filter can be used to correct for radial distortion as can result from the use
  8208. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8209. one can use tools available for example as part of opencv or simply trial-and-error.
  8210. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8211. and extract the k1 and k2 coefficients from the resulting matrix.
  8212. Note that effectively the same filter is available in the open-source tools Krita and
  8213. Digikam from the KDE project.
  8214. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8215. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8216. brightness distribution, so you may want to use both filters together in certain
  8217. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8218. be applied before or after lens correction.
  8219. @subsection Options
  8220. The filter accepts the following options:
  8221. @table @option
  8222. @item cx
  8223. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8224. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8225. width. Default is 0.5.
  8226. @item cy
  8227. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8228. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8229. height. Default is 0.5.
  8230. @item k1
  8231. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8232. no correction. Default is 0.
  8233. @item k2
  8234. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8235. 0 means no correction. Default is 0.
  8236. @end table
  8237. The formula that generates the correction is:
  8238. @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)
  8239. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8240. distances from the focal point in the source and target images, respectively.
  8241. @section lensfun
  8242. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8243. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8244. to apply the lens correction. The filter will load the lensfun database and
  8245. query it to find the corresponding camera and lens entries in the database. As
  8246. long as these entries can be found with the given options, the filter can
  8247. perform corrections on frames. Note that incomplete strings will result in the
  8248. filter choosing the best match with the given options, and the filter will
  8249. output the chosen camera and lens models (logged with level "info"). You must
  8250. provide the make, camera model, and lens model as they are required.
  8251. The filter accepts the following options:
  8252. @table @option
  8253. @item make
  8254. The make of the camera (for example, "Canon"). This option is required.
  8255. @item model
  8256. The model of the camera (for example, "Canon EOS 100D"). This option is
  8257. required.
  8258. @item lens_model
  8259. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8260. option is required.
  8261. @item mode
  8262. The type of correction to apply. The following values are valid options:
  8263. @table @samp
  8264. @item vignetting
  8265. Enables fixing lens vignetting.
  8266. @item geometry
  8267. Enables fixing lens geometry. This is the default.
  8268. @item subpixel
  8269. Enables fixing chromatic aberrations.
  8270. @item vig_geo
  8271. Enables fixing lens vignetting and lens geometry.
  8272. @item vig_subpixel
  8273. Enables fixing lens vignetting and chromatic aberrations.
  8274. @item distortion
  8275. Enables fixing both lens geometry and chromatic aberrations.
  8276. @item all
  8277. Enables all possible corrections.
  8278. @end table
  8279. @item focal_length
  8280. The focal length of the image/video (zoom; expected constant for video). For
  8281. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8282. range should be chosen when using that lens. Default 18.
  8283. @item aperture
  8284. The aperture of the image/video (expected constant for video). Note that
  8285. aperture is only used for vignetting correction. Default 3.5.
  8286. @item focus_distance
  8287. The focus distance of the image/video (expected constant for video). Note that
  8288. focus distance is only used for vignetting and only slightly affects the
  8289. vignetting correction process. If unknown, leave it at the default value (which
  8290. is 1000).
  8291. @item target_geometry
  8292. The target geometry of the output image/video. The following values are valid
  8293. options:
  8294. @table @samp
  8295. @item rectilinear (default)
  8296. @item fisheye
  8297. @item panoramic
  8298. @item equirectangular
  8299. @item fisheye_orthographic
  8300. @item fisheye_stereographic
  8301. @item fisheye_equisolid
  8302. @item fisheye_thoby
  8303. @end table
  8304. @item reverse
  8305. Apply the reverse of image correction (instead of correcting distortion, apply
  8306. it).
  8307. @item interpolation
  8308. The type of interpolation used when correcting distortion. The following values
  8309. are valid options:
  8310. @table @samp
  8311. @item nearest
  8312. @item linear (default)
  8313. @item lanczos
  8314. @end table
  8315. @end table
  8316. @subsection Examples
  8317. @itemize
  8318. @item
  8319. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  8320. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  8321. aperture of "8.0".
  8322. @example
  8323. 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
  8324. @end example
  8325. @item
  8326. Apply the same as before, but only for the first 5 seconds of video.
  8327. @example
  8328. 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
  8329. @end example
  8330. @end itemize
  8331. @section libvmaf
  8332. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8333. score between two input videos.
  8334. The obtained VMAF score is printed through the logging system.
  8335. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8336. After installing the library it can be enabled using:
  8337. @code{./configure --enable-libvmaf}.
  8338. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8339. The filter has following options:
  8340. @table @option
  8341. @item model_path
  8342. Set the model path which is to be used for SVM.
  8343. Default value: @code{"vmaf_v0.6.1.pkl"}
  8344. @item log_path
  8345. Set the file path to be used to store logs.
  8346. @item log_fmt
  8347. Set the format of the log file (xml or json).
  8348. @item enable_transform
  8349. Enables transform for computing vmaf.
  8350. @item phone_model
  8351. Invokes the phone model which will generate VMAF scores higher than in the
  8352. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8353. @item psnr
  8354. Enables computing psnr along with vmaf.
  8355. @item ssim
  8356. Enables computing ssim along with vmaf.
  8357. @item ms_ssim
  8358. Enables computing ms_ssim along with vmaf.
  8359. @item pool
  8360. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8361. @end table
  8362. This filter also supports the @ref{framesync} options.
  8363. On the below examples the input file @file{main.mpg} being processed is
  8364. compared with the reference file @file{ref.mpg}.
  8365. @example
  8366. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8367. @end example
  8368. Example with options:
  8369. @example
  8370. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  8371. @end example
  8372. @section limiter
  8373. Limits the pixel components values to the specified range [min, max].
  8374. The filter accepts the following options:
  8375. @table @option
  8376. @item min
  8377. Lower bound. Defaults to the lowest allowed value for the input.
  8378. @item max
  8379. Upper bound. Defaults to the highest allowed value for the input.
  8380. @item planes
  8381. Specify which planes will be processed. Defaults to all available.
  8382. @end table
  8383. @section loop
  8384. Loop video frames.
  8385. The filter accepts the following options:
  8386. @table @option
  8387. @item loop
  8388. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8389. Default is 0.
  8390. @item size
  8391. Set maximal size in number of frames. Default is 0.
  8392. @item start
  8393. Set first frame of loop. Default is 0.
  8394. @end table
  8395. @anchor{lut3d}
  8396. @section lut3d
  8397. Apply a 3D LUT to an input video.
  8398. The filter accepts the following options:
  8399. @table @option
  8400. @item file
  8401. Set the 3D LUT file name.
  8402. Currently supported formats:
  8403. @table @samp
  8404. @item 3dl
  8405. AfterEffects
  8406. @item cube
  8407. Iridas
  8408. @item dat
  8409. DaVinci
  8410. @item m3d
  8411. Pandora
  8412. @end table
  8413. @item interp
  8414. Select interpolation mode.
  8415. Available values are:
  8416. @table @samp
  8417. @item nearest
  8418. Use values from the nearest defined point.
  8419. @item trilinear
  8420. Interpolate values using the 8 points defining a cube.
  8421. @item tetrahedral
  8422. Interpolate values using a tetrahedron.
  8423. @end table
  8424. @end table
  8425. This filter also supports the @ref{framesync} options.
  8426. @section lumakey
  8427. Turn certain luma values into transparency.
  8428. The filter accepts the following options:
  8429. @table @option
  8430. @item threshold
  8431. Set the luma which will be used as base for transparency.
  8432. Default value is @code{0}.
  8433. @item tolerance
  8434. Set the range of luma values to be keyed out.
  8435. Default value is @code{0}.
  8436. @item softness
  8437. Set the range of softness. Default value is @code{0}.
  8438. Use this to control gradual transition from zero to full transparency.
  8439. @end table
  8440. @section lut, lutrgb, lutyuv
  8441. Compute a look-up table for binding each pixel component input value
  8442. to an output value, and apply it to the input video.
  8443. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8444. to an RGB input video.
  8445. These filters accept the following parameters:
  8446. @table @option
  8447. @item c0
  8448. set first pixel component expression
  8449. @item c1
  8450. set second pixel component expression
  8451. @item c2
  8452. set third pixel component expression
  8453. @item c3
  8454. set fourth pixel component expression, corresponds to the alpha component
  8455. @item r
  8456. set red component expression
  8457. @item g
  8458. set green component expression
  8459. @item b
  8460. set blue component expression
  8461. @item a
  8462. alpha component expression
  8463. @item y
  8464. set Y/luminance component expression
  8465. @item u
  8466. set U/Cb component expression
  8467. @item v
  8468. set V/Cr component expression
  8469. @end table
  8470. Each of them specifies the expression to use for computing the lookup table for
  8471. the corresponding pixel component values.
  8472. The exact component associated to each of the @var{c*} options depends on the
  8473. format in input.
  8474. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8475. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8476. The expressions can contain the following constants and functions:
  8477. @table @option
  8478. @item w
  8479. @item h
  8480. The input width and height.
  8481. @item val
  8482. The input value for the pixel component.
  8483. @item clipval
  8484. The input value, clipped to the @var{minval}-@var{maxval} range.
  8485. @item maxval
  8486. The maximum value for the pixel component.
  8487. @item minval
  8488. The minimum value for the pixel component.
  8489. @item negval
  8490. The negated value for the pixel component value, clipped to the
  8491. @var{minval}-@var{maxval} range; it corresponds to the expression
  8492. "maxval-clipval+minval".
  8493. @item clip(val)
  8494. The computed value in @var{val}, clipped to the
  8495. @var{minval}-@var{maxval} range.
  8496. @item gammaval(gamma)
  8497. The computed gamma correction value of the pixel component value,
  8498. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8499. expression
  8500. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8501. @end table
  8502. All expressions default to "val".
  8503. @subsection Examples
  8504. @itemize
  8505. @item
  8506. Negate input video:
  8507. @example
  8508. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8509. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8510. @end example
  8511. The above is the same as:
  8512. @example
  8513. lutrgb="r=negval:g=negval:b=negval"
  8514. lutyuv="y=negval:u=negval:v=negval"
  8515. @end example
  8516. @item
  8517. Negate luminance:
  8518. @example
  8519. lutyuv=y=negval
  8520. @end example
  8521. @item
  8522. Remove chroma components, turning the video into a graytone image:
  8523. @example
  8524. lutyuv="u=128:v=128"
  8525. @end example
  8526. @item
  8527. Apply a luma burning effect:
  8528. @example
  8529. lutyuv="y=2*val"
  8530. @end example
  8531. @item
  8532. Remove green and blue components:
  8533. @example
  8534. lutrgb="g=0:b=0"
  8535. @end example
  8536. @item
  8537. Set a constant alpha channel value on input:
  8538. @example
  8539. format=rgba,lutrgb=a="maxval-minval/2"
  8540. @end example
  8541. @item
  8542. Correct luminance gamma by a factor of 0.5:
  8543. @example
  8544. lutyuv=y=gammaval(0.5)
  8545. @end example
  8546. @item
  8547. Discard least significant bits of luma:
  8548. @example
  8549. lutyuv=y='bitand(val, 128+64+32)'
  8550. @end example
  8551. @item
  8552. Technicolor like effect:
  8553. @example
  8554. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8555. @end example
  8556. @end itemize
  8557. @section lut2, tlut2
  8558. The @code{lut2} filter takes two input streams and outputs one
  8559. stream.
  8560. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8561. from one single stream.
  8562. This filter accepts the following parameters:
  8563. @table @option
  8564. @item c0
  8565. set first pixel component expression
  8566. @item c1
  8567. set second pixel component expression
  8568. @item c2
  8569. set third pixel component expression
  8570. @item c3
  8571. set fourth pixel component expression, corresponds to the alpha component
  8572. @end table
  8573. Each of them specifies the expression to use for computing the lookup table for
  8574. the corresponding pixel component values.
  8575. The exact component associated to each of the @var{c*} options depends on the
  8576. format in inputs.
  8577. The expressions can contain the following constants:
  8578. @table @option
  8579. @item w
  8580. @item h
  8581. The input width and height.
  8582. @item x
  8583. The first input value for the pixel component.
  8584. @item y
  8585. The second input value for the pixel component.
  8586. @item bdx
  8587. The first input video bit depth.
  8588. @item bdy
  8589. The second input video bit depth.
  8590. @end table
  8591. All expressions default to "x".
  8592. @subsection Examples
  8593. @itemize
  8594. @item
  8595. Highlight differences between two RGB video streams:
  8596. @example
  8597. 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)'
  8598. @end example
  8599. @item
  8600. Highlight differences between two YUV video streams:
  8601. @example
  8602. 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)'
  8603. @end example
  8604. @item
  8605. Show max difference between two video streams:
  8606. @example
  8607. 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)))'
  8608. @end example
  8609. @end itemize
  8610. @section maskedclamp
  8611. Clamp the first input stream with the second input and third input stream.
  8612. Returns the value of first stream to be between second input
  8613. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8614. This filter accepts the following options:
  8615. @table @option
  8616. @item undershoot
  8617. Default value is @code{0}.
  8618. @item overshoot
  8619. Default value is @code{0}.
  8620. @item planes
  8621. Set which planes will be processed as bitmap, unprocessed planes will be
  8622. copied from first stream.
  8623. By default value 0xf, all planes will be processed.
  8624. @end table
  8625. @section maskedmerge
  8626. Merge the first input stream with the second input stream using per pixel
  8627. weights in the third input stream.
  8628. A value of 0 in the third stream pixel component means that pixel component
  8629. from first stream is returned unchanged, while maximum value (eg. 255 for
  8630. 8-bit videos) means that pixel component from second stream is returned
  8631. unchanged. Intermediate values define the amount of merging between both
  8632. input stream's pixel components.
  8633. This filter accepts the following options:
  8634. @table @option
  8635. @item planes
  8636. Set which planes will be processed as bitmap, unprocessed planes will be
  8637. copied from first stream.
  8638. By default value 0xf, all planes will be processed.
  8639. @end table
  8640. @section mcdeint
  8641. Apply motion-compensation deinterlacing.
  8642. It needs one field per frame as input and must thus be used together
  8643. with yadif=1/3 or equivalent.
  8644. This filter accepts the following options:
  8645. @table @option
  8646. @item mode
  8647. Set the deinterlacing mode.
  8648. It accepts one of the following values:
  8649. @table @samp
  8650. @item fast
  8651. @item medium
  8652. @item slow
  8653. use iterative motion estimation
  8654. @item extra_slow
  8655. like @samp{slow}, but use multiple reference frames.
  8656. @end table
  8657. Default value is @samp{fast}.
  8658. @item parity
  8659. Set the picture field parity assumed for the input video. It must be
  8660. one of the following values:
  8661. @table @samp
  8662. @item 0, tff
  8663. assume top field first
  8664. @item 1, bff
  8665. assume bottom field first
  8666. @end table
  8667. Default value is @samp{bff}.
  8668. @item qp
  8669. Set per-block quantization parameter (QP) used by the internal
  8670. encoder.
  8671. Higher values should result in a smoother motion vector field but less
  8672. optimal individual vectors. Default value is 1.
  8673. @end table
  8674. @section mergeplanes
  8675. Merge color channel components from several video streams.
  8676. The filter accepts up to 4 input streams, and merge selected input
  8677. planes to the output video.
  8678. This filter accepts the following options:
  8679. @table @option
  8680. @item mapping
  8681. Set input to output plane mapping. Default is @code{0}.
  8682. The mappings is specified as a bitmap. It should be specified as a
  8683. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8684. mapping for the first plane of the output stream. 'A' sets the number of
  8685. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8686. corresponding input to use (from 0 to 3). The rest of the mappings is
  8687. similar, 'Bb' describes the mapping for the output stream second
  8688. plane, 'Cc' describes the mapping for the output stream third plane and
  8689. 'Dd' describes the mapping for the output stream fourth plane.
  8690. @item format
  8691. Set output pixel format. Default is @code{yuva444p}.
  8692. @end table
  8693. @subsection Examples
  8694. @itemize
  8695. @item
  8696. Merge three gray video streams of same width and height into single video stream:
  8697. @example
  8698. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8699. @end example
  8700. @item
  8701. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8702. @example
  8703. [a0][a1]mergeplanes=0x00010210:yuva444p
  8704. @end example
  8705. @item
  8706. Swap Y and A plane in yuva444p stream:
  8707. @example
  8708. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8709. @end example
  8710. @item
  8711. Swap U and V plane in yuv420p stream:
  8712. @example
  8713. format=yuv420p,mergeplanes=0x000201:yuv420p
  8714. @end example
  8715. @item
  8716. Cast a rgb24 clip to yuv444p:
  8717. @example
  8718. format=rgb24,mergeplanes=0x000102:yuv444p
  8719. @end example
  8720. @end itemize
  8721. @section mestimate
  8722. Estimate and export motion vectors using block matching algorithms.
  8723. Motion vectors are stored in frame side data to be used by other filters.
  8724. This filter accepts the following options:
  8725. @table @option
  8726. @item method
  8727. Specify the motion estimation method. Accepts one of the following values:
  8728. @table @samp
  8729. @item esa
  8730. Exhaustive search algorithm.
  8731. @item tss
  8732. Three step search algorithm.
  8733. @item tdls
  8734. Two dimensional logarithmic search algorithm.
  8735. @item ntss
  8736. New three step search algorithm.
  8737. @item fss
  8738. Four step search algorithm.
  8739. @item ds
  8740. Diamond search algorithm.
  8741. @item hexbs
  8742. Hexagon-based search algorithm.
  8743. @item epzs
  8744. Enhanced predictive zonal search algorithm.
  8745. @item umh
  8746. Uneven multi-hexagon search algorithm.
  8747. @end table
  8748. Default value is @samp{esa}.
  8749. @item mb_size
  8750. Macroblock size. Default @code{16}.
  8751. @item search_param
  8752. Search parameter. Default @code{7}.
  8753. @end table
  8754. @section midequalizer
  8755. Apply Midway Image Equalization effect using two video streams.
  8756. Midway Image Equalization adjusts a pair of images to have the same
  8757. histogram, while maintaining their dynamics as much as possible. It's
  8758. useful for e.g. matching exposures from a pair of stereo cameras.
  8759. This filter has two inputs and one output, which must be of same pixel format, but
  8760. may be of different sizes. The output of filter is first input adjusted with
  8761. midway histogram of both inputs.
  8762. This filter accepts the following option:
  8763. @table @option
  8764. @item planes
  8765. Set which planes to process. Default is @code{15}, which is all available planes.
  8766. @end table
  8767. @section minterpolate
  8768. Convert the video to specified frame rate using motion interpolation.
  8769. This filter accepts the following options:
  8770. @table @option
  8771. @item fps
  8772. 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}.
  8773. @item mi_mode
  8774. Motion interpolation mode. Following values are accepted:
  8775. @table @samp
  8776. @item dup
  8777. Duplicate previous or next frame for interpolating new ones.
  8778. @item blend
  8779. Blend source frames. Interpolated frame is mean of previous and next frames.
  8780. @item mci
  8781. Motion compensated interpolation. Following options are effective when this mode is selected:
  8782. @table @samp
  8783. @item mc_mode
  8784. Motion compensation mode. Following values are accepted:
  8785. @table @samp
  8786. @item obmc
  8787. Overlapped block motion compensation.
  8788. @item aobmc
  8789. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8790. @end table
  8791. Default mode is @samp{obmc}.
  8792. @item me_mode
  8793. Motion estimation mode. Following values are accepted:
  8794. @table @samp
  8795. @item bidir
  8796. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8797. @item bilat
  8798. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8799. @end table
  8800. Default mode is @samp{bilat}.
  8801. @item me
  8802. The algorithm to be used for motion estimation. Following values are accepted:
  8803. @table @samp
  8804. @item esa
  8805. Exhaustive search algorithm.
  8806. @item tss
  8807. Three step search algorithm.
  8808. @item tdls
  8809. Two dimensional logarithmic search algorithm.
  8810. @item ntss
  8811. New three step search algorithm.
  8812. @item fss
  8813. Four step search algorithm.
  8814. @item ds
  8815. Diamond search algorithm.
  8816. @item hexbs
  8817. Hexagon-based search algorithm.
  8818. @item epzs
  8819. Enhanced predictive zonal search algorithm.
  8820. @item umh
  8821. Uneven multi-hexagon search algorithm.
  8822. @end table
  8823. Default algorithm is @samp{epzs}.
  8824. @item mb_size
  8825. Macroblock size. Default @code{16}.
  8826. @item search_param
  8827. Motion estimation search parameter. Default @code{32}.
  8828. @item vsbmc
  8829. 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).
  8830. @end table
  8831. @end table
  8832. @item scd
  8833. 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:
  8834. @table @samp
  8835. @item none
  8836. Disable scene change detection.
  8837. @item fdiff
  8838. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8839. @end table
  8840. Default method is @samp{fdiff}.
  8841. @item scd_threshold
  8842. Scene change detection threshold. Default is @code{5.0}.
  8843. @end table
  8844. @section mix
  8845. Mix several video input streams into one video stream.
  8846. A description of the accepted options follows.
  8847. @table @option
  8848. @item nb_inputs
  8849. The number of inputs. If unspecified, it defaults to 2.
  8850. @item weights
  8851. Specify weight of each input video stream as sequence.
  8852. Each weight is separated by space. If number of weights
  8853. is smaller than number of @var{frames} last specified
  8854. weight will be used for all remaining unset weights.
  8855. @item scale
  8856. Specify scale, if it is set it will be multiplied with sum
  8857. of each weight multiplied with pixel values to give final destination
  8858. pixel value. By default @var{scale} is auto scaled to sum of weights.
  8859. @item duration
  8860. Specify how end of stream is determined.
  8861. @table @samp
  8862. @item longest
  8863. The duration of the longest input. (default)
  8864. @item shortest
  8865. The duration of the shortest input.
  8866. @item first
  8867. The duration of the first input.
  8868. @end table
  8869. @end table
  8870. @section mpdecimate
  8871. Drop frames that do not differ greatly from the previous frame in
  8872. order to reduce frame rate.
  8873. The main use of this filter is for very-low-bitrate encoding
  8874. (e.g. streaming over dialup modem), but it could in theory be used for
  8875. fixing movies that were inverse-telecined incorrectly.
  8876. A description of the accepted options follows.
  8877. @table @option
  8878. @item max
  8879. Set the maximum number of consecutive frames which can be dropped (if
  8880. positive), or the minimum interval between dropped frames (if
  8881. negative). If the value is 0, the frame is dropped disregarding the
  8882. number of previous sequentially dropped frames.
  8883. Default value is 0.
  8884. @item hi
  8885. @item lo
  8886. @item frac
  8887. Set the dropping threshold values.
  8888. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8889. represent actual pixel value differences, so a threshold of 64
  8890. corresponds to 1 unit of difference for each pixel, or the same spread
  8891. out differently over the block.
  8892. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8893. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8894. meaning the whole image) differ by more than a threshold of @option{lo}.
  8895. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8896. 64*5, and default value for @option{frac} is 0.33.
  8897. @end table
  8898. @section negate
  8899. Negate (invert) the input video.
  8900. It accepts the following option:
  8901. @table @option
  8902. @item negate_alpha
  8903. With value 1, it negates the alpha component, if present. Default value is 0.
  8904. @end table
  8905. @section nlmeans
  8906. Denoise frames using Non-Local Means algorithm.
  8907. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8908. context similarity is defined by comparing their surrounding patches of size
  8909. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8910. around the pixel.
  8911. Note that the research area defines centers for patches, which means some
  8912. patches will be made of pixels outside that research area.
  8913. The filter accepts the following options.
  8914. @table @option
  8915. @item s
  8916. Set denoising strength.
  8917. @item p
  8918. Set patch size.
  8919. @item pc
  8920. Same as @option{p} but for chroma planes.
  8921. The default value is @var{0} and means automatic.
  8922. @item r
  8923. Set research size.
  8924. @item rc
  8925. Same as @option{r} but for chroma planes.
  8926. The default value is @var{0} and means automatic.
  8927. @end table
  8928. @section nnedi
  8929. Deinterlace video using neural network edge directed interpolation.
  8930. This filter accepts the following options:
  8931. @table @option
  8932. @item weights
  8933. Mandatory option, without binary file filter can not work.
  8934. Currently file can be found here:
  8935. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8936. @item deint
  8937. Set which frames to deinterlace, by default it is @code{all}.
  8938. Can be @code{all} or @code{interlaced}.
  8939. @item field
  8940. Set mode of operation.
  8941. Can be one of the following:
  8942. @table @samp
  8943. @item af
  8944. Use frame flags, both fields.
  8945. @item a
  8946. Use frame flags, single field.
  8947. @item t
  8948. Use top field only.
  8949. @item b
  8950. Use bottom field only.
  8951. @item tf
  8952. Use both fields, top first.
  8953. @item bf
  8954. Use both fields, bottom first.
  8955. @end table
  8956. @item planes
  8957. Set which planes to process, by default filter process all frames.
  8958. @item nsize
  8959. Set size of local neighborhood around each pixel, used by the predictor neural
  8960. network.
  8961. Can be one of the following:
  8962. @table @samp
  8963. @item s8x6
  8964. @item s16x6
  8965. @item s32x6
  8966. @item s48x6
  8967. @item s8x4
  8968. @item s16x4
  8969. @item s32x4
  8970. @end table
  8971. @item nns
  8972. Set the number of neurons in predictor neural network.
  8973. Can be one of the following:
  8974. @table @samp
  8975. @item n16
  8976. @item n32
  8977. @item n64
  8978. @item n128
  8979. @item n256
  8980. @end table
  8981. @item qual
  8982. Controls the number of different neural network predictions that are blended
  8983. together to compute the final output value. Can be @code{fast}, default or
  8984. @code{slow}.
  8985. @item etype
  8986. Set which set of weights to use in the predictor.
  8987. Can be one of the following:
  8988. @table @samp
  8989. @item a
  8990. weights trained to minimize absolute error
  8991. @item s
  8992. weights trained to minimize squared error
  8993. @end table
  8994. @item pscrn
  8995. Controls whether or not the prescreener neural network is used to decide
  8996. which pixels should be processed by the predictor neural network and which
  8997. can be handled by simple cubic interpolation.
  8998. The prescreener is trained to know whether cubic interpolation will be
  8999. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9000. The computational complexity of the prescreener nn is much less than that of
  9001. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9002. using the prescreener generally results in much faster processing.
  9003. The prescreener is pretty accurate, so the difference between using it and not
  9004. using it is almost always unnoticeable.
  9005. Can be one of the following:
  9006. @table @samp
  9007. @item none
  9008. @item original
  9009. @item new
  9010. @end table
  9011. Default is @code{new}.
  9012. @item fapprox
  9013. Set various debugging flags.
  9014. @end table
  9015. @section noformat
  9016. Force libavfilter not to use any of the specified pixel formats for the
  9017. input to the next filter.
  9018. It accepts the following parameters:
  9019. @table @option
  9020. @item pix_fmts
  9021. A '|'-separated list of pixel format names, such as
  9022. pix_fmts=yuv420p|monow|rgb24".
  9023. @end table
  9024. @subsection Examples
  9025. @itemize
  9026. @item
  9027. Force libavfilter to use a format different from @var{yuv420p} for the
  9028. input to the vflip filter:
  9029. @example
  9030. noformat=pix_fmts=yuv420p,vflip
  9031. @end example
  9032. @item
  9033. Convert the input video to any of the formats not contained in the list:
  9034. @example
  9035. noformat=yuv420p|yuv444p|yuv410p
  9036. @end example
  9037. @end itemize
  9038. @section noise
  9039. Add noise on video input frame.
  9040. The filter accepts the following options:
  9041. @table @option
  9042. @item all_seed
  9043. @item c0_seed
  9044. @item c1_seed
  9045. @item c2_seed
  9046. @item c3_seed
  9047. Set noise seed for specific pixel component or all pixel components in case
  9048. of @var{all_seed}. Default value is @code{123457}.
  9049. @item all_strength, alls
  9050. @item c0_strength, c0s
  9051. @item c1_strength, c1s
  9052. @item c2_strength, c2s
  9053. @item c3_strength, c3s
  9054. Set noise strength for specific pixel component or all pixel components in case
  9055. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9056. @item all_flags, allf
  9057. @item c0_flags, c0f
  9058. @item c1_flags, c1f
  9059. @item c2_flags, c2f
  9060. @item c3_flags, c3f
  9061. Set pixel component flags or set flags for all components if @var{all_flags}.
  9062. Available values for component flags are:
  9063. @table @samp
  9064. @item a
  9065. averaged temporal noise (smoother)
  9066. @item p
  9067. mix random noise with a (semi)regular pattern
  9068. @item t
  9069. temporal noise (noise pattern changes between frames)
  9070. @item u
  9071. uniform noise (gaussian otherwise)
  9072. @end table
  9073. @end table
  9074. @subsection Examples
  9075. Add temporal and uniform noise to input video:
  9076. @example
  9077. noise=alls=20:allf=t+u
  9078. @end example
  9079. @section normalize
  9080. Normalize RGB video (aka histogram stretching, contrast stretching).
  9081. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9082. For each channel of each frame, the filter computes the input range and maps
  9083. it linearly to the user-specified output range. The output range defaults
  9084. to the full dynamic range from pure black to pure white.
  9085. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9086. changes in brightness) caused when small dark or bright objects enter or leave
  9087. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9088. video camera, and, like a video camera, it may cause a period of over- or
  9089. under-exposure of the video.
  9090. The R,G,B channels can be normalized independently, which may cause some
  9091. color shifting, or linked together as a single channel, which prevents
  9092. color shifting. Linked normalization preserves hue. Independent normalization
  9093. does not, so it can be used to remove some color casts. Independent and linked
  9094. normalization can be combined in any ratio.
  9095. The normalize filter accepts the following options:
  9096. @table @option
  9097. @item blackpt
  9098. @item whitept
  9099. Colors which define the output range. The minimum input value is mapped to
  9100. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9101. The defaults are black and white respectively. Specifying white for
  9102. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9103. normalized video. Shades of grey can be used to reduce the dynamic range
  9104. (contrast). Specifying saturated colors here can create some interesting
  9105. effects.
  9106. @item smoothing
  9107. The number of previous frames to use for temporal smoothing. The input range
  9108. of each channel is smoothed using a rolling average over the current frame
  9109. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9110. smoothing).
  9111. @item independence
  9112. Controls the ratio of independent (color shifting) channel normalization to
  9113. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9114. independent. Defaults to 1.0 (fully independent).
  9115. @item strength
  9116. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9117. expensive no-op. Defaults to 1.0 (full strength).
  9118. @end table
  9119. @subsection Examples
  9120. Stretch video contrast to use the full dynamic range, with no temporal
  9121. smoothing; may flicker depending on the source content:
  9122. @example
  9123. normalize=blackpt=black:whitept=white:smoothing=0
  9124. @end example
  9125. As above, but with 50 frames of temporal smoothing; flicker should be
  9126. reduced, depending on the source content:
  9127. @example
  9128. normalize=blackpt=black:whitept=white:smoothing=50
  9129. @end example
  9130. As above, but with hue-preserving linked channel normalization:
  9131. @example
  9132. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9133. @end example
  9134. As above, but with half strength:
  9135. @example
  9136. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9137. @end example
  9138. Map the darkest input color to red, the brightest input color to cyan:
  9139. @example
  9140. normalize=blackpt=red:whitept=cyan
  9141. @end example
  9142. @section null
  9143. Pass the video source unchanged to the output.
  9144. @section ocr
  9145. Optical Character Recognition
  9146. This filter uses Tesseract for optical character recognition. To enable
  9147. compilation of this filter, you need to configure FFmpeg with
  9148. @code{--enable-libtesseract}.
  9149. It accepts the following options:
  9150. @table @option
  9151. @item datapath
  9152. Set datapath to tesseract data. Default is to use whatever was
  9153. set at installation.
  9154. @item language
  9155. Set language, default is "eng".
  9156. @item whitelist
  9157. Set character whitelist.
  9158. @item blacklist
  9159. Set character blacklist.
  9160. @end table
  9161. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9162. @section ocv
  9163. Apply a video transform using libopencv.
  9164. To enable this filter, install the libopencv library and headers and
  9165. configure FFmpeg with @code{--enable-libopencv}.
  9166. It accepts the following parameters:
  9167. @table @option
  9168. @item filter_name
  9169. The name of the libopencv filter to apply.
  9170. @item filter_params
  9171. The parameters to pass to the libopencv filter. If not specified, the default
  9172. values are assumed.
  9173. @end table
  9174. Refer to the official libopencv documentation for more precise
  9175. information:
  9176. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9177. Several libopencv filters are supported; see the following subsections.
  9178. @anchor{dilate}
  9179. @subsection dilate
  9180. Dilate an image by using a specific structuring element.
  9181. It corresponds to the libopencv function @code{cvDilate}.
  9182. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9183. @var{struct_el} represents a structuring element, and has the syntax:
  9184. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9185. @var{cols} and @var{rows} represent the number of columns and rows of
  9186. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9187. point, and @var{shape} the shape for the structuring element. @var{shape}
  9188. must be "rect", "cross", "ellipse", or "custom".
  9189. If the value for @var{shape} is "custom", it must be followed by a
  9190. string of the form "=@var{filename}". The file with name
  9191. @var{filename} is assumed to represent a binary image, with each
  9192. printable character corresponding to a bright pixel. When a custom
  9193. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9194. or columns and rows of the read file are assumed instead.
  9195. The default value for @var{struct_el} is "3x3+0x0/rect".
  9196. @var{nb_iterations} specifies the number of times the transform is
  9197. applied to the image, and defaults to 1.
  9198. Some examples:
  9199. @example
  9200. # Use the default values
  9201. ocv=dilate
  9202. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9203. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9204. # Read the shape from the file diamond.shape, iterating two times.
  9205. # The file diamond.shape may contain a pattern of characters like this
  9206. # *
  9207. # ***
  9208. # *****
  9209. # ***
  9210. # *
  9211. # The specified columns and rows are ignored
  9212. # but the anchor point coordinates are not
  9213. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9214. @end example
  9215. @subsection erode
  9216. Erode an image by using a specific structuring element.
  9217. It corresponds to the libopencv function @code{cvErode}.
  9218. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9219. with the same syntax and semantics as the @ref{dilate} filter.
  9220. @subsection smooth
  9221. Smooth the input video.
  9222. The filter takes the following parameters:
  9223. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9224. @var{type} is the type of smooth filter to apply, and must be one of
  9225. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9226. or "bilateral". The default value is "gaussian".
  9227. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9228. depend on the smooth type. @var{param1} and
  9229. @var{param2} accept integer positive values or 0. @var{param3} and
  9230. @var{param4} accept floating point values.
  9231. The default value for @var{param1} is 3. The default value for the
  9232. other parameters is 0.
  9233. These parameters correspond to the parameters assigned to the
  9234. libopencv function @code{cvSmooth}.
  9235. @section oscilloscope
  9236. 2D Video Oscilloscope.
  9237. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9238. It accepts the following parameters:
  9239. @table @option
  9240. @item x
  9241. Set scope center x position.
  9242. @item y
  9243. Set scope center y position.
  9244. @item s
  9245. Set scope size, relative to frame diagonal.
  9246. @item t
  9247. Set scope tilt/rotation.
  9248. @item o
  9249. Set trace opacity.
  9250. @item tx
  9251. Set trace center x position.
  9252. @item ty
  9253. Set trace center y position.
  9254. @item tw
  9255. Set trace width, relative to width of frame.
  9256. @item th
  9257. Set trace height, relative to height of frame.
  9258. @item c
  9259. Set which components to trace. By default it traces first three components.
  9260. @item g
  9261. Draw trace grid. By default is enabled.
  9262. @item st
  9263. Draw some statistics. By default is enabled.
  9264. @item sc
  9265. Draw scope. By default is enabled.
  9266. @end table
  9267. @subsection Examples
  9268. @itemize
  9269. @item
  9270. Inspect full first row of video frame.
  9271. @example
  9272. oscilloscope=x=0.5:y=0:s=1
  9273. @end example
  9274. @item
  9275. Inspect full last row of video frame.
  9276. @example
  9277. oscilloscope=x=0.5:y=1:s=1
  9278. @end example
  9279. @item
  9280. Inspect full 5th line of video frame of height 1080.
  9281. @example
  9282. oscilloscope=x=0.5:y=5/1080:s=1
  9283. @end example
  9284. @item
  9285. Inspect full last column of video frame.
  9286. @example
  9287. oscilloscope=x=1:y=0.5:s=1:t=1
  9288. @end example
  9289. @end itemize
  9290. @anchor{overlay}
  9291. @section overlay
  9292. Overlay one video on top of another.
  9293. It takes two inputs and has one output. The first input is the "main"
  9294. video on which the second input is overlaid.
  9295. It accepts the following parameters:
  9296. A description of the accepted options follows.
  9297. @table @option
  9298. @item x
  9299. @item y
  9300. Set the expression for the x and y coordinates of the overlaid video
  9301. on the main video. Default value is "0" for both expressions. In case
  9302. the expression is invalid, it is set to a huge value (meaning that the
  9303. overlay will not be displayed within the output visible area).
  9304. @item eof_action
  9305. See @ref{framesync}.
  9306. @item eval
  9307. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9308. It accepts the following values:
  9309. @table @samp
  9310. @item init
  9311. only evaluate expressions once during the filter initialization or
  9312. when a command is processed
  9313. @item frame
  9314. evaluate expressions for each incoming frame
  9315. @end table
  9316. Default value is @samp{frame}.
  9317. @item shortest
  9318. See @ref{framesync}.
  9319. @item format
  9320. Set the format for the output video.
  9321. It accepts the following values:
  9322. @table @samp
  9323. @item yuv420
  9324. force YUV420 output
  9325. @item yuv422
  9326. force YUV422 output
  9327. @item yuv444
  9328. force YUV444 output
  9329. @item rgb
  9330. force packed RGB output
  9331. @item gbrp
  9332. force planar RGB output
  9333. @item auto
  9334. automatically pick format
  9335. @end table
  9336. Default value is @samp{yuv420}.
  9337. @item repeatlast
  9338. See @ref{framesync}.
  9339. @item alpha
  9340. Set format of alpha of the overlaid video, it can be @var{straight} or
  9341. @var{premultiplied}. Default is @var{straight}.
  9342. @end table
  9343. The @option{x}, and @option{y} expressions can contain the following
  9344. parameters.
  9345. @table @option
  9346. @item main_w, W
  9347. @item main_h, H
  9348. The main input width and height.
  9349. @item overlay_w, w
  9350. @item overlay_h, h
  9351. The overlay input width and height.
  9352. @item x
  9353. @item y
  9354. The computed values for @var{x} and @var{y}. They are evaluated for
  9355. each new frame.
  9356. @item hsub
  9357. @item vsub
  9358. horizontal and vertical chroma subsample values of the output
  9359. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9360. @var{vsub} is 1.
  9361. @item n
  9362. the number of input frame, starting from 0
  9363. @item pos
  9364. the position in the file of the input frame, NAN if unknown
  9365. @item t
  9366. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9367. @end table
  9368. This filter also supports the @ref{framesync} options.
  9369. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9370. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9371. when @option{eval} is set to @samp{init}.
  9372. Be aware that frames are taken from each input video in timestamp
  9373. order, hence, if their initial timestamps differ, it is a good idea
  9374. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9375. have them begin in the same zero timestamp, as the example for
  9376. the @var{movie} filter does.
  9377. You can chain together more overlays but you should test the
  9378. efficiency of such approach.
  9379. @subsection Commands
  9380. This filter supports the following commands:
  9381. @table @option
  9382. @item x
  9383. @item y
  9384. Modify the x and y of the overlay input.
  9385. The command accepts the same syntax of the corresponding option.
  9386. If the specified expression is not valid, it is kept at its current
  9387. value.
  9388. @end table
  9389. @subsection Examples
  9390. @itemize
  9391. @item
  9392. Draw the overlay at 10 pixels from the bottom right corner of the main
  9393. video:
  9394. @example
  9395. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9396. @end example
  9397. Using named options the example above becomes:
  9398. @example
  9399. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9400. @end example
  9401. @item
  9402. Insert a transparent PNG logo in the bottom left corner of the input,
  9403. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9404. @example
  9405. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9406. @end example
  9407. @item
  9408. Insert 2 different transparent PNG logos (second logo on bottom
  9409. right corner) using the @command{ffmpeg} tool:
  9410. @example
  9411. 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
  9412. @end example
  9413. @item
  9414. Add a transparent color layer on top of the main video; @code{WxH}
  9415. must specify the size of the main input to the overlay filter:
  9416. @example
  9417. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9418. @end example
  9419. @item
  9420. Play an original video and a filtered version (here with the deshake
  9421. filter) side by side using the @command{ffplay} tool:
  9422. @example
  9423. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9424. @end example
  9425. The above command is the same as:
  9426. @example
  9427. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9428. @end example
  9429. @item
  9430. Make a sliding overlay appearing from the left to the right top part of the
  9431. screen starting since time 2:
  9432. @example
  9433. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9434. @end example
  9435. @item
  9436. Compose output by putting two input videos side to side:
  9437. @example
  9438. ffmpeg -i left.avi -i right.avi -filter_complex "
  9439. nullsrc=size=200x100 [background];
  9440. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9441. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9442. [background][left] overlay=shortest=1 [background+left];
  9443. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9444. "
  9445. @end example
  9446. @item
  9447. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9448. @example
  9449. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9450. -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]'
  9451. masked.avi
  9452. @end example
  9453. @item
  9454. Chain several overlays in cascade:
  9455. @example
  9456. nullsrc=s=200x200 [bg];
  9457. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9458. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9459. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9460. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9461. [in3] null, [mid2] overlay=100:100 [out0]
  9462. @end example
  9463. @end itemize
  9464. @section owdenoise
  9465. Apply Overcomplete Wavelet denoiser.
  9466. The filter accepts the following options:
  9467. @table @option
  9468. @item depth
  9469. Set depth.
  9470. Larger depth values will denoise lower frequency components more, but
  9471. slow down filtering.
  9472. Must be an int in the range 8-16, default is @code{8}.
  9473. @item luma_strength, ls
  9474. Set luma strength.
  9475. Must be a double value in the range 0-1000, default is @code{1.0}.
  9476. @item chroma_strength, cs
  9477. Set chroma strength.
  9478. Must be a double value in the range 0-1000, default is @code{1.0}.
  9479. @end table
  9480. @anchor{pad}
  9481. @section pad
  9482. Add paddings to the input image, and place the original input at the
  9483. provided @var{x}, @var{y} coordinates.
  9484. It accepts the following parameters:
  9485. @table @option
  9486. @item width, w
  9487. @item height, h
  9488. Specify an expression for the size of the output image with the
  9489. paddings added. If the value for @var{width} or @var{height} is 0, the
  9490. corresponding input size is used for the output.
  9491. The @var{width} expression can reference the value set by the
  9492. @var{height} expression, and vice versa.
  9493. The default value of @var{width} and @var{height} is 0.
  9494. @item x
  9495. @item y
  9496. Specify the offsets to place the input image at within the padded area,
  9497. with respect to the top/left border of the output image.
  9498. The @var{x} expression can reference the value set by the @var{y}
  9499. expression, and vice versa.
  9500. The default value of @var{x} and @var{y} is 0.
  9501. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9502. so the input image is centered on the padded area.
  9503. @item color
  9504. Specify the color of the padded area. For the syntax of this option,
  9505. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9506. manual,ffmpeg-utils}.
  9507. The default value of @var{color} is "black".
  9508. @item eval
  9509. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9510. It accepts the following values:
  9511. @table @samp
  9512. @item init
  9513. Only evaluate expressions once during the filter initialization or when
  9514. a command is processed.
  9515. @item frame
  9516. Evaluate expressions for each incoming frame.
  9517. @end table
  9518. Default value is @samp{init}.
  9519. @item aspect
  9520. Pad to aspect instead to a resolution.
  9521. @end table
  9522. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9523. options are expressions containing the following constants:
  9524. @table @option
  9525. @item in_w
  9526. @item in_h
  9527. The input video width and height.
  9528. @item iw
  9529. @item ih
  9530. These are the same as @var{in_w} and @var{in_h}.
  9531. @item out_w
  9532. @item out_h
  9533. The output width and height (the size of the padded area), as
  9534. specified by the @var{width} and @var{height} expressions.
  9535. @item ow
  9536. @item oh
  9537. These are the same as @var{out_w} and @var{out_h}.
  9538. @item x
  9539. @item y
  9540. The x and y offsets as specified by the @var{x} and @var{y}
  9541. expressions, or NAN if not yet specified.
  9542. @item a
  9543. same as @var{iw} / @var{ih}
  9544. @item sar
  9545. input sample aspect ratio
  9546. @item dar
  9547. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9548. @item hsub
  9549. @item vsub
  9550. The horizontal and vertical chroma subsample values. For example for the
  9551. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9552. @end table
  9553. @subsection Examples
  9554. @itemize
  9555. @item
  9556. Add paddings with the color "violet" to the input video. The output video
  9557. size is 640x480, and the top-left corner of the input video is placed at
  9558. column 0, row 40
  9559. @example
  9560. pad=640:480:0:40:violet
  9561. @end example
  9562. The example above is equivalent to the following command:
  9563. @example
  9564. pad=width=640:height=480:x=0:y=40:color=violet
  9565. @end example
  9566. @item
  9567. Pad the input to get an output with dimensions increased by 3/2,
  9568. and put the input video at the center of the padded area:
  9569. @example
  9570. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9571. @end example
  9572. @item
  9573. Pad the input to get a squared output with size equal to the maximum
  9574. value between the input width and height, and put the input video at
  9575. the center of the padded area:
  9576. @example
  9577. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9578. @end example
  9579. @item
  9580. Pad the input to get a final w/h ratio of 16:9:
  9581. @example
  9582. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9583. @end example
  9584. @item
  9585. In case of anamorphic video, in order to set the output display aspect
  9586. correctly, it is necessary to use @var{sar} in the expression,
  9587. according to the relation:
  9588. @example
  9589. (ih * X / ih) * sar = output_dar
  9590. X = output_dar / sar
  9591. @end example
  9592. Thus the previous example needs to be modified to:
  9593. @example
  9594. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9595. @end example
  9596. @item
  9597. Double the output size and put the input video in the bottom-right
  9598. corner of the output padded area:
  9599. @example
  9600. pad="2*iw:2*ih:ow-iw:oh-ih"
  9601. @end example
  9602. @end itemize
  9603. @anchor{palettegen}
  9604. @section palettegen
  9605. Generate one palette for a whole video stream.
  9606. It accepts the following options:
  9607. @table @option
  9608. @item max_colors
  9609. Set the maximum number of colors to quantize in the palette.
  9610. Note: the palette will still contain 256 colors; the unused palette entries
  9611. will be black.
  9612. @item reserve_transparent
  9613. Create a palette of 255 colors maximum and reserve the last one for
  9614. transparency. Reserving the transparency color is useful for GIF optimization.
  9615. If not set, the maximum of colors in the palette will be 256. You probably want
  9616. to disable this option for a standalone image.
  9617. Set by default.
  9618. @item transparency_color
  9619. Set the color that will be used as background for transparency.
  9620. @item stats_mode
  9621. Set statistics mode.
  9622. It accepts the following values:
  9623. @table @samp
  9624. @item full
  9625. Compute full frame histograms.
  9626. @item diff
  9627. Compute histograms only for the part that differs from previous frame. This
  9628. might be relevant to give more importance to the moving part of your input if
  9629. the background is static.
  9630. @item single
  9631. Compute new histogram for each frame.
  9632. @end table
  9633. Default value is @var{full}.
  9634. @end table
  9635. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9636. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9637. color quantization of the palette. This information is also visible at
  9638. @var{info} logging level.
  9639. @subsection Examples
  9640. @itemize
  9641. @item
  9642. Generate a representative palette of a given video using @command{ffmpeg}:
  9643. @example
  9644. ffmpeg -i input.mkv -vf palettegen palette.png
  9645. @end example
  9646. @end itemize
  9647. @section paletteuse
  9648. Use a palette to downsample an input video stream.
  9649. The filter takes two inputs: one video stream and a palette. The palette must
  9650. be a 256 pixels image.
  9651. It accepts the following options:
  9652. @table @option
  9653. @item dither
  9654. Select dithering mode. Available algorithms are:
  9655. @table @samp
  9656. @item bayer
  9657. Ordered 8x8 bayer dithering (deterministic)
  9658. @item heckbert
  9659. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9660. Note: this dithering is sometimes considered "wrong" and is included as a
  9661. reference.
  9662. @item floyd_steinberg
  9663. Floyd and Steingberg dithering (error diffusion)
  9664. @item sierra2
  9665. Frankie Sierra dithering v2 (error diffusion)
  9666. @item sierra2_4a
  9667. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9668. @end table
  9669. Default is @var{sierra2_4a}.
  9670. @item bayer_scale
  9671. When @var{bayer} dithering is selected, this option defines the scale of the
  9672. pattern (how much the crosshatch pattern is visible). A low value means more
  9673. visible pattern for less banding, and higher value means less visible pattern
  9674. at the cost of more banding.
  9675. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9676. @item diff_mode
  9677. If set, define the zone to process
  9678. @table @samp
  9679. @item rectangle
  9680. Only the changing rectangle will be reprocessed. This is similar to GIF
  9681. cropping/offsetting compression mechanism. This option can be useful for speed
  9682. if only a part of the image is changing, and has use cases such as limiting the
  9683. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9684. moving scene (it leads to more deterministic output if the scene doesn't change
  9685. much, and as a result less moving noise and better GIF compression).
  9686. @end table
  9687. Default is @var{none}.
  9688. @item new
  9689. Take new palette for each output frame.
  9690. @item alpha_threshold
  9691. Sets the alpha threshold for transparency. Alpha values above this threshold
  9692. will be treated as completely opaque, and values below this threshold will be
  9693. treated as completely transparent.
  9694. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9695. @end table
  9696. @subsection Examples
  9697. @itemize
  9698. @item
  9699. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9700. using @command{ffmpeg}:
  9701. @example
  9702. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9703. @end example
  9704. @end itemize
  9705. @section perspective
  9706. Correct perspective of video not recorded perpendicular to the screen.
  9707. A description of the accepted parameters follows.
  9708. @table @option
  9709. @item x0
  9710. @item y0
  9711. @item x1
  9712. @item y1
  9713. @item x2
  9714. @item y2
  9715. @item x3
  9716. @item y3
  9717. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9718. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9719. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9720. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9721. then the corners of the source will be sent to the specified coordinates.
  9722. The expressions can use the following variables:
  9723. @table @option
  9724. @item W
  9725. @item H
  9726. the width and height of video frame.
  9727. @item in
  9728. Input frame count.
  9729. @item on
  9730. Output frame count.
  9731. @end table
  9732. @item interpolation
  9733. Set interpolation for perspective correction.
  9734. It accepts the following values:
  9735. @table @samp
  9736. @item linear
  9737. @item cubic
  9738. @end table
  9739. Default value is @samp{linear}.
  9740. @item sense
  9741. Set interpretation of coordinate options.
  9742. It accepts the following values:
  9743. @table @samp
  9744. @item 0, source
  9745. Send point in the source specified by the given coordinates to
  9746. the corners of the destination.
  9747. @item 1, destination
  9748. Send the corners of the source to the point in the destination specified
  9749. by the given coordinates.
  9750. Default value is @samp{source}.
  9751. @end table
  9752. @item eval
  9753. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9754. It accepts the following values:
  9755. @table @samp
  9756. @item init
  9757. only evaluate expressions once during the filter initialization or
  9758. when a command is processed
  9759. @item frame
  9760. evaluate expressions for each incoming frame
  9761. @end table
  9762. Default value is @samp{init}.
  9763. @end table
  9764. @section phase
  9765. Delay interlaced video by one field time so that the field order changes.
  9766. The intended use is to fix PAL movies that have been captured with the
  9767. opposite field order to the film-to-video transfer.
  9768. A description of the accepted parameters follows.
  9769. @table @option
  9770. @item mode
  9771. Set phase mode.
  9772. It accepts the following values:
  9773. @table @samp
  9774. @item t
  9775. Capture field order top-first, transfer bottom-first.
  9776. Filter will delay the bottom field.
  9777. @item b
  9778. Capture field order bottom-first, transfer top-first.
  9779. Filter will delay the top field.
  9780. @item p
  9781. Capture and transfer with the same field order. This mode only exists
  9782. for the documentation of the other options to refer to, but if you
  9783. actually select it, the filter will faithfully do nothing.
  9784. @item a
  9785. Capture field order determined automatically by field flags, transfer
  9786. opposite.
  9787. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9788. basis using field flags. If no field information is available,
  9789. then this works just like @samp{u}.
  9790. @item u
  9791. Capture unknown or varying, transfer opposite.
  9792. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9793. analyzing the images and selecting the alternative that produces best
  9794. match between the fields.
  9795. @item T
  9796. Capture top-first, transfer unknown or varying.
  9797. Filter selects among @samp{t} and @samp{p} using image analysis.
  9798. @item B
  9799. Capture bottom-first, transfer unknown or varying.
  9800. Filter selects among @samp{b} and @samp{p} using image analysis.
  9801. @item A
  9802. Capture determined by field flags, transfer unknown or varying.
  9803. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9804. image analysis. If no field information is available, then this works just
  9805. like @samp{U}. This is the default mode.
  9806. @item U
  9807. Both capture and transfer unknown or varying.
  9808. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9809. @end table
  9810. @end table
  9811. @section pixdesctest
  9812. Pixel format descriptor test filter, mainly useful for internal
  9813. testing. The output video should be equal to the input video.
  9814. For example:
  9815. @example
  9816. format=monow, pixdesctest
  9817. @end example
  9818. can be used to test the monowhite pixel format descriptor definition.
  9819. @section pixscope
  9820. Display sample values of color channels. Mainly useful for checking color
  9821. and levels. Minimum supported resolution is 640x480.
  9822. The filters accept the following options:
  9823. @table @option
  9824. @item x
  9825. Set scope X position, relative offset on X axis.
  9826. @item y
  9827. Set scope Y position, relative offset on Y axis.
  9828. @item w
  9829. Set scope width.
  9830. @item h
  9831. Set scope height.
  9832. @item o
  9833. Set window opacity. This window also holds statistics about pixel area.
  9834. @item wx
  9835. Set window X position, relative offset on X axis.
  9836. @item wy
  9837. Set window Y position, relative offset on Y axis.
  9838. @end table
  9839. @section pp
  9840. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9841. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9842. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9843. Each subfilter and some options have a short and a long name that can be used
  9844. interchangeably, i.e. dr/dering are the same.
  9845. The filters accept the following options:
  9846. @table @option
  9847. @item subfilters
  9848. Set postprocessing subfilters string.
  9849. @end table
  9850. All subfilters share common options to determine their scope:
  9851. @table @option
  9852. @item a/autoq
  9853. Honor the quality commands for this subfilter.
  9854. @item c/chrom
  9855. Do chrominance filtering, too (default).
  9856. @item y/nochrom
  9857. Do luminance filtering only (no chrominance).
  9858. @item n/noluma
  9859. Do chrominance filtering only (no luminance).
  9860. @end table
  9861. These options can be appended after the subfilter name, separated by a '|'.
  9862. Available subfilters are:
  9863. @table @option
  9864. @item hb/hdeblock[|difference[|flatness]]
  9865. Horizontal deblocking filter
  9866. @table @option
  9867. @item difference
  9868. Difference factor where higher values mean more deblocking (default: @code{32}).
  9869. @item flatness
  9870. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9871. @end table
  9872. @item vb/vdeblock[|difference[|flatness]]
  9873. Vertical deblocking filter
  9874. @table @option
  9875. @item difference
  9876. Difference factor where higher values mean more deblocking (default: @code{32}).
  9877. @item flatness
  9878. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9879. @end table
  9880. @item ha/hadeblock[|difference[|flatness]]
  9881. Accurate horizontal deblocking filter
  9882. @table @option
  9883. @item difference
  9884. Difference factor where higher values mean more deblocking (default: @code{32}).
  9885. @item flatness
  9886. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9887. @end table
  9888. @item va/vadeblock[|difference[|flatness]]
  9889. Accurate vertical deblocking filter
  9890. @table @option
  9891. @item difference
  9892. Difference factor where higher values mean more deblocking (default: @code{32}).
  9893. @item flatness
  9894. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9895. @end table
  9896. @end table
  9897. The horizontal and vertical deblocking filters share the difference and
  9898. flatness values so you cannot set different horizontal and vertical
  9899. thresholds.
  9900. @table @option
  9901. @item h1/x1hdeblock
  9902. Experimental horizontal deblocking filter
  9903. @item v1/x1vdeblock
  9904. Experimental vertical deblocking filter
  9905. @item dr/dering
  9906. Deringing filter
  9907. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9908. @table @option
  9909. @item threshold1
  9910. larger -> stronger filtering
  9911. @item threshold2
  9912. larger -> stronger filtering
  9913. @item threshold3
  9914. larger -> stronger filtering
  9915. @end table
  9916. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9917. @table @option
  9918. @item f/fullyrange
  9919. Stretch luminance to @code{0-255}.
  9920. @end table
  9921. @item lb/linblenddeint
  9922. Linear blend deinterlacing filter that deinterlaces the given block by
  9923. filtering all lines with a @code{(1 2 1)} filter.
  9924. @item li/linipoldeint
  9925. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9926. linearly interpolating every second line.
  9927. @item ci/cubicipoldeint
  9928. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9929. cubically interpolating every second line.
  9930. @item md/mediandeint
  9931. Median deinterlacing filter that deinterlaces the given block by applying a
  9932. median filter to every second line.
  9933. @item fd/ffmpegdeint
  9934. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9935. second line with a @code{(-1 4 2 4 -1)} filter.
  9936. @item l5/lowpass5
  9937. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9938. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9939. @item fq/forceQuant[|quantizer]
  9940. Overrides the quantizer table from the input with the constant quantizer you
  9941. specify.
  9942. @table @option
  9943. @item quantizer
  9944. Quantizer to use
  9945. @end table
  9946. @item de/default
  9947. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9948. @item fa/fast
  9949. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9950. @item ac
  9951. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9952. @end table
  9953. @subsection Examples
  9954. @itemize
  9955. @item
  9956. Apply horizontal and vertical deblocking, deringing and automatic
  9957. brightness/contrast:
  9958. @example
  9959. pp=hb/vb/dr/al
  9960. @end example
  9961. @item
  9962. Apply default filters without brightness/contrast correction:
  9963. @example
  9964. pp=de/-al
  9965. @end example
  9966. @item
  9967. Apply default filters and temporal denoiser:
  9968. @example
  9969. pp=default/tmpnoise|1|2|3
  9970. @end example
  9971. @item
  9972. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9973. automatically depending on available CPU time:
  9974. @example
  9975. pp=hb|y/vb|a
  9976. @end example
  9977. @end itemize
  9978. @section pp7
  9979. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9980. similar to spp = 6 with 7 point DCT, where only the center sample is
  9981. used after IDCT.
  9982. The filter accepts the following options:
  9983. @table @option
  9984. @item qp
  9985. Force a constant quantization parameter. It accepts an integer in range
  9986. 0 to 63. If not set, the filter will use the QP from the video stream
  9987. (if available).
  9988. @item mode
  9989. Set thresholding mode. Available modes are:
  9990. @table @samp
  9991. @item hard
  9992. Set hard thresholding.
  9993. @item soft
  9994. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9995. @item medium
  9996. Set medium thresholding (good results, default).
  9997. @end table
  9998. @end table
  9999. @section premultiply
  10000. Apply alpha premultiply effect to input video stream using first plane
  10001. of second stream as alpha.
  10002. Both streams must have same dimensions and same pixel format.
  10003. The filter accepts the following option:
  10004. @table @option
  10005. @item planes
  10006. Set which planes will be processed, unprocessed planes will be copied.
  10007. By default value 0xf, all planes will be processed.
  10008. @item inplace
  10009. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10010. @end table
  10011. @section prewitt
  10012. Apply prewitt operator to input video stream.
  10013. The filter accepts the following option:
  10014. @table @option
  10015. @item planes
  10016. Set which planes will be processed, unprocessed planes will be copied.
  10017. By default value 0xf, all planes will be processed.
  10018. @item scale
  10019. Set value which will be multiplied with filtered result.
  10020. @item delta
  10021. Set value which will be added to filtered result.
  10022. @end table
  10023. @anchor{program_opencl}
  10024. @section program_opencl
  10025. Filter video using an OpenCL program.
  10026. @table @option
  10027. @item source
  10028. OpenCL program source file.
  10029. @item kernel
  10030. Kernel name in program.
  10031. @item inputs
  10032. Number of inputs to the filter. Defaults to 1.
  10033. @item size, s
  10034. Size of output frames. Defaults to the same as the first input.
  10035. @end table
  10036. The program source file must contain a kernel function with the given name,
  10037. which will be run once for each plane of the output. Each run on a plane
  10038. gets enqueued as a separate 2D global NDRange with one work-item for each
  10039. pixel to be generated. The global ID offset for each work-item is therefore
  10040. the coordinates of a pixel in the destination image.
  10041. The kernel function needs to take the following arguments:
  10042. @itemize
  10043. @item
  10044. Destination image, @var{__write_only image2d_t}.
  10045. This image will become the output; the kernel should write all of it.
  10046. @item
  10047. Frame index, @var{unsigned int}.
  10048. This is a counter starting from zero and increasing by one for each frame.
  10049. @item
  10050. Source images, @var{__read_only image2d_t}.
  10051. These are the most recent images on each input. The kernel may read from
  10052. them to generate the output, but they can't be written to.
  10053. @end itemize
  10054. Example programs:
  10055. @itemize
  10056. @item
  10057. Copy the input to the output (output must be the same size as the input).
  10058. @verbatim
  10059. __kernel void copy(__write_only image2d_t destination,
  10060. unsigned int index,
  10061. __read_only image2d_t source)
  10062. {
  10063. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10064. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10065. float4 value = read_imagef(source, sampler, location);
  10066. write_imagef(destination, location, value);
  10067. }
  10068. @end verbatim
  10069. @item
  10070. Apply a simple transformation, rotating the input by an amount increasing
  10071. with the index counter. Pixel values are linearly interpolated by the
  10072. sampler, and the output need not have the same dimensions as the input.
  10073. @verbatim
  10074. __kernel void rotate_image(__write_only image2d_t dst,
  10075. unsigned int index,
  10076. __read_only image2d_t src)
  10077. {
  10078. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10079. CLK_FILTER_LINEAR);
  10080. float angle = (float)index / 100.0f;
  10081. float2 dst_dim = convert_float2(get_image_dim(dst));
  10082. float2 src_dim = convert_float2(get_image_dim(src));
  10083. float2 dst_cen = dst_dim / 2.0f;
  10084. float2 src_cen = src_dim / 2.0f;
  10085. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10086. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10087. float2 src_pos = {
  10088. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10089. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10090. };
  10091. src_pos = src_pos * src_dim / dst_dim;
  10092. float2 src_loc = src_pos + src_cen;
  10093. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10094. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10095. write_imagef(dst, dst_loc, 0.5f);
  10096. else
  10097. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10098. }
  10099. @end verbatim
  10100. @item
  10101. Blend two inputs together, with the amount of each input used varying
  10102. with the index counter.
  10103. @verbatim
  10104. __kernel void blend_images(__write_only image2d_t dst,
  10105. unsigned int index,
  10106. __read_only image2d_t src1,
  10107. __read_only image2d_t src2)
  10108. {
  10109. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10110. CLK_FILTER_LINEAR);
  10111. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10112. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10113. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10114. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10115. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10116. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10117. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10118. }
  10119. @end verbatim
  10120. @end itemize
  10121. @section pseudocolor
  10122. Alter frame colors in video with pseudocolors.
  10123. This filter accept the following options:
  10124. @table @option
  10125. @item c0
  10126. set pixel first component expression
  10127. @item c1
  10128. set pixel second component expression
  10129. @item c2
  10130. set pixel third component expression
  10131. @item c3
  10132. set pixel fourth component expression, corresponds to the alpha component
  10133. @item i
  10134. set component to use as base for altering colors
  10135. @end table
  10136. Each of them specifies the expression to use for computing the lookup table for
  10137. the corresponding pixel component values.
  10138. The expressions can contain the following constants and functions:
  10139. @table @option
  10140. @item w
  10141. @item h
  10142. The input width and height.
  10143. @item val
  10144. The input value for the pixel component.
  10145. @item ymin, umin, vmin, amin
  10146. The minimum allowed component value.
  10147. @item ymax, umax, vmax, amax
  10148. The maximum allowed component value.
  10149. @end table
  10150. All expressions default to "val".
  10151. @subsection Examples
  10152. @itemize
  10153. @item
  10154. Change too high luma values to gradient:
  10155. @example
  10156. 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'"
  10157. @end example
  10158. @end itemize
  10159. @section psnr
  10160. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10161. Ratio) between two input videos.
  10162. This filter takes in input two input videos, the first input is
  10163. considered the "main" source and is passed unchanged to the
  10164. output. The second input is used as a "reference" video for computing
  10165. the PSNR.
  10166. Both video inputs must have the same resolution and pixel format for
  10167. this filter to work correctly. Also it assumes that both inputs
  10168. have the same number of frames, which are compared one by one.
  10169. The obtained average PSNR is printed through the logging system.
  10170. The filter stores the accumulated MSE (mean squared error) of each
  10171. frame, and at the end of the processing it is averaged across all frames
  10172. equally, and the following formula is applied to obtain the PSNR:
  10173. @example
  10174. PSNR = 10*log10(MAX^2/MSE)
  10175. @end example
  10176. Where MAX is the average of the maximum values of each component of the
  10177. image.
  10178. The description of the accepted parameters follows.
  10179. @table @option
  10180. @item stats_file, f
  10181. If specified the filter will use the named file to save the PSNR of
  10182. each individual frame. When filename equals "-" the data is sent to
  10183. standard output.
  10184. @item stats_version
  10185. Specifies which version of the stats file format to use. Details of
  10186. each format are written below.
  10187. Default value is 1.
  10188. @item stats_add_max
  10189. Determines whether the max value is output to the stats log.
  10190. Default value is 0.
  10191. Requires stats_version >= 2. If this is set and stats_version < 2,
  10192. the filter will return an error.
  10193. @end table
  10194. This filter also supports the @ref{framesync} options.
  10195. The file printed if @var{stats_file} is selected, contains a sequence of
  10196. key/value pairs of the form @var{key}:@var{value} for each compared
  10197. couple of frames.
  10198. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10199. the list of per-frame-pair stats, with key value pairs following the frame
  10200. format with the following parameters:
  10201. @table @option
  10202. @item psnr_log_version
  10203. The version of the log file format. Will match @var{stats_version}.
  10204. @item fields
  10205. A comma separated list of the per-frame-pair parameters included in
  10206. the log.
  10207. @end table
  10208. A description of each shown per-frame-pair parameter follows:
  10209. @table @option
  10210. @item n
  10211. sequential number of the input frame, starting from 1
  10212. @item mse_avg
  10213. Mean Square Error pixel-by-pixel average difference of the compared
  10214. frames, averaged over all the image components.
  10215. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10216. Mean Square Error pixel-by-pixel average difference of the compared
  10217. frames for the component specified by the suffix.
  10218. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10219. Peak Signal to Noise ratio of the compared frames for the component
  10220. specified by the suffix.
  10221. @item max_avg, max_y, max_u, max_v
  10222. Maximum allowed value for each channel, and average over all
  10223. channels.
  10224. @end table
  10225. For example:
  10226. @example
  10227. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10228. [main][ref] psnr="stats_file=stats.log" [out]
  10229. @end example
  10230. On this example the input file being processed is compared with the
  10231. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10232. is stored in @file{stats.log}.
  10233. @anchor{pullup}
  10234. @section pullup
  10235. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10236. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10237. content.
  10238. The pullup filter is designed to take advantage of future context in making
  10239. its decisions. This filter is stateless in the sense that it does not lock
  10240. onto a pattern to follow, but it instead looks forward to the following
  10241. fields in order to identify matches and rebuild progressive frames.
  10242. To produce content with an even framerate, insert the fps filter after
  10243. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10244. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10245. The filter accepts the following options:
  10246. @table @option
  10247. @item jl
  10248. @item jr
  10249. @item jt
  10250. @item jb
  10251. These options set the amount of "junk" to ignore at the left, right, top, and
  10252. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10253. while top and bottom are in units of 2 lines.
  10254. The default is 8 pixels on each side.
  10255. @item sb
  10256. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10257. filter generating an occasional mismatched frame, but it may also cause an
  10258. excessive number of frames to be dropped during high motion sequences.
  10259. Conversely, setting it to -1 will make filter match fields more easily.
  10260. This may help processing of video where there is slight blurring between
  10261. the fields, but may also cause there to be interlaced frames in the output.
  10262. Default value is @code{0}.
  10263. @item mp
  10264. Set the metric plane to use. It accepts the following values:
  10265. @table @samp
  10266. @item l
  10267. Use luma plane.
  10268. @item u
  10269. Use chroma blue plane.
  10270. @item v
  10271. Use chroma red plane.
  10272. @end table
  10273. This option may be set to use chroma plane instead of the default luma plane
  10274. for doing filter's computations. This may improve accuracy on very clean
  10275. source material, but more likely will decrease accuracy, especially if there
  10276. is chroma noise (rainbow effect) or any grayscale video.
  10277. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10278. load and make pullup usable in realtime on slow machines.
  10279. @end table
  10280. For best results (without duplicated frames in the output file) it is
  10281. necessary to change the output frame rate. For example, to inverse
  10282. telecine NTSC input:
  10283. @example
  10284. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10285. @end example
  10286. @section qp
  10287. Change video quantization parameters (QP).
  10288. The filter accepts the following option:
  10289. @table @option
  10290. @item qp
  10291. Set expression for quantization parameter.
  10292. @end table
  10293. The expression is evaluated through the eval API and can contain, among others,
  10294. the following constants:
  10295. @table @var
  10296. @item known
  10297. 1 if index is not 129, 0 otherwise.
  10298. @item qp
  10299. Sequential index starting from -129 to 128.
  10300. @end table
  10301. @subsection Examples
  10302. @itemize
  10303. @item
  10304. Some equation like:
  10305. @example
  10306. qp=2+2*sin(PI*qp)
  10307. @end example
  10308. @end itemize
  10309. @section random
  10310. Flush video frames from internal cache of frames into a random order.
  10311. No frame is discarded.
  10312. Inspired by @ref{frei0r} nervous filter.
  10313. @table @option
  10314. @item frames
  10315. Set size in number of frames of internal cache, in range from @code{2} to
  10316. @code{512}. Default is @code{30}.
  10317. @item seed
  10318. Set seed for random number generator, must be an integer included between
  10319. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10320. less than @code{0}, the filter will try to use a good random seed on a
  10321. best effort basis.
  10322. @end table
  10323. @section readeia608
  10324. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10325. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10326. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10327. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10328. @table @option
  10329. @item lavfi.readeia608.X.cc
  10330. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10331. @item lavfi.readeia608.X.line
  10332. The number of the line on which the EIA-608 data was identified and read.
  10333. @end table
  10334. This filter accepts the following options:
  10335. @table @option
  10336. @item scan_min
  10337. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10338. @item scan_max
  10339. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10340. @item mac
  10341. Set minimal acceptable amplitude change for sync codes detection.
  10342. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10343. @item spw
  10344. Set the ratio of width reserved for sync code detection.
  10345. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10346. @item mhd
  10347. Set the max peaks height difference for sync code detection.
  10348. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10349. @item mpd
  10350. Set max peaks period difference for sync code detection.
  10351. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10352. @item msd
  10353. Set the first two max start code bits differences.
  10354. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10355. @item bhd
  10356. Set the minimum ratio of bits height compared to 3rd start code bit.
  10357. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10358. @item th_w
  10359. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10360. @item th_b
  10361. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10362. @item chp
  10363. Enable checking the parity bit. In the event of a parity error, the filter will output
  10364. @code{0x00} for that character. Default is false.
  10365. @end table
  10366. @subsection Examples
  10367. @itemize
  10368. @item
  10369. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10370. @example
  10371. 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
  10372. @end example
  10373. @end itemize
  10374. @section readvitc
  10375. Read vertical interval timecode (VITC) information from the top lines of a
  10376. video frame.
  10377. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10378. timecode value, if a valid timecode has been detected. Further metadata key
  10379. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10380. timecode data has been found or not.
  10381. This filter accepts the following options:
  10382. @table @option
  10383. @item scan_max
  10384. Set the maximum number of lines to scan for VITC data. If the value is set to
  10385. @code{-1} the full video frame is scanned. Default is @code{45}.
  10386. @item thr_b
  10387. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10388. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10389. @item thr_w
  10390. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10391. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10392. @end table
  10393. @subsection Examples
  10394. @itemize
  10395. @item
  10396. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10397. draw @code{--:--:--:--} as a placeholder:
  10398. @example
  10399. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10400. @end example
  10401. @end itemize
  10402. @section remap
  10403. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10404. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10405. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10406. value for pixel will be used for destination pixel.
  10407. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10408. will have Xmap/Ymap video stream dimensions.
  10409. Xmap and Ymap input video streams are 16bit depth, single channel.
  10410. @section removegrain
  10411. The removegrain filter is a spatial denoiser for progressive video.
  10412. @table @option
  10413. @item m0
  10414. Set mode for the first plane.
  10415. @item m1
  10416. Set mode for the second plane.
  10417. @item m2
  10418. Set mode for the third plane.
  10419. @item m3
  10420. Set mode for the fourth plane.
  10421. @end table
  10422. Range of mode is from 0 to 24. Description of each mode follows:
  10423. @table @var
  10424. @item 0
  10425. Leave input plane unchanged. Default.
  10426. @item 1
  10427. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10428. @item 2
  10429. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10430. @item 3
  10431. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10432. @item 4
  10433. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10434. This is equivalent to a median filter.
  10435. @item 5
  10436. Line-sensitive clipping giving the minimal change.
  10437. @item 6
  10438. Line-sensitive clipping, intermediate.
  10439. @item 7
  10440. Line-sensitive clipping, intermediate.
  10441. @item 8
  10442. Line-sensitive clipping, intermediate.
  10443. @item 9
  10444. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10445. @item 10
  10446. Replaces the target pixel with the closest neighbour.
  10447. @item 11
  10448. [1 2 1] horizontal and vertical kernel blur.
  10449. @item 12
  10450. Same as mode 11.
  10451. @item 13
  10452. Bob mode, interpolates top field from the line where the neighbours
  10453. pixels are the closest.
  10454. @item 14
  10455. Bob mode, interpolates bottom field from the line where the neighbours
  10456. pixels are the closest.
  10457. @item 15
  10458. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10459. interpolation formula.
  10460. @item 16
  10461. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10462. interpolation formula.
  10463. @item 17
  10464. Clips the pixel with the minimum and maximum of respectively the maximum and
  10465. minimum of each pair of opposite neighbour pixels.
  10466. @item 18
  10467. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10468. the current pixel is minimal.
  10469. @item 19
  10470. Replaces the pixel with the average of its 8 neighbours.
  10471. @item 20
  10472. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10473. @item 21
  10474. Clips pixels using the averages of opposite neighbour.
  10475. @item 22
  10476. Same as mode 21 but simpler and faster.
  10477. @item 23
  10478. Small edge and halo removal, but reputed useless.
  10479. @item 24
  10480. Similar as 23.
  10481. @end table
  10482. @section removelogo
  10483. Suppress a TV station logo, using an image file to determine which
  10484. pixels comprise the logo. It works by filling in the pixels that
  10485. comprise the logo with neighboring pixels.
  10486. The filter accepts the following options:
  10487. @table @option
  10488. @item filename, f
  10489. Set the filter bitmap file, which can be any image format supported by
  10490. libavformat. The width and height of the image file must match those of the
  10491. video stream being processed.
  10492. @end table
  10493. Pixels in the provided bitmap image with a value of zero are not
  10494. considered part of the logo, non-zero pixels are considered part of
  10495. the logo. If you use white (255) for the logo and black (0) for the
  10496. rest, you will be safe. For making the filter bitmap, it is
  10497. recommended to take a screen capture of a black frame with the logo
  10498. visible, and then using a threshold filter followed by the erode
  10499. filter once or twice.
  10500. If needed, little splotches can be fixed manually. Remember that if
  10501. logo pixels are not covered, the filter quality will be much
  10502. reduced. Marking too many pixels as part of the logo does not hurt as
  10503. much, but it will increase the amount of blurring needed to cover over
  10504. the image and will destroy more information than necessary, and extra
  10505. pixels will slow things down on a large logo.
  10506. @section repeatfields
  10507. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10508. fields based on its value.
  10509. @section reverse
  10510. Reverse a video clip.
  10511. Warning: This filter requires memory to buffer the entire clip, so trimming
  10512. is suggested.
  10513. @subsection Examples
  10514. @itemize
  10515. @item
  10516. Take the first 5 seconds of a clip, and reverse it.
  10517. @example
  10518. trim=end=5,reverse
  10519. @end example
  10520. @end itemize
  10521. @section roberts
  10522. Apply roberts cross operator to input video stream.
  10523. The filter accepts the following option:
  10524. @table @option
  10525. @item planes
  10526. Set which planes will be processed, unprocessed planes will be copied.
  10527. By default value 0xf, all planes will be processed.
  10528. @item scale
  10529. Set value which will be multiplied with filtered result.
  10530. @item delta
  10531. Set value which will be added to filtered result.
  10532. @end table
  10533. @section rotate
  10534. Rotate video by an arbitrary angle expressed in radians.
  10535. The filter accepts the following options:
  10536. A description of the optional parameters follows.
  10537. @table @option
  10538. @item angle, a
  10539. Set an expression for the angle by which to rotate the input video
  10540. clockwise, expressed as a number of radians. A negative value will
  10541. result in a counter-clockwise rotation. By default it is set to "0".
  10542. This expression is evaluated for each frame.
  10543. @item out_w, ow
  10544. Set the output width expression, default value is "iw".
  10545. This expression is evaluated just once during configuration.
  10546. @item out_h, oh
  10547. Set the output height expression, default value is "ih".
  10548. This expression is evaluated just once during configuration.
  10549. @item bilinear
  10550. Enable bilinear interpolation if set to 1, a value of 0 disables
  10551. it. Default value is 1.
  10552. @item fillcolor, c
  10553. Set the color used to fill the output area not covered by the rotated
  10554. image. For the general syntax of this option, check the
  10555. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10556. If the special value "none" is selected then no
  10557. background is printed (useful for example if the background is never shown).
  10558. Default value is "black".
  10559. @end table
  10560. The expressions for the angle and the output size can contain the
  10561. following constants and functions:
  10562. @table @option
  10563. @item n
  10564. sequential number of the input frame, starting from 0. It is always NAN
  10565. before the first frame is filtered.
  10566. @item t
  10567. time in seconds of the input frame, it is set to 0 when the filter is
  10568. configured. It is always NAN before the first frame is filtered.
  10569. @item hsub
  10570. @item vsub
  10571. horizontal and vertical chroma subsample values. For example for the
  10572. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10573. @item in_w, iw
  10574. @item in_h, ih
  10575. the input video width and height
  10576. @item out_w, ow
  10577. @item out_h, oh
  10578. the output width and height, that is the size of the padded area as
  10579. specified by the @var{width} and @var{height} expressions
  10580. @item rotw(a)
  10581. @item roth(a)
  10582. the minimal width/height required for completely containing the input
  10583. video rotated by @var{a} radians.
  10584. These are only available when computing the @option{out_w} and
  10585. @option{out_h} expressions.
  10586. @end table
  10587. @subsection Examples
  10588. @itemize
  10589. @item
  10590. Rotate the input by PI/6 radians clockwise:
  10591. @example
  10592. rotate=PI/6
  10593. @end example
  10594. @item
  10595. Rotate the input by PI/6 radians counter-clockwise:
  10596. @example
  10597. rotate=-PI/6
  10598. @end example
  10599. @item
  10600. Rotate the input by 45 degrees clockwise:
  10601. @example
  10602. rotate=45*PI/180
  10603. @end example
  10604. @item
  10605. Apply a constant rotation with period T, starting from an angle of PI/3:
  10606. @example
  10607. rotate=PI/3+2*PI*t/T
  10608. @end example
  10609. @item
  10610. Make the input video rotation oscillating with a period of T
  10611. seconds and an amplitude of A radians:
  10612. @example
  10613. rotate=A*sin(2*PI/T*t)
  10614. @end example
  10615. @item
  10616. Rotate the video, output size is chosen so that the whole rotating
  10617. input video is always completely contained in the output:
  10618. @example
  10619. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10620. @end example
  10621. @item
  10622. Rotate the video, reduce the output size so that no background is ever
  10623. shown:
  10624. @example
  10625. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10626. @end example
  10627. @end itemize
  10628. @subsection Commands
  10629. The filter supports the following commands:
  10630. @table @option
  10631. @item a, angle
  10632. Set the angle expression.
  10633. The command accepts the same syntax of the corresponding option.
  10634. If the specified expression is not valid, it is kept at its current
  10635. value.
  10636. @end table
  10637. @section sab
  10638. Apply Shape Adaptive Blur.
  10639. The filter accepts the following options:
  10640. @table @option
  10641. @item luma_radius, lr
  10642. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10643. value is 1.0. A greater value will result in a more blurred image, and
  10644. in slower processing.
  10645. @item luma_pre_filter_radius, lpfr
  10646. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10647. value is 1.0.
  10648. @item luma_strength, ls
  10649. Set luma maximum difference between pixels to still be considered, must
  10650. be a value in the 0.1-100.0 range, default value is 1.0.
  10651. @item chroma_radius, cr
  10652. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10653. greater value will result in a more blurred image, and in slower
  10654. processing.
  10655. @item chroma_pre_filter_radius, cpfr
  10656. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10657. @item chroma_strength, cs
  10658. Set chroma maximum difference between pixels to still be considered,
  10659. must be a value in the -0.9-100.0 range.
  10660. @end table
  10661. Each chroma option value, if not explicitly specified, is set to the
  10662. corresponding luma option value.
  10663. @anchor{scale}
  10664. @section scale
  10665. Scale (resize) the input video, using the libswscale library.
  10666. The scale filter forces the output display aspect ratio to be the same
  10667. of the input, by changing the output sample aspect ratio.
  10668. If the input image format is different from the format requested by
  10669. the next filter, the scale filter will convert the input to the
  10670. requested format.
  10671. @subsection Options
  10672. The filter accepts the following options, or any of the options
  10673. supported by the libswscale scaler.
  10674. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10675. the complete list of scaler options.
  10676. @table @option
  10677. @item width, w
  10678. @item height, h
  10679. Set the output video dimension expression. Default value is the input
  10680. dimension.
  10681. If the @var{width} or @var{w} value is 0, the input width is used for
  10682. the output. If the @var{height} or @var{h} value is 0, the input height
  10683. is used for the output.
  10684. If one and only one of the values is -n with n >= 1, the scale filter
  10685. will use a value that maintains the aspect ratio of the input image,
  10686. calculated from the other specified dimension. After that it will,
  10687. however, make sure that the calculated dimension is divisible by n and
  10688. adjust the value if necessary.
  10689. If both values are -n with n >= 1, the behavior will be identical to
  10690. both values being set to 0 as previously detailed.
  10691. See below for the list of accepted constants for use in the dimension
  10692. expression.
  10693. @item eval
  10694. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10695. @table @samp
  10696. @item init
  10697. Only evaluate expressions once during the filter initialization or when a command is processed.
  10698. @item frame
  10699. Evaluate expressions for each incoming frame.
  10700. @end table
  10701. Default value is @samp{init}.
  10702. @item interl
  10703. Set the interlacing mode. It accepts the following values:
  10704. @table @samp
  10705. @item 1
  10706. Force interlaced aware scaling.
  10707. @item 0
  10708. Do not apply interlaced scaling.
  10709. @item -1
  10710. Select interlaced aware scaling depending on whether the source frames
  10711. are flagged as interlaced or not.
  10712. @end table
  10713. Default value is @samp{0}.
  10714. @item flags
  10715. Set libswscale scaling flags. See
  10716. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10717. complete list of values. If not explicitly specified the filter applies
  10718. the default flags.
  10719. @item param0, param1
  10720. Set libswscale input parameters for scaling algorithms that need them. See
  10721. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10722. complete documentation. If not explicitly specified the filter applies
  10723. empty parameters.
  10724. @item size, s
  10725. Set the video size. For the syntax of this option, check the
  10726. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10727. @item in_color_matrix
  10728. @item out_color_matrix
  10729. Set in/output YCbCr color space type.
  10730. This allows the autodetected value to be overridden as well as allows forcing
  10731. a specific value used for the output and encoder.
  10732. If not specified, the color space type depends on the pixel format.
  10733. Possible values:
  10734. @table @samp
  10735. @item auto
  10736. Choose automatically.
  10737. @item bt709
  10738. Format conforming to International Telecommunication Union (ITU)
  10739. Recommendation BT.709.
  10740. @item fcc
  10741. Set color space conforming to the United States Federal Communications
  10742. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10743. @item bt601
  10744. Set color space conforming to:
  10745. @itemize
  10746. @item
  10747. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10748. @item
  10749. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10750. @item
  10751. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10752. @end itemize
  10753. @item smpte240m
  10754. Set color space conforming to SMPTE ST 240:1999.
  10755. @end table
  10756. @item in_range
  10757. @item out_range
  10758. Set in/output YCbCr sample range.
  10759. This allows the autodetected value to be overridden as well as allows forcing
  10760. a specific value used for the output and encoder. If not specified, the
  10761. range depends on the pixel format. Possible values:
  10762. @table @samp
  10763. @item auto/unknown
  10764. Choose automatically.
  10765. @item jpeg/full/pc
  10766. Set full range (0-255 in case of 8-bit luma).
  10767. @item mpeg/limited/tv
  10768. Set "MPEG" range (16-235 in case of 8-bit luma).
  10769. @end table
  10770. @item force_original_aspect_ratio
  10771. Enable decreasing or increasing output video width or height if necessary to
  10772. keep the original aspect ratio. Possible values:
  10773. @table @samp
  10774. @item disable
  10775. Scale the video as specified and disable this feature.
  10776. @item decrease
  10777. The output video dimensions will automatically be decreased if needed.
  10778. @item increase
  10779. The output video dimensions will automatically be increased if needed.
  10780. @end table
  10781. One useful instance of this option is that when you know a specific device's
  10782. maximum allowed resolution, you can use this to limit the output video to
  10783. that, while retaining the aspect ratio. For example, device A allows
  10784. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10785. decrease) and specifying 1280x720 to the command line makes the output
  10786. 1280x533.
  10787. Please note that this is a different thing than specifying -1 for @option{w}
  10788. or @option{h}, you still need to specify the output resolution for this option
  10789. to work.
  10790. @end table
  10791. The values of the @option{w} and @option{h} options are expressions
  10792. containing the following constants:
  10793. @table @var
  10794. @item in_w
  10795. @item in_h
  10796. The input width and height
  10797. @item iw
  10798. @item ih
  10799. These are the same as @var{in_w} and @var{in_h}.
  10800. @item out_w
  10801. @item out_h
  10802. The output (scaled) width and height
  10803. @item ow
  10804. @item oh
  10805. These are the same as @var{out_w} and @var{out_h}
  10806. @item a
  10807. The same as @var{iw} / @var{ih}
  10808. @item sar
  10809. input sample aspect ratio
  10810. @item dar
  10811. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10812. @item hsub
  10813. @item vsub
  10814. horizontal and vertical input chroma subsample values. For example for the
  10815. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10816. @item ohsub
  10817. @item ovsub
  10818. horizontal and vertical output chroma subsample values. For example for the
  10819. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10820. @end table
  10821. @subsection Examples
  10822. @itemize
  10823. @item
  10824. Scale the input video to a size of 200x100
  10825. @example
  10826. scale=w=200:h=100
  10827. @end example
  10828. This is equivalent to:
  10829. @example
  10830. scale=200:100
  10831. @end example
  10832. or:
  10833. @example
  10834. scale=200x100
  10835. @end example
  10836. @item
  10837. Specify a size abbreviation for the output size:
  10838. @example
  10839. scale=qcif
  10840. @end example
  10841. which can also be written as:
  10842. @example
  10843. scale=size=qcif
  10844. @end example
  10845. @item
  10846. Scale the input to 2x:
  10847. @example
  10848. scale=w=2*iw:h=2*ih
  10849. @end example
  10850. @item
  10851. The above is the same as:
  10852. @example
  10853. scale=2*in_w:2*in_h
  10854. @end example
  10855. @item
  10856. Scale the input to 2x with forced interlaced scaling:
  10857. @example
  10858. scale=2*iw:2*ih:interl=1
  10859. @end example
  10860. @item
  10861. Scale the input to half size:
  10862. @example
  10863. scale=w=iw/2:h=ih/2
  10864. @end example
  10865. @item
  10866. Increase the width, and set the height to the same size:
  10867. @example
  10868. scale=3/2*iw:ow
  10869. @end example
  10870. @item
  10871. Seek Greek harmony:
  10872. @example
  10873. scale=iw:1/PHI*iw
  10874. scale=ih*PHI:ih
  10875. @end example
  10876. @item
  10877. Increase the height, and set the width to 3/2 of the height:
  10878. @example
  10879. scale=w=3/2*oh:h=3/5*ih
  10880. @end example
  10881. @item
  10882. Increase the size, making the size a multiple of the chroma
  10883. subsample values:
  10884. @example
  10885. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10886. @end example
  10887. @item
  10888. Increase the width to a maximum of 500 pixels,
  10889. keeping the same aspect ratio as the input:
  10890. @example
  10891. scale=w='min(500\, iw*3/2):h=-1'
  10892. @end example
  10893. @item
  10894. Make pixels square by combining scale and setsar:
  10895. @example
  10896. scale='trunc(ih*dar):ih',setsar=1/1
  10897. @end example
  10898. @item
  10899. Make pixels square by combining scale and setsar,
  10900. making sure the resulting resolution is even (required by some codecs):
  10901. @example
  10902. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  10903. @end example
  10904. @end itemize
  10905. @subsection Commands
  10906. This filter supports the following commands:
  10907. @table @option
  10908. @item width, w
  10909. @item height, h
  10910. Set the output video dimension expression.
  10911. The command accepts the same syntax of the corresponding option.
  10912. If the specified expression is not valid, it is kept at its current
  10913. value.
  10914. @end table
  10915. @section scale_npp
  10916. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10917. format conversion on CUDA video frames. Setting the output width and height
  10918. works in the same way as for the @var{scale} filter.
  10919. The following additional options are accepted:
  10920. @table @option
  10921. @item format
  10922. The pixel format of the output CUDA frames. If set to the string "same" (the
  10923. default), the input format will be kept. Note that automatic format negotiation
  10924. and conversion is not yet supported for hardware frames
  10925. @item interp_algo
  10926. The interpolation algorithm used for resizing. One of the following:
  10927. @table @option
  10928. @item nn
  10929. Nearest neighbour.
  10930. @item linear
  10931. @item cubic
  10932. @item cubic2p_bspline
  10933. 2-parameter cubic (B=1, C=0)
  10934. @item cubic2p_catmullrom
  10935. 2-parameter cubic (B=0, C=1/2)
  10936. @item cubic2p_b05c03
  10937. 2-parameter cubic (B=1/2, C=3/10)
  10938. @item super
  10939. Supersampling
  10940. @item lanczos
  10941. @end table
  10942. @end table
  10943. @section scale2ref
  10944. Scale (resize) the input video, based on a reference video.
  10945. See the scale filter for available options, scale2ref supports the same but
  10946. uses the reference video instead of the main input as basis. scale2ref also
  10947. supports the following additional constants for the @option{w} and
  10948. @option{h} options:
  10949. @table @var
  10950. @item main_w
  10951. @item main_h
  10952. The main input video's width and height
  10953. @item main_a
  10954. The same as @var{main_w} / @var{main_h}
  10955. @item main_sar
  10956. The main input video's sample aspect ratio
  10957. @item main_dar, mdar
  10958. The main input video's display aspect ratio. Calculated from
  10959. @code{(main_w / main_h) * main_sar}.
  10960. @item main_hsub
  10961. @item main_vsub
  10962. The main input video's horizontal and vertical chroma subsample values.
  10963. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10964. is 1.
  10965. @end table
  10966. @subsection Examples
  10967. @itemize
  10968. @item
  10969. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10970. @example
  10971. 'scale2ref[b][a];[a][b]overlay'
  10972. @end example
  10973. @end itemize
  10974. @anchor{selectivecolor}
  10975. @section selectivecolor
  10976. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10977. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10978. by the "purity" of the color (that is, how saturated it already is).
  10979. This filter is similar to the Adobe Photoshop Selective Color tool.
  10980. The filter accepts the following options:
  10981. @table @option
  10982. @item correction_method
  10983. Select color correction method.
  10984. Available values are:
  10985. @table @samp
  10986. @item absolute
  10987. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10988. component value).
  10989. @item relative
  10990. Specified adjustments are relative to the original component value.
  10991. @end table
  10992. Default is @code{absolute}.
  10993. @item reds
  10994. Adjustments for red pixels (pixels where the red component is the maximum)
  10995. @item yellows
  10996. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10997. @item greens
  10998. Adjustments for green pixels (pixels where the green component is the maximum)
  10999. @item cyans
  11000. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11001. @item blues
  11002. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11003. @item magentas
  11004. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11005. @item whites
  11006. Adjustments for white pixels (pixels where all components are greater than 128)
  11007. @item neutrals
  11008. Adjustments for all pixels except pure black and pure white
  11009. @item blacks
  11010. Adjustments for black pixels (pixels where all components are lesser than 128)
  11011. @item psfile
  11012. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11013. @end table
  11014. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11015. 4 space separated floating point adjustment values in the [-1,1] range,
  11016. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11017. pixels of its range.
  11018. @subsection Examples
  11019. @itemize
  11020. @item
  11021. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11022. increase magenta by 27% in blue areas:
  11023. @example
  11024. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11025. @end example
  11026. @item
  11027. Use a Photoshop selective color preset:
  11028. @example
  11029. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11030. @end example
  11031. @end itemize
  11032. @anchor{separatefields}
  11033. @section separatefields
  11034. The @code{separatefields} takes a frame-based video input and splits
  11035. each frame into its components fields, producing a new half height clip
  11036. with twice the frame rate and twice the frame count.
  11037. This filter use field-dominance information in frame to decide which
  11038. of each pair of fields to place first in the output.
  11039. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11040. @section setdar, setsar
  11041. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11042. output video.
  11043. This is done by changing the specified Sample (aka Pixel) Aspect
  11044. Ratio, according to the following equation:
  11045. @example
  11046. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11047. @end example
  11048. Keep in mind that the @code{setdar} filter does not modify the pixel
  11049. dimensions of the video frame. Also, the display aspect ratio set by
  11050. this filter may be changed by later filters in the filterchain,
  11051. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11052. applied.
  11053. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11054. the filter output video.
  11055. Note that as a consequence of the application of this filter, the
  11056. output display aspect ratio will change according to the equation
  11057. above.
  11058. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11059. filter may be changed by later filters in the filterchain, e.g. if
  11060. another "setsar" or a "setdar" filter is applied.
  11061. It accepts the following parameters:
  11062. @table @option
  11063. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11064. Set the aspect ratio used by the filter.
  11065. The parameter can be a floating point number string, an expression, or
  11066. a string of the form @var{num}:@var{den}, where @var{num} and
  11067. @var{den} are the numerator and denominator of the aspect ratio. If
  11068. the parameter is not specified, it is assumed the value "0".
  11069. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11070. should be escaped.
  11071. @item max
  11072. Set the maximum integer value to use for expressing numerator and
  11073. denominator when reducing the expressed aspect ratio to a rational.
  11074. Default value is @code{100}.
  11075. @end table
  11076. The parameter @var{sar} is an expression containing
  11077. the following constants:
  11078. @table @option
  11079. @item E, PI, PHI
  11080. These are approximated values for the mathematical constants e
  11081. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11082. @item w, h
  11083. The input width and height.
  11084. @item a
  11085. These are the same as @var{w} / @var{h}.
  11086. @item sar
  11087. The input sample aspect ratio.
  11088. @item dar
  11089. The input display aspect ratio. It is the same as
  11090. (@var{w} / @var{h}) * @var{sar}.
  11091. @item hsub, vsub
  11092. Horizontal and vertical chroma subsample values. For example, for the
  11093. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11094. @end table
  11095. @subsection Examples
  11096. @itemize
  11097. @item
  11098. To change the display aspect ratio to 16:9, specify one of the following:
  11099. @example
  11100. setdar=dar=1.77777
  11101. setdar=dar=16/9
  11102. @end example
  11103. @item
  11104. To change the sample aspect ratio to 10:11, specify:
  11105. @example
  11106. setsar=sar=10/11
  11107. @end example
  11108. @item
  11109. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11110. 1000 in the aspect ratio reduction, use the command:
  11111. @example
  11112. setdar=ratio=16/9:max=1000
  11113. @end example
  11114. @end itemize
  11115. @anchor{setfield}
  11116. @section setfield
  11117. Force field for the output video frame.
  11118. The @code{setfield} filter marks the interlace type field for the
  11119. output frames. It does not change the input frame, but only sets the
  11120. corresponding property, which affects how the frame is treated by
  11121. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11122. The filter accepts the following options:
  11123. @table @option
  11124. @item mode
  11125. Available values are:
  11126. @table @samp
  11127. @item auto
  11128. Keep the same field property.
  11129. @item bff
  11130. Mark the frame as bottom-field-first.
  11131. @item tff
  11132. Mark the frame as top-field-first.
  11133. @item prog
  11134. Mark the frame as progressive.
  11135. @end table
  11136. @end table
  11137. @section showinfo
  11138. Show a line containing various information for each input video frame.
  11139. The input video is not modified.
  11140. The shown line contains a sequence of key/value pairs of the form
  11141. @var{key}:@var{value}.
  11142. The following values are shown in the output:
  11143. @table @option
  11144. @item n
  11145. The (sequential) number of the input frame, starting from 0.
  11146. @item pts
  11147. The Presentation TimeStamp of the input frame, expressed as a number of
  11148. time base units. The time base unit depends on the filter input pad.
  11149. @item pts_time
  11150. The Presentation TimeStamp of the input frame, expressed as a number of
  11151. seconds.
  11152. @item pos
  11153. The position of the frame in the input stream, or -1 if this information is
  11154. unavailable and/or meaningless (for example in case of synthetic video).
  11155. @item fmt
  11156. The pixel format name.
  11157. @item sar
  11158. The sample aspect ratio of the input frame, expressed in the form
  11159. @var{num}/@var{den}.
  11160. @item s
  11161. The size of the input frame. For the syntax of this option, check the
  11162. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11163. @item i
  11164. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  11165. for bottom field first).
  11166. @item iskey
  11167. This is 1 if the frame is a key frame, 0 otherwise.
  11168. @item type
  11169. The picture type of the input frame ("I" for an I-frame, "P" for a
  11170. P-frame, "B" for a B-frame, or "?" for an unknown type).
  11171. Also refer to the documentation of the @code{AVPictureType} enum and of
  11172. the @code{av_get_picture_type_char} function defined in
  11173. @file{libavutil/avutil.h}.
  11174. @item checksum
  11175. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  11176. @item plane_checksum
  11177. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  11178. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  11179. @end table
  11180. @section showpalette
  11181. Displays the 256 colors palette of each frame. This filter is only relevant for
  11182. @var{pal8} pixel format frames.
  11183. It accepts the following option:
  11184. @table @option
  11185. @item s
  11186. Set the size of the box used to represent one palette color entry. Default is
  11187. @code{30} (for a @code{30x30} pixel box).
  11188. @end table
  11189. @section shuffleframes
  11190. Reorder and/or duplicate and/or drop video frames.
  11191. It accepts the following parameters:
  11192. @table @option
  11193. @item mapping
  11194. Set the destination indexes of input frames.
  11195. This is space or '|' separated list of indexes that maps input frames to output
  11196. frames. Number of indexes also sets maximal value that each index may have.
  11197. '-1' index have special meaning and that is to drop frame.
  11198. @end table
  11199. The first frame has the index 0. The default is to keep the input unchanged.
  11200. @subsection Examples
  11201. @itemize
  11202. @item
  11203. Swap second and third frame of every three frames of the input:
  11204. @example
  11205. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  11206. @end example
  11207. @item
  11208. Swap 10th and 1st frame of every ten frames of the input:
  11209. @example
  11210. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  11211. @end example
  11212. @end itemize
  11213. @section shuffleplanes
  11214. Reorder and/or duplicate video planes.
  11215. It accepts the following parameters:
  11216. @table @option
  11217. @item map0
  11218. The index of the input plane to be used as the first output plane.
  11219. @item map1
  11220. The index of the input plane to be used as the second output plane.
  11221. @item map2
  11222. The index of the input plane to be used as the third output plane.
  11223. @item map3
  11224. The index of the input plane to be used as the fourth output plane.
  11225. @end table
  11226. The first plane has the index 0. The default is to keep the input unchanged.
  11227. @subsection Examples
  11228. @itemize
  11229. @item
  11230. Swap the second and third planes of the input:
  11231. @example
  11232. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  11233. @end example
  11234. @end itemize
  11235. @anchor{signalstats}
  11236. @section signalstats
  11237. Evaluate various visual metrics that assist in determining issues associated
  11238. with the digitization of analog video media.
  11239. By default the filter will log these metadata values:
  11240. @table @option
  11241. @item YMIN
  11242. Display the minimal Y value contained within the input frame. Expressed in
  11243. range of [0-255].
  11244. @item YLOW
  11245. Display the Y value at the 10% percentile within the input frame. Expressed in
  11246. range of [0-255].
  11247. @item YAVG
  11248. Display the average Y value within the input frame. Expressed in range of
  11249. [0-255].
  11250. @item YHIGH
  11251. Display the Y value at the 90% percentile within the input frame. Expressed in
  11252. range of [0-255].
  11253. @item YMAX
  11254. Display the maximum Y value contained within the input frame. Expressed in
  11255. range of [0-255].
  11256. @item UMIN
  11257. Display the minimal U value contained within the input frame. Expressed in
  11258. range of [0-255].
  11259. @item ULOW
  11260. Display the U value at the 10% percentile within the input frame. Expressed in
  11261. range of [0-255].
  11262. @item UAVG
  11263. Display the average U value within the input frame. Expressed in range of
  11264. [0-255].
  11265. @item UHIGH
  11266. Display the U value at the 90% percentile within the input frame. Expressed in
  11267. range of [0-255].
  11268. @item UMAX
  11269. Display the maximum U value contained within the input frame. Expressed in
  11270. range of [0-255].
  11271. @item VMIN
  11272. Display the minimal V value contained within the input frame. Expressed in
  11273. range of [0-255].
  11274. @item VLOW
  11275. Display the V value at the 10% percentile within the input frame. Expressed in
  11276. range of [0-255].
  11277. @item VAVG
  11278. Display the average V value within the input frame. Expressed in range of
  11279. [0-255].
  11280. @item VHIGH
  11281. Display the V value at the 90% percentile within the input frame. Expressed in
  11282. range of [0-255].
  11283. @item VMAX
  11284. Display the maximum V value contained within the input frame. Expressed in
  11285. range of [0-255].
  11286. @item SATMIN
  11287. Display the minimal saturation value contained within the input frame.
  11288. Expressed in range of [0-~181.02].
  11289. @item SATLOW
  11290. Display the saturation value at the 10% percentile within the input frame.
  11291. Expressed in range of [0-~181.02].
  11292. @item SATAVG
  11293. Display the average saturation value within the input frame. Expressed in range
  11294. of [0-~181.02].
  11295. @item SATHIGH
  11296. Display the saturation value at the 90% percentile within the input frame.
  11297. Expressed in range of [0-~181.02].
  11298. @item SATMAX
  11299. Display the maximum saturation value contained within the input frame.
  11300. Expressed in range of [0-~181.02].
  11301. @item HUEMED
  11302. Display the median value for hue within the input frame. Expressed in range of
  11303. [0-360].
  11304. @item HUEAVG
  11305. Display the average value for hue within the input frame. Expressed in range of
  11306. [0-360].
  11307. @item YDIF
  11308. Display the average of sample value difference between all values of the Y
  11309. plane in the current frame and corresponding values of the previous input frame.
  11310. Expressed in range of [0-255].
  11311. @item UDIF
  11312. Display the average of sample value difference between all values of the U
  11313. plane in the current frame and corresponding values of the previous input frame.
  11314. Expressed in range of [0-255].
  11315. @item VDIF
  11316. Display the average of sample value difference between all values of the V
  11317. plane in the current frame and corresponding values of the previous input frame.
  11318. Expressed in range of [0-255].
  11319. @item YBITDEPTH
  11320. Display bit depth of Y plane in current frame.
  11321. Expressed in range of [0-16].
  11322. @item UBITDEPTH
  11323. Display bit depth of U plane in current frame.
  11324. Expressed in range of [0-16].
  11325. @item VBITDEPTH
  11326. Display bit depth of V plane in current frame.
  11327. Expressed in range of [0-16].
  11328. @end table
  11329. The filter accepts the following options:
  11330. @table @option
  11331. @item stat
  11332. @item out
  11333. @option{stat} specify an additional form of image analysis.
  11334. @option{out} output video with the specified type of pixel highlighted.
  11335. Both options accept the following values:
  11336. @table @samp
  11337. @item tout
  11338. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  11339. unlike the neighboring pixels of the same field. Examples of temporal outliers
  11340. include the results of video dropouts, head clogs, or tape tracking issues.
  11341. @item vrep
  11342. Identify @var{vertical line repetition}. Vertical line repetition includes
  11343. similar rows of pixels within a frame. In born-digital video vertical line
  11344. repetition is common, but this pattern is uncommon in video digitized from an
  11345. analog source. When it occurs in video that results from the digitization of an
  11346. analog source it can indicate concealment from a dropout compensator.
  11347. @item brng
  11348. Identify pixels that fall outside of legal broadcast range.
  11349. @end table
  11350. @item color, c
  11351. Set the highlight color for the @option{out} option. The default color is
  11352. yellow.
  11353. @end table
  11354. @subsection Examples
  11355. @itemize
  11356. @item
  11357. Output data of various video metrics:
  11358. @example
  11359. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11360. @end example
  11361. @item
  11362. Output specific data about the minimum and maximum values of the Y plane per frame:
  11363. @example
  11364. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11365. @end example
  11366. @item
  11367. Playback video while highlighting pixels that are outside of broadcast range in red.
  11368. @example
  11369. ffplay example.mov -vf signalstats="out=brng:color=red"
  11370. @end example
  11371. @item
  11372. Playback video with signalstats metadata drawn over the frame.
  11373. @example
  11374. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11375. @end example
  11376. The contents of signalstat_drawtext.txt used in the command are:
  11377. @example
  11378. time %@{pts:hms@}
  11379. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11380. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11381. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11382. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11383. @end example
  11384. @end itemize
  11385. @anchor{signature}
  11386. @section signature
  11387. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11388. input. In this case the matching between the inputs can be calculated additionally.
  11389. The filter always passes through the first input. The signature of each stream can
  11390. be written into a file.
  11391. It accepts the following options:
  11392. @table @option
  11393. @item detectmode
  11394. Enable or disable the matching process.
  11395. Available values are:
  11396. @table @samp
  11397. @item off
  11398. Disable the calculation of a matching (default).
  11399. @item full
  11400. Calculate the matching for the whole video and output whether the whole video
  11401. matches or only parts.
  11402. @item fast
  11403. Calculate only until a matching is found or the video ends. Should be faster in
  11404. some cases.
  11405. @end table
  11406. @item nb_inputs
  11407. Set the number of inputs. The option value must be a non negative integer.
  11408. Default value is 1.
  11409. @item filename
  11410. Set the path to which the output is written. If there is more than one input,
  11411. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11412. integer), that will be replaced with the input number. If no filename is
  11413. specified, no output will be written. This is the default.
  11414. @item format
  11415. Choose the output format.
  11416. Available values are:
  11417. @table @samp
  11418. @item binary
  11419. Use the specified binary representation (default).
  11420. @item xml
  11421. Use the specified xml representation.
  11422. @end table
  11423. @item th_d
  11424. Set threshold to detect one word as similar. The option value must be an integer
  11425. greater than zero. The default value is 9000.
  11426. @item th_dc
  11427. Set threshold to detect all words as similar. The option value must be an integer
  11428. greater than zero. The default value is 60000.
  11429. @item th_xh
  11430. Set threshold to detect frames as similar. The option value must be an integer
  11431. greater than zero. The default value is 116.
  11432. @item th_di
  11433. Set the minimum length of a sequence in frames to recognize it as matching
  11434. sequence. The option value must be a non negative integer value.
  11435. The default value is 0.
  11436. @item th_it
  11437. Set the minimum relation, that matching frames to all frames must have.
  11438. The option value must be a double value between 0 and 1. The default value is 0.5.
  11439. @end table
  11440. @subsection Examples
  11441. @itemize
  11442. @item
  11443. To calculate the signature of an input video and store it in signature.bin:
  11444. @example
  11445. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11446. @end example
  11447. @item
  11448. To detect whether two videos match and store the signatures in XML format in
  11449. signature0.xml and signature1.xml:
  11450. @example
  11451. 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 -
  11452. @end example
  11453. @end itemize
  11454. @anchor{smartblur}
  11455. @section smartblur
  11456. Blur the input video without impacting the outlines.
  11457. It accepts the following options:
  11458. @table @option
  11459. @item luma_radius, lr
  11460. Set the luma radius. The option value must be a float number in
  11461. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11462. used to blur the image (slower if larger). Default value is 1.0.
  11463. @item luma_strength, ls
  11464. Set the luma strength. The option value must be a float number
  11465. in the range [-1.0,1.0] that configures the blurring. A value included
  11466. in [0.0,1.0] will blur the image whereas a value included in
  11467. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11468. @item luma_threshold, lt
  11469. Set the luma threshold used as a coefficient to determine
  11470. whether a pixel should be blurred or not. The option value must be an
  11471. integer in the range [-30,30]. A value of 0 will filter all the image,
  11472. a value included in [0,30] will filter flat areas and a value included
  11473. in [-30,0] will filter edges. Default value is 0.
  11474. @item chroma_radius, cr
  11475. Set the chroma radius. The option value must be a float number in
  11476. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11477. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11478. @item chroma_strength, cs
  11479. Set the chroma strength. The option value must be a float number
  11480. in the range [-1.0,1.0] that configures the blurring. A value included
  11481. in [0.0,1.0] will blur the image whereas a value included in
  11482. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11483. @item chroma_threshold, ct
  11484. Set the chroma threshold used as a coefficient to determine
  11485. whether a pixel should be blurred or not. The option value must be an
  11486. integer in the range [-30,30]. A value of 0 will filter all the image,
  11487. a value included in [0,30] will filter flat areas and a value included
  11488. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11489. @end table
  11490. If a chroma option is not explicitly set, the corresponding luma value
  11491. is set.
  11492. @section ssim
  11493. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11494. This filter takes in input two input videos, the first input is
  11495. considered the "main" source and is passed unchanged to the
  11496. output. The second input is used as a "reference" video for computing
  11497. the SSIM.
  11498. Both video inputs must have the same resolution and pixel format for
  11499. this filter to work correctly. Also it assumes that both inputs
  11500. have the same number of frames, which are compared one by one.
  11501. The filter stores the calculated SSIM of each frame.
  11502. The description of the accepted parameters follows.
  11503. @table @option
  11504. @item stats_file, f
  11505. If specified the filter will use the named file to save the SSIM of
  11506. each individual frame. When filename equals "-" the data is sent to
  11507. standard output.
  11508. @end table
  11509. The file printed if @var{stats_file} is selected, contains a sequence of
  11510. key/value pairs of the form @var{key}:@var{value} for each compared
  11511. couple of frames.
  11512. A description of each shown parameter follows:
  11513. @table @option
  11514. @item n
  11515. sequential number of the input frame, starting from 1
  11516. @item Y, U, V, R, G, B
  11517. SSIM of the compared frames for the component specified by the suffix.
  11518. @item All
  11519. SSIM of the compared frames for the whole frame.
  11520. @item dB
  11521. Same as above but in dB representation.
  11522. @end table
  11523. This filter also supports the @ref{framesync} options.
  11524. For example:
  11525. @example
  11526. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11527. [main][ref] ssim="stats_file=stats.log" [out]
  11528. @end example
  11529. On this example the input file being processed is compared with the
  11530. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11531. is stored in @file{stats.log}.
  11532. Another example with both psnr and ssim at same time:
  11533. @example
  11534. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11535. @end example
  11536. @section stereo3d
  11537. Convert between different stereoscopic image formats.
  11538. The filters accept the following options:
  11539. @table @option
  11540. @item in
  11541. Set stereoscopic image format of input.
  11542. Available values for input image formats are:
  11543. @table @samp
  11544. @item sbsl
  11545. side by side parallel (left eye left, right eye right)
  11546. @item sbsr
  11547. side by side crosseye (right eye left, left eye right)
  11548. @item sbs2l
  11549. side by side parallel with half width resolution
  11550. (left eye left, right eye right)
  11551. @item sbs2r
  11552. side by side crosseye with half width resolution
  11553. (right eye left, left eye right)
  11554. @item abl
  11555. above-below (left eye above, right eye below)
  11556. @item abr
  11557. above-below (right eye above, left eye below)
  11558. @item ab2l
  11559. above-below with half height resolution
  11560. (left eye above, right eye below)
  11561. @item ab2r
  11562. above-below with half height resolution
  11563. (right eye above, left eye below)
  11564. @item al
  11565. alternating frames (left eye first, right eye second)
  11566. @item ar
  11567. alternating frames (right eye first, left eye second)
  11568. @item irl
  11569. interleaved rows (left eye has top row, right eye starts on next row)
  11570. @item irr
  11571. interleaved rows (right eye has top row, left eye starts on next row)
  11572. @item icl
  11573. interleaved columns, left eye first
  11574. @item icr
  11575. interleaved columns, right eye first
  11576. Default value is @samp{sbsl}.
  11577. @end table
  11578. @item out
  11579. Set stereoscopic image format of output.
  11580. @table @samp
  11581. @item sbsl
  11582. side by side parallel (left eye left, right eye right)
  11583. @item sbsr
  11584. side by side crosseye (right eye left, left eye right)
  11585. @item sbs2l
  11586. side by side parallel with half width resolution
  11587. (left eye left, right eye right)
  11588. @item sbs2r
  11589. side by side crosseye with half width resolution
  11590. (right eye left, left eye right)
  11591. @item abl
  11592. above-below (left eye above, right eye below)
  11593. @item abr
  11594. above-below (right eye above, left eye below)
  11595. @item ab2l
  11596. above-below with half height resolution
  11597. (left eye above, right eye below)
  11598. @item ab2r
  11599. above-below with half height resolution
  11600. (right eye above, left eye below)
  11601. @item al
  11602. alternating frames (left eye first, right eye second)
  11603. @item ar
  11604. alternating frames (right eye first, left eye second)
  11605. @item irl
  11606. interleaved rows (left eye has top row, right eye starts on next row)
  11607. @item irr
  11608. interleaved rows (right eye has top row, left eye starts on next row)
  11609. @item arbg
  11610. anaglyph red/blue gray
  11611. (red filter on left eye, blue filter on right eye)
  11612. @item argg
  11613. anaglyph red/green gray
  11614. (red filter on left eye, green filter on right eye)
  11615. @item arcg
  11616. anaglyph red/cyan gray
  11617. (red filter on left eye, cyan filter on right eye)
  11618. @item arch
  11619. anaglyph red/cyan half colored
  11620. (red filter on left eye, cyan filter on right eye)
  11621. @item arcc
  11622. anaglyph red/cyan color
  11623. (red filter on left eye, cyan filter on right eye)
  11624. @item arcd
  11625. anaglyph red/cyan color optimized with the least squares projection of dubois
  11626. (red filter on left eye, cyan filter on right eye)
  11627. @item agmg
  11628. anaglyph green/magenta gray
  11629. (green filter on left eye, magenta filter on right eye)
  11630. @item agmh
  11631. anaglyph green/magenta half colored
  11632. (green filter on left eye, magenta filter on right eye)
  11633. @item agmc
  11634. anaglyph green/magenta colored
  11635. (green filter on left eye, magenta filter on right eye)
  11636. @item agmd
  11637. anaglyph green/magenta color optimized with the least squares projection of dubois
  11638. (green filter on left eye, magenta filter on right eye)
  11639. @item aybg
  11640. anaglyph yellow/blue gray
  11641. (yellow filter on left eye, blue filter on right eye)
  11642. @item aybh
  11643. anaglyph yellow/blue half colored
  11644. (yellow filter on left eye, blue filter on right eye)
  11645. @item aybc
  11646. anaglyph yellow/blue colored
  11647. (yellow filter on left eye, blue filter on right eye)
  11648. @item aybd
  11649. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11650. (yellow filter on left eye, blue filter on right eye)
  11651. @item ml
  11652. mono output (left eye only)
  11653. @item mr
  11654. mono output (right eye only)
  11655. @item chl
  11656. checkerboard, left eye first
  11657. @item chr
  11658. checkerboard, right eye first
  11659. @item icl
  11660. interleaved columns, left eye first
  11661. @item icr
  11662. interleaved columns, right eye first
  11663. @item hdmi
  11664. HDMI frame pack
  11665. @end table
  11666. Default value is @samp{arcd}.
  11667. @end table
  11668. @subsection Examples
  11669. @itemize
  11670. @item
  11671. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11672. @example
  11673. stereo3d=sbsl:aybd
  11674. @end example
  11675. @item
  11676. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11677. @example
  11678. stereo3d=abl:sbsr
  11679. @end example
  11680. @end itemize
  11681. @section streamselect, astreamselect
  11682. Select video or audio streams.
  11683. The filter accepts the following options:
  11684. @table @option
  11685. @item inputs
  11686. Set number of inputs. Default is 2.
  11687. @item map
  11688. Set input indexes to remap to outputs.
  11689. @end table
  11690. @subsection Commands
  11691. The @code{streamselect} and @code{astreamselect} filter supports the following
  11692. commands:
  11693. @table @option
  11694. @item map
  11695. Set input indexes to remap to outputs.
  11696. @end table
  11697. @subsection Examples
  11698. @itemize
  11699. @item
  11700. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11701. @example
  11702. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11703. @end example
  11704. @item
  11705. Same as above, but for audio:
  11706. @example
  11707. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11708. @end example
  11709. @end itemize
  11710. @section sobel
  11711. Apply sobel operator to input video stream.
  11712. The filter accepts the following option:
  11713. @table @option
  11714. @item planes
  11715. Set which planes will be processed, unprocessed planes will be copied.
  11716. By default value 0xf, all planes will be processed.
  11717. @item scale
  11718. Set value which will be multiplied with filtered result.
  11719. @item delta
  11720. Set value which will be added to filtered result.
  11721. @end table
  11722. @anchor{spp}
  11723. @section spp
  11724. Apply a simple postprocessing filter that compresses and decompresses the image
  11725. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11726. and average the results.
  11727. The filter accepts the following options:
  11728. @table @option
  11729. @item quality
  11730. Set quality. This option defines the number of levels for averaging. It accepts
  11731. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11732. effect. A value of @code{6} means the higher quality. For each increment of
  11733. that value the speed drops by a factor of approximately 2. Default value is
  11734. @code{3}.
  11735. @item qp
  11736. Force a constant quantization parameter. If not set, the filter will use the QP
  11737. from the video stream (if available).
  11738. @item mode
  11739. Set thresholding mode. Available modes are:
  11740. @table @samp
  11741. @item hard
  11742. Set hard thresholding (default).
  11743. @item soft
  11744. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11745. @end table
  11746. @item use_bframe_qp
  11747. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11748. option may cause flicker since the B-Frames have often larger QP. Default is
  11749. @code{0} (not enabled).
  11750. @end table
  11751. @anchor{subtitles}
  11752. @section subtitles
  11753. Draw subtitles on top of input video using the libass library.
  11754. To enable compilation of this filter you need to configure FFmpeg with
  11755. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11756. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11757. Alpha) subtitles format.
  11758. The filter accepts the following options:
  11759. @table @option
  11760. @item filename, f
  11761. Set the filename of the subtitle file to read. It must be specified.
  11762. @item original_size
  11763. Specify the size of the original video, the video for which the ASS file
  11764. was composed. For the syntax of this option, check the
  11765. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11766. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11767. correctly scale the fonts if the aspect ratio has been changed.
  11768. @item fontsdir
  11769. Set a directory path containing fonts that can be used by the filter.
  11770. These fonts will be used in addition to whatever the font provider uses.
  11771. @item alpha
  11772. Process alpha channel, by default alpha channel is untouched.
  11773. @item charenc
  11774. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11775. useful if not UTF-8.
  11776. @item stream_index, si
  11777. Set subtitles stream index. @code{subtitles} filter only.
  11778. @item force_style
  11779. Override default style or script info parameters of the subtitles. It accepts a
  11780. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11781. @end table
  11782. If the first key is not specified, it is assumed that the first value
  11783. specifies the @option{filename}.
  11784. For example, to render the file @file{sub.srt} on top of the input
  11785. video, use the command:
  11786. @example
  11787. subtitles=sub.srt
  11788. @end example
  11789. which is equivalent to:
  11790. @example
  11791. subtitles=filename=sub.srt
  11792. @end example
  11793. To render the default subtitles stream from file @file{video.mkv}, use:
  11794. @example
  11795. subtitles=video.mkv
  11796. @end example
  11797. To render the second subtitles stream from that file, use:
  11798. @example
  11799. subtitles=video.mkv:si=1
  11800. @end example
  11801. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  11802. @code{DejaVu Serif}, use:
  11803. @example
  11804. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  11805. @end example
  11806. @section super2xsai
  11807. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11808. Interpolate) pixel art scaling algorithm.
  11809. Useful for enlarging pixel art images without reducing sharpness.
  11810. @section swaprect
  11811. Swap two rectangular objects in video.
  11812. This filter accepts the following options:
  11813. @table @option
  11814. @item w
  11815. Set object width.
  11816. @item h
  11817. Set object height.
  11818. @item x1
  11819. Set 1st rect x coordinate.
  11820. @item y1
  11821. Set 1st rect y coordinate.
  11822. @item x2
  11823. Set 2nd rect x coordinate.
  11824. @item y2
  11825. Set 2nd rect y coordinate.
  11826. All expressions are evaluated once for each frame.
  11827. @end table
  11828. The all options are expressions containing the following constants:
  11829. @table @option
  11830. @item w
  11831. @item h
  11832. The input width and height.
  11833. @item a
  11834. same as @var{w} / @var{h}
  11835. @item sar
  11836. input sample aspect ratio
  11837. @item dar
  11838. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11839. @item n
  11840. The number of the input frame, starting from 0.
  11841. @item t
  11842. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11843. @item pos
  11844. the position in the file of the input frame, NAN if unknown
  11845. @end table
  11846. @section swapuv
  11847. Swap U & V plane.
  11848. @section telecine
  11849. Apply telecine process to the video.
  11850. This filter accepts the following options:
  11851. @table @option
  11852. @item first_field
  11853. @table @samp
  11854. @item top, t
  11855. top field first
  11856. @item bottom, b
  11857. bottom field first
  11858. The default value is @code{top}.
  11859. @end table
  11860. @item pattern
  11861. A string of numbers representing the pulldown pattern you wish to apply.
  11862. The default value is @code{23}.
  11863. @end table
  11864. @example
  11865. Some typical patterns:
  11866. NTSC output (30i):
  11867. 27.5p: 32222
  11868. 24p: 23 (classic)
  11869. 24p: 2332 (preferred)
  11870. 20p: 33
  11871. 18p: 334
  11872. 16p: 3444
  11873. PAL output (25i):
  11874. 27.5p: 12222
  11875. 24p: 222222222223 ("Euro pulldown")
  11876. 16.67p: 33
  11877. 16p: 33333334
  11878. @end example
  11879. @section threshold
  11880. Apply threshold effect to video stream.
  11881. This filter needs four video streams to perform thresholding.
  11882. First stream is stream we are filtering.
  11883. Second stream is holding threshold values, third stream is holding min values,
  11884. and last, fourth stream is holding max values.
  11885. The filter accepts the following option:
  11886. @table @option
  11887. @item planes
  11888. Set which planes will be processed, unprocessed planes will be copied.
  11889. By default value 0xf, all planes will be processed.
  11890. @end table
  11891. For example if first stream pixel's component value is less then threshold value
  11892. of pixel component from 2nd threshold stream, third stream value will picked,
  11893. otherwise fourth stream pixel component value will be picked.
  11894. Using color source filter one can perform various types of thresholding:
  11895. @subsection Examples
  11896. @itemize
  11897. @item
  11898. Binary threshold, using gray color as threshold:
  11899. @example
  11900. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11901. @end example
  11902. @item
  11903. Inverted binary threshold, using gray color as threshold:
  11904. @example
  11905. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11906. @end example
  11907. @item
  11908. Truncate binary threshold, using gray color as threshold:
  11909. @example
  11910. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11911. @end example
  11912. @item
  11913. Threshold to zero, using gray color as threshold:
  11914. @example
  11915. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11916. @end example
  11917. @item
  11918. Inverted threshold to zero, using gray color as threshold:
  11919. @example
  11920. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11921. @end example
  11922. @end itemize
  11923. @section thumbnail
  11924. Select the most representative frame in a given sequence of consecutive frames.
  11925. The filter accepts the following options:
  11926. @table @option
  11927. @item n
  11928. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11929. will pick one of them, and then handle the next batch of @var{n} frames until
  11930. the end. Default is @code{100}.
  11931. @end table
  11932. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11933. value will result in a higher memory usage, so a high value is not recommended.
  11934. @subsection Examples
  11935. @itemize
  11936. @item
  11937. Extract one picture each 50 frames:
  11938. @example
  11939. thumbnail=50
  11940. @end example
  11941. @item
  11942. Complete example of a thumbnail creation with @command{ffmpeg}:
  11943. @example
  11944. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11945. @end example
  11946. @end itemize
  11947. @section tile
  11948. Tile several successive frames together.
  11949. The filter accepts the following options:
  11950. @table @option
  11951. @item layout
  11952. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11953. this option, check the
  11954. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11955. @item nb_frames
  11956. Set the maximum number of frames to render in the given area. It must be less
  11957. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11958. the area will be used.
  11959. @item margin
  11960. Set the outer border margin in pixels.
  11961. @item padding
  11962. Set the inner border thickness (i.e. the number of pixels between frames). For
  11963. more advanced padding options (such as having different values for the edges),
  11964. refer to the pad video filter.
  11965. @item color
  11966. Specify the color of the unused area. For the syntax of this option, check the
  11967. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11968. The default value of @var{color} is "black".
  11969. @item overlap
  11970. Set the number of frames to overlap when tiling several successive frames together.
  11971. The value must be between @code{0} and @var{nb_frames - 1}.
  11972. @item init_padding
  11973. Set the number of frames to initially be empty before displaying first output frame.
  11974. This controls how soon will one get first output frame.
  11975. The value must be between @code{0} and @var{nb_frames - 1}.
  11976. @end table
  11977. @subsection Examples
  11978. @itemize
  11979. @item
  11980. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11981. @example
  11982. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11983. @end example
  11984. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11985. duplicating each output frame to accommodate the originally detected frame
  11986. rate.
  11987. @item
  11988. Display @code{5} pictures in an area of @code{3x2} frames,
  11989. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11990. mixed flat and named options:
  11991. @example
  11992. tile=3x2:nb_frames=5:padding=7:margin=2
  11993. @end example
  11994. @end itemize
  11995. @section tinterlace
  11996. Perform various types of temporal field interlacing.
  11997. Frames are counted starting from 1, so the first input frame is
  11998. considered odd.
  11999. The filter accepts the following options:
  12000. @table @option
  12001. @item mode
  12002. Specify the mode of the interlacing. This option can also be specified
  12003. as a value alone. See below for a list of values for this option.
  12004. Available values are:
  12005. @table @samp
  12006. @item merge, 0
  12007. Move odd frames into the upper field, even into the lower field,
  12008. generating a double height frame at half frame rate.
  12009. @example
  12010. ------> time
  12011. Input:
  12012. Frame 1 Frame 2 Frame 3 Frame 4
  12013. 11111 22222 33333 44444
  12014. 11111 22222 33333 44444
  12015. 11111 22222 33333 44444
  12016. 11111 22222 33333 44444
  12017. Output:
  12018. 11111 33333
  12019. 22222 44444
  12020. 11111 33333
  12021. 22222 44444
  12022. 11111 33333
  12023. 22222 44444
  12024. 11111 33333
  12025. 22222 44444
  12026. @end example
  12027. @item drop_even, 1
  12028. Only output odd frames, even frames are dropped, generating a frame with
  12029. unchanged height at half frame rate.
  12030. @example
  12031. ------> time
  12032. Input:
  12033. Frame 1 Frame 2 Frame 3 Frame 4
  12034. 11111 22222 33333 44444
  12035. 11111 22222 33333 44444
  12036. 11111 22222 33333 44444
  12037. 11111 22222 33333 44444
  12038. Output:
  12039. 11111 33333
  12040. 11111 33333
  12041. 11111 33333
  12042. 11111 33333
  12043. @end example
  12044. @item drop_odd, 2
  12045. Only output even frames, odd frames are dropped, generating a frame with
  12046. unchanged height at half frame rate.
  12047. @example
  12048. ------> time
  12049. Input:
  12050. Frame 1 Frame 2 Frame 3 Frame 4
  12051. 11111 22222 33333 44444
  12052. 11111 22222 33333 44444
  12053. 11111 22222 33333 44444
  12054. 11111 22222 33333 44444
  12055. Output:
  12056. 22222 44444
  12057. 22222 44444
  12058. 22222 44444
  12059. 22222 44444
  12060. @end example
  12061. @item pad, 3
  12062. Expand each frame to full height, but pad alternate lines with black,
  12063. generating a frame with double height at the same input frame rate.
  12064. @example
  12065. ------> time
  12066. Input:
  12067. Frame 1 Frame 2 Frame 3 Frame 4
  12068. 11111 22222 33333 44444
  12069. 11111 22222 33333 44444
  12070. 11111 22222 33333 44444
  12071. 11111 22222 33333 44444
  12072. Output:
  12073. 11111 ..... 33333 .....
  12074. ..... 22222 ..... 44444
  12075. 11111 ..... 33333 .....
  12076. ..... 22222 ..... 44444
  12077. 11111 ..... 33333 .....
  12078. ..... 22222 ..... 44444
  12079. 11111 ..... 33333 .....
  12080. ..... 22222 ..... 44444
  12081. @end example
  12082. @item interleave_top, 4
  12083. Interleave the upper field from odd frames with the lower field from
  12084. even frames, generating a frame with unchanged height at half frame rate.
  12085. @example
  12086. ------> time
  12087. Input:
  12088. Frame 1 Frame 2 Frame 3 Frame 4
  12089. 11111<- 22222 33333<- 44444
  12090. 11111 22222<- 33333 44444<-
  12091. 11111<- 22222 33333<- 44444
  12092. 11111 22222<- 33333 44444<-
  12093. Output:
  12094. 11111 33333
  12095. 22222 44444
  12096. 11111 33333
  12097. 22222 44444
  12098. @end example
  12099. @item interleave_bottom, 5
  12100. Interleave the lower field from odd frames with the upper field from
  12101. even frames, generating a frame with unchanged height at half frame rate.
  12102. @example
  12103. ------> time
  12104. Input:
  12105. Frame 1 Frame 2 Frame 3 Frame 4
  12106. 11111 22222<- 33333 44444<-
  12107. 11111<- 22222 33333<- 44444
  12108. 11111 22222<- 33333 44444<-
  12109. 11111<- 22222 33333<- 44444
  12110. Output:
  12111. 22222 44444
  12112. 11111 33333
  12113. 22222 44444
  12114. 11111 33333
  12115. @end example
  12116. @item interlacex2, 6
  12117. Double frame rate with unchanged height. Frames are inserted each
  12118. containing the second temporal field from the previous input frame and
  12119. the first temporal field from the next input frame. This mode relies on
  12120. the top_field_first flag. Useful for interlaced video displays with no
  12121. field synchronisation.
  12122. @example
  12123. ------> time
  12124. Input:
  12125. Frame 1 Frame 2 Frame 3 Frame 4
  12126. 11111 22222 33333 44444
  12127. 11111 22222 33333 44444
  12128. 11111 22222 33333 44444
  12129. 11111 22222 33333 44444
  12130. Output:
  12131. 11111 22222 22222 33333 33333 44444 44444
  12132. 11111 11111 22222 22222 33333 33333 44444
  12133. 11111 22222 22222 33333 33333 44444 44444
  12134. 11111 11111 22222 22222 33333 33333 44444
  12135. @end example
  12136. @item mergex2, 7
  12137. Move odd frames into the upper field, even into the lower field,
  12138. generating a double height frame at same frame rate.
  12139. @example
  12140. ------> time
  12141. Input:
  12142. Frame 1 Frame 2 Frame 3 Frame 4
  12143. 11111 22222 33333 44444
  12144. 11111 22222 33333 44444
  12145. 11111 22222 33333 44444
  12146. 11111 22222 33333 44444
  12147. Output:
  12148. 11111 33333 33333 55555
  12149. 22222 22222 44444 44444
  12150. 11111 33333 33333 55555
  12151. 22222 22222 44444 44444
  12152. 11111 33333 33333 55555
  12153. 22222 22222 44444 44444
  12154. 11111 33333 33333 55555
  12155. 22222 22222 44444 44444
  12156. @end example
  12157. @end table
  12158. Numeric values are deprecated but are accepted for backward
  12159. compatibility reasons.
  12160. Default mode is @code{merge}.
  12161. @item flags
  12162. Specify flags influencing the filter process.
  12163. Available value for @var{flags} is:
  12164. @table @option
  12165. @item low_pass_filter, vlfp
  12166. Enable linear vertical low-pass filtering in the filter.
  12167. Vertical low-pass filtering is required when creating an interlaced
  12168. destination from a progressive source which contains high-frequency
  12169. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  12170. patterning.
  12171. @item complex_filter, cvlfp
  12172. Enable complex vertical low-pass filtering.
  12173. This will slightly less reduce interlace 'twitter' and Moire
  12174. patterning but better retain detail and subjective sharpness impression.
  12175. @end table
  12176. Vertical low-pass filtering can only be enabled for @option{mode}
  12177. @var{interleave_top} and @var{interleave_bottom}.
  12178. @end table
  12179. @section tmix
  12180. Mix successive video frames.
  12181. A description of the accepted options follows.
  12182. @table @option
  12183. @item frames
  12184. The number of successive frames to mix. If unspecified, it defaults to 3.
  12185. @item weights
  12186. Specify weight of each input video frame.
  12187. Each weight is separated by space. If number of weights is smaller than
  12188. number of @var{frames} last specified weight will be used for all remaining
  12189. unset weights.
  12190. @item scale
  12191. Specify scale, if it is set it will be multiplied with sum
  12192. of each weight multiplied with pixel values to give final destination
  12193. pixel value. By default @var{scale} is auto scaled to sum of weights.
  12194. @end table
  12195. @subsection Examples
  12196. @itemize
  12197. @item
  12198. Average 7 successive frames:
  12199. @example
  12200. tmix=frames=7:weights="1 1 1 1 1 1 1"
  12201. @end example
  12202. @item
  12203. Apply simple temporal convolution:
  12204. @example
  12205. tmix=frames=3:weights="-1 3 -1"
  12206. @end example
  12207. @item
  12208. Similar as above but only showing temporal differences:
  12209. @example
  12210. tmix=frames=3:weights="-1 2 -1":scale=1
  12211. @end example
  12212. @end itemize
  12213. @section tonemap
  12214. Tone map colors from different dynamic ranges.
  12215. This filter expects data in single precision floating point, as it needs to
  12216. operate on (and can output) out-of-range values. Another filter, such as
  12217. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  12218. The tonemapping algorithms implemented only work on linear light, so input
  12219. data should be linearized beforehand (and possibly correctly tagged).
  12220. @example
  12221. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  12222. @end example
  12223. @subsection Options
  12224. The filter accepts the following options.
  12225. @table @option
  12226. @item tonemap
  12227. Set the tone map algorithm to use.
  12228. Possible values are:
  12229. @table @var
  12230. @item none
  12231. Do not apply any tone map, only desaturate overbright pixels.
  12232. @item clip
  12233. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  12234. in-range values, while distorting out-of-range values.
  12235. @item linear
  12236. Stretch the entire reference gamut to a linear multiple of the display.
  12237. @item gamma
  12238. Fit a logarithmic transfer between the tone curves.
  12239. @item reinhard
  12240. Preserve overall image brightness with a simple curve, using nonlinear
  12241. contrast, which results in flattening details and degrading color accuracy.
  12242. @item hable
  12243. Preserve both dark and bright details better than @var{reinhard}, at the cost
  12244. of slightly darkening everything. Use it when detail preservation is more
  12245. important than color and brightness accuracy.
  12246. @item mobius
  12247. Smoothly map out-of-range values, while retaining contrast and colors for
  12248. in-range material as much as possible. Use it when color accuracy is more
  12249. important than detail preservation.
  12250. @end table
  12251. Default is none.
  12252. @item param
  12253. Tune the tone mapping algorithm.
  12254. This affects the following algorithms:
  12255. @table @var
  12256. @item none
  12257. Ignored.
  12258. @item linear
  12259. Specifies the scale factor to use while stretching.
  12260. Default to 1.0.
  12261. @item gamma
  12262. Specifies the exponent of the function.
  12263. Default to 1.8.
  12264. @item clip
  12265. Specify an extra linear coefficient to multiply into the signal before clipping.
  12266. Default to 1.0.
  12267. @item reinhard
  12268. Specify the local contrast coefficient at the display peak.
  12269. Default to 0.5, which means that in-gamut values will be about half as bright
  12270. as when clipping.
  12271. @item hable
  12272. Ignored.
  12273. @item mobius
  12274. Specify the transition point from linear to mobius transform. Every value
  12275. below this point is guaranteed to be mapped 1:1. The higher the value, the
  12276. more accurate the result will be, at the cost of losing bright details.
  12277. Default to 0.3, which due to the steep initial slope still preserves in-range
  12278. colors fairly accurately.
  12279. @end table
  12280. @item desat
  12281. Apply desaturation for highlights that exceed this level of brightness. The
  12282. higher the parameter, the more color information will be preserved. This
  12283. setting helps prevent unnaturally blown-out colors for super-highlights, by
  12284. (smoothly) turning into white instead. This makes images feel more natural,
  12285. at the cost of reducing information about out-of-range colors.
  12286. The default of 2.0 is somewhat conservative and will mostly just apply to
  12287. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  12288. This option works only if the input frame has a supported color tag.
  12289. @item peak
  12290. Override signal/nominal/reference peak with this value. Useful when the
  12291. embedded peak information in display metadata is not reliable or when tone
  12292. mapping from a lower range to a higher range.
  12293. @end table
  12294. @section transpose
  12295. Transpose rows with columns in the input video and optionally flip it.
  12296. It accepts the following parameters:
  12297. @table @option
  12298. @item dir
  12299. Specify the transposition direction.
  12300. Can assume the following values:
  12301. @table @samp
  12302. @item 0, 4, cclock_flip
  12303. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  12304. @example
  12305. L.R L.l
  12306. . . -> . .
  12307. l.r R.r
  12308. @end example
  12309. @item 1, 5, clock
  12310. Rotate by 90 degrees clockwise, that is:
  12311. @example
  12312. L.R l.L
  12313. . . -> . .
  12314. l.r r.R
  12315. @end example
  12316. @item 2, 6, cclock
  12317. Rotate by 90 degrees counterclockwise, that is:
  12318. @example
  12319. L.R R.r
  12320. . . -> . .
  12321. l.r L.l
  12322. @end example
  12323. @item 3, 7, clock_flip
  12324. Rotate by 90 degrees clockwise and vertically flip, that is:
  12325. @example
  12326. L.R r.R
  12327. . . -> . .
  12328. l.r l.L
  12329. @end example
  12330. @end table
  12331. For values between 4-7, the transposition is only done if the input
  12332. video geometry is portrait and not landscape. These values are
  12333. deprecated, the @code{passthrough} option should be used instead.
  12334. Numerical values are deprecated, and should be dropped in favor of
  12335. symbolic constants.
  12336. @item passthrough
  12337. Do not apply the transposition if the input geometry matches the one
  12338. specified by the specified value. It accepts the following values:
  12339. @table @samp
  12340. @item none
  12341. Always apply transposition.
  12342. @item portrait
  12343. Preserve portrait geometry (when @var{height} >= @var{width}).
  12344. @item landscape
  12345. Preserve landscape geometry (when @var{width} >= @var{height}).
  12346. @end table
  12347. Default value is @code{none}.
  12348. @end table
  12349. For example to rotate by 90 degrees clockwise and preserve portrait
  12350. layout:
  12351. @example
  12352. transpose=dir=1:passthrough=portrait
  12353. @end example
  12354. The command above can also be specified as:
  12355. @example
  12356. transpose=1:portrait
  12357. @end example
  12358. @section trim
  12359. Trim the input so that the output contains one continuous subpart of the input.
  12360. It accepts the following parameters:
  12361. @table @option
  12362. @item start
  12363. Specify the time of the start of the kept section, i.e. the frame with the
  12364. timestamp @var{start} will be the first frame in the output.
  12365. @item end
  12366. Specify the time of the first frame that will be dropped, i.e. the frame
  12367. immediately preceding the one with the timestamp @var{end} will be the last
  12368. frame in the output.
  12369. @item start_pts
  12370. This is the same as @var{start}, except this option sets the start timestamp
  12371. in timebase units instead of seconds.
  12372. @item end_pts
  12373. This is the same as @var{end}, except this option sets the end timestamp
  12374. in timebase units instead of seconds.
  12375. @item duration
  12376. The maximum duration of the output in seconds.
  12377. @item start_frame
  12378. The number of the first frame that should be passed to the output.
  12379. @item end_frame
  12380. The number of the first frame that should be dropped.
  12381. @end table
  12382. @option{start}, @option{end}, and @option{duration} are expressed as time
  12383. duration specifications; see
  12384. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12385. for the accepted syntax.
  12386. Note that the first two sets of the start/end options and the @option{duration}
  12387. option look at the frame timestamp, while the _frame variants simply count the
  12388. frames that pass through the filter. Also note that this filter does not modify
  12389. the timestamps. If you wish for the output timestamps to start at zero, insert a
  12390. setpts filter after the trim filter.
  12391. If multiple start or end options are set, this filter tries to be greedy and
  12392. keep all the frames that match at least one of the specified constraints. To keep
  12393. only the part that matches all the constraints at once, chain multiple trim
  12394. filters.
  12395. The defaults are such that all the input is kept. So it is possible to set e.g.
  12396. just the end values to keep everything before the specified time.
  12397. Examples:
  12398. @itemize
  12399. @item
  12400. Drop everything except the second minute of input:
  12401. @example
  12402. ffmpeg -i INPUT -vf trim=60:120
  12403. @end example
  12404. @item
  12405. Keep only the first second:
  12406. @example
  12407. ffmpeg -i INPUT -vf trim=duration=1
  12408. @end example
  12409. @end itemize
  12410. @section unpremultiply
  12411. Apply alpha unpremultiply effect to input video stream using first plane
  12412. of second stream as alpha.
  12413. Both streams must have same dimensions and same pixel format.
  12414. The filter accepts the following option:
  12415. @table @option
  12416. @item planes
  12417. Set which planes will be processed, unprocessed planes will be copied.
  12418. By default value 0xf, all planes will be processed.
  12419. If the format has 1 or 2 components, then luma is bit 0.
  12420. If the format has 3 or 4 components:
  12421. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  12422. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  12423. If present, the alpha channel is always the last bit.
  12424. @item inplace
  12425. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12426. @end table
  12427. @anchor{unsharp}
  12428. @section unsharp
  12429. Sharpen or blur the input video.
  12430. It accepts the following parameters:
  12431. @table @option
  12432. @item luma_msize_x, lx
  12433. Set the luma matrix horizontal size. It must be an odd integer between
  12434. 3 and 23. The default value is 5.
  12435. @item luma_msize_y, ly
  12436. Set the luma matrix vertical size. It must be an odd integer between 3
  12437. and 23. The default value is 5.
  12438. @item luma_amount, la
  12439. Set the luma effect strength. It must be a floating point number, reasonable
  12440. values lay between -1.5 and 1.5.
  12441. Negative values will blur the input video, while positive values will
  12442. sharpen it, a value of zero will disable the effect.
  12443. Default value is 1.0.
  12444. @item chroma_msize_x, cx
  12445. Set the chroma matrix horizontal size. It must be an odd integer
  12446. between 3 and 23. The default value is 5.
  12447. @item chroma_msize_y, cy
  12448. Set the chroma matrix vertical size. It must be an odd integer
  12449. between 3 and 23. The default value is 5.
  12450. @item chroma_amount, ca
  12451. Set the chroma effect strength. It must be a floating point number, reasonable
  12452. values lay between -1.5 and 1.5.
  12453. Negative values will blur the input video, while positive values will
  12454. sharpen it, a value of zero will disable the effect.
  12455. Default value is 0.0.
  12456. @end table
  12457. All parameters are optional and default to the equivalent of the
  12458. string '5:5:1.0:5:5:0.0'.
  12459. @subsection Examples
  12460. @itemize
  12461. @item
  12462. Apply strong luma sharpen effect:
  12463. @example
  12464. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12465. @end example
  12466. @item
  12467. Apply a strong blur of both luma and chroma parameters:
  12468. @example
  12469. unsharp=7:7:-2:7:7:-2
  12470. @end example
  12471. @end itemize
  12472. @section uspp
  12473. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12474. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12475. shifts and average the results.
  12476. The way this differs from the behavior of spp is that uspp actually encodes &
  12477. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12478. DCT similar to MJPEG.
  12479. The filter accepts the following options:
  12480. @table @option
  12481. @item quality
  12482. Set quality. This option defines the number of levels for averaging. It accepts
  12483. an integer in the range 0-8. If set to @code{0}, the filter will have no
  12484. effect. A value of @code{8} means the higher quality. For each increment of
  12485. that value the speed drops by a factor of approximately 2. Default value is
  12486. @code{3}.
  12487. @item qp
  12488. Force a constant quantization parameter. If not set, the filter will use the QP
  12489. from the video stream (if available).
  12490. @end table
  12491. @section vaguedenoiser
  12492. Apply a wavelet based denoiser.
  12493. It transforms each frame from the video input into the wavelet domain,
  12494. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  12495. the obtained coefficients. It does an inverse wavelet transform after.
  12496. Due to wavelet properties, it should give a nice smoothed result, and
  12497. reduced noise, without blurring picture features.
  12498. This filter accepts the following options:
  12499. @table @option
  12500. @item threshold
  12501. The filtering strength. The higher, the more filtered the video will be.
  12502. Hard thresholding can use a higher threshold than soft thresholding
  12503. before the video looks overfiltered. Default value is 2.
  12504. @item method
  12505. The filtering method the filter will use.
  12506. It accepts the following values:
  12507. @table @samp
  12508. @item hard
  12509. All values under the threshold will be zeroed.
  12510. @item soft
  12511. All values under the threshold will be zeroed. All values above will be
  12512. reduced by the threshold.
  12513. @item garrote
  12514. Scales or nullifies coefficients - intermediary between (more) soft and
  12515. (less) hard thresholding.
  12516. @end table
  12517. Default is garrote.
  12518. @item nsteps
  12519. Number of times, the wavelet will decompose the picture. Picture can't
  12520. be decomposed beyond a particular point (typically, 8 for a 640x480
  12521. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  12522. @item percent
  12523. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  12524. @item planes
  12525. A list of the planes to process. By default all planes are processed.
  12526. @end table
  12527. @section vectorscope
  12528. Display 2 color component values in the two dimensional graph (which is called
  12529. a vectorscope).
  12530. This filter accepts the following options:
  12531. @table @option
  12532. @item mode, m
  12533. Set vectorscope mode.
  12534. It accepts the following values:
  12535. @table @samp
  12536. @item gray
  12537. Gray values are displayed on graph, higher brightness means more pixels have
  12538. same component color value on location in graph. This is the default mode.
  12539. @item color
  12540. Gray values are displayed on graph. Surrounding pixels values which are not
  12541. present in video frame are drawn in gradient of 2 color components which are
  12542. set by option @code{x} and @code{y}. The 3rd color component is static.
  12543. @item color2
  12544. Actual color components values present in video frame are displayed on graph.
  12545. @item color3
  12546. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  12547. on graph increases value of another color component, which is luminance by
  12548. default values of @code{x} and @code{y}.
  12549. @item color4
  12550. Actual colors present in video frame are displayed on graph. If two different
  12551. colors map to same position on graph then color with higher value of component
  12552. not present in graph is picked.
  12553. @item color5
  12554. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  12555. component picked from radial gradient.
  12556. @end table
  12557. @item x
  12558. Set which color component will be represented on X-axis. Default is @code{1}.
  12559. @item y
  12560. Set which color component will be represented on Y-axis. Default is @code{2}.
  12561. @item intensity, i
  12562. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  12563. of color component which represents frequency of (X, Y) location in graph.
  12564. @item envelope, e
  12565. @table @samp
  12566. @item none
  12567. No envelope, this is default.
  12568. @item instant
  12569. Instant envelope, even darkest single pixel will be clearly highlighted.
  12570. @item peak
  12571. Hold maximum and minimum values presented in graph over time. This way you
  12572. can still spot out of range values without constantly looking at vectorscope.
  12573. @item peak+instant
  12574. Peak and instant envelope combined together.
  12575. @end table
  12576. @item graticule, g
  12577. Set what kind of graticule to draw.
  12578. @table @samp
  12579. @item none
  12580. @item green
  12581. @item color
  12582. @end table
  12583. @item opacity, o
  12584. Set graticule opacity.
  12585. @item flags, f
  12586. Set graticule flags.
  12587. @table @samp
  12588. @item white
  12589. Draw graticule for white point.
  12590. @item black
  12591. Draw graticule for black point.
  12592. @item name
  12593. Draw color points short names.
  12594. @end table
  12595. @item bgopacity, b
  12596. Set background opacity.
  12597. @item lthreshold, l
  12598. Set low threshold for color component not represented on X or Y axis.
  12599. Values lower than this value will be ignored. Default is 0.
  12600. Note this value is multiplied with actual max possible value one pixel component
  12601. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12602. is 0.1 * 255 = 25.
  12603. @item hthreshold, h
  12604. Set high threshold for color component not represented on X or Y axis.
  12605. Values higher than this value will be ignored. Default is 1.
  12606. Note this value is multiplied with actual max possible value one pixel component
  12607. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12608. is 0.9 * 255 = 230.
  12609. @item colorspace, c
  12610. Set what kind of colorspace to use when drawing graticule.
  12611. @table @samp
  12612. @item auto
  12613. @item 601
  12614. @item 709
  12615. @end table
  12616. Default is auto.
  12617. @end table
  12618. @anchor{vidstabdetect}
  12619. @section vidstabdetect
  12620. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12621. @ref{vidstabtransform} for pass 2.
  12622. This filter generates a file with relative translation and rotation
  12623. transform information about subsequent frames, which is then used by
  12624. the @ref{vidstabtransform} filter.
  12625. To enable compilation of this filter you need to configure FFmpeg with
  12626. @code{--enable-libvidstab}.
  12627. This filter accepts the following options:
  12628. @table @option
  12629. @item result
  12630. Set the path to the file used to write the transforms information.
  12631. Default value is @file{transforms.trf}.
  12632. @item shakiness
  12633. Set how shaky the video is and how quick the camera is. It accepts an
  12634. integer in the range 1-10, a value of 1 means little shakiness, a
  12635. value of 10 means strong shakiness. Default value is 5.
  12636. @item accuracy
  12637. Set the accuracy of the detection process. It must be a value in the
  12638. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  12639. accuracy. Default value is 15.
  12640. @item stepsize
  12641. Set stepsize of the search process. The region around minimum is
  12642. scanned with 1 pixel resolution. Default value is 6.
  12643. @item mincontrast
  12644. Set minimum contrast. Below this value a local measurement field is
  12645. discarded. Must be a floating point value in the range 0-1. Default
  12646. value is 0.3.
  12647. @item tripod
  12648. Set reference frame number for tripod mode.
  12649. If enabled, the motion of the frames is compared to a reference frame
  12650. in the filtered stream, identified by the specified number. The idea
  12651. is to compensate all movements in a more-or-less static scene and keep
  12652. the camera view absolutely still.
  12653. If set to 0, it is disabled. The frames are counted starting from 1.
  12654. @item show
  12655. Show fields and transforms in the resulting frames. It accepts an
  12656. integer in the range 0-2. Default value is 0, which disables any
  12657. visualization.
  12658. @end table
  12659. @subsection Examples
  12660. @itemize
  12661. @item
  12662. Use default values:
  12663. @example
  12664. vidstabdetect
  12665. @end example
  12666. @item
  12667. Analyze strongly shaky movie and put the results in file
  12668. @file{mytransforms.trf}:
  12669. @example
  12670. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12671. @end example
  12672. @item
  12673. Visualize the result of internal transformations in the resulting
  12674. video:
  12675. @example
  12676. vidstabdetect=show=1
  12677. @end example
  12678. @item
  12679. Analyze a video with medium shakiness using @command{ffmpeg}:
  12680. @example
  12681. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12682. @end example
  12683. @end itemize
  12684. @anchor{vidstabtransform}
  12685. @section vidstabtransform
  12686. Video stabilization/deshaking: pass 2 of 2,
  12687. see @ref{vidstabdetect} for pass 1.
  12688. Read a file with transform information for each frame and
  12689. apply/compensate them. Together with the @ref{vidstabdetect}
  12690. filter this can be used to deshake videos. See also
  12691. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12692. the @ref{unsharp} filter, see below.
  12693. To enable compilation of this filter you need to configure FFmpeg with
  12694. @code{--enable-libvidstab}.
  12695. @subsection Options
  12696. @table @option
  12697. @item input
  12698. Set path to the file used to read the transforms. Default value is
  12699. @file{transforms.trf}.
  12700. @item smoothing
  12701. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12702. camera movements. Default value is 10.
  12703. For example a number of 10 means that 21 frames are used (10 in the
  12704. past and 10 in the future) to smoothen the motion in the video. A
  12705. larger value leads to a smoother video, but limits the acceleration of
  12706. the camera (pan/tilt movements). 0 is a special case where a static
  12707. camera is simulated.
  12708. @item optalgo
  12709. Set the camera path optimization algorithm.
  12710. Accepted values are:
  12711. @table @samp
  12712. @item gauss
  12713. gaussian kernel low-pass filter on camera motion (default)
  12714. @item avg
  12715. averaging on transformations
  12716. @end table
  12717. @item maxshift
  12718. Set maximal number of pixels to translate frames. Default value is -1,
  12719. meaning no limit.
  12720. @item maxangle
  12721. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12722. value is -1, meaning no limit.
  12723. @item crop
  12724. Specify how to deal with borders that may be visible due to movement
  12725. compensation.
  12726. Available values are:
  12727. @table @samp
  12728. @item keep
  12729. keep image information from previous frame (default)
  12730. @item black
  12731. fill the border black
  12732. @end table
  12733. @item invert
  12734. Invert transforms if set to 1. Default value is 0.
  12735. @item relative
  12736. Consider transforms as relative to previous frame if set to 1,
  12737. absolute if set to 0. Default value is 0.
  12738. @item zoom
  12739. Set percentage to zoom. A positive value will result in a zoom-in
  12740. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12741. zoom).
  12742. @item optzoom
  12743. Set optimal zooming to avoid borders.
  12744. Accepted values are:
  12745. @table @samp
  12746. @item 0
  12747. disabled
  12748. @item 1
  12749. optimal static zoom value is determined (only very strong movements
  12750. will lead to visible borders) (default)
  12751. @item 2
  12752. optimal adaptive zoom value is determined (no borders will be
  12753. visible), see @option{zoomspeed}
  12754. @end table
  12755. Note that the value given at zoom is added to the one calculated here.
  12756. @item zoomspeed
  12757. Set percent to zoom maximally each frame (enabled when
  12758. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12759. 0.25.
  12760. @item interpol
  12761. Specify type of interpolation.
  12762. Available values are:
  12763. @table @samp
  12764. @item no
  12765. no interpolation
  12766. @item linear
  12767. linear only horizontal
  12768. @item bilinear
  12769. linear in both directions (default)
  12770. @item bicubic
  12771. cubic in both directions (slow)
  12772. @end table
  12773. @item tripod
  12774. Enable virtual tripod mode if set to 1, which is equivalent to
  12775. @code{relative=0:smoothing=0}. Default value is 0.
  12776. Use also @code{tripod} option of @ref{vidstabdetect}.
  12777. @item debug
  12778. Increase log verbosity if set to 1. Also the detected global motions
  12779. are written to the temporary file @file{global_motions.trf}. Default
  12780. value is 0.
  12781. @end table
  12782. @subsection Examples
  12783. @itemize
  12784. @item
  12785. Use @command{ffmpeg} for a typical stabilization with default values:
  12786. @example
  12787. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12788. @end example
  12789. Note the use of the @ref{unsharp} filter which is always recommended.
  12790. @item
  12791. Zoom in a bit more and load transform data from a given file:
  12792. @example
  12793. vidstabtransform=zoom=5:input="mytransforms.trf"
  12794. @end example
  12795. @item
  12796. Smoothen the video even more:
  12797. @example
  12798. vidstabtransform=smoothing=30
  12799. @end example
  12800. @end itemize
  12801. @section vflip
  12802. Flip the input video vertically.
  12803. For example, to vertically flip a video with @command{ffmpeg}:
  12804. @example
  12805. ffmpeg -i in.avi -vf "vflip" out.avi
  12806. @end example
  12807. @section vfrdet
  12808. Detect variable frame rate video.
  12809. This filter tries to detect if the input is variable or constant frame rate.
  12810. At end it will output number of frames detected as having variable delta pts,
  12811. and ones with constant delta pts.
  12812. If there was frames with variable delta, than it will also show min and max delta
  12813. encountered.
  12814. @anchor{vignette}
  12815. @section vignette
  12816. Make or reverse a natural vignetting effect.
  12817. The filter accepts the following options:
  12818. @table @option
  12819. @item angle, a
  12820. Set lens angle expression as a number of radians.
  12821. The value is clipped in the @code{[0,PI/2]} range.
  12822. Default value: @code{"PI/5"}
  12823. @item x0
  12824. @item y0
  12825. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12826. by default.
  12827. @item mode
  12828. Set forward/backward mode.
  12829. Available modes are:
  12830. @table @samp
  12831. @item forward
  12832. The larger the distance from the central point, the darker the image becomes.
  12833. @item backward
  12834. The larger the distance from the central point, the brighter the image becomes.
  12835. This can be used to reverse a vignette effect, though there is no automatic
  12836. detection to extract the lens @option{angle} and other settings (yet). It can
  12837. also be used to create a burning effect.
  12838. @end table
  12839. Default value is @samp{forward}.
  12840. @item eval
  12841. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12842. It accepts the following values:
  12843. @table @samp
  12844. @item init
  12845. Evaluate expressions only once during the filter initialization.
  12846. @item frame
  12847. Evaluate expressions for each incoming frame. This is way slower than the
  12848. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12849. allows advanced dynamic expressions.
  12850. @end table
  12851. Default value is @samp{init}.
  12852. @item dither
  12853. Set dithering to reduce the circular banding effects. Default is @code{1}
  12854. (enabled).
  12855. @item aspect
  12856. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12857. Setting this value to the SAR of the input will make a rectangular vignetting
  12858. following the dimensions of the video.
  12859. Default is @code{1/1}.
  12860. @end table
  12861. @subsection Expressions
  12862. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12863. following parameters.
  12864. @table @option
  12865. @item w
  12866. @item h
  12867. input width and height
  12868. @item n
  12869. the number of input frame, starting from 0
  12870. @item pts
  12871. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12872. @var{TB} units, NAN if undefined
  12873. @item r
  12874. frame rate of the input video, NAN if the input frame rate is unknown
  12875. @item t
  12876. the PTS (Presentation TimeStamp) of the filtered video frame,
  12877. expressed in seconds, NAN if undefined
  12878. @item tb
  12879. time base of the input video
  12880. @end table
  12881. @subsection Examples
  12882. @itemize
  12883. @item
  12884. Apply simple strong vignetting effect:
  12885. @example
  12886. vignette=PI/4
  12887. @end example
  12888. @item
  12889. Make a flickering vignetting:
  12890. @example
  12891. vignette='PI/4+random(1)*PI/50':eval=frame
  12892. @end example
  12893. @end itemize
  12894. @section vmafmotion
  12895. Obtain the average vmaf motion score of a video.
  12896. It is one of the component filters of VMAF.
  12897. The obtained average motion score is printed through the logging system.
  12898. In the below example the input file @file{ref.mpg} is being processed and score
  12899. is computed.
  12900. @example
  12901. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12902. @end example
  12903. @section vstack
  12904. Stack input videos vertically.
  12905. All streams must be of same pixel format and of same width.
  12906. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12907. to create same output.
  12908. The filter accept the following option:
  12909. @table @option
  12910. @item inputs
  12911. Set number of input streams. Default is 2.
  12912. @item shortest
  12913. If set to 1, force the output to terminate when the shortest input
  12914. terminates. Default value is 0.
  12915. @end table
  12916. @section w3fdif
  12917. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12918. Deinterlacing Filter").
  12919. Based on the process described by Martin Weston for BBC R&D, and
  12920. implemented based on the de-interlace algorithm written by Jim
  12921. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12922. uses filter coefficients calculated by BBC R&D.
  12923. There are two sets of filter coefficients, so called "simple":
  12924. and "complex". Which set of filter coefficients is used can
  12925. be set by passing an optional parameter:
  12926. @table @option
  12927. @item filter
  12928. Set the interlacing filter coefficients. Accepts one of the following values:
  12929. @table @samp
  12930. @item simple
  12931. Simple filter coefficient set.
  12932. @item complex
  12933. More-complex filter coefficient set.
  12934. @end table
  12935. Default value is @samp{complex}.
  12936. @item deint
  12937. Specify which frames to deinterlace. Accept one of the following values:
  12938. @table @samp
  12939. @item all
  12940. Deinterlace all frames,
  12941. @item interlaced
  12942. Only deinterlace frames marked as interlaced.
  12943. @end table
  12944. Default value is @samp{all}.
  12945. @end table
  12946. @section waveform
  12947. Video waveform monitor.
  12948. The waveform monitor plots color component intensity. By default luminance
  12949. only. Each column of the waveform corresponds to a column of pixels in the
  12950. source video.
  12951. It accepts the following options:
  12952. @table @option
  12953. @item mode, m
  12954. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12955. In row mode, the graph on the left side represents color component value 0 and
  12956. the right side represents value = 255. In column mode, the top side represents
  12957. color component value = 0 and bottom side represents value = 255.
  12958. @item intensity, i
  12959. Set intensity. Smaller values are useful to find out how many values of the same
  12960. luminance are distributed across input rows/columns.
  12961. Default value is @code{0.04}. Allowed range is [0, 1].
  12962. @item mirror, r
  12963. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12964. In mirrored mode, higher values will be represented on the left
  12965. side for @code{row} mode and at the top for @code{column} mode. Default is
  12966. @code{1} (mirrored).
  12967. @item display, d
  12968. Set display mode.
  12969. It accepts the following values:
  12970. @table @samp
  12971. @item overlay
  12972. Presents information identical to that in the @code{parade}, except
  12973. that the graphs representing color components are superimposed directly
  12974. over one another.
  12975. This display mode makes it easier to spot relative differences or similarities
  12976. in overlapping areas of the color components that are supposed to be identical,
  12977. such as neutral whites, grays, or blacks.
  12978. @item stack
  12979. Display separate graph for the color components side by side in
  12980. @code{row} mode or one below the other in @code{column} mode.
  12981. @item parade
  12982. Display separate graph for the color components side by side in
  12983. @code{column} mode or one below the other in @code{row} mode.
  12984. Using this display mode makes it easy to spot color casts in the highlights
  12985. and shadows of an image, by comparing the contours of the top and the bottom
  12986. graphs of each waveform. Since whites, grays, and blacks are characterized
  12987. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12988. should display three waveforms of roughly equal width/height. If not, the
  12989. correction is easy to perform by making level adjustments the three waveforms.
  12990. @end table
  12991. Default is @code{stack}.
  12992. @item components, c
  12993. Set which color components to display. Default is 1, which means only luminance
  12994. or red color component if input is in RGB colorspace. If is set for example to
  12995. 7 it will display all 3 (if) available color components.
  12996. @item envelope, e
  12997. @table @samp
  12998. @item none
  12999. No envelope, this is default.
  13000. @item instant
  13001. Instant envelope, minimum and maximum values presented in graph will be easily
  13002. visible even with small @code{step} value.
  13003. @item peak
  13004. Hold minimum and maximum values presented in graph across time. This way you
  13005. can still spot out of range values without constantly looking at waveforms.
  13006. @item peak+instant
  13007. Peak and instant envelope combined together.
  13008. @end table
  13009. @item filter, f
  13010. @table @samp
  13011. @item lowpass
  13012. No filtering, this is default.
  13013. @item flat
  13014. Luma and chroma combined together.
  13015. @item aflat
  13016. Similar as above, but shows difference between blue and red chroma.
  13017. @item xflat
  13018. Similar as above, but use different colors.
  13019. @item chroma
  13020. Displays only chroma.
  13021. @item color
  13022. Displays actual color value on waveform.
  13023. @item acolor
  13024. Similar as above, but with luma showing frequency of chroma values.
  13025. @end table
  13026. @item graticule, g
  13027. Set which graticule to display.
  13028. @table @samp
  13029. @item none
  13030. Do not display graticule.
  13031. @item green
  13032. Display green graticule showing legal broadcast ranges.
  13033. @item orange
  13034. Display orange graticule showing legal broadcast ranges.
  13035. @end table
  13036. @item opacity, o
  13037. Set graticule opacity.
  13038. @item flags, fl
  13039. Set graticule flags.
  13040. @table @samp
  13041. @item numbers
  13042. Draw numbers above lines. By default enabled.
  13043. @item dots
  13044. Draw dots instead of lines.
  13045. @end table
  13046. @item scale, s
  13047. Set scale used for displaying graticule.
  13048. @table @samp
  13049. @item digital
  13050. @item millivolts
  13051. @item ire
  13052. @end table
  13053. Default is digital.
  13054. @item bgopacity, b
  13055. Set background opacity.
  13056. @end table
  13057. @section weave, doubleweave
  13058. The @code{weave} takes a field-based video input and join
  13059. each two sequential fields into single frame, producing a new double
  13060. height clip with half the frame rate and half the frame count.
  13061. The @code{doubleweave} works same as @code{weave} but without
  13062. halving frame rate and frame count.
  13063. It accepts the following option:
  13064. @table @option
  13065. @item first_field
  13066. Set first field. Available values are:
  13067. @table @samp
  13068. @item top, t
  13069. Set the frame as top-field-first.
  13070. @item bottom, b
  13071. Set the frame as bottom-field-first.
  13072. @end table
  13073. @end table
  13074. @subsection Examples
  13075. @itemize
  13076. @item
  13077. Interlace video using @ref{select} and @ref{separatefields} filter:
  13078. @example
  13079. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  13080. @end example
  13081. @end itemize
  13082. @section xbr
  13083. Apply the xBR high-quality magnification filter which is designed for pixel
  13084. art. It follows a set of edge-detection rules, see
  13085. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  13086. It accepts the following option:
  13087. @table @option
  13088. @item n
  13089. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  13090. @code{3xBR} and @code{4} for @code{4xBR}.
  13091. Default is @code{3}.
  13092. @end table
  13093. @anchor{yadif}
  13094. @section yadif
  13095. Deinterlace the input video ("yadif" means "yet another deinterlacing
  13096. filter").
  13097. It accepts the following parameters:
  13098. @table @option
  13099. @item mode
  13100. The interlacing mode to adopt. It accepts one of the following values:
  13101. @table @option
  13102. @item 0, send_frame
  13103. Output one frame for each frame.
  13104. @item 1, send_field
  13105. Output one frame for each field.
  13106. @item 2, send_frame_nospatial
  13107. Like @code{send_frame}, but it skips the spatial interlacing check.
  13108. @item 3, send_field_nospatial
  13109. Like @code{send_field}, but it skips the spatial interlacing check.
  13110. @end table
  13111. The default value is @code{send_frame}.
  13112. @item parity
  13113. The picture field parity assumed for the input interlaced video. It accepts one
  13114. of the following values:
  13115. @table @option
  13116. @item 0, tff
  13117. Assume the top field is first.
  13118. @item 1, bff
  13119. Assume the bottom field is first.
  13120. @item -1, auto
  13121. Enable automatic detection of field parity.
  13122. @end table
  13123. The default value is @code{auto}.
  13124. If the interlacing is unknown or the decoder does not export this information,
  13125. top field first will be assumed.
  13126. @item deint
  13127. Specify which frames to deinterlace. Accept one of the following
  13128. values:
  13129. @table @option
  13130. @item 0, all
  13131. Deinterlace all frames.
  13132. @item 1, interlaced
  13133. Only deinterlace frames marked as interlaced.
  13134. @end table
  13135. The default value is @code{all}.
  13136. @end table
  13137. @section zoompan
  13138. Apply Zoom & Pan effect.
  13139. This filter accepts the following options:
  13140. @table @option
  13141. @item zoom, z
  13142. Set the zoom expression. Default is 1.
  13143. @item x
  13144. @item y
  13145. Set the x and y expression. Default is 0.
  13146. @item d
  13147. Set the duration expression in number of frames.
  13148. This sets for how many number of frames effect will last for
  13149. single input image.
  13150. @item s
  13151. Set the output image size, default is 'hd720'.
  13152. @item fps
  13153. Set the output frame rate, default is '25'.
  13154. @end table
  13155. Each expression can contain the following constants:
  13156. @table @option
  13157. @item in_w, iw
  13158. Input width.
  13159. @item in_h, ih
  13160. Input height.
  13161. @item out_w, ow
  13162. Output width.
  13163. @item out_h, oh
  13164. Output height.
  13165. @item in
  13166. Input frame count.
  13167. @item on
  13168. Output frame count.
  13169. @item x
  13170. @item y
  13171. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  13172. for current input frame.
  13173. @item px
  13174. @item py
  13175. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  13176. not yet such frame (first input frame).
  13177. @item zoom
  13178. Last calculated zoom from 'z' expression for current input frame.
  13179. @item pzoom
  13180. Last calculated zoom of last output frame of previous input frame.
  13181. @item duration
  13182. Number of output frames for current input frame. Calculated from 'd' expression
  13183. for each input frame.
  13184. @item pduration
  13185. number of output frames created for previous input frame
  13186. @item a
  13187. Rational number: input width / input height
  13188. @item sar
  13189. sample aspect ratio
  13190. @item dar
  13191. display aspect ratio
  13192. @end table
  13193. @subsection Examples
  13194. @itemize
  13195. @item
  13196. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  13197. @example
  13198. 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
  13199. @end example
  13200. @item
  13201. Zoom-in up to 1.5 and pan always at center of picture:
  13202. @example
  13203. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13204. @end example
  13205. @item
  13206. Same as above but without pausing:
  13207. @example
  13208. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13209. @end example
  13210. @end itemize
  13211. @anchor{zscale}
  13212. @section zscale
  13213. Scale (resize) the input video, using the z.lib library:
  13214. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  13215. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  13216. The zscale filter forces the output display aspect ratio to be the same
  13217. as the input, by changing the output sample aspect ratio.
  13218. If the input image format is different from the format requested by
  13219. the next filter, the zscale filter will convert the input to the
  13220. requested format.
  13221. @subsection Options
  13222. The filter accepts the following options.
  13223. @table @option
  13224. @item width, w
  13225. @item height, h
  13226. Set the output video dimension expression. Default value is the input
  13227. dimension.
  13228. If the @var{width} or @var{w} value is 0, the input width is used for
  13229. the output. If the @var{height} or @var{h} value is 0, the input height
  13230. is used for the output.
  13231. If one and only one of the values is -n with n >= 1, the zscale filter
  13232. will use a value that maintains the aspect ratio of the input image,
  13233. calculated from the other specified dimension. After that it will,
  13234. however, make sure that the calculated dimension is divisible by n and
  13235. adjust the value if necessary.
  13236. If both values are -n with n >= 1, the behavior will be identical to
  13237. both values being set to 0 as previously detailed.
  13238. See below for the list of accepted constants for use in the dimension
  13239. expression.
  13240. @item size, s
  13241. Set the video size. For the syntax of this option, check the
  13242. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13243. @item dither, d
  13244. Set the dither type.
  13245. Possible values are:
  13246. @table @var
  13247. @item none
  13248. @item ordered
  13249. @item random
  13250. @item error_diffusion
  13251. @end table
  13252. Default is none.
  13253. @item filter, f
  13254. Set the resize filter type.
  13255. Possible values are:
  13256. @table @var
  13257. @item point
  13258. @item bilinear
  13259. @item bicubic
  13260. @item spline16
  13261. @item spline36
  13262. @item lanczos
  13263. @end table
  13264. Default is bilinear.
  13265. @item range, r
  13266. Set the color range.
  13267. Possible values are:
  13268. @table @var
  13269. @item input
  13270. @item limited
  13271. @item full
  13272. @end table
  13273. Default is same as input.
  13274. @item primaries, p
  13275. Set the color primaries.
  13276. Possible values are:
  13277. @table @var
  13278. @item input
  13279. @item 709
  13280. @item unspecified
  13281. @item 170m
  13282. @item 240m
  13283. @item 2020
  13284. @end table
  13285. Default is same as input.
  13286. @item transfer, t
  13287. Set the transfer characteristics.
  13288. Possible values are:
  13289. @table @var
  13290. @item input
  13291. @item 709
  13292. @item unspecified
  13293. @item 601
  13294. @item linear
  13295. @item 2020_10
  13296. @item 2020_12
  13297. @item smpte2084
  13298. @item iec61966-2-1
  13299. @item arib-std-b67
  13300. @end table
  13301. Default is same as input.
  13302. @item matrix, m
  13303. Set the colorspace matrix.
  13304. Possible value are:
  13305. @table @var
  13306. @item input
  13307. @item 709
  13308. @item unspecified
  13309. @item 470bg
  13310. @item 170m
  13311. @item 2020_ncl
  13312. @item 2020_cl
  13313. @end table
  13314. Default is same as input.
  13315. @item rangein, rin
  13316. Set the input color range.
  13317. Possible values are:
  13318. @table @var
  13319. @item input
  13320. @item limited
  13321. @item full
  13322. @end table
  13323. Default is same as input.
  13324. @item primariesin, pin
  13325. Set the input color primaries.
  13326. Possible values are:
  13327. @table @var
  13328. @item input
  13329. @item 709
  13330. @item unspecified
  13331. @item 170m
  13332. @item 240m
  13333. @item 2020
  13334. @end table
  13335. Default is same as input.
  13336. @item transferin, tin
  13337. Set the input transfer characteristics.
  13338. Possible values are:
  13339. @table @var
  13340. @item input
  13341. @item 709
  13342. @item unspecified
  13343. @item 601
  13344. @item linear
  13345. @item 2020_10
  13346. @item 2020_12
  13347. @end table
  13348. Default is same as input.
  13349. @item matrixin, min
  13350. Set the input colorspace matrix.
  13351. Possible value are:
  13352. @table @var
  13353. @item input
  13354. @item 709
  13355. @item unspecified
  13356. @item 470bg
  13357. @item 170m
  13358. @item 2020_ncl
  13359. @item 2020_cl
  13360. @end table
  13361. @item chromal, c
  13362. Set the output chroma location.
  13363. Possible values are:
  13364. @table @var
  13365. @item input
  13366. @item left
  13367. @item center
  13368. @item topleft
  13369. @item top
  13370. @item bottomleft
  13371. @item bottom
  13372. @end table
  13373. @item chromalin, cin
  13374. Set the input chroma location.
  13375. Possible values are:
  13376. @table @var
  13377. @item input
  13378. @item left
  13379. @item center
  13380. @item topleft
  13381. @item top
  13382. @item bottomleft
  13383. @item bottom
  13384. @end table
  13385. @item npl
  13386. Set the nominal peak luminance.
  13387. @end table
  13388. The values of the @option{w} and @option{h} options are expressions
  13389. containing the following constants:
  13390. @table @var
  13391. @item in_w
  13392. @item in_h
  13393. The input width and height
  13394. @item iw
  13395. @item ih
  13396. These are the same as @var{in_w} and @var{in_h}.
  13397. @item out_w
  13398. @item out_h
  13399. The output (scaled) width and height
  13400. @item ow
  13401. @item oh
  13402. These are the same as @var{out_w} and @var{out_h}
  13403. @item a
  13404. The same as @var{iw} / @var{ih}
  13405. @item sar
  13406. input sample aspect ratio
  13407. @item dar
  13408. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  13409. @item hsub
  13410. @item vsub
  13411. horizontal and vertical input chroma subsample values. For example for the
  13412. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13413. @item ohsub
  13414. @item ovsub
  13415. horizontal and vertical output chroma subsample values. For example for the
  13416. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13417. @end table
  13418. @table @option
  13419. @end table
  13420. @c man end VIDEO FILTERS
  13421. @chapter Video Sources
  13422. @c man begin VIDEO SOURCES
  13423. Below is a description of the currently available video sources.
  13424. @section buffer
  13425. Buffer video frames, and make them available to the filter chain.
  13426. This source is mainly intended for a programmatic use, in particular
  13427. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  13428. It accepts the following parameters:
  13429. @table @option
  13430. @item video_size
  13431. Specify the size (width and height) of the buffered video frames. For the
  13432. syntax of this option, check the
  13433. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13434. @item width
  13435. The input video width.
  13436. @item height
  13437. The input video height.
  13438. @item pix_fmt
  13439. A string representing the pixel format of the buffered video frames.
  13440. It may be a number corresponding to a pixel format, or a pixel format
  13441. name.
  13442. @item time_base
  13443. Specify the timebase assumed by the timestamps of the buffered frames.
  13444. @item frame_rate
  13445. Specify the frame rate expected for the video stream.
  13446. @item pixel_aspect, sar
  13447. The sample (pixel) aspect ratio of the input video.
  13448. @item sws_param
  13449. Specify the optional parameters to be used for the scale filter which
  13450. is automatically inserted when an input change is detected in the
  13451. input size or format.
  13452. @item hw_frames_ctx
  13453. When using a hardware pixel format, this should be a reference to an
  13454. AVHWFramesContext describing input frames.
  13455. @end table
  13456. For example:
  13457. @example
  13458. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  13459. @end example
  13460. will instruct the source to accept video frames with size 320x240 and
  13461. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  13462. square pixels (1:1 sample aspect ratio).
  13463. Since the pixel format with name "yuv410p" corresponds to the number 6
  13464. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  13465. this example corresponds to:
  13466. @example
  13467. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  13468. @end example
  13469. Alternatively, the options can be specified as a flat string, but this
  13470. syntax is deprecated:
  13471. @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}]
  13472. @section cellauto
  13473. Create a pattern generated by an elementary cellular automaton.
  13474. The initial state of the cellular automaton can be defined through the
  13475. @option{filename} and @option{pattern} options. If such options are
  13476. not specified an initial state is created randomly.
  13477. At each new frame a new row in the video is filled with the result of
  13478. the cellular automaton next generation. The behavior when the whole
  13479. frame is filled is defined by the @option{scroll} option.
  13480. This source accepts the following options:
  13481. @table @option
  13482. @item filename, f
  13483. Read the initial cellular automaton state, i.e. the starting row, from
  13484. the specified file.
  13485. In the file, each non-whitespace character is considered an alive
  13486. cell, a newline will terminate the row, and further characters in the
  13487. file will be ignored.
  13488. @item pattern, p
  13489. Read the initial cellular automaton state, i.e. the starting row, from
  13490. the specified string.
  13491. Each non-whitespace character in the string is considered an alive
  13492. cell, a newline will terminate the row, and further characters in the
  13493. string will be ignored.
  13494. @item rate, r
  13495. Set the video rate, that is the number of frames generated per second.
  13496. Default is 25.
  13497. @item random_fill_ratio, ratio
  13498. Set the random fill ratio for the initial cellular automaton row. It
  13499. is a floating point number value ranging from 0 to 1, defaults to
  13500. 1/PHI.
  13501. This option is ignored when a file or a pattern is specified.
  13502. @item random_seed, seed
  13503. Set the seed for filling randomly the initial row, must be an integer
  13504. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13505. set to -1, the filter will try to use a good random seed on a best
  13506. effort basis.
  13507. @item rule
  13508. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  13509. Default value is 110.
  13510. @item size, s
  13511. Set the size of the output video. For the syntax of this option, check the
  13512. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13513. If @option{filename} or @option{pattern} is specified, the size is set
  13514. by default to the width of the specified initial state row, and the
  13515. height is set to @var{width} * PHI.
  13516. If @option{size} is set, it must contain the width of the specified
  13517. pattern string, and the specified pattern will be centered in the
  13518. larger row.
  13519. If a filename or a pattern string is not specified, the size value
  13520. defaults to "320x518" (used for a randomly generated initial state).
  13521. @item scroll
  13522. If set to 1, scroll the output upward when all the rows in the output
  13523. have been already filled. If set to 0, the new generated row will be
  13524. written over the top row just after the bottom row is filled.
  13525. Defaults to 1.
  13526. @item start_full, full
  13527. If set to 1, completely fill the output with generated rows before
  13528. outputting the first frame.
  13529. This is the default behavior, for disabling set the value to 0.
  13530. @item stitch
  13531. If set to 1, stitch the left and right row edges together.
  13532. This is the default behavior, for disabling set the value to 0.
  13533. @end table
  13534. @subsection Examples
  13535. @itemize
  13536. @item
  13537. Read the initial state from @file{pattern}, and specify an output of
  13538. size 200x400.
  13539. @example
  13540. cellauto=f=pattern:s=200x400
  13541. @end example
  13542. @item
  13543. Generate a random initial row with a width of 200 cells, with a fill
  13544. ratio of 2/3:
  13545. @example
  13546. cellauto=ratio=2/3:s=200x200
  13547. @end example
  13548. @item
  13549. Create a pattern generated by rule 18 starting by a single alive cell
  13550. centered on an initial row with width 100:
  13551. @example
  13552. cellauto=p=@@:s=100x400:full=0:rule=18
  13553. @end example
  13554. @item
  13555. Specify a more elaborated initial pattern:
  13556. @example
  13557. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  13558. @end example
  13559. @end itemize
  13560. @anchor{coreimagesrc}
  13561. @section coreimagesrc
  13562. Video source generated on GPU using Apple's CoreImage API on OSX.
  13563. This video source is a specialized version of the @ref{coreimage} video filter.
  13564. Use a core image generator at the beginning of the applied filterchain to
  13565. generate the content.
  13566. The coreimagesrc video source accepts the following options:
  13567. @table @option
  13568. @item list_generators
  13569. List all available generators along with all their respective options as well as
  13570. possible minimum and maximum values along with the default values.
  13571. @example
  13572. list_generators=true
  13573. @end example
  13574. @item size, s
  13575. Specify the size of the sourced video. For the syntax of this option, check the
  13576. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13577. The default value is @code{320x240}.
  13578. @item rate, r
  13579. Specify the frame rate of the sourced video, as the number of frames
  13580. generated per second. It has to be a string in the format
  13581. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13582. number or a valid video frame rate abbreviation. The default value is
  13583. "25".
  13584. @item sar
  13585. Set the sample aspect ratio of the sourced video.
  13586. @item duration, d
  13587. Set the duration of the sourced video. See
  13588. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13589. for the accepted syntax.
  13590. If not specified, or the expressed duration is negative, the video is
  13591. supposed to be generated forever.
  13592. @end table
  13593. Additionally, all options of the @ref{coreimage} video filter are accepted.
  13594. A complete filterchain can be used for further processing of the
  13595. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  13596. and examples for details.
  13597. @subsection Examples
  13598. @itemize
  13599. @item
  13600. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  13601. given as complete and escaped command-line for Apple's standard bash shell:
  13602. @example
  13603. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13604. @end example
  13605. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13606. need for a nullsrc video source.
  13607. @end itemize
  13608. @section mandelbrot
  13609. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13610. point specified with @var{start_x} and @var{start_y}.
  13611. This source accepts the following options:
  13612. @table @option
  13613. @item end_pts
  13614. Set the terminal pts value. Default value is 400.
  13615. @item end_scale
  13616. Set the terminal scale value.
  13617. Must be a floating point value. Default value is 0.3.
  13618. @item inner
  13619. Set the inner coloring mode, that is the algorithm used to draw the
  13620. Mandelbrot fractal internal region.
  13621. It shall assume one of the following values:
  13622. @table @option
  13623. @item black
  13624. Set black mode.
  13625. @item convergence
  13626. Show time until convergence.
  13627. @item mincol
  13628. Set color based on point closest to the origin of the iterations.
  13629. @item period
  13630. Set period mode.
  13631. @end table
  13632. Default value is @var{mincol}.
  13633. @item bailout
  13634. Set the bailout value. Default value is 10.0.
  13635. @item maxiter
  13636. Set the maximum of iterations performed by the rendering
  13637. algorithm. Default value is 7189.
  13638. @item outer
  13639. Set outer coloring mode.
  13640. It shall assume one of following values:
  13641. @table @option
  13642. @item iteration_count
  13643. Set iteration cound mode.
  13644. @item normalized_iteration_count
  13645. set normalized iteration count mode.
  13646. @end table
  13647. Default value is @var{normalized_iteration_count}.
  13648. @item rate, r
  13649. Set frame rate, expressed as number of frames per second. Default
  13650. value is "25".
  13651. @item size, s
  13652. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  13653. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  13654. @item start_scale
  13655. Set the initial scale value. Default value is 3.0.
  13656. @item start_x
  13657. Set the initial x position. Must be a floating point value between
  13658. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13659. @item start_y
  13660. Set the initial y position. Must be a floating point value between
  13661. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13662. @end table
  13663. @section mptestsrc
  13664. Generate various test patterns, as generated by the MPlayer test filter.
  13665. The size of the generated video is fixed, and is 256x256.
  13666. This source is useful in particular for testing encoding features.
  13667. This source accepts the following options:
  13668. @table @option
  13669. @item rate, r
  13670. Specify the frame rate of the sourced video, as the number of frames
  13671. generated per second. It has to be a string in the format
  13672. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13673. number or a valid video frame rate abbreviation. The default value is
  13674. "25".
  13675. @item duration, d
  13676. Set the duration of the sourced video. See
  13677. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13678. for the accepted syntax.
  13679. If not specified, or the expressed duration is negative, the video is
  13680. supposed to be generated forever.
  13681. @item test, t
  13682. Set the number or the name of the test to perform. Supported tests are:
  13683. @table @option
  13684. @item dc_luma
  13685. @item dc_chroma
  13686. @item freq_luma
  13687. @item freq_chroma
  13688. @item amp_luma
  13689. @item amp_chroma
  13690. @item cbp
  13691. @item mv
  13692. @item ring1
  13693. @item ring2
  13694. @item all
  13695. @end table
  13696. Default value is "all", which will cycle through the list of all tests.
  13697. @end table
  13698. Some examples:
  13699. @example
  13700. mptestsrc=t=dc_luma
  13701. @end example
  13702. will generate a "dc_luma" test pattern.
  13703. @section frei0r_src
  13704. Provide a frei0r source.
  13705. To enable compilation of this filter you need to install the frei0r
  13706. header and configure FFmpeg with @code{--enable-frei0r}.
  13707. This source accepts the following parameters:
  13708. @table @option
  13709. @item size
  13710. The size of the video to generate. For the syntax of this option, check the
  13711. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13712. @item framerate
  13713. The framerate of the generated video. It may be a string of the form
  13714. @var{num}/@var{den} or a frame rate abbreviation.
  13715. @item filter_name
  13716. The name to the frei0r source to load. For more information regarding frei0r and
  13717. how to set the parameters, read the @ref{frei0r} section in the video filters
  13718. documentation.
  13719. @item filter_params
  13720. A '|'-separated list of parameters to pass to the frei0r source.
  13721. @end table
  13722. For example, to generate a frei0r partik0l source with size 200x200
  13723. and frame rate 10 which is overlaid on the overlay filter main input:
  13724. @example
  13725. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13726. @end example
  13727. @section life
  13728. Generate a life pattern.
  13729. This source is based on a generalization of John Conway's life game.
  13730. The sourced input represents a life grid, each pixel represents a cell
  13731. which can be in one of two possible states, alive or dead. Every cell
  13732. interacts with its eight neighbours, which are the cells that are
  13733. horizontally, vertically, or diagonally adjacent.
  13734. At each interaction the grid evolves according to the adopted rule,
  13735. which specifies the number of neighbor alive cells which will make a
  13736. cell stay alive or born. The @option{rule} option allows one to specify
  13737. the rule to adopt.
  13738. This source accepts the following options:
  13739. @table @option
  13740. @item filename, f
  13741. Set the file from which to read the initial grid state. In the file,
  13742. each non-whitespace character is considered an alive cell, and newline
  13743. is used to delimit the end of each row.
  13744. If this option is not specified, the initial grid is generated
  13745. randomly.
  13746. @item rate, r
  13747. Set the video rate, that is the number of frames generated per second.
  13748. Default is 25.
  13749. @item random_fill_ratio, ratio
  13750. Set the random fill ratio for the initial random grid. It is a
  13751. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13752. It is ignored when a file is specified.
  13753. @item random_seed, seed
  13754. Set the seed for filling the initial random grid, must be an integer
  13755. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13756. set to -1, the filter will try to use a good random seed on a best
  13757. effort basis.
  13758. @item rule
  13759. Set the life rule.
  13760. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13761. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13762. @var{NS} specifies the number of alive neighbor cells which make a
  13763. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13764. which make a dead cell to become alive (i.e. to "born").
  13765. "s" and "b" can be used in place of "S" and "B", respectively.
  13766. Alternatively a rule can be specified by an 18-bits integer. The 9
  13767. high order bits are used to encode the next cell state if it is alive
  13768. for each number of neighbor alive cells, the low order bits specify
  13769. the rule for "borning" new cells. Higher order bits encode for an
  13770. higher number of neighbor cells.
  13771. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13772. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13773. Default value is "S23/B3", which is the original Conway's game of life
  13774. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13775. cells, and will born a new cell if there are three alive cells around
  13776. a dead cell.
  13777. @item size, s
  13778. Set the size of the output video. For the syntax of this option, check the
  13779. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13780. If @option{filename} is specified, the size is set by default to the
  13781. same size of the input file. If @option{size} is set, it must contain
  13782. the size specified in the input file, and the initial grid defined in
  13783. that file is centered in the larger resulting area.
  13784. If a filename is not specified, the size value defaults to "320x240"
  13785. (used for a randomly generated initial grid).
  13786. @item stitch
  13787. If set to 1, stitch the left and right grid edges together, and the
  13788. top and bottom edges also. Defaults to 1.
  13789. @item mold
  13790. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13791. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13792. value from 0 to 255.
  13793. @item life_color
  13794. Set the color of living (or new born) cells.
  13795. @item death_color
  13796. Set the color of dead cells. If @option{mold} is set, this is the first color
  13797. used to represent a dead cell.
  13798. @item mold_color
  13799. Set mold color, for definitely dead and moldy cells.
  13800. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  13801. ffmpeg-utils manual,ffmpeg-utils}.
  13802. @end table
  13803. @subsection Examples
  13804. @itemize
  13805. @item
  13806. Read a grid from @file{pattern}, and center it on a grid of size
  13807. 300x300 pixels:
  13808. @example
  13809. life=f=pattern:s=300x300
  13810. @end example
  13811. @item
  13812. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  13813. @example
  13814. life=ratio=2/3:s=200x200
  13815. @end example
  13816. @item
  13817. Specify a custom rule for evolving a randomly generated grid:
  13818. @example
  13819. life=rule=S14/B34
  13820. @end example
  13821. @item
  13822. Full example with slow death effect (mold) using @command{ffplay}:
  13823. @example
  13824. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13825. @end example
  13826. @end itemize
  13827. @anchor{allrgb}
  13828. @anchor{allyuv}
  13829. @anchor{color}
  13830. @anchor{haldclutsrc}
  13831. @anchor{nullsrc}
  13832. @anchor{pal75bars}
  13833. @anchor{pal100bars}
  13834. @anchor{rgbtestsrc}
  13835. @anchor{smptebars}
  13836. @anchor{smptehdbars}
  13837. @anchor{testsrc}
  13838. @anchor{testsrc2}
  13839. @anchor{yuvtestsrc}
  13840. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13841. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13842. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13843. The @code{color} source provides an uniformly colored input.
  13844. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13845. @ref{haldclut} filter.
  13846. The @code{nullsrc} source returns unprocessed video frames. It is
  13847. mainly useful to be employed in analysis / debugging tools, or as the
  13848. source for filters which ignore the input data.
  13849. The @code{pal75bars} source generates a color bars pattern, based on
  13850. EBU PAL recommendations with 75% color levels.
  13851. The @code{pal100bars} source generates a color bars pattern, based on
  13852. EBU PAL recommendations with 100% color levels.
  13853. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13854. detecting RGB vs BGR issues. You should see a red, green and blue
  13855. stripe from top to bottom.
  13856. The @code{smptebars} source generates a color bars pattern, based on
  13857. the SMPTE Engineering Guideline EG 1-1990.
  13858. The @code{smptehdbars} source generates a color bars pattern, based on
  13859. the SMPTE RP 219-2002.
  13860. The @code{testsrc} source generates a test video pattern, showing a
  13861. color pattern, a scrolling gradient and a timestamp. This is mainly
  13862. intended for testing purposes.
  13863. The @code{testsrc2} source is similar to testsrc, but supports more
  13864. pixel formats instead of just @code{rgb24}. This allows using it as an
  13865. input for other tests without requiring a format conversion.
  13866. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13867. see a y, cb and cr stripe from top to bottom.
  13868. The sources accept the following parameters:
  13869. @table @option
  13870. @item level
  13871. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13872. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13873. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13874. coded on a @code{1/(N*N)} scale.
  13875. @item color, c
  13876. Specify the color of the source, only available in the @code{color}
  13877. source. For the syntax of this option, check the
  13878. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13879. @item size, s
  13880. Specify the size of the sourced video. For the syntax of this option, check the
  13881. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13882. The default value is @code{320x240}.
  13883. This option is not available with the @code{allrgb}, @code{allyuv}, and
  13884. @code{haldclutsrc} filters.
  13885. @item rate, r
  13886. Specify the frame rate of the sourced video, as the number of frames
  13887. generated per second. It has to be a string in the format
  13888. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13889. number or a valid video frame rate abbreviation. The default value is
  13890. "25".
  13891. @item duration, d
  13892. Set the duration of the sourced video. See
  13893. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13894. for the accepted syntax.
  13895. If not specified, or the expressed duration is negative, the video is
  13896. supposed to be generated forever.
  13897. @item sar
  13898. Set the sample aspect ratio of the sourced video.
  13899. @item alpha
  13900. Specify the alpha (opacity) of the background, only available in the
  13901. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13902. 255 (fully opaque, the default).
  13903. @item decimals, n
  13904. Set the number of decimals to show in the timestamp, only available in the
  13905. @code{testsrc} source.
  13906. The displayed timestamp value will correspond to the original
  13907. timestamp value multiplied by the power of 10 of the specified
  13908. value. Default value is 0.
  13909. @end table
  13910. @subsection Examples
  13911. @itemize
  13912. @item
  13913. Generate a video with a duration of 5.3 seconds, with size
  13914. 176x144 and a frame rate of 10 frames per second:
  13915. @example
  13916. testsrc=duration=5.3:size=qcif:rate=10
  13917. @end example
  13918. @item
  13919. The following graph description will generate a red source
  13920. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13921. frames per second:
  13922. @example
  13923. color=c=red@@0.2:s=qcif:r=10
  13924. @end example
  13925. @item
  13926. If the input content is to be ignored, @code{nullsrc} can be used. The
  13927. following command generates noise in the luminance plane by employing
  13928. the @code{geq} filter:
  13929. @example
  13930. nullsrc=s=256x256, geq=random(1)*255:128:128
  13931. @end example
  13932. @end itemize
  13933. @subsection Commands
  13934. The @code{color} source supports the following commands:
  13935. @table @option
  13936. @item c, color
  13937. Set the color of the created image. Accepts the same syntax of the
  13938. corresponding @option{color} option.
  13939. @end table
  13940. @section openclsrc
  13941. Generate video using an OpenCL program.
  13942. @table @option
  13943. @item source
  13944. OpenCL program source file.
  13945. @item kernel
  13946. Kernel name in program.
  13947. @item size, s
  13948. Size of frames to generate. This must be set.
  13949. @item format
  13950. Pixel format to use for the generated frames. This must be set.
  13951. @item rate, r
  13952. Number of frames generated every second. Default value is '25'.
  13953. @end table
  13954. For details of how the program loading works, see the @ref{program_opencl}
  13955. filter.
  13956. Example programs:
  13957. @itemize
  13958. @item
  13959. Generate a colour ramp by setting pixel values from the position of the pixel
  13960. in the output image. (Note that this will work with all pixel formats, but
  13961. the generated output will not be the same.)
  13962. @verbatim
  13963. __kernel void ramp(__write_only image2d_t dst,
  13964. unsigned int index)
  13965. {
  13966. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13967. float4 val;
  13968. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  13969. write_imagef(dst, loc, val);
  13970. }
  13971. @end verbatim
  13972. @item
  13973. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  13974. @verbatim
  13975. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  13976. unsigned int index)
  13977. {
  13978. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13979. float4 value = 0.0f;
  13980. int x = loc.x + index;
  13981. int y = loc.y + index;
  13982. while (x > 0 || y > 0) {
  13983. if (x % 3 == 1 && y % 3 == 1) {
  13984. value = 1.0f;
  13985. break;
  13986. }
  13987. x /= 3;
  13988. y /= 3;
  13989. }
  13990. write_imagef(dst, loc, value);
  13991. }
  13992. @end verbatim
  13993. @end itemize
  13994. @c man end VIDEO SOURCES
  13995. @chapter Video Sinks
  13996. @c man begin VIDEO SINKS
  13997. Below is a description of the currently available video sinks.
  13998. @section buffersink
  13999. Buffer video frames, and make them available to the end of the filter
  14000. graph.
  14001. This sink is mainly intended for programmatic use, in particular
  14002. through the interface defined in @file{libavfilter/buffersink.h}
  14003. or the options system.
  14004. It accepts a pointer to an AVBufferSinkContext structure, which
  14005. defines the incoming buffers' formats, to be passed as the opaque
  14006. parameter to @code{avfilter_init_filter} for initialization.
  14007. @section nullsink
  14008. Null video sink: do absolutely nothing with the input video. It is
  14009. mainly useful as a template and for use in analysis / debugging
  14010. tools.
  14011. @c man end VIDEO SINKS
  14012. @chapter Multimedia Filters
  14013. @c man begin MULTIMEDIA FILTERS
  14014. Below is a description of the currently available multimedia filters.
  14015. @section abitscope
  14016. Convert input audio to a video output, displaying the audio bit scope.
  14017. The filter accepts the following options:
  14018. @table @option
  14019. @item rate, r
  14020. Set frame rate, expressed as number of frames per second. Default
  14021. value is "25".
  14022. @item size, s
  14023. Specify the video size for the output. For the syntax of this option, check the
  14024. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14025. Default value is @code{1024x256}.
  14026. @item colors
  14027. Specify list of colors separated by space or by '|' which will be used to
  14028. draw channels. Unrecognized or missing colors will be replaced
  14029. by white color.
  14030. @end table
  14031. @section ahistogram
  14032. Convert input audio to a video output, displaying the volume histogram.
  14033. The filter accepts the following options:
  14034. @table @option
  14035. @item dmode
  14036. Specify how histogram is calculated.
  14037. It accepts the following values:
  14038. @table @samp
  14039. @item single
  14040. Use single histogram for all channels.
  14041. @item separate
  14042. Use separate histogram for each channel.
  14043. @end table
  14044. Default is @code{single}.
  14045. @item rate, r
  14046. Set frame rate, expressed as number of frames per second. Default
  14047. value is "25".
  14048. @item size, s
  14049. Specify the video size for the output. For the syntax of this option, check the
  14050. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14051. Default value is @code{hd720}.
  14052. @item scale
  14053. Set display scale.
  14054. It accepts the following values:
  14055. @table @samp
  14056. @item log
  14057. logarithmic
  14058. @item sqrt
  14059. square root
  14060. @item cbrt
  14061. cubic root
  14062. @item lin
  14063. linear
  14064. @item rlog
  14065. reverse logarithmic
  14066. @end table
  14067. Default is @code{log}.
  14068. @item ascale
  14069. Set amplitude scale.
  14070. It accepts the following values:
  14071. @table @samp
  14072. @item log
  14073. logarithmic
  14074. @item lin
  14075. linear
  14076. @end table
  14077. Default is @code{log}.
  14078. @item acount
  14079. Set how much frames to accumulate in histogram.
  14080. Defauls is 1. Setting this to -1 accumulates all frames.
  14081. @item rheight
  14082. Set histogram ratio of window height.
  14083. @item slide
  14084. Set sonogram sliding.
  14085. It accepts the following values:
  14086. @table @samp
  14087. @item replace
  14088. replace old rows with new ones.
  14089. @item scroll
  14090. scroll from top to bottom.
  14091. @end table
  14092. Default is @code{replace}.
  14093. @end table
  14094. @section aphasemeter
  14095. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  14096. representing mean phase of current audio frame. A video output can also be produced and is
  14097. enabled by default. The audio is passed through as first output.
  14098. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  14099. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  14100. and @code{1} means channels are in phase.
  14101. The filter accepts the following options, all related to its video output:
  14102. @table @option
  14103. @item rate, r
  14104. Set the output frame rate. Default value is @code{25}.
  14105. @item size, s
  14106. Set the video size for the output. For the syntax of this option, check the
  14107. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14108. Default value is @code{800x400}.
  14109. @item rc
  14110. @item gc
  14111. @item bc
  14112. Specify the red, green, blue contrast. Default values are @code{2},
  14113. @code{7} and @code{1}.
  14114. Allowed range is @code{[0, 255]}.
  14115. @item mpc
  14116. Set color which will be used for drawing median phase. If color is
  14117. @code{none} which is default, no median phase value will be drawn.
  14118. @item video
  14119. Enable video output. Default is enabled.
  14120. @end table
  14121. @section avectorscope
  14122. Convert input audio to a video output, representing the audio vector
  14123. scope.
  14124. The filter is used to measure the difference between channels of stereo
  14125. audio stream. A monoaural signal, consisting of identical left and right
  14126. signal, results in straight vertical line. Any stereo separation is visible
  14127. as a deviation from this line, creating a Lissajous figure.
  14128. If the straight (or deviation from it) but horizontal line appears this
  14129. indicates that the left and right channels are out of phase.
  14130. The filter accepts the following options:
  14131. @table @option
  14132. @item mode, m
  14133. Set the vectorscope mode.
  14134. Available values are:
  14135. @table @samp
  14136. @item lissajous
  14137. Lissajous rotated by 45 degrees.
  14138. @item lissajous_xy
  14139. Same as above but not rotated.
  14140. @item polar
  14141. Shape resembling half of circle.
  14142. @end table
  14143. Default value is @samp{lissajous}.
  14144. @item size, s
  14145. Set the video size for the output. For the syntax of this option, check the
  14146. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14147. Default value is @code{400x400}.
  14148. @item rate, r
  14149. Set the output frame rate. Default value is @code{25}.
  14150. @item rc
  14151. @item gc
  14152. @item bc
  14153. @item ac
  14154. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  14155. @code{160}, @code{80} and @code{255}.
  14156. Allowed range is @code{[0, 255]}.
  14157. @item rf
  14158. @item gf
  14159. @item bf
  14160. @item af
  14161. Specify the red, green, blue and alpha fade. Default values are @code{15},
  14162. @code{10}, @code{5} and @code{5}.
  14163. Allowed range is @code{[0, 255]}.
  14164. @item zoom
  14165. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  14166. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  14167. @item draw
  14168. Set the vectorscope drawing mode.
  14169. Available values are:
  14170. @table @samp
  14171. @item dot
  14172. Draw dot for each sample.
  14173. @item line
  14174. Draw line between previous and current sample.
  14175. @end table
  14176. Default value is @samp{dot}.
  14177. @item scale
  14178. Specify amplitude scale of audio samples.
  14179. Available values are:
  14180. @table @samp
  14181. @item lin
  14182. Linear.
  14183. @item sqrt
  14184. Square root.
  14185. @item cbrt
  14186. Cubic root.
  14187. @item log
  14188. Logarithmic.
  14189. @end table
  14190. @item swap
  14191. Swap left channel axis with right channel axis.
  14192. @item mirror
  14193. Mirror axis.
  14194. @table @samp
  14195. @item none
  14196. No mirror.
  14197. @item x
  14198. Mirror only x axis.
  14199. @item y
  14200. Mirror only y axis.
  14201. @item xy
  14202. Mirror both axis.
  14203. @end table
  14204. @end table
  14205. @subsection Examples
  14206. @itemize
  14207. @item
  14208. Complete example using @command{ffplay}:
  14209. @example
  14210. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14211. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  14212. @end example
  14213. @end itemize
  14214. @section bench, abench
  14215. Benchmark part of a filtergraph.
  14216. The filter accepts the following options:
  14217. @table @option
  14218. @item action
  14219. Start or stop a timer.
  14220. Available values are:
  14221. @table @samp
  14222. @item start
  14223. Get the current time, set it as frame metadata (using the key
  14224. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  14225. @item stop
  14226. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  14227. the input frame metadata to get the time difference. Time difference, average,
  14228. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  14229. @code{min}) are then printed. The timestamps are expressed in seconds.
  14230. @end table
  14231. @end table
  14232. @subsection Examples
  14233. @itemize
  14234. @item
  14235. Benchmark @ref{selectivecolor} filter:
  14236. @example
  14237. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  14238. @end example
  14239. @end itemize
  14240. @section concat
  14241. Concatenate audio and video streams, joining them together one after the
  14242. other.
  14243. The filter works on segments of synchronized video and audio streams. All
  14244. segments must have the same number of streams of each type, and that will
  14245. also be the number of streams at output.
  14246. The filter accepts the following options:
  14247. @table @option
  14248. @item n
  14249. Set the number of segments. Default is 2.
  14250. @item v
  14251. Set the number of output video streams, that is also the number of video
  14252. streams in each segment. Default is 1.
  14253. @item a
  14254. Set the number of output audio streams, that is also the number of audio
  14255. streams in each segment. Default is 0.
  14256. @item unsafe
  14257. Activate unsafe mode: do not fail if segments have a different format.
  14258. @end table
  14259. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  14260. @var{a} audio outputs.
  14261. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  14262. segment, in the same order as the outputs, then the inputs for the second
  14263. segment, etc.
  14264. Related streams do not always have exactly the same duration, for various
  14265. reasons including codec frame size or sloppy authoring. For that reason,
  14266. related synchronized streams (e.g. a video and its audio track) should be
  14267. concatenated at once. The concat filter will use the duration of the longest
  14268. stream in each segment (except the last one), and if necessary pad shorter
  14269. audio streams with silence.
  14270. For this filter to work correctly, all segments must start at timestamp 0.
  14271. All corresponding streams must have the same parameters in all segments; the
  14272. filtering system will automatically select a common pixel format for video
  14273. streams, and a common sample format, sample rate and channel layout for
  14274. audio streams, but other settings, such as resolution, must be converted
  14275. explicitly by the user.
  14276. Different frame rates are acceptable but will result in variable frame rate
  14277. at output; be sure to configure the output file to handle it.
  14278. @subsection Examples
  14279. @itemize
  14280. @item
  14281. Concatenate an opening, an episode and an ending, all in bilingual version
  14282. (video in stream 0, audio in streams 1 and 2):
  14283. @example
  14284. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  14285. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  14286. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  14287. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  14288. @end example
  14289. @item
  14290. Concatenate two parts, handling audio and video separately, using the
  14291. (a)movie sources, and adjusting the resolution:
  14292. @example
  14293. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  14294. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  14295. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  14296. @end example
  14297. Note that a desync will happen at the stitch if the audio and video streams
  14298. do not have exactly the same duration in the first file.
  14299. @end itemize
  14300. @subsection Commands
  14301. This filter supports the following commands:
  14302. @table @option
  14303. @item next
  14304. Close the current segment and step to the next one
  14305. @end table
  14306. @section drawgraph, adrawgraph
  14307. Draw a graph using input video or audio metadata.
  14308. It accepts the following parameters:
  14309. @table @option
  14310. @item m1
  14311. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  14312. @item fg1
  14313. Set 1st foreground color expression.
  14314. @item m2
  14315. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  14316. @item fg2
  14317. Set 2nd foreground color expression.
  14318. @item m3
  14319. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  14320. @item fg3
  14321. Set 3rd foreground color expression.
  14322. @item m4
  14323. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  14324. @item fg4
  14325. Set 4th foreground color expression.
  14326. @item min
  14327. Set minimal value of metadata value.
  14328. @item max
  14329. Set maximal value of metadata value.
  14330. @item bg
  14331. Set graph background color. Default is white.
  14332. @item mode
  14333. Set graph mode.
  14334. Available values for mode is:
  14335. @table @samp
  14336. @item bar
  14337. @item dot
  14338. @item line
  14339. @end table
  14340. Default is @code{line}.
  14341. @item slide
  14342. Set slide mode.
  14343. Available values for slide is:
  14344. @table @samp
  14345. @item frame
  14346. Draw new frame when right border is reached.
  14347. @item replace
  14348. Replace old columns with new ones.
  14349. @item scroll
  14350. Scroll from right to left.
  14351. @item rscroll
  14352. Scroll from left to right.
  14353. @item picture
  14354. Draw single picture.
  14355. @end table
  14356. Default is @code{frame}.
  14357. @item size
  14358. Set size of graph video. For the syntax of this option, check the
  14359. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14360. The default value is @code{900x256}.
  14361. The foreground color expressions can use the following variables:
  14362. @table @option
  14363. @item MIN
  14364. Minimal value of metadata value.
  14365. @item MAX
  14366. Maximal value of metadata value.
  14367. @item VAL
  14368. Current metadata key value.
  14369. @end table
  14370. The color is defined as 0xAABBGGRR.
  14371. @end table
  14372. Example using metadata from @ref{signalstats} filter:
  14373. @example
  14374. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  14375. @end example
  14376. Example using metadata from @ref{ebur128} filter:
  14377. @example
  14378. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  14379. @end example
  14380. @anchor{ebur128}
  14381. @section ebur128
  14382. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  14383. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  14384. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  14385. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  14386. The filter also has a video output (see the @var{video} option) with a real
  14387. time graph to observe the loudness evolution. The graphic contains the logged
  14388. message mentioned above, so it is not printed anymore when this option is set,
  14389. unless the verbose logging is set. The main graphing area contains the
  14390. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  14391. the momentary loudness (400 milliseconds).
  14392. More information about the Loudness Recommendation EBU R128 on
  14393. @url{http://tech.ebu.ch/loudness}.
  14394. The filter accepts the following options:
  14395. @table @option
  14396. @item video
  14397. Activate the video output. The audio stream is passed unchanged whether this
  14398. option is set or no. The video stream will be the first output stream if
  14399. activated. Default is @code{0}.
  14400. @item size
  14401. Set the video size. This option is for video only. For the syntax of this
  14402. option, check the
  14403. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14404. Default and minimum resolution is @code{640x480}.
  14405. @item meter
  14406. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  14407. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  14408. other integer value between this range is allowed.
  14409. @item metadata
  14410. Set metadata injection. If set to @code{1}, the audio input will be segmented
  14411. into 100ms output frames, each of them containing various loudness information
  14412. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  14413. Default is @code{0}.
  14414. @item framelog
  14415. Force the frame logging level.
  14416. Available values are:
  14417. @table @samp
  14418. @item info
  14419. information logging level
  14420. @item verbose
  14421. verbose logging level
  14422. @end table
  14423. By default, the logging level is set to @var{info}. If the @option{video} or
  14424. the @option{metadata} options are set, it switches to @var{verbose}.
  14425. @item peak
  14426. Set peak mode(s).
  14427. Available modes can be cumulated (the option is a @code{flag} type). Possible
  14428. values are:
  14429. @table @samp
  14430. @item none
  14431. Disable any peak mode (default).
  14432. @item sample
  14433. Enable sample-peak mode.
  14434. Simple peak mode looking for the higher sample value. It logs a message
  14435. for sample-peak (identified by @code{SPK}).
  14436. @item true
  14437. Enable true-peak mode.
  14438. If enabled, the peak lookup is done on an over-sampled version of the input
  14439. stream for better peak accuracy. It logs a message for true-peak.
  14440. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  14441. This mode requires a build with @code{libswresample}.
  14442. @end table
  14443. @item dualmono
  14444. Treat mono input files as "dual mono". If a mono file is intended for playback
  14445. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  14446. If set to @code{true}, this option will compensate for this effect.
  14447. Multi-channel input files are not affected by this option.
  14448. @item panlaw
  14449. Set a specific pan law to be used for the measurement of dual mono files.
  14450. This parameter is optional, and has a default value of -3.01dB.
  14451. @end table
  14452. @subsection Examples
  14453. @itemize
  14454. @item
  14455. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  14456. @example
  14457. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  14458. @end example
  14459. @item
  14460. Run an analysis with @command{ffmpeg}:
  14461. @example
  14462. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  14463. @end example
  14464. @end itemize
  14465. @section interleave, ainterleave
  14466. Temporally interleave frames from several inputs.
  14467. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  14468. These filters read frames from several inputs and send the oldest
  14469. queued frame to the output.
  14470. Input streams must have well defined, monotonically increasing frame
  14471. timestamp values.
  14472. In order to submit one frame to output, these filters need to enqueue
  14473. at least one frame for each input, so they cannot work in case one
  14474. input is not yet terminated and will not receive incoming frames.
  14475. For example consider the case when one input is a @code{select} filter
  14476. which always drops input frames. The @code{interleave} filter will keep
  14477. reading from that input, but it will never be able to send new frames
  14478. to output until the input sends an end-of-stream signal.
  14479. Also, depending on inputs synchronization, the filters will drop
  14480. frames in case one input receives more frames than the other ones, and
  14481. the queue is already filled.
  14482. These filters accept the following options:
  14483. @table @option
  14484. @item nb_inputs, n
  14485. Set the number of different inputs, it is 2 by default.
  14486. @end table
  14487. @subsection Examples
  14488. @itemize
  14489. @item
  14490. Interleave frames belonging to different streams using @command{ffmpeg}:
  14491. @example
  14492. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  14493. @end example
  14494. @item
  14495. Add flickering blur effect:
  14496. @example
  14497. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  14498. @end example
  14499. @end itemize
  14500. @section metadata, ametadata
  14501. Manipulate frame metadata.
  14502. This filter accepts the following options:
  14503. @table @option
  14504. @item mode
  14505. Set mode of operation of the filter.
  14506. Can be one of the following:
  14507. @table @samp
  14508. @item select
  14509. If both @code{value} and @code{key} is set, select frames
  14510. which have such metadata. If only @code{key} is set, select
  14511. every frame that has such key in metadata.
  14512. @item add
  14513. Add new metadata @code{key} and @code{value}. If key is already available
  14514. do nothing.
  14515. @item modify
  14516. Modify value of already present key.
  14517. @item delete
  14518. If @code{value} is set, delete only keys that have such value.
  14519. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  14520. the frame.
  14521. @item print
  14522. Print key and its value if metadata was found. If @code{key} is not set print all
  14523. metadata values available in frame.
  14524. @end table
  14525. @item key
  14526. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  14527. @item value
  14528. Set metadata value which will be used. This option is mandatory for
  14529. @code{modify} and @code{add} mode.
  14530. @item function
  14531. Which function to use when comparing metadata value and @code{value}.
  14532. Can be one of following:
  14533. @table @samp
  14534. @item same_str
  14535. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  14536. @item starts_with
  14537. Values are interpreted as strings, returns true if metadata value starts with
  14538. the @code{value} option string.
  14539. @item less
  14540. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  14541. @item equal
  14542. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  14543. @item greater
  14544. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  14545. @item expr
  14546. Values are interpreted as floats, returns true if expression from option @code{expr}
  14547. evaluates to true.
  14548. @end table
  14549. @item expr
  14550. Set expression which is used when @code{function} is set to @code{expr}.
  14551. The expression is evaluated through the eval API and can contain the following
  14552. constants:
  14553. @table @option
  14554. @item VALUE1
  14555. Float representation of @code{value} from metadata key.
  14556. @item VALUE2
  14557. Float representation of @code{value} as supplied by user in @code{value} option.
  14558. @end table
  14559. @item file
  14560. If specified in @code{print} mode, output is written to the named file. Instead of
  14561. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  14562. for standard output. If @code{file} option is not set, output is written to the log
  14563. with AV_LOG_INFO loglevel.
  14564. @end table
  14565. @subsection Examples
  14566. @itemize
  14567. @item
  14568. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  14569. between 0 and 1.
  14570. @example
  14571. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  14572. @end example
  14573. @item
  14574. Print silencedetect output to file @file{metadata.txt}.
  14575. @example
  14576. silencedetect,ametadata=mode=print:file=metadata.txt
  14577. @end example
  14578. @item
  14579. Direct all metadata to a pipe with file descriptor 4.
  14580. @example
  14581. metadata=mode=print:file='pipe\:4'
  14582. @end example
  14583. @end itemize
  14584. @section perms, aperms
  14585. Set read/write permissions for the output frames.
  14586. These filters are mainly aimed at developers to test direct path in the
  14587. following filter in the filtergraph.
  14588. The filters accept the following options:
  14589. @table @option
  14590. @item mode
  14591. Select the permissions mode.
  14592. It accepts the following values:
  14593. @table @samp
  14594. @item none
  14595. Do nothing. This is the default.
  14596. @item ro
  14597. Set all the output frames read-only.
  14598. @item rw
  14599. Set all the output frames directly writable.
  14600. @item toggle
  14601. Make the frame read-only if writable, and writable if read-only.
  14602. @item random
  14603. Set each output frame read-only or writable randomly.
  14604. @end table
  14605. @item seed
  14606. Set the seed for the @var{random} mode, must be an integer included between
  14607. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14608. @code{-1}, the filter will try to use a good random seed on a best effort
  14609. basis.
  14610. @end table
  14611. Note: in case of auto-inserted filter between the permission filter and the
  14612. following one, the permission might not be received as expected in that
  14613. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  14614. perms/aperms filter can avoid this problem.
  14615. @section realtime, arealtime
  14616. Slow down filtering to match real time approximately.
  14617. These filters will pause the filtering for a variable amount of time to
  14618. match the output rate with the input timestamps.
  14619. They are similar to the @option{re} option to @code{ffmpeg}.
  14620. They accept the following options:
  14621. @table @option
  14622. @item limit
  14623. Time limit for the pauses. Any pause longer than that will be considered
  14624. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  14625. @end table
  14626. @anchor{select}
  14627. @section select, aselect
  14628. Select frames to pass in output.
  14629. This filter accepts the following options:
  14630. @table @option
  14631. @item expr, e
  14632. Set expression, which is evaluated for each input frame.
  14633. If the expression is evaluated to zero, the frame is discarded.
  14634. If the evaluation result is negative or NaN, the frame is sent to the
  14635. first output; otherwise it is sent to the output with index
  14636. @code{ceil(val)-1}, assuming that the input index starts from 0.
  14637. For example a value of @code{1.2} corresponds to the output with index
  14638. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  14639. @item outputs, n
  14640. Set the number of outputs. The output to which to send the selected
  14641. frame is based on the result of the evaluation. Default value is 1.
  14642. @end table
  14643. The expression can contain the following constants:
  14644. @table @option
  14645. @item n
  14646. The (sequential) number of the filtered frame, starting from 0.
  14647. @item selected_n
  14648. The (sequential) number of the selected frame, starting from 0.
  14649. @item prev_selected_n
  14650. The sequential number of the last selected frame. It's NAN if undefined.
  14651. @item TB
  14652. The timebase of the input timestamps.
  14653. @item pts
  14654. The PTS (Presentation TimeStamp) of the filtered video frame,
  14655. expressed in @var{TB} units. It's NAN if undefined.
  14656. @item t
  14657. The PTS of the filtered video frame,
  14658. expressed in seconds. It's NAN if undefined.
  14659. @item prev_pts
  14660. The PTS of the previously filtered video frame. It's NAN if undefined.
  14661. @item prev_selected_pts
  14662. The PTS of the last previously filtered video frame. It's NAN if undefined.
  14663. @item prev_selected_t
  14664. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  14665. @item start_pts
  14666. The PTS of the first video frame in the video. It's NAN if undefined.
  14667. @item start_t
  14668. The time of the first video frame in the video. It's NAN if undefined.
  14669. @item pict_type @emph{(video only)}
  14670. The type of the filtered frame. It can assume one of the following
  14671. values:
  14672. @table @option
  14673. @item I
  14674. @item P
  14675. @item B
  14676. @item S
  14677. @item SI
  14678. @item SP
  14679. @item BI
  14680. @end table
  14681. @item interlace_type @emph{(video only)}
  14682. The frame interlace type. It can assume one of the following values:
  14683. @table @option
  14684. @item PROGRESSIVE
  14685. The frame is progressive (not interlaced).
  14686. @item TOPFIRST
  14687. The frame is top-field-first.
  14688. @item BOTTOMFIRST
  14689. The frame is bottom-field-first.
  14690. @end table
  14691. @item consumed_sample_n @emph{(audio only)}
  14692. the number of selected samples before the current frame
  14693. @item samples_n @emph{(audio only)}
  14694. the number of samples in the current frame
  14695. @item sample_rate @emph{(audio only)}
  14696. the input sample rate
  14697. @item key
  14698. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  14699. @item pos
  14700. the position in the file of the filtered frame, -1 if the information
  14701. is not available (e.g. for synthetic video)
  14702. @item scene @emph{(video only)}
  14703. value between 0 and 1 to indicate a new scene; a low value reflects a low
  14704. probability for the current frame to introduce a new scene, while a higher
  14705. value means the current frame is more likely to be one (see the example below)
  14706. @item concatdec_select
  14707. The concat demuxer can select only part of a concat input file by setting an
  14708. inpoint and an outpoint, but the output packets may not be entirely contained
  14709. in the selected interval. By using this variable, it is possible to skip frames
  14710. generated by the concat demuxer which are not exactly contained in the selected
  14711. interval.
  14712. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  14713. and the @var{lavf.concat.duration} packet metadata values which are also
  14714. present in the decoded frames.
  14715. The @var{concatdec_select} variable is -1 if the frame pts is at least
  14716. start_time and either the duration metadata is missing or the frame pts is less
  14717. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  14718. missing.
  14719. That basically means that an input frame is selected if its pts is within the
  14720. interval set by the concat demuxer.
  14721. @end table
  14722. The default value of the select expression is "1".
  14723. @subsection Examples
  14724. @itemize
  14725. @item
  14726. Select all frames in input:
  14727. @example
  14728. select
  14729. @end example
  14730. The example above is the same as:
  14731. @example
  14732. select=1
  14733. @end example
  14734. @item
  14735. Skip all frames:
  14736. @example
  14737. select=0
  14738. @end example
  14739. @item
  14740. Select only I-frames:
  14741. @example
  14742. select='eq(pict_type\,I)'
  14743. @end example
  14744. @item
  14745. Select one frame every 100:
  14746. @example
  14747. select='not(mod(n\,100))'
  14748. @end example
  14749. @item
  14750. Select only frames contained in the 10-20 time interval:
  14751. @example
  14752. select=between(t\,10\,20)
  14753. @end example
  14754. @item
  14755. Select only I-frames contained in the 10-20 time interval:
  14756. @example
  14757. select=between(t\,10\,20)*eq(pict_type\,I)
  14758. @end example
  14759. @item
  14760. Select frames with a minimum distance of 10 seconds:
  14761. @example
  14762. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14763. @end example
  14764. @item
  14765. Use aselect to select only audio frames with samples number > 100:
  14766. @example
  14767. aselect='gt(samples_n\,100)'
  14768. @end example
  14769. @item
  14770. Create a mosaic of the first scenes:
  14771. @example
  14772. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14773. @end example
  14774. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14775. choice.
  14776. @item
  14777. Send even and odd frames to separate outputs, and compose them:
  14778. @example
  14779. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14780. @end example
  14781. @item
  14782. Select useful frames from an ffconcat file which is using inpoints and
  14783. outpoints but where the source files are not intra frame only.
  14784. @example
  14785. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14786. @end example
  14787. @end itemize
  14788. @section sendcmd, asendcmd
  14789. Send commands to filters in the filtergraph.
  14790. These filters read commands to be sent to other filters in the
  14791. filtergraph.
  14792. @code{sendcmd} must be inserted between two video filters,
  14793. @code{asendcmd} must be inserted between two audio filters, but apart
  14794. from that they act the same way.
  14795. The specification of commands can be provided in the filter arguments
  14796. with the @var{commands} option, or in a file specified by the
  14797. @var{filename} option.
  14798. These filters accept the following options:
  14799. @table @option
  14800. @item commands, c
  14801. Set the commands to be read and sent to the other filters.
  14802. @item filename, f
  14803. Set the filename of the commands to be read and sent to the other
  14804. filters.
  14805. @end table
  14806. @subsection Commands syntax
  14807. A commands description consists of a sequence of interval
  14808. specifications, comprising a list of commands to be executed when a
  14809. particular event related to that interval occurs. The occurring event
  14810. is typically the current frame time entering or leaving a given time
  14811. interval.
  14812. An interval is specified by the following syntax:
  14813. @example
  14814. @var{START}[-@var{END}] @var{COMMANDS};
  14815. @end example
  14816. The time interval is specified by the @var{START} and @var{END} times.
  14817. @var{END} is optional and defaults to the maximum time.
  14818. The current frame time is considered within the specified interval if
  14819. it is included in the interval [@var{START}, @var{END}), that is when
  14820. the time is greater or equal to @var{START} and is lesser than
  14821. @var{END}.
  14822. @var{COMMANDS} consists of a sequence of one or more command
  14823. specifications, separated by ",", relating to that interval. The
  14824. syntax of a command specification is given by:
  14825. @example
  14826. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  14827. @end example
  14828. @var{FLAGS} is optional and specifies the type of events relating to
  14829. the time interval which enable sending the specified command, and must
  14830. be a non-null sequence of identifier flags separated by "+" or "|" and
  14831. enclosed between "[" and "]".
  14832. The following flags are recognized:
  14833. @table @option
  14834. @item enter
  14835. The command is sent when the current frame timestamp enters the
  14836. specified interval. In other words, the command is sent when the
  14837. previous frame timestamp was not in the given interval, and the
  14838. current is.
  14839. @item leave
  14840. The command is sent when the current frame timestamp leaves the
  14841. specified interval. In other words, the command is sent when the
  14842. previous frame timestamp was in the given interval, and the
  14843. current is not.
  14844. @end table
  14845. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  14846. assumed.
  14847. @var{TARGET} specifies the target of the command, usually the name of
  14848. the filter class or a specific filter instance name.
  14849. @var{COMMAND} specifies the name of the command for the target filter.
  14850. @var{ARG} is optional and specifies the optional list of argument for
  14851. the given @var{COMMAND}.
  14852. Between one interval specification and another, whitespaces, or
  14853. sequences of characters starting with @code{#} until the end of line,
  14854. are ignored and can be used to annotate comments.
  14855. A simplified BNF description of the commands specification syntax
  14856. follows:
  14857. @example
  14858. @var{COMMAND_FLAG} ::= "enter" | "leave"
  14859. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  14860. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  14861. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  14862. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  14863. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  14864. @end example
  14865. @subsection Examples
  14866. @itemize
  14867. @item
  14868. Specify audio tempo change at second 4:
  14869. @example
  14870. asendcmd=c='4.0 atempo tempo 1.5',atempo
  14871. @end example
  14872. @item
  14873. Target a specific filter instance:
  14874. @example
  14875. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  14876. @end example
  14877. @item
  14878. Specify a list of drawtext and hue commands in a file.
  14879. @example
  14880. # show text in the interval 5-10
  14881. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  14882. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  14883. # desaturate the image in the interval 15-20
  14884. 15.0-20.0 [enter] hue s 0,
  14885. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  14886. [leave] hue s 1,
  14887. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  14888. # apply an exponential saturation fade-out effect, starting from time 25
  14889. 25 [enter] hue s exp(25-t)
  14890. @end example
  14891. A filtergraph allowing to read and process the above command list
  14892. stored in a file @file{test.cmd}, can be specified with:
  14893. @example
  14894. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  14895. @end example
  14896. @end itemize
  14897. @anchor{setpts}
  14898. @section setpts, asetpts
  14899. Change the PTS (presentation timestamp) of the input frames.
  14900. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14901. This filter accepts the following options:
  14902. @table @option
  14903. @item expr
  14904. The expression which is evaluated for each frame to construct its timestamp.
  14905. @end table
  14906. The expression is evaluated through the eval API and can contain the following
  14907. constants:
  14908. @table @option
  14909. @item FRAME_RATE, FR
  14910. frame rate, only defined for constant frame-rate video
  14911. @item PTS
  14912. The presentation timestamp in input
  14913. @item N
  14914. The count of the input frame for video or the number of consumed samples,
  14915. not including the current frame for audio, starting from 0.
  14916. @item NB_CONSUMED_SAMPLES
  14917. The number of consumed samples, not including the current frame (only
  14918. audio)
  14919. @item NB_SAMPLES, S
  14920. The number of samples in the current frame (only audio)
  14921. @item SAMPLE_RATE, SR
  14922. The audio sample rate.
  14923. @item STARTPTS
  14924. The PTS of the first frame.
  14925. @item STARTT
  14926. the time in seconds of the first frame
  14927. @item INTERLACED
  14928. State whether the current frame is interlaced.
  14929. @item T
  14930. the time in seconds of the current frame
  14931. @item POS
  14932. original position in the file of the frame, or undefined if undefined
  14933. for the current frame
  14934. @item PREV_INPTS
  14935. The previous input PTS.
  14936. @item PREV_INT
  14937. previous input time in seconds
  14938. @item PREV_OUTPTS
  14939. The previous output PTS.
  14940. @item PREV_OUTT
  14941. previous output time in seconds
  14942. @item RTCTIME
  14943. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14944. instead.
  14945. @item RTCSTART
  14946. The wallclock (RTC) time at the start of the movie in microseconds.
  14947. @item TB
  14948. The timebase of the input timestamps.
  14949. @end table
  14950. @subsection Examples
  14951. @itemize
  14952. @item
  14953. Start counting PTS from zero
  14954. @example
  14955. setpts=PTS-STARTPTS
  14956. @end example
  14957. @item
  14958. Apply fast motion effect:
  14959. @example
  14960. setpts=0.5*PTS
  14961. @end example
  14962. @item
  14963. Apply slow motion effect:
  14964. @example
  14965. setpts=2.0*PTS
  14966. @end example
  14967. @item
  14968. Set fixed rate of 25 frames per second:
  14969. @example
  14970. setpts=N/(25*TB)
  14971. @end example
  14972. @item
  14973. Set fixed rate 25 fps with some jitter:
  14974. @example
  14975. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14976. @end example
  14977. @item
  14978. Apply an offset of 10 seconds to the input PTS:
  14979. @example
  14980. setpts=PTS+10/TB
  14981. @end example
  14982. @item
  14983. Generate timestamps from a "live source" and rebase onto the current timebase:
  14984. @example
  14985. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14986. @end example
  14987. @item
  14988. Generate timestamps by counting samples:
  14989. @example
  14990. asetpts=N/SR/TB
  14991. @end example
  14992. @end itemize
  14993. @section setrange
  14994. Force color range for the output video frame.
  14995. The @code{setrange} filter marks the color range property for the
  14996. output frames. It does not change the input frame, but only sets the
  14997. corresponding property, which affects how the frame is treated by
  14998. following filters.
  14999. The filter accepts the following options:
  15000. @table @option
  15001. @item range
  15002. Available values are:
  15003. @table @samp
  15004. @item auto
  15005. Keep the same color range property.
  15006. @item unspecified, unknown
  15007. Set the color range as unspecified.
  15008. @item limited, tv, mpeg
  15009. Set the color range as limited.
  15010. @item full, pc, jpeg
  15011. Set the color range as full.
  15012. @end table
  15013. @end table
  15014. @section settb, asettb
  15015. Set the timebase to use for the output frames timestamps.
  15016. It is mainly useful for testing timebase configuration.
  15017. It accepts the following parameters:
  15018. @table @option
  15019. @item expr, tb
  15020. The expression which is evaluated into the output timebase.
  15021. @end table
  15022. The value for @option{tb} is an arithmetic expression representing a
  15023. rational. The expression can contain the constants "AVTB" (the default
  15024. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  15025. audio only). Default value is "intb".
  15026. @subsection Examples
  15027. @itemize
  15028. @item
  15029. Set the timebase to 1/25:
  15030. @example
  15031. settb=expr=1/25
  15032. @end example
  15033. @item
  15034. Set the timebase to 1/10:
  15035. @example
  15036. settb=expr=0.1
  15037. @end example
  15038. @item
  15039. Set the timebase to 1001/1000:
  15040. @example
  15041. settb=1+0.001
  15042. @end example
  15043. @item
  15044. Set the timebase to 2*intb:
  15045. @example
  15046. settb=2*intb
  15047. @end example
  15048. @item
  15049. Set the default timebase value:
  15050. @example
  15051. settb=AVTB
  15052. @end example
  15053. @end itemize
  15054. @section showcqt
  15055. Convert input audio to a video output representing frequency spectrum
  15056. logarithmically using Brown-Puckette constant Q transform algorithm with
  15057. direct frequency domain coefficient calculation (but the transform itself
  15058. is not really constant Q, instead the Q factor is actually variable/clamped),
  15059. with musical tone scale, from E0 to D#10.
  15060. The filter accepts the following options:
  15061. @table @option
  15062. @item size, s
  15063. Specify the video size for the output. It must be even. For the syntax of this option,
  15064. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15065. Default value is @code{1920x1080}.
  15066. @item fps, rate, r
  15067. Set the output frame rate. Default value is @code{25}.
  15068. @item bar_h
  15069. Set the bargraph height. It must be even. Default value is @code{-1} which
  15070. computes the bargraph height automatically.
  15071. @item axis_h
  15072. Set the axis height. It must be even. Default value is @code{-1} which computes
  15073. the axis height automatically.
  15074. @item sono_h
  15075. Set the sonogram height. It must be even. Default value is @code{-1} which
  15076. computes the sonogram height automatically.
  15077. @item fullhd
  15078. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  15079. instead. Default value is @code{1}.
  15080. @item sono_v, volume
  15081. Specify the sonogram volume expression. It can contain variables:
  15082. @table @option
  15083. @item bar_v
  15084. the @var{bar_v} evaluated expression
  15085. @item frequency, freq, f
  15086. the frequency where it is evaluated
  15087. @item timeclamp, tc
  15088. the value of @var{timeclamp} option
  15089. @end table
  15090. and functions:
  15091. @table @option
  15092. @item a_weighting(f)
  15093. A-weighting of equal loudness
  15094. @item b_weighting(f)
  15095. B-weighting of equal loudness
  15096. @item c_weighting(f)
  15097. C-weighting of equal loudness.
  15098. @end table
  15099. Default value is @code{16}.
  15100. @item bar_v, volume2
  15101. Specify the bargraph volume expression. It can contain variables:
  15102. @table @option
  15103. @item sono_v
  15104. the @var{sono_v} evaluated expression
  15105. @item frequency, freq, f
  15106. the frequency where it is evaluated
  15107. @item timeclamp, tc
  15108. the value of @var{timeclamp} option
  15109. @end table
  15110. and functions:
  15111. @table @option
  15112. @item a_weighting(f)
  15113. A-weighting of equal loudness
  15114. @item b_weighting(f)
  15115. B-weighting of equal loudness
  15116. @item c_weighting(f)
  15117. C-weighting of equal loudness.
  15118. @end table
  15119. Default value is @code{sono_v}.
  15120. @item sono_g, gamma
  15121. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  15122. higher gamma makes the spectrum having more range. Default value is @code{3}.
  15123. Acceptable range is @code{[1, 7]}.
  15124. @item bar_g, gamma2
  15125. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  15126. @code{[1, 7]}.
  15127. @item bar_t
  15128. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  15129. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  15130. @item timeclamp, tc
  15131. Specify the transform timeclamp. At low frequency, there is trade-off between
  15132. accuracy in time domain and frequency domain. If timeclamp is lower,
  15133. event in time domain is represented more accurately (such as fast bass drum),
  15134. otherwise event in frequency domain is represented more accurately
  15135. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  15136. @item attack
  15137. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  15138. limits future samples by applying asymmetric windowing in time domain, useful
  15139. when low latency is required. Accepted range is @code{[0, 1]}.
  15140. @item basefreq
  15141. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  15142. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  15143. @item endfreq
  15144. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  15145. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  15146. @item coeffclamp
  15147. This option is deprecated and ignored.
  15148. @item tlength
  15149. Specify the transform length in time domain. Use this option to control accuracy
  15150. trade-off between time domain and frequency domain at every frequency sample.
  15151. It can contain variables:
  15152. @table @option
  15153. @item frequency, freq, f
  15154. the frequency where it is evaluated
  15155. @item timeclamp, tc
  15156. the value of @var{timeclamp} option.
  15157. @end table
  15158. Default value is @code{384*tc/(384+tc*f)}.
  15159. @item count
  15160. Specify the transform count for every video frame. Default value is @code{6}.
  15161. Acceptable range is @code{[1, 30]}.
  15162. @item fcount
  15163. Specify the transform count for every single pixel. Default value is @code{0},
  15164. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  15165. @item fontfile
  15166. Specify font file for use with freetype to draw the axis. If not specified,
  15167. use embedded font. Note that drawing with font file or embedded font is not
  15168. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  15169. option instead.
  15170. @item font
  15171. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  15172. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  15173. @item fontcolor
  15174. Specify font color expression. This is arithmetic expression that should return
  15175. integer value 0xRRGGBB. It can contain variables:
  15176. @table @option
  15177. @item frequency, freq, f
  15178. the frequency where it is evaluated
  15179. @item timeclamp, tc
  15180. the value of @var{timeclamp} option
  15181. @end table
  15182. and functions:
  15183. @table @option
  15184. @item midi(f)
  15185. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  15186. @item r(x), g(x), b(x)
  15187. red, green, and blue value of intensity x.
  15188. @end table
  15189. Default value is @code{st(0, (midi(f)-59.5)/12);
  15190. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  15191. r(1-ld(1)) + b(ld(1))}.
  15192. @item axisfile
  15193. Specify image file to draw the axis. This option override @var{fontfile} and
  15194. @var{fontcolor} option.
  15195. @item axis, text
  15196. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  15197. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  15198. Default value is @code{1}.
  15199. @item csp
  15200. Set colorspace. The accepted values are:
  15201. @table @samp
  15202. @item unspecified
  15203. Unspecified (default)
  15204. @item bt709
  15205. BT.709
  15206. @item fcc
  15207. FCC
  15208. @item bt470bg
  15209. BT.470BG or BT.601-6 625
  15210. @item smpte170m
  15211. SMPTE-170M or BT.601-6 525
  15212. @item smpte240m
  15213. SMPTE-240M
  15214. @item bt2020ncl
  15215. BT.2020 with non-constant luminance
  15216. @end table
  15217. @item cscheme
  15218. Set spectrogram color scheme. This is list of floating point values with format
  15219. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  15220. The default is @code{1|0.5|0|0|0.5|1}.
  15221. @end table
  15222. @subsection Examples
  15223. @itemize
  15224. @item
  15225. Playing audio while showing the spectrum:
  15226. @example
  15227. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  15228. @end example
  15229. @item
  15230. Same as above, but with frame rate 30 fps:
  15231. @example
  15232. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  15233. @end example
  15234. @item
  15235. Playing at 1280x720:
  15236. @example
  15237. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  15238. @end example
  15239. @item
  15240. Disable sonogram display:
  15241. @example
  15242. sono_h=0
  15243. @end example
  15244. @item
  15245. A1 and its harmonics: A1, A2, (near)E3, A3:
  15246. @example
  15247. 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),
  15248. asplit[a][out1]; [a] showcqt [out0]'
  15249. @end example
  15250. @item
  15251. Same as above, but with more accuracy in frequency domain:
  15252. @example
  15253. 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),
  15254. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  15255. @end example
  15256. @item
  15257. Custom volume:
  15258. @example
  15259. bar_v=10:sono_v=bar_v*a_weighting(f)
  15260. @end example
  15261. @item
  15262. Custom gamma, now spectrum is linear to the amplitude.
  15263. @example
  15264. bar_g=2:sono_g=2
  15265. @end example
  15266. @item
  15267. Custom tlength equation:
  15268. @example
  15269. 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)))'
  15270. @end example
  15271. @item
  15272. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  15273. @example
  15274. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  15275. @end example
  15276. @item
  15277. Custom font using fontconfig:
  15278. @example
  15279. font='Courier New,Monospace,mono|bold'
  15280. @end example
  15281. @item
  15282. Custom frequency range with custom axis using image file:
  15283. @example
  15284. axisfile=myaxis.png:basefreq=40:endfreq=10000
  15285. @end example
  15286. @end itemize
  15287. @section showfreqs
  15288. Convert input audio to video output representing the audio power spectrum.
  15289. Audio amplitude is on Y-axis while frequency is on X-axis.
  15290. The filter accepts the following options:
  15291. @table @option
  15292. @item size, s
  15293. Specify size of video. For the syntax of this option, check the
  15294. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15295. Default is @code{1024x512}.
  15296. @item mode
  15297. Set display mode.
  15298. This set how each frequency bin will be represented.
  15299. It accepts the following values:
  15300. @table @samp
  15301. @item line
  15302. @item bar
  15303. @item dot
  15304. @end table
  15305. Default is @code{bar}.
  15306. @item ascale
  15307. Set amplitude scale.
  15308. It accepts the following values:
  15309. @table @samp
  15310. @item lin
  15311. Linear scale.
  15312. @item sqrt
  15313. Square root scale.
  15314. @item cbrt
  15315. Cubic root scale.
  15316. @item log
  15317. Logarithmic scale.
  15318. @end table
  15319. Default is @code{log}.
  15320. @item fscale
  15321. Set frequency scale.
  15322. It accepts the following values:
  15323. @table @samp
  15324. @item lin
  15325. Linear scale.
  15326. @item log
  15327. Logarithmic scale.
  15328. @item rlog
  15329. Reverse logarithmic scale.
  15330. @end table
  15331. Default is @code{lin}.
  15332. @item win_size
  15333. Set window size.
  15334. It accepts the following values:
  15335. @table @samp
  15336. @item w16
  15337. @item w32
  15338. @item w64
  15339. @item w128
  15340. @item w256
  15341. @item w512
  15342. @item w1024
  15343. @item w2048
  15344. @item w4096
  15345. @item w8192
  15346. @item w16384
  15347. @item w32768
  15348. @item w65536
  15349. @end table
  15350. Default is @code{w2048}
  15351. @item win_func
  15352. Set windowing function.
  15353. It accepts the following values:
  15354. @table @samp
  15355. @item rect
  15356. @item bartlett
  15357. @item hanning
  15358. @item hamming
  15359. @item blackman
  15360. @item welch
  15361. @item flattop
  15362. @item bharris
  15363. @item bnuttall
  15364. @item bhann
  15365. @item sine
  15366. @item nuttall
  15367. @item lanczos
  15368. @item gauss
  15369. @item tukey
  15370. @item dolph
  15371. @item cauchy
  15372. @item parzen
  15373. @item poisson
  15374. @end table
  15375. Default is @code{hanning}.
  15376. @item overlap
  15377. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15378. which means optimal overlap for selected window function will be picked.
  15379. @item averaging
  15380. Set time averaging. Setting this to 0 will display current maximal peaks.
  15381. Default is @code{1}, which means time averaging is disabled.
  15382. @item colors
  15383. Specify list of colors separated by space or by '|' which will be used to
  15384. draw channel frequencies. Unrecognized or missing colors will be replaced
  15385. by white color.
  15386. @item cmode
  15387. Set channel display mode.
  15388. It accepts the following values:
  15389. @table @samp
  15390. @item combined
  15391. @item separate
  15392. @end table
  15393. Default is @code{combined}.
  15394. @item minamp
  15395. Set minimum amplitude used in @code{log} amplitude scaler.
  15396. @end table
  15397. @anchor{showspectrum}
  15398. @section showspectrum
  15399. Convert input audio to a video output, representing the audio frequency
  15400. spectrum.
  15401. The filter accepts the following options:
  15402. @table @option
  15403. @item size, s
  15404. Specify the video size for the output. For the syntax of this option, check the
  15405. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15406. Default value is @code{640x512}.
  15407. @item slide
  15408. Specify how the spectrum should slide along the window.
  15409. It accepts the following values:
  15410. @table @samp
  15411. @item replace
  15412. the samples start again on the left when they reach the right
  15413. @item scroll
  15414. the samples scroll from right to left
  15415. @item fullframe
  15416. frames are only produced when the samples reach the right
  15417. @item rscroll
  15418. the samples scroll from left to right
  15419. @end table
  15420. Default value is @code{replace}.
  15421. @item mode
  15422. Specify display mode.
  15423. It accepts the following values:
  15424. @table @samp
  15425. @item combined
  15426. all channels are displayed in the same row
  15427. @item separate
  15428. all channels are displayed in separate rows
  15429. @end table
  15430. Default value is @samp{combined}.
  15431. @item color
  15432. Specify display color mode.
  15433. It accepts the following values:
  15434. @table @samp
  15435. @item channel
  15436. each channel is displayed in a separate color
  15437. @item intensity
  15438. each channel is displayed using the same color scheme
  15439. @item rainbow
  15440. each channel is displayed using the rainbow color scheme
  15441. @item moreland
  15442. each channel is displayed using the moreland color scheme
  15443. @item nebulae
  15444. each channel is displayed using the nebulae color scheme
  15445. @item fire
  15446. each channel is displayed using the fire color scheme
  15447. @item fiery
  15448. each channel is displayed using the fiery color scheme
  15449. @item fruit
  15450. each channel is displayed using the fruit color scheme
  15451. @item cool
  15452. each channel is displayed using the cool color scheme
  15453. @end table
  15454. Default value is @samp{channel}.
  15455. @item scale
  15456. Specify scale used for calculating intensity color values.
  15457. It accepts the following values:
  15458. @table @samp
  15459. @item lin
  15460. linear
  15461. @item sqrt
  15462. square root, default
  15463. @item cbrt
  15464. cubic root
  15465. @item log
  15466. logarithmic
  15467. @item 4thrt
  15468. 4th root
  15469. @item 5thrt
  15470. 5th root
  15471. @end table
  15472. Default value is @samp{sqrt}.
  15473. @item saturation
  15474. Set saturation modifier for displayed colors. Negative values provide
  15475. alternative color scheme. @code{0} is no saturation at all.
  15476. Saturation must be in [-10.0, 10.0] range.
  15477. Default value is @code{1}.
  15478. @item win_func
  15479. Set window function.
  15480. It accepts the following values:
  15481. @table @samp
  15482. @item rect
  15483. @item bartlett
  15484. @item hann
  15485. @item hanning
  15486. @item hamming
  15487. @item blackman
  15488. @item welch
  15489. @item flattop
  15490. @item bharris
  15491. @item bnuttall
  15492. @item bhann
  15493. @item sine
  15494. @item nuttall
  15495. @item lanczos
  15496. @item gauss
  15497. @item tukey
  15498. @item dolph
  15499. @item cauchy
  15500. @item parzen
  15501. @item poisson
  15502. @end table
  15503. Default value is @code{hann}.
  15504. @item orientation
  15505. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15506. @code{horizontal}. Default is @code{vertical}.
  15507. @item overlap
  15508. Set ratio of overlap window. Default value is @code{0}.
  15509. When value is @code{1} overlap is set to recommended size for specific
  15510. window function currently used.
  15511. @item gain
  15512. Set scale gain for calculating intensity color values.
  15513. Default value is @code{1}.
  15514. @item data
  15515. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  15516. @item rotation
  15517. Set color rotation, must be in [-1.0, 1.0] range.
  15518. Default value is @code{0}.
  15519. @end table
  15520. The usage is very similar to the showwaves filter; see the examples in that
  15521. section.
  15522. @subsection Examples
  15523. @itemize
  15524. @item
  15525. Large window with logarithmic color scaling:
  15526. @example
  15527. showspectrum=s=1280x480:scale=log
  15528. @end example
  15529. @item
  15530. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  15531. @example
  15532. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15533. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  15534. @end example
  15535. @end itemize
  15536. @section showspectrumpic
  15537. Convert input audio to a single video frame, representing the audio frequency
  15538. spectrum.
  15539. The filter accepts the following options:
  15540. @table @option
  15541. @item size, s
  15542. Specify the video size for the output. For the syntax of this option, check the
  15543. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15544. Default value is @code{4096x2048}.
  15545. @item mode
  15546. Specify display mode.
  15547. It accepts the following values:
  15548. @table @samp
  15549. @item combined
  15550. all channels are displayed in the same row
  15551. @item separate
  15552. all channels are displayed in separate rows
  15553. @end table
  15554. Default value is @samp{combined}.
  15555. @item color
  15556. Specify display color mode.
  15557. It accepts the following values:
  15558. @table @samp
  15559. @item channel
  15560. each channel is displayed in a separate color
  15561. @item intensity
  15562. each channel is displayed using the same color scheme
  15563. @item rainbow
  15564. each channel is displayed using the rainbow color scheme
  15565. @item moreland
  15566. each channel is displayed using the moreland color scheme
  15567. @item nebulae
  15568. each channel is displayed using the nebulae color scheme
  15569. @item fire
  15570. each channel is displayed using the fire color scheme
  15571. @item fiery
  15572. each channel is displayed using the fiery color scheme
  15573. @item fruit
  15574. each channel is displayed using the fruit color scheme
  15575. @item cool
  15576. each channel is displayed using the cool color scheme
  15577. @end table
  15578. Default value is @samp{intensity}.
  15579. @item scale
  15580. Specify scale used for calculating intensity color values.
  15581. It accepts the following values:
  15582. @table @samp
  15583. @item lin
  15584. linear
  15585. @item sqrt
  15586. square root, default
  15587. @item cbrt
  15588. cubic root
  15589. @item log
  15590. logarithmic
  15591. @item 4thrt
  15592. 4th root
  15593. @item 5thrt
  15594. 5th root
  15595. @end table
  15596. Default value is @samp{log}.
  15597. @item saturation
  15598. Set saturation modifier for displayed colors. Negative values provide
  15599. alternative color scheme. @code{0} is no saturation at all.
  15600. Saturation must be in [-10.0, 10.0] range.
  15601. Default value is @code{1}.
  15602. @item win_func
  15603. Set window function.
  15604. It accepts the following values:
  15605. @table @samp
  15606. @item rect
  15607. @item bartlett
  15608. @item hann
  15609. @item hanning
  15610. @item hamming
  15611. @item blackman
  15612. @item welch
  15613. @item flattop
  15614. @item bharris
  15615. @item bnuttall
  15616. @item bhann
  15617. @item sine
  15618. @item nuttall
  15619. @item lanczos
  15620. @item gauss
  15621. @item tukey
  15622. @item dolph
  15623. @item cauchy
  15624. @item parzen
  15625. @item poisson
  15626. @end table
  15627. Default value is @code{hann}.
  15628. @item orientation
  15629. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15630. @code{horizontal}. Default is @code{vertical}.
  15631. @item gain
  15632. Set scale gain for calculating intensity color values.
  15633. Default value is @code{1}.
  15634. @item legend
  15635. Draw time and frequency axes and legends. Default is enabled.
  15636. @item rotation
  15637. Set color rotation, must be in [-1.0, 1.0] range.
  15638. Default value is @code{0}.
  15639. @end table
  15640. @subsection Examples
  15641. @itemize
  15642. @item
  15643. Extract an audio spectrogram of a whole audio track
  15644. in a 1024x1024 picture using @command{ffmpeg}:
  15645. @example
  15646. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  15647. @end example
  15648. @end itemize
  15649. @section showvolume
  15650. Convert input audio volume to a video output.
  15651. The filter accepts the following options:
  15652. @table @option
  15653. @item rate, r
  15654. Set video rate.
  15655. @item b
  15656. Set border width, allowed range is [0, 5]. Default is 1.
  15657. @item w
  15658. Set channel width, allowed range is [80, 8192]. Default is 400.
  15659. @item h
  15660. Set channel height, allowed range is [1, 900]. Default is 20.
  15661. @item f
  15662. Set fade, allowed range is [0, 1]. Default is 0.95.
  15663. @item c
  15664. Set volume color expression.
  15665. The expression can use the following variables:
  15666. @table @option
  15667. @item VOLUME
  15668. Current max volume of channel in dB.
  15669. @item PEAK
  15670. Current peak.
  15671. @item CHANNEL
  15672. Current channel number, starting from 0.
  15673. @end table
  15674. @item t
  15675. If set, displays channel names. Default is enabled.
  15676. @item v
  15677. If set, displays volume values. Default is enabled.
  15678. @item o
  15679. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  15680. default is @code{h}.
  15681. @item s
  15682. Set step size, allowed range is [0, 5]. Default is 0, which means
  15683. step is disabled.
  15684. @item p
  15685. Set background opacity, allowed range is [0, 1]. Default is 0.
  15686. @item m
  15687. Set metering mode, can be peak: @code{p} or rms: @code{r},
  15688. default is @code{p}.
  15689. @item ds
  15690. Set display scale, can be linear: @code{lin} or log: @code{log},
  15691. default is @code{lin}.
  15692. @item dm
  15693. In second.
  15694. If set to > 0., display a line for the max level
  15695. in the previous seconds.
  15696. default is disabled: @code{0.}
  15697. @item dmc
  15698. The color of the max line. Use when @code{dm} option is set to > 0.
  15699. default is: @code{orange}
  15700. @end table
  15701. @section showwaves
  15702. Convert input audio to a video output, representing the samples waves.
  15703. The filter accepts the following options:
  15704. @table @option
  15705. @item size, s
  15706. Specify the video size for the output. For the syntax of this option, check the
  15707. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15708. Default value is @code{600x240}.
  15709. @item mode
  15710. Set display mode.
  15711. Available values are:
  15712. @table @samp
  15713. @item point
  15714. Draw a point for each sample.
  15715. @item line
  15716. Draw a vertical line for each sample.
  15717. @item p2p
  15718. Draw a point for each sample and a line between them.
  15719. @item cline
  15720. Draw a centered vertical line for each sample.
  15721. @end table
  15722. Default value is @code{point}.
  15723. @item n
  15724. Set the number of samples which are printed on the same column. A
  15725. larger value will decrease the frame rate. Must be a positive
  15726. integer. This option can be set only if the value for @var{rate}
  15727. is not explicitly specified.
  15728. @item rate, r
  15729. Set the (approximate) output frame rate. This is done by setting the
  15730. option @var{n}. Default value is "25".
  15731. @item split_channels
  15732. Set if channels should be drawn separately or overlap. Default value is 0.
  15733. @item colors
  15734. Set colors separated by '|' which are going to be used for drawing of each channel.
  15735. @item scale
  15736. Set amplitude scale.
  15737. Available values are:
  15738. @table @samp
  15739. @item lin
  15740. Linear.
  15741. @item log
  15742. Logarithmic.
  15743. @item sqrt
  15744. Square root.
  15745. @item cbrt
  15746. Cubic root.
  15747. @end table
  15748. Default is linear.
  15749. @item draw
  15750. Set the draw mode. This is mostly useful to set for high @var{n}.
  15751. Available values are:
  15752. @table @samp
  15753. @item scale
  15754. Scale pixel values for each drawn sample.
  15755. @item full
  15756. Draw every sample directly.
  15757. @end table
  15758. Default value is @code{scale}.
  15759. @end table
  15760. @subsection Examples
  15761. @itemize
  15762. @item
  15763. Output the input file audio and the corresponding video representation
  15764. at the same time:
  15765. @example
  15766. amovie=a.mp3,asplit[out0],showwaves[out1]
  15767. @end example
  15768. @item
  15769. Create a synthetic signal and show it with showwaves, forcing a
  15770. frame rate of 30 frames per second:
  15771. @example
  15772. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15773. @end example
  15774. @end itemize
  15775. @section showwavespic
  15776. Convert input audio to a single video frame, representing the samples waves.
  15777. The filter accepts the following options:
  15778. @table @option
  15779. @item size, s
  15780. Specify the video size for the output. For the syntax of this option, check the
  15781. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15782. Default value is @code{600x240}.
  15783. @item split_channels
  15784. Set if channels should be drawn separately or overlap. Default value is 0.
  15785. @item colors
  15786. Set colors separated by '|' which are going to be used for drawing of each channel.
  15787. @item scale
  15788. Set amplitude scale.
  15789. Available values are:
  15790. @table @samp
  15791. @item lin
  15792. Linear.
  15793. @item log
  15794. Logarithmic.
  15795. @item sqrt
  15796. Square root.
  15797. @item cbrt
  15798. Cubic root.
  15799. @end table
  15800. Default is linear.
  15801. @end table
  15802. @subsection Examples
  15803. @itemize
  15804. @item
  15805. Extract a channel split representation of the wave form of a whole audio track
  15806. in a 1024x800 picture using @command{ffmpeg}:
  15807. @example
  15808. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  15809. @end example
  15810. @end itemize
  15811. @section sidedata, asidedata
  15812. Delete frame side data, or select frames based on it.
  15813. This filter accepts the following options:
  15814. @table @option
  15815. @item mode
  15816. Set mode of operation of the filter.
  15817. Can be one of the following:
  15818. @table @samp
  15819. @item select
  15820. Select every frame with side data of @code{type}.
  15821. @item delete
  15822. Delete side data of @code{type}. If @code{type} is not set, delete all side
  15823. data in the frame.
  15824. @end table
  15825. @item type
  15826. Set side data type used with all modes. Must be set for @code{select} mode. For
  15827. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  15828. in @file{libavutil/frame.h}. For example, to choose
  15829. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  15830. @end table
  15831. @section spectrumsynth
  15832. Sythesize audio from 2 input video spectrums, first input stream represents
  15833. magnitude across time and second represents phase across time.
  15834. The filter will transform from frequency domain as displayed in videos back
  15835. to time domain as presented in audio output.
  15836. This filter is primarily created for reversing processed @ref{showspectrum}
  15837. filter outputs, but can synthesize sound from other spectrograms too.
  15838. But in such case results are going to be poor if the phase data is not
  15839. available, because in such cases phase data need to be recreated, usually
  15840. its just recreated from random noise.
  15841. For best results use gray only output (@code{channel} color mode in
  15842. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  15843. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  15844. @code{data} option. Inputs videos should generally use @code{fullframe}
  15845. slide mode as that saves resources needed for decoding video.
  15846. The filter accepts the following options:
  15847. @table @option
  15848. @item sample_rate
  15849. Specify sample rate of output audio, the sample rate of audio from which
  15850. spectrum was generated may differ.
  15851. @item channels
  15852. Set number of channels represented in input video spectrums.
  15853. @item scale
  15854. Set scale which was used when generating magnitude input spectrum.
  15855. Can be @code{lin} or @code{log}. Default is @code{log}.
  15856. @item slide
  15857. Set slide which was used when generating inputs spectrums.
  15858. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  15859. Default is @code{fullframe}.
  15860. @item win_func
  15861. Set window function used for resynthesis.
  15862. @item overlap
  15863. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15864. which means optimal overlap for selected window function will be picked.
  15865. @item orientation
  15866. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  15867. Default is @code{vertical}.
  15868. @end table
  15869. @subsection Examples
  15870. @itemize
  15871. @item
  15872. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  15873. then resynthesize videos back to audio with spectrumsynth:
  15874. @example
  15875. 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
  15876. 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
  15877. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  15878. @end example
  15879. @end itemize
  15880. @section split, asplit
  15881. Split input into several identical outputs.
  15882. @code{asplit} works with audio input, @code{split} with video.
  15883. The filter accepts a single parameter which specifies the number of outputs. If
  15884. unspecified, it defaults to 2.
  15885. @subsection Examples
  15886. @itemize
  15887. @item
  15888. Create two separate outputs from the same input:
  15889. @example
  15890. [in] split [out0][out1]
  15891. @end example
  15892. @item
  15893. To create 3 or more outputs, you need to specify the number of
  15894. outputs, like in:
  15895. @example
  15896. [in] asplit=3 [out0][out1][out2]
  15897. @end example
  15898. @item
  15899. Create two separate outputs from the same input, one cropped and
  15900. one padded:
  15901. @example
  15902. [in] split [splitout1][splitout2];
  15903. [splitout1] crop=100:100:0:0 [cropout];
  15904. [splitout2] pad=200:200:100:100 [padout];
  15905. @end example
  15906. @item
  15907. Create 5 copies of the input audio with @command{ffmpeg}:
  15908. @example
  15909. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  15910. @end example
  15911. @end itemize
  15912. @section zmq, azmq
  15913. Receive commands sent through a libzmq client, and forward them to
  15914. filters in the filtergraph.
  15915. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  15916. must be inserted between two video filters, @code{azmq} between two
  15917. audio filters. Both are capable to send messages to any filter type.
  15918. To enable these filters you need to install the libzmq library and
  15919. headers and configure FFmpeg with @code{--enable-libzmq}.
  15920. For more information about libzmq see:
  15921. @url{http://www.zeromq.org/}
  15922. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15923. receives messages sent through a network interface defined by the
  15924. @option{bind_address} (or the abbreviation "@option{b}") option.
  15925. Default value of this option is @file{tcp://localhost:5555}. You may
  15926. want to alter this value to your needs, but do not forget to escape any
  15927. ':' signs (see @ref{filtergraph escaping}).
  15928. The received message must be in the form:
  15929. @example
  15930. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15931. @end example
  15932. @var{TARGET} specifies the target of the command, usually the name of
  15933. the filter class or a specific filter instance name. The default
  15934. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  15935. but you can override this by using the @samp{filter_name@@id} syntax
  15936. (see @ref{Filtergraph syntax}).
  15937. @var{COMMAND} specifies the name of the command for the target filter.
  15938. @var{ARG} is optional and specifies the optional argument list for the
  15939. given @var{COMMAND}.
  15940. Upon reception, the message is processed and the corresponding command
  15941. is injected into the filtergraph. Depending on the result, the filter
  15942. will send a reply to the client, adopting the format:
  15943. @example
  15944. @var{ERROR_CODE} @var{ERROR_REASON}
  15945. @var{MESSAGE}
  15946. @end example
  15947. @var{MESSAGE} is optional.
  15948. @subsection Examples
  15949. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15950. be used to send commands processed by these filters.
  15951. Consider the following filtergraph generated by @command{ffplay}.
  15952. In this example the last overlay filter has an instance name. All other
  15953. filters will have default instance names.
  15954. @example
  15955. ffplay -dumpgraph 1 -f lavfi "
  15956. color=s=100x100:c=red [l];
  15957. color=s=100x100:c=blue [r];
  15958. nullsrc=s=200x100, zmq [bg];
  15959. [bg][l] overlay [bg+l];
  15960. [bg+l][r] overlay@@my=x=100 "
  15961. @end example
  15962. To change the color of the left side of the video, the following
  15963. command can be used:
  15964. @example
  15965. echo Parsed_color_0 c yellow | tools/zmqsend
  15966. @end example
  15967. To change the right side:
  15968. @example
  15969. echo Parsed_color_1 c pink | tools/zmqsend
  15970. @end example
  15971. To change the position of the right side:
  15972. @example
  15973. echo overlay@@my x 150 | tools/zmqsend
  15974. @end example
  15975. @c man end MULTIMEDIA FILTERS
  15976. @chapter Multimedia Sources
  15977. @c man begin MULTIMEDIA SOURCES
  15978. Below is a description of the currently available multimedia sources.
  15979. @section amovie
  15980. This is the same as @ref{movie} source, except it selects an audio
  15981. stream by default.
  15982. @anchor{movie}
  15983. @section movie
  15984. Read audio and/or video stream(s) from a movie container.
  15985. It accepts the following parameters:
  15986. @table @option
  15987. @item filename
  15988. The name of the resource to read (not necessarily a file; it can also be a
  15989. device or a stream accessed through some protocol).
  15990. @item format_name, f
  15991. Specifies the format assumed for the movie to read, and can be either
  15992. the name of a container or an input device. If not specified, the
  15993. format is guessed from @var{movie_name} or by probing.
  15994. @item seek_point, sp
  15995. Specifies the seek point in seconds. The frames will be output
  15996. starting from this seek point. The parameter is evaluated with
  15997. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15998. postfix. The default value is "0".
  15999. @item streams, s
  16000. Specifies the streams to read. Several streams can be specified,
  16001. separated by "+". The source will then have as many outputs, in the
  16002. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  16003. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  16004. respectively the default (best suited) video and audio stream. Default
  16005. is "dv", or "da" if the filter is called as "amovie".
  16006. @item stream_index, si
  16007. Specifies the index of the video stream to read. If the value is -1,
  16008. the most suitable video stream will be automatically selected. The default
  16009. value is "-1". Deprecated. If the filter is called "amovie", it will select
  16010. audio instead of video.
  16011. @item loop
  16012. Specifies how many times to read the stream in sequence.
  16013. If the value is 0, the stream will be looped infinitely.
  16014. Default value is "1".
  16015. Note that when the movie is looped the source timestamps are not
  16016. changed, so it will generate non monotonically increasing timestamps.
  16017. @item discontinuity
  16018. Specifies the time difference between frames above which the point is
  16019. considered a timestamp discontinuity which is removed by adjusting the later
  16020. timestamps.
  16021. @end table
  16022. It allows overlaying a second video on top of the main input of
  16023. a filtergraph, as shown in this graph:
  16024. @example
  16025. input -----------> deltapts0 --> overlay --> output
  16026. ^
  16027. |
  16028. movie --> scale--> deltapts1 -------+
  16029. @end example
  16030. @subsection Examples
  16031. @itemize
  16032. @item
  16033. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  16034. on top of the input labelled "in":
  16035. @example
  16036. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  16037. [in] setpts=PTS-STARTPTS [main];
  16038. [main][over] overlay=16:16 [out]
  16039. @end example
  16040. @item
  16041. Read from a video4linux2 device, and overlay it on top of the input
  16042. labelled "in":
  16043. @example
  16044. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  16045. [in] setpts=PTS-STARTPTS [main];
  16046. [main][over] overlay=16:16 [out]
  16047. @end example
  16048. @item
  16049. Read the first video stream and the audio stream with id 0x81 from
  16050. dvd.vob; the video is connected to the pad named "video" and the audio is
  16051. connected to the pad named "audio":
  16052. @example
  16053. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  16054. @end example
  16055. @end itemize
  16056. @subsection Commands
  16057. Both movie and amovie support the following commands:
  16058. @table @option
  16059. @item seek
  16060. Perform seek using "av_seek_frame".
  16061. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  16062. @itemize
  16063. @item
  16064. @var{stream_index}: If stream_index is -1, a default
  16065. stream is selected, and @var{timestamp} is automatically converted
  16066. from AV_TIME_BASE units to the stream specific time_base.
  16067. @item
  16068. @var{timestamp}: Timestamp in AVStream.time_base units
  16069. or, if no stream is specified, in AV_TIME_BASE units.
  16070. @item
  16071. @var{flags}: Flags which select direction and seeking mode.
  16072. @end itemize
  16073. @item get_duration
  16074. Get movie duration in AV_TIME_BASE units.
  16075. @end table
  16076. @c man end MULTIMEDIA SOURCES