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.

21329 lines
567KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item threshold
  315. If a signal of stream rises above this level it will affect the gain
  316. reduction.
  317. By default it is 0.125. Range is between 0.00097563 and 1.
  318. @item ratio
  319. Set a ratio by which the signal is reduced. 1:2 means that if the level
  320. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  321. Default is 2. Range is between 1 and 20.
  322. @item attack
  323. Amount of milliseconds the signal has to rise above the threshold before gain
  324. reduction starts. Default is 20. Range is between 0.01 and 2000.
  325. @item release
  326. Amount of milliseconds the signal has to fall below the threshold before
  327. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  328. @item makeup
  329. Set the amount by how much signal will be amplified after processing.
  330. Default is 1. Range is from 1 to 64.
  331. @item knee
  332. Curve the sharp knee around the threshold to enter gain reduction more softly.
  333. Default is 2.82843. Range is between 1 and 8.
  334. @item link
  335. Choose if the @code{average} level between all channels of input stream
  336. or the louder(@code{maximum}) channel of input stream affects the
  337. reduction. Default is @code{average}.
  338. @item detection
  339. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  340. of @code{rms}. Default is @code{rms} which is mostly smoother.
  341. @item mix
  342. How much to use compressed signal in output. Default is 1.
  343. Range is between 0 and 1.
  344. @end table
  345. @section acontrast
  346. Simple audio dynamic range commpression/expansion filter.
  347. The filter accepts the following options:
  348. @table @option
  349. @item contrast
  350. Set contrast. Default is 33. Allowed range is between 0 and 100.
  351. @end table
  352. @section acopy
  353. Copy the input audio source unchanged to the output. This is mainly useful for
  354. testing purposes.
  355. @section acrossfade
  356. Apply cross fade from one input audio stream to another input audio stream.
  357. The cross fade is applied for specified duration near the end of first stream.
  358. The filter accepts the following options:
  359. @table @option
  360. @item nb_samples, ns
  361. Specify the number of samples for which the cross fade effect has to last.
  362. At the end of the cross fade effect the first input audio will be completely
  363. silent. Default is 44100.
  364. @item duration, d
  365. Specify the duration of the cross fade effect. See
  366. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  367. for the accepted syntax.
  368. By default the duration is determined by @var{nb_samples}.
  369. If set this option is used instead of @var{nb_samples}.
  370. @item overlap, o
  371. Should first stream end overlap with second stream start. Default is enabled.
  372. @item curve1
  373. Set curve for cross fade transition for first stream.
  374. @item curve2
  375. Set curve for cross fade transition for second stream.
  376. For description of available curve types see @ref{afade} filter description.
  377. @end table
  378. @subsection Examples
  379. @itemize
  380. @item
  381. Cross fade from one input to another:
  382. @example
  383. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  384. @end example
  385. @item
  386. Cross fade from one input to another but without overlapping:
  387. @example
  388. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  389. @end example
  390. @end itemize
  391. @section acrossover
  392. Split audio stream into several bands.
  393. This filter splits audio stream into two or more frequency ranges.
  394. Summing all streams back will give flat output.
  395. The filter accepts the following options:
  396. @table @option
  397. @item split
  398. Set split frequencies. Those must be positive and increasing.
  399. @item order
  400. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  401. Default is @var{4th}.
  402. @end table
  403. @section acrusher
  404. Reduce audio bit resolution.
  405. This filter is bit crusher with enhanced functionality. A bit crusher
  406. is used to audibly reduce number of bits an audio signal is sampled
  407. with. This doesn't change the bit depth at all, it just produces the
  408. effect. Material reduced in bit depth sounds more harsh and "digital".
  409. This filter is able to even round to continuous values instead of discrete
  410. bit depths.
  411. Additionally it has a D/C offset which results in different crushing of
  412. the lower and the upper half of the signal.
  413. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  414. Another feature of this filter is the logarithmic mode.
  415. This setting switches from linear distances between bits to logarithmic ones.
  416. The result is a much more "natural" sounding crusher which doesn't gate low
  417. signals for example. The human ear has a logarithmic perception,
  418. so this kind of crushing is much more pleasant.
  419. Logarithmic crushing is also able to get anti-aliased.
  420. The filter accepts the following options:
  421. @table @option
  422. @item level_in
  423. Set level in.
  424. @item level_out
  425. Set level out.
  426. @item bits
  427. Set bit reduction.
  428. @item mix
  429. Set mixing amount.
  430. @item mode
  431. Can be linear: @code{lin} or logarithmic: @code{log}.
  432. @item dc
  433. Set DC.
  434. @item aa
  435. Set anti-aliasing.
  436. @item samples
  437. Set sample reduction.
  438. @item lfo
  439. Enable LFO. By default disabled.
  440. @item lforange
  441. Set LFO range.
  442. @item lforate
  443. Set LFO rate.
  444. @end table
  445. @section acue
  446. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  447. filter.
  448. @section adeclick
  449. Remove impulsive noise from input audio.
  450. Samples detected as impulsive noise are replaced by interpolated samples using
  451. autoregressive modelling.
  452. @table @option
  453. @item w
  454. Set window size, in milliseconds. Allowed range is from @code{10} to
  455. @code{100}. Default value is @code{55} milliseconds.
  456. This sets size of window which will be processed at once.
  457. @item o
  458. Set window overlap, in percentage of window size. Allowed range is from
  459. @code{50} to @code{95}. Default value is @code{75} percent.
  460. Setting this to a very high value increases impulsive noise removal but makes
  461. whole process much slower.
  462. @item a
  463. Set autoregression order, in percentage of window size. Allowed range is from
  464. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  465. controls quality of interpolated samples using neighbour good samples.
  466. @item t
  467. Set threshold value. Allowed range is from @code{1} to @code{100}.
  468. Default value is @code{2}.
  469. This controls the strength of impulsive noise which is going to be removed.
  470. The lower value, the more samples will be detected as impulsive noise.
  471. @item b
  472. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  473. @code{10}. Default value is @code{2}.
  474. If any two samples deteced as noise are spaced less than this value then any
  475. sample inbetween those two samples will be also detected as noise.
  476. @item m
  477. Set overlap method.
  478. It accepts the following values:
  479. @table @option
  480. @item a
  481. Select overlap-add method. Even not interpolated samples are slightly
  482. changed with this method.
  483. @item s
  484. Select overlap-save method. Not interpolated samples remain unchanged.
  485. @end table
  486. Default value is @code{a}.
  487. @end table
  488. @section adeclip
  489. Remove clipped samples from input audio.
  490. Samples detected as clipped are replaced by interpolated samples using
  491. autoregressive modelling.
  492. @table @option
  493. @item w
  494. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  495. Default value is @code{55} milliseconds.
  496. This sets size of window which will be processed at once.
  497. @item o
  498. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  499. to @code{95}. Default value is @code{75} percent.
  500. @item a
  501. Set autoregression order, in percentage of window size. Allowed range is from
  502. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  503. quality of interpolated samples using neighbour good samples.
  504. @item t
  505. Set threshold value. Allowed range is from @code{1} to @code{100}.
  506. Default value is @code{10}. Higher values make clip detection less aggressive.
  507. @item n
  508. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  509. Default value is @code{1000}. Higher values make clip detection less aggressive.
  510. @item m
  511. Set overlap method.
  512. It accepts the following values:
  513. @table @option
  514. @item a
  515. Select overlap-add method. Even not interpolated samples are slightly changed
  516. with this method.
  517. @item s
  518. Select overlap-save method. Not interpolated samples remain unchanged.
  519. @end table
  520. Default value is @code{a}.
  521. @end table
  522. @section adelay
  523. Delay one or more audio channels.
  524. Samples in delayed channel are filled with silence.
  525. The filter accepts the following option:
  526. @table @option
  527. @item delays
  528. Set list of delays in milliseconds for each channel separated by '|'.
  529. Unused delays will be silently ignored. If number of given delays is
  530. smaller than number of channels all remaining channels will not be delayed.
  531. If you want to delay exact number of samples, append 'S' to number.
  532. @end table
  533. @subsection Examples
  534. @itemize
  535. @item
  536. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  537. the second channel (and any other channels that may be present) unchanged.
  538. @example
  539. adelay=1500|0|500
  540. @end example
  541. @item
  542. Delay second channel by 500 samples, the third channel by 700 samples and leave
  543. the first channel (and any other channels that may be present) unchanged.
  544. @example
  545. adelay=0|500S|700S
  546. @end example
  547. @end itemize
  548. @section aderivative, aintegral
  549. Compute derivative/integral of audio stream.
  550. Applying both filters one after another produces original audio.
  551. @section aecho
  552. Apply echoing to the input audio.
  553. Echoes are reflected sound and can occur naturally amongst mountains
  554. (and sometimes large buildings) when talking or shouting; digital echo
  555. effects emulate this behaviour and are often used to help fill out the
  556. sound of a single instrument or vocal. The time difference between the
  557. original signal and the reflection is the @code{delay}, and the
  558. loudness of the reflected signal is the @code{decay}.
  559. Multiple echoes can have different delays and decays.
  560. A description of the accepted parameters follows.
  561. @table @option
  562. @item in_gain
  563. Set input gain of reflected signal. Default is @code{0.6}.
  564. @item out_gain
  565. Set output gain of reflected signal. Default is @code{0.3}.
  566. @item delays
  567. Set list of time intervals in milliseconds between original signal and reflections
  568. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  569. Default is @code{1000}.
  570. @item decays
  571. Set list of loudness of reflected signals separated by '|'.
  572. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  573. Default is @code{0.5}.
  574. @end table
  575. @subsection Examples
  576. @itemize
  577. @item
  578. Make it sound as if there are twice as many instruments as are actually playing:
  579. @example
  580. aecho=0.8:0.88:60:0.4
  581. @end example
  582. @item
  583. If delay is very short, then it sound like a (metallic) robot playing music:
  584. @example
  585. aecho=0.8:0.88:6:0.4
  586. @end example
  587. @item
  588. A longer delay will sound like an open air concert in the mountains:
  589. @example
  590. aecho=0.8:0.9:1000:0.3
  591. @end example
  592. @item
  593. Same as above but with one more mountain:
  594. @example
  595. aecho=0.8:0.9:1000|1800:0.3|0.25
  596. @end example
  597. @end itemize
  598. @section aemphasis
  599. Audio emphasis filter creates or restores material directly taken from LPs or
  600. emphased CDs with different filter curves. E.g. to store music on vinyl the
  601. signal has to be altered by a filter first to even out the disadvantages of
  602. this recording medium.
  603. Once the material is played back the inverse filter has to be applied to
  604. restore the distortion of the frequency response.
  605. The filter accepts the following options:
  606. @table @option
  607. @item level_in
  608. Set input gain.
  609. @item level_out
  610. Set output gain.
  611. @item mode
  612. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  613. use @code{production} mode. Default is @code{reproduction} mode.
  614. @item type
  615. Set filter type. Selects medium. Can be one of the following:
  616. @table @option
  617. @item col
  618. select Columbia.
  619. @item emi
  620. select EMI.
  621. @item bsi
  622. select BSI (78RPM).
  623. @item riaa
  624. select RIAA.
  625. @item cd
  626. select Compact Disc (CD).
  627. @item 50fm
  628. select 50µs (FM).
  629. @item 75fm
  630. select 75µs (FM).
  631. @item 50kf
  632. select 50µs (FM-KF).
  633. @item 75kf
  634. select 75µs (FM-KF).
  635. @end table
  636. @end table
  637. @section aeval
  638. Modify an audio signal according to the specified expressions.
  639. This filter accepts one or more expressions (one for each channel),
  640. which are evaluated and used to modify a corresponding audio signal.
  641. It accepts the following parameters:
  642. @table @option
  643. @item exprs
  644. Set the '|'-separated expressions list for each separate channel. If
  645. the number of input channels is greater than the number of
  646. expressions, the last specified expression is used for the remaining
  647. output channels.
  648. @item channel_layout, c
  649. Set output channel layout. If not specified, the channel layout is
  650. specified by the number of expressions. If set to @samp{same}, it will
  651. use by default the same input channel layout.
  652. @end table
  653. Each expression in @var{exprs} can contain the following constants and functions:
  654. @table @option
  655. @item ch
  656. channel number of the current expression
  657. @item n
  658. number of the evaluated sample, starting from 0
  659. @item s
  660. sample rate
  661. @item t
  662. time of the evaluated sample expressed in seconds
  663. @item nb_in_channels
  664. @item nb_out_channels
  665. input and output number of channels
  666. @item val(CH)
  667. the value of input channel with number @var{CH}
  668. @end table
  669. Note: this filter is slow. For faster processing you should use a
  670. dedicated filter.
  671. @subsection Examples
  672. @itemize
  673. @item
  674. Half volume:
  675. @example
  676. aeval=val(ch)/2:c=same
  677. @end example
  678. @item
  679. Invert phase of the second channel:
  680. @example
  681. aeval=val(0)|-val(1)
  682. @end example
  683. @end itemize
  684. @anchor{afade}
  685. @section afade
  686. Apply fade-in/out effect to input audio.
  687. A description of the accepted parameters follows.
  688. @table @option
  689. @item type, t
  690. Specify the effect type, can be either @code{in} for fade-in, or
  691. @code{out} for a fade-out effect. Default is @code{in}.
  692. @item start_sample, ss
  693. Specify the number of the start sample for starting to apply the fade
  694. effect. Default is 0.
  695. @item nb_samples, ns
  696. Specify the number of samples for which the fade effect has to last. At
  697. the end of the fade-in effect the output audio will have the same
  698. volume as the input audio, at the end of the fade-out transition
  699. the output audio will be silence. Default is 44100.
  700. @item start_time, st
  701. Specify the start time of the fade effect. Default is 0.
  702. The value must be specified as a time duration; see
  703. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  704. for the accepted syntax.
  705. If set this option is used instead of @var{start_sample}.
  706. @item duration, d
  707. Specify the duration of the fade effect. See
  708. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  709. for the accepted syntax.
  710. At the end of the fade-in effect the output audio will have the same
  711. volume as the input audio, at the end of the fade-out transition
  712. the output audio will be silence.
  713. By default the duration is determined by @var{nb_samples}.
  714. If set this option is used instead of @var{nb_samples}.
  715. @item curve
  716. Set curve for fade transition.
  717. It accepts the following values:
  718. @table @option
  719. @item tri
  720. select triangular, linear slope (default)
  721. @item qsin
  722. select quarter of sine wave
  723. @item hsin
  724. select half of sine wave
  725. @item esin
  726. select exponential sine wave
  727. @item log
  728. select logarithmic
  729. @item ipar
  730. select inverted parabola
  731. @item qua
  732. select quadratic
  733. @item cub
  734. select cubic
  735. @item squ
  736. select square root
  737. @item cbr
  738. select cubic root
  739. @item par
  740. select parabola
  741. @item exp
  742. select exponential
  743. @item iqsin
  744. select inverted quarter of sine wave
  745. @item ihsin
  746. select inverted half of sine wave
  747. @item dese
  748. select double-exponential seat
  749. @item desi
  750. select double-exponential sigmoid
  751. @end table
  752. @end table
  753. @subsection Examples
  754. @itemize
  755. @item
  756. Fade in first 15 seconds of audio:
  757. @example
  758. afade=t=in:ss=0:d=15
  759. @end example
  760. @item
  761. Fade out last 25 seconds of a 900 seconds audio:
  762. @example
  763. afade=t=out:st=875:d=25
  764. @end example
  765. @end itemize
  766. @section afftfilt
  767. Apply arbitrary expressions to samples in frequency domain.
  768. @table @option
  769. @item real
  770. Set frequency domain real expression for each separate channel separated
  771. by '|'. Default is "1".
  772. If the number of input channels is greater than the number of
  773. expressions, the last specified expression is used for the remaining
  774. output channels.
  775. @item imag
  776. Set frequency domain imaginary expression for each separate channel
  777. separated by '|'. If not set, @var{real} option is used.
  778. Each expression in @var{real} and @var{imag} can contain the following
  779. constants:
  780. @table @option
  781. @item sr
  782. sample rate
  783. @item b
  784. current frequency bin number
  785. @item nb
  786. number of available bins
  787. @item ch
  788. channel number of the current expression
  789. @item chs
  790. number of channels
  791. @item pts
  792. current frame pts
  793. @end table
  794. @item win_size
  795. Set window size.
  796. It accepts the following values:
  797. @table @samp
  798. @item w16
  799. @item w32
  800. @item w64
  801. @item w128
  802. @item w256
  803. @item w512
  804. @item w1024
  805. @item w2048
  806. @item w4096
  807. @item w8192
  808. @item w16384
  809. @item w32768
  810. @item w65536
  811. @end table
  812. Default is @code{w4096}
  813. @item win_func
  814. Set window function. Default is @code{hann}.
  815. @item overlap
  816. Set window overlap. If set to 1, the recommended overlap for selected
  817. window function will be picked. Default is @code{0.75}.
  818. @end table
  819. @subsection Examples
  820. @itemize
  821. @item
  822. Leave almost only low frequencies in audio:
  823. @example
  824. afftfilt="1-clip((b/nb)*b,0,1)"
  825. @end example
  826. @end itemize
  827. @anchor{afir}
  828. @section afir
  829. Apply an arbitrary Frequency Impulse Response filter.
  830. This filter is designed for applying long FIR filters,
  831. up to 30 seconds long.
  832. It can be used as component for digital crossover filters,
  833. room equalization, cross talk cancellation, wavefield synthesis,
  834. auralization, ambiophonics and ambisonics.
  835. This filter uses second stream as FIR coefficients.
  836. If second stream holds single channel, it will be used
  837. for all input channels in first stream, otherwise
  838. number of channels in second stream must be same as
  839. number of channels in first stream.
  840. It accepts the following parameters:
  841. @table @option
  842. @item dry
  843. Set dry gain. This sets input gain.
  844. @item wet
  845. Set wet gain. This sets final output gain.
  846. @item length
  847. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  848. @item again
  849. Enable applying gain measured from power of IR.
  850. @item maxir
  851. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  852. Allowed range is 0.1 to 60 seconds.
  853. @item response
  854. Show IR frequency reponse, magnitude and phase in additional video stream.
  855. By default it is disabled.
  856. @item channel
  857. Set for which IR channel to display frequency response. By default is first channel
  858. displayed. This option is used only when @var{response} is enabled.
  859. @item size
  860. Set video stream size. This option is used only when @var{response} is enabled.
  861. @end table
  862. @subsection Examples
  863. @itemize
  864. @item
  865. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  866. @example
  867. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  868. @end example
  869. @end itemize
  870. @anchor{aformat}
  871. @section aformat
  872. Set output format constraints for the input audio. The framework will
  873. negotiate the most appropriate format to minimize conversions.
  874. It accepts the following parameters:
  875. @table @option
  876. @item sample_fmts
  877. A '|'-separated list of requested sample formats.
  878. @item sample_rates
  879. A '|'-separated list of requested sample rates.
  880. @item channel_layouts
  881. A '|'-separated list of requested channel layouts.
  882. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  883. for the required syntax.
  884. @end table
  885. If a parameter is omitted, all values are allowed.
  886. Force the output to either unsigned 8-bit or signed 16-bit stereo
  887. @example
  888. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  889. @end example
  890. @section agate
  891. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  892. processing reduces disturbing noise between useful signals.
  893. Gating is done by detecting the volume below a chosen level @var{threshold}
  894. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  895. floor is set via @var{range}. Because an exact manipulation of the signal
  896. would cause distortion of the waveform the reduction can be levelled over
  897. time. This is done by setting @var{attack} and @var{release}.
  898. @var{attack} determines how long the signal has to fall below the threshold
  899. before any reduction will occur and @var{release} sets the time the signal
  900. has to rise above the threshold to reduce the reduction again.
  901. Shorter signals than the chosen attack time will be left untouched.
  902. @table @option
  903. @item level_in
  904. Set input level before filtering.
  905. Default is 1. Allowed range is from 0.015625 to 64.
  906. @item range
  907. Set the level of gain reduction when the signal is below the threshold.
  908. Default is 0.06125. Allowed range is from 0 to 1.
  909. @item threshold
  910. If a signal rises above this level the gain reduction is released.
  911. Default is 0.125. Allowed range is from 0 to 1.
  912. @item ratio
  913. Set a ratio by which the signal is reduced.
  914. Default is 2. Allowed range is from 1 to 9000.
  915. @item attack
  916. Amount of milliseconds the signal has to rise above the threshold before gain
  917. reduction stops.
  918. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  919. @item release
  920. Amount of milliseconds the signal has to fall below the threshold before the
  921. reduction is increased again. Default is 250 milliseconds.
  922. Allowed range is from 0.01 to 9000.
  923. @item makeup
  924. Set amount of amplification of signal after processing.
  925. Default is 1. Allowed range is from 1 to 64.
  926. @item knee
  927. Curve the sharp knee around the threshold to enter gain reduction more softly.
  928. Default is 2.828427125. Allowed range is from 1 to 8.
  929. @item detection
  930. Choose if exact signal should be taken for detection or an RMS like one.
  931. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  932. @item link
  933. Choose if the average level between all channels or the louder channel affects
  934. the reduction.
  935. Default is @code{average}. Can be @code{average} or @code{maximum}.
  936. @end table
  937. @section aiir
  938. Apply an arbitrary Infinite Impulse Response filter.
  939. It accepts the following parameters:
  940. @table @option
  941. @item z
  942. Set numerator/zeros coefficients.
  943. @item p
  944. Set denominator/poles coefficients.
  945. @item k
  946. Set channels gains.
  947. @item dry_gain
  948. Set input gain.
  949. @item wet_gain
  950. Set output gain.
  951. @item f
  952. Set coefficients format.
  953. @table @samp
  954. @item tf
  955. transfer function
  956. @item zp
  957. Z-plane zeros/poles, cartesian (default)
  958. @item pr
  959. Z-plane zeros/poles, polar radians
  960. @item pd
  961. Z-plane zeros/poles, polar degrees
  962. @end table
  963. @item r
  964. Set kind of processing.
  965. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  966. @item e
  967. Set filtering precision.
  968. @table @samp
  969. @item dbl
  970. double-precision floating-point (default)
  971. @item flt
  972. single-precision floating-point
  973. @item i32
  974. 32-bit integers
  975. @item i16
  976. 16-bit integers
  977. @end table
  978. @item response
  979. Show IR frequency reponse, magnitude and phase in additional video stream.
  980. By default it is disabled.
  981. @item channel
  982. Set for which IR channel to display frequency response. By default is first channel
  983. displayed. This option is used only when @var{response} is enabled.
  984. @item size
  985. Set video stream size. This option is used only when @var{response} is enabled.
  986. @end table
  987. Coefficients in @code{tf} format are separated by spaces and are in ascending
  988. order.
  989. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  990. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  991. imaginary unit.
  992. Different coefficients and gains can be provided for every channel, in such case
  993. use '|' to separate coefficients or gains. Last provided coefficients will be
  994. used for all remaining channels.
  995. @subsection Examples
  996. @itemize
  997. @item
  998. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  999. @example
  1000. 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
  1001. @end example
  1002. @item
  1003. Same as above but in @code{zp} format:
  1004. @example
  1005. 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
  1006. @end example
  1007. @end itemize
  1008. @section alimiter
  1009. The limiter prevents an input signal from rising over a desired threshold.
  1010. This limiter uses lookahead technology to prevent your signal from distorting.
  1011. It means that there is a small delay after the signal is processed. Keep in mind
  1012. that the delay it produces is the attack time you set.
  1013. The filter accepts the following options:
  1014. @table @option
  1015. @item level_in
  1016. Set input gain. Default is 1.
  1017. @item level_out
  1018. Set output gain. Default is 1.
  1019. @item limit
  1020. Don't let signals above this level pass the limiter. Default is 1.
  1021. @item attack
  1022. The limiter will reach its attenuation level in this amount of time in
  1023. milliseconds. Default is 5 milliseconds.
  1024. @item release
  1025. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1026. Default is 50 milliseconds.
  1027. @item asc
  1028. When gain reduction is always needed ASC takes care of releasing to an
  1029. average reduction level rather than reaching a reduction of 0 in the release
  1030. time.
  1031. @item asc_level
  1032. Select how much the release time is affected by ASC, 0 means nearly no changes
  1033. in release time while 1 produces higher release times.
  1034. @item level
  1035. Auto level output signal. Default is enabled.
  1036. This normalizes audio back to 0dB if enabled.
  1037. @end table
  1038. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1039. with @ref{aresample} before applying this filter.
  1040. @section allpass
  1041. Apply a two-pole all-pass filter with central frequency (in Hz)
  1042. @var{frequency}, and filter-width @var{width}.
  1043. An all-pass filter changes the audio's frequency to phase relationship
  1044. without changing its frequency to amplitude relationship.
  1045. The filter accepts the following options:
  1046. @table @option
  1047. @item frequency, f
  1048. Set frequency in Hz.
  1049. @item width_type, t
  1050. Set method to specify band-width of filter.
  1051. @table @option
  1052. @item h
  1053. Hz
  1054. @item q
  1055. Q-Factor
  1056. @item o
  1057. octave
  1058. @item s
  1059. slope
  1060. @item k
  1061. kHz
  1062. @end table
  1063. @item width, w
  1064. Specify the band-width of a filter in width_type units.
  1065. @item channels, c
  1066. Specify which channels to filter, by default all available are filtered.
  1067. @end table
  1068. @subsection Commands
  1069. This filter supports the following commands:
  1070. @table @option
  1071. @item frequency, f
  1072. Change allpass frequency.
  1073. Syntax for the command is : "@var{frequency}"
  1074. @item width_type, t
  1075. Change allpass width_type.
  1076. Syntax for the command is : "@var{width_type}"
  1077. @item width, w
  1078. Change allpass width.
  1079. Syntax for the command is : "@var{width}"
  1080. @end table
  1081. @section aloop
  1082. Loop audio samples.
  1083. The filter accepts the following options:
  1084. @table @option
  1085. @item loop
  1086. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1087. Default is 0.
  1088. @item size
  1089. Set maximal number of samples. Default is 0.
  1090. @item start
  1091. Set first sample of loop. Default is 0.
  1092. @end table
  1093. @anchor{amerge}
  1094. @section amerge
  1095. Merge two or more audio streams into a single multi-channel stream.
  1096. The filter accepts the following options:
  1097. @table @option
  1098. @item inputs
  1099. Set the number of inputs. Default is 2.
  1100. @end table
  1101. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1102. the channel layout of the output will be set accordingly and the channels
  1103. will be reordered as necessary. If the channel layouts of the inputs are not
  1104. disjoint, the output will have all the channels of the first input then all
  1105. the channels of the second input, in that order, and the channel layout of
  1106. the output will be the default value corresponding to the total number of
  1107. channels.
  1108. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1109. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1110. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1111. first input, b1 is the first channel of the second input).
  1112. On the other hand, if both input are in stereo, the output channels will be
  1113. in the default order: a1, a2, b1, b2, and the channel layout will be
  1114. arbitrarily set to 4.0, which may or may not be the expected value.
  1115. All inputs must have the same sample rate, and format.
  1116. If inputs do not have the same duration, the output will stop with the
  1117. shortest.
  1118. @subsection Examples
  1119. @itemize
  1120. @item
  1121. Merge two mono files into a stereo stream:
  1122. @example
  1123. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1124. @end example
  1125. @item
  1126. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1127. @example
  1128. 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
  1129. @end example
  1130. @end itemize
  1131. @section amix
  1132. Mixes multiple audio inputs into a single output.
  1133. Note that this filter only supports float samples (the @var{amerge}
  1134. and @var{pan} audio filters support many formats). If the @var{amix}
  1135. input has integer samples then @ref{aresample} will be automatically
  1136. inserted to perform the conversion to float samples.
  1137. For example
  1138. @example
  1139. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1140. @end example
  1141. will mix 3 input audio streams to a single output with the same duration as the
  1142. first input and a dropout transition time of 3 seconds.
  1143. It accepts the following parameters:
  1144. @table @option
  1145. @item inputs
  1146. The number of inputs. If unspecified, it defaults to 2.
  1147. @item duration
  1148. How to determine the end-of-stream.
  1149. @table @option
  1150. @item longest
  1151. The duration of the longest input. (default)
  1152. @item shortest
  1153. The duration of the shortest input.
  1154. @item first
  1155. The duration of the first input.
  1156. @end table
  1157. @item dropout_transition
  1158. The transition time, in seconds, for volume renormalization when an input
  1159. stream ends. The default value is 2 seconds.
  1160. @item weights
  1161. Specify weight of each input audio stream as sequence.
  1162. Each weight is separated by space. By default all inputs have same weight.
  1163. @end table
  1164. @section amultiply
  1165. Multiply first audio stream with second audio stream and store result
  1166. in output audio stream. Multiplication is done by multiplying each
  1167. sample from first stream with sample at same position from second stream.
  1168. With this element-wise multiplication one can create amplitude fades and
  1169. amplitude modulations.
  1170. @section anequalizer
  1171. High-order parametric multiband equalizer for each channel.
  1172. It accepts the following parameters:
  1173. @table @option
  1174. @item params
  1175. This option string is in format:
  1176. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1177. Each equalizer band is separated by '|'.
  1178. @table @option
  1179. @item chn
  1180. Set channel number to which equalization will be applied.
  1181. If input doesn't have that channel the entry is ignored.
  1182. @item f
  1183. Set central frequency for band.
  1184. If input doesn't have that frequency the entry is ignored.
  1185. @item w
  1186. Set band width in hertz.
  1187. @item g
  1188. Set band gain in dB.
  1189. @item t
  1190. Set filter type for band, optional, can be:
  1191. @table @samp
  1192. @item 0
  1193. Butterworth, this is default.
  1194. @item 1
  1195. Chebyshev type 1.
  1196. @item 2
  1197. Chebyshev type 2.
  1198. @end table
  1199. @end table
  1200. @item curves
  1201. With this option activated frequency response of anequalizer is displayed
  1202. in video stream.
  1203. @item size
  1204. Set video stream size. Only useful if curves option is activated.
  1205. @item mgain
  1206. Set max gain that will be displayed. Only useful if curves option is activated.
  1207. Setting this to a reasonable value makes it possible to display gain which is derived from
  1208. neighbour bands which are too close to each other and thus produce higher gain
  1209. when both are activated.
  1210. @item fscale
  1211. Set frequency scale used to draw frequency response in video output.
  1212. Can be linear or logarithmic. Default is logarithmic.
  1213. @item colors
  1214. Set color for each channel curve which is going to be displayed in video stream.
  1215. This is list of color names separated by space or by '|'.
  1216. Unrecognised or missing colors will be replaced by white color.
  1217. @end table
  1218. @subsection Examples
  1219. @itemize
  1220. @item
  1221. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1222. for first 2 channels using Chebyshev type 1 filter:
  1223. @example
  1224. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1225. @end example
  1226. @end itemize
  1227. @subsection Commands
  1228. This filter supports the following commands:
  1229. @table @option
  1230. @item change
  1231. Alter existing filter parameters.
  1232. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1233. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1234. error is returned.
  1235. @var{freq} set new frequency parameter.
  1236. @var{width} set new width parameter in herz.
  1237. @var{gain} set new gain parameter in dB.
  1238. Full filter invocation with asendcmd may look like this:
  1239. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1240. @end table
  1241. @section anull
  1242. Pass the audio source unchanged to the output.
  1243. @section apad
  1244. Pad the end of an audio stream with silence.
  1245. This can be used together with @command{ffmpeg} @option{-shortest} to
  1246. extend audio streams to the same length as the video stream.
  1247. A description of the accepted options follows.
  1248. @table @option
  1249. @item packet_size
  1250. Set silence packet size. Default value is 4096.
  1251. @item pad_len
  1252. Set the number of samples of silence to add to the end. After the
  1253. value is reached, the stream is terminated. This option is mutually
  1254. exclusive with @option{whole_len}.
  1255. @item whole_len
  1256. Set the minimum total number of samples in the output audio stream. If
  1257. the value is longer than the input audio length, silence is added to
  1258. the end, until the value is reached. This option is mutually exclusive
  1259. with @option{pad_len}.
  1260. @end table
  1261. If neither the @option{pad_len} nor the @option{whole_len} option is
  1262. set, the filter will add silence to the end of the input stream
  1263. indefinitely.
  1264. @subsection Examples
  1265. @itemize
  1266. @item
  1267. Add 1024 samples of silence to the end of the input:
  1268. @example
  1269. apad=pad_len=1024
  1270. @end example
  1271. @item
  1272. Make sure the audio output will contain at least 10000 samples, pad
  1273. the input with silence if required:
  1274. @example
  1275. apad=whole_len=10000
  1276. @end example
  1277. @item
  1278. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1279. video stream will always result the shortest and will be converted
  1280. until the end in the output file when using the @option{shortest}
  1281. option:
  1282. @example
  1283. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1284. @end example
  1285. @end itemize
  1286. @section aphaser
  1287. Add a phasing effect to the input audio.
  1288. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1289. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1290. A description of the accepted parameters follows.
  1291. @table @option
  1292. @item in_gain
  1293. Set input gain. Default is 0.4.
  1294. @item out_gain
  1295. Set output gain. Default is 0.74
  1296. @item delay
  1297. Set delay in milliseconds. Default is 3.0.
  1298. @item decay
  1299. Set decay. Default is 0.4.
  1300. @item speed
  1301. Set modulation speed in Hz. Default is 0.5.
  1302. @item type
  1303. Set modulation type. Default is triangular.
  1304. It accepts the following values:
  1305. @table @samp
  1306. @item triangular, t
  1307. @item sinusoidal, s
  1308. @end table
  1309. @end table
  1310. @section apulsator
  1311. Audio pulsator is something between an autopanner and a tremolo.
  1312. But it can produce funny stereo effects as well. Pulsator changes the volume
  1313. of the left and right channel based on a LFO (low frequency oscillator) with
  1314. different waveforms and shifted phases.
  1315. This filter have the ability to define an offset between left and right
  1316. channel. An offset of 0 means that both LFO shapes match each other.
  1317. The left and right channel are altered equally - a conventional tremolo.
  1318. An offset of 50% means that the shape of the right channel is exactly shifted
  1319. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1320. an autopanner. At 1 both curves match again. Every setting in between moves the
  1321. phase shift gapless between all stages and produces some "bypassing" sounds with
  1322. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1323. the 0.5) the faster the signal passes from the left to the right speaker.
  1324. The filter accepts the following options:
  1325. @table @option
  1326. @item level_in
  1327. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1328. @item level_out
  1329. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1330. @item mode
  1331. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1332. sawup or sawdown. Default is sine.
  1333. @item amount
  1334. Set modulation. Define how much of original signal is affected by the LFO.
  1335. @item offset_l
  1336. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1337. @item offset_r
  1338. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1339. @item width
  1340. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1341. @item timing
  1342. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1343. @item bpm
  1344. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1345. is set to bpm.
  1346. @item ms
  1347. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1348. is set to ms.
  1349. @item hz
  1350. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1351. if timing is set to hz.
  1352. @end table
  1353. @anchor{aresample}
  1354. @section aresample
  1355. Resample the input audio to the specified parameters, using the
  1356. libswresample library. If none are specified then the filter will
  1357. automatically convert between its input and output.
  1358. This filter is also able to stretch/squeeze the audio data to make it match
  1359. the timestamps or to inject silence / cut out audio to make it match the
  1360. timestamps, do a combination of both or do neither.
  1361. The filter accepts the syntax
  1362. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1363. expresses a sample rate and @var{resampler_options} is a list of
  1364. @var{key}=@var{value} pairs, separated by ":". See the
  1365. @ref{Resampler Options,,"Resampler Options" section in the
  1366. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1367. for the complete list of supported options.
  1368. @subsection Examples
  1369. @itemize
  1370. @item
  1371. Resample the input audio to 44100Hz:
  1372. @example
  1373. aresample=44100
  1374. @end example
  1375. @item
  1376. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1377. samples per second compensation:
  1378. @example
  1379. aresample=async=1000
  1380. @end example
  1381. @end itemize
  1382. @section areverse
  1383. Reverse an audio clip.
  1384. Warning: This filter requires memory to buffer the entire clip, so trimming
  1385. is suggested.
  1386. @subsection Examples
  1387. @itemize
  1388. @item
  1389. Take the first 5 seconds of a clip, and reverse it.
  1390. @example
  1391. atrim=end=5,areverse
  1392. @end example
  1393. @end itemize
  1394. @section asetnsamples
  1395. Set the number of samples per each output audio frame.
  1396. The last output packet may contain a different number of samples, as
  1397. the filter will flush all the remaining samples when the input audio
  1398. signals its end.
  1399. The filter accepts the following options:
  1400. @table @option
  1401. @item nb_out_samples, n
  1402. Set the number of frames per each output audio frame. The number is
  1403. intended as the number of samples @emph{per each channel}.
  1404. Default value is 1024.
  1405. @item pad, p
  1406. If set to 1, the filter will pad the last audio frame with zeroes, so
  1407. that the last frame will contain the same number of samples as the
  1408. previous ones. Default value is 1.
  1409. @end table
  1410. For example, to set the number of per-frame samples to 1234 and
  1411. disable padding for the last frame, use:
  1412. @example
  1413. asetnsamples=n=1234:p=0
  1414. @end example
  1415. @section asetrate
  1416. Set the sample rate without altering the PCM data.
  1417. This will result in a change of speed and pitch.
  1418. The filter accepts the following options:
  1419. @table @option
  1420. @item sample_rate, r
  1421. Set the output sample rate. Default is 44100 Hz.
  1422. @end table
  1423. @section ashowinfo
  1424. Show a line containing various information for each input audio frame.
  1425. The input audio is not modified.
  1426. The shown line contains a sequence of key/value pairs of the form
  1427. @var{key}:@var{value}.
  1428. The following values are shown in the output:
  1429. @table @option
  1430. @item n
  1431. The (sequential) number of the input frame, starting from 0.
  1432. @item pts
  1433. The presentation timestamp of the input frame, in time base units; the time base
  1434. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1435. @item pts_time
  1436. The presentation timestamp of the input frame in seconds.
  1437. @item pos
  1438. position of the frame in the input stream, -1 if this information in
  1439. unavailable and/or meaningless (for example in case of synthetic audio)
  1440. @item fmt
  1441. The sample format.
  1442. @item chlayout
  1443. The channel layout.
  1444. @item rate
  1445. The sample rate for the audio frame.
  1446. @item nb_samples
  1447. The number of samples (per channel) in the frame.
  1448. @item checksum
  1449. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1450. audio, the data is treated as if all the planes were concatenated.
  1451. @item plane_checksums
  1452. A list of Adler-32 checksums for each data plane.
  1453. @end table
  1454. @anchor{astats}
  1455. @section astats
  1456. Display time domain statistical information about the audio channels.
  1457. Statistics are calculated and displayed for each audio channel and,
  1458. where applicable, an overall figure is also given.
  1459. It accepts the following option:
  1460. @table @option
  1461. @item length
  1462. Short window length in seconds, used for peak and trough RMS measurement.
  1463. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1464. @item metadata
  1465. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1466. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1467. disabled.
  1468. Available keys for each channel are:
  1469. DC_offset
  1470. Min_level
  1471. Max_level
  1472. Min_difference
  1473. Max_difference
  1474. Mean_difference
  1475. RMS_difference
  1476. Peak_level
  1477. RMS_peak
  1478. RMS_trough
  1479. Crest_factor
  1480. Flat_factor
  1481. Peak_count
  1482. Bit_depth
  1483. Dynamic_range
  1484. Zero_crossings
  1485. Zero_crossings_rate
  1486. and for Overall:
  1487. DC_offset
  1488. Min_level
  1489. Max_level
  1490. Min_difference
  1491. Max_difference
  1492. Mean_difference
  1493. RMS_difference
  1494. Peak_level
  1495. RMS_level
  1496. RMS_peak
  1497. RMS_trough
  1498. Flat_factor
  1499. Peak_count
  1500. Bit_depth
  1501. Number_of_samples
  1502. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1503. this @code{lavfi.astats.Overall.Peak_count}.
  1504. For description what each key means read below.
  1505. @item reset
  1506. Set number of frame after which stats are going to be recalculated.
  1507. Default is disabled.
  1508. @end table
  1509. A description of each shown parameter follows:
  1510. @table @option
  1511. @item DC offset
  1512. Mean amplitude displacement from zero.
  1513. @item Min level
  1514. Minimal sample level.
  1515. @item Max level
  1516. Maximal sample level.
  1517. @item Min difference
  1518. Minimal difference between two consecutive samples.
  1519. @item Max difference
  1520. Maximal difference between two consecutive samples.
  1521. @item Mean difference
  1522. Mean difference between two consecutive samples.
  1523. The average of each difference between two consecutive samples.
  1524. @item RMS difference
  1525. Root Mean Square difference between two consecutive samples.
  1526. @item Peak level dB
  1527. @item RMS level dB
  1528. Standard peak and RMS level measured in dBFS.
  1529. @item RMS peak dB
  1530. @item RMS trough dB
  1531. Peak and trough values for RMS level measured over a short window.
  1532. @item Crest factor
  1533. Standard ratio of peak to RMS level (note: not in dB).
  1534. @item Flat factor
  1535. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1536. (i.e. either @var{Min level} or @var{Max level}).
  1537. @item Peak count
  1538. Number of occasions (not the number of samples) that the signal attained either
  1539. @var{Min level} or @var{Max level}.
  1540. @item Bit depth
  1541. Overall bit depth of audio. Number of bits used for each sample.
  1542. @item Dynamic range
  1543. Measured dynamic range of audio in dB.
  1544. @item Zero crossings
  1545. Number of points where the waveform crosses the zero level axis.
  1546. @item Zero crossings rate
  1547. Rate of Zero crossings and number of audio samples.
  1548. @end table
  1549. @section atempo
  1550. Adjust audio tempo.
  1551. The filter accepts exactly one parameter, the audio tempo. If not
  1552. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1553. be in the [0.5, 100.0] range.
  1554. Note that tempo greater than 2 will skip some samples rather than
  1555. blend them in. If for any reason this is a concern it is always
  1556. possible to daisy-chain several instances of atempo to achieve the
  1557. desired product tempo.
  1558. @subsection Examples
  1559. @itemize
  1560. @item
  1561. Slow down audio to 80% tempo:
  1562. @example
  1563. atempo=0.8
  1564. @end example
  1565. @item
  1566. To speed up audio to 300% tempo:
  1567. @example
  1568. atempo=3
  1569. @end example
  1570. @item
  1571. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1572. @example
  1573. atempo=sqrt(3),atempo=sqrt(3)
  1574. @end example
  1575. @end itemize
  1576. @section atrim
  1577. Trim the input so that the output contains one continuous subpart of the input.
  1578. It accepts the following parameters:
  1579. @table @option
  1580. @item start
  1581. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1582. sample with the timestamp @var{start} will be the first sample in the output.
  1583. @item end
  1584. Specify time of the first audio sample that will be dropped, i.e. the
  1585. audio sample immediately preceding the one with the timestamp @var{end} will be
  1586. the last sample in the output.
  1587. @item start_pts
  1588. Same as @var{start}, except this option sets the start timestamp in samples
  1589. instead of seconds.
  1590. @item end_pts
  1591. Same as @var{end}, except this option sets the end timestamp in samples instead
  1592. of seconds.
  1593. @item duration
  1594. The maximum duration of the output in seconds.
  1595. @item start_sample
  1596. The number of the first sample that should be output.
  1597. @item end_sample
  1598. The number of the first sample that should be dropped.
  1599. @end table
  1600. @option{start}, @option{end}, and @option{duration} are expressed as time
  1601. duration specifications; see
  1602. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1603. Note that the first two sets of the start/end options and the @option{duration}
  1604. option look at the frame timestamp, while the _sample options simply count the
  1605. samples that pass through the filter. So start/end_pts and start/end_sample will
  1606. give different results when the timestamps are wrong, inexact or do not start at
  1607. zero. Also note that this filter does not modify the timestamps. If you wish
  1608. to have the output timestamps start at zero, insert the asetpts filter after the
  1609. atrim filter.
  1610. If multiple start or end options are set, this filter tries to be greedy and
  1611. keep all samples that match at least one of the specified constraints. To keep
  1612. only the part that matches all the constraints at once, chain multiple atrim
  1613. filters.
  1614. The defaults are such that all the input is kept. So it is possible to set e.g.
  1615. just the end values to keep everything before the specified time.
  1616. Examples:
  1617. @itemize
  1618. @item
  1619. Drop everything except the second minute of input:
  1620. @example
  1621. ffmpeg -i INPUT -af atrim=60:120
  1622. @end example
  1623. @item
  1624. Keep only the first 1000 samples:
  1625. @example
  1626. ffmpeg -i INPUT -af atrim=end_sample=1000
  1627. @end example
  1628. @end itemize
  1629. @section bandpass
  1630. Apply a two-pole Butterworth band-pass filter with central
  1631. frequency @var{frequency}, and (3dB-point) band-width width.
  1632. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1633. instead of the default: constant 0dB peak gain.
  1634. The filter roll off at 6dB per octave (20dB per decade).
  1635. The filter accepts the following options:
  1636. @table @option
  1637. @item frequency, f
  1638. Set the filter's central frequency. Default is @code{3000}.
  1639. @item csg
  1640. Constant skirt gain if set to 1. Defaults to 0.
  1641. @item width_type, t
  1642. Set method to specify band-width of filter.
  1643. @table @option
  1644. @item h
  1645. Hz
  1646. @item q
  1647. Q-Factor
  1648. @item o
  1649. octave
  1650. @item s
  1651. slope
  1652. @item k
  1653. kHz
  1654. @end table
  1655. @item width, w
  1656. Specify the band-width of a filter in width_type units.
  1657. @item channels, c
  1658. Specify which channels to filter, by default all available are filtered.
  1659. @end table
  1660. @subsection Commands
  1661. This filter supports the following commands:
  1662. @table @option
  1663. @item frequency, f
  1664. Change bandpass frequency.
  1665. Syntax for the command is : "@var{frequency}"
  1666. @item width_type, t
  1667. Change bandpass width_type.
  1668. Syntax for the command is : "@var{width_type}"
  1669. @item width, w
  1670. Change bandpass width.
  1671. Syntax for the command is : "@var{width}"
  1672. @end table
  1673. @section bandreject
  1674. Apply a two-pole Butterworth band-reject filter with central
  1675. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1676. The filter roll off at 6dB per octave (20dB per decade).
  1677. The filter accepts the following options:
  1678. @table @option
  1679. @item frequency, f
  1680. Set the filter's central frequency. Default is @code{3000}.
  1681. @item width_type, t
  1682. Set method to specify band-width of filter.
  1683. @table @option
  1684. @item h
  1685. Hz
  1686. @item q
  1687. Q-Factor
  1688. @item o
  1689. octave
  1690. @item s
  1691. slope
  1692. @item k
  1693. kHz
  1694. @end table
  1695. @item width, w
  1696. Specify the band-width of a filter in width_type units.
  1697. @item channels, c
  1698. Specify which channels to filter, by default all available are filtered.
  1699. @end table
  1700. @subsection Commands
  1701. This filter supports the following commands:
  1702. @table @option
  1703. @item frequency, f
  1704. Change bandreject frequency.
  1705. Syntax for the command is : "@var{frequency}"
  1706. @item width_type, t
  1707. Change bandreject width_type.
  1708. Syntax for the command is : "@var{width_type}"
  1709. @item width, w
  1710. Change bandreject width.
  1711. Syntax for the command is : "@var{width}"
  1712. @end table
  1713. @section bass, lowshelf
  1714. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1715. shelving filter with a response similar to that of a standard
  1716. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1717. The filter accepts the following options:
  1718. @table @option
  1719. @item gain, g
  1720. Give the gain at 0 Hz. Its useful range is about -20
  1721. (for a large cut) to +20 (for a large boost).
  1722. Beware of clipping when using a positive gain.
  1723. @item frequency, f
  1724. Set the filter's central frequency and so can be used
  1725. to extend or reduce the frequency range to be boosted or cut.
  1726. The default value is @code{100} Hz.
  1727. @item width_type, t
  1728. Set method to specify band-width of filter.
  1729. @table @option
  1730. @item h
  1731. Hz
  1732. @item q
  1733. Q-Factor
  1734. @item o
  1735. octave
  1736. @item s
  1737. slope
  1738. @item k
  1739. kHz
  1740. @end table
  1741. @item width, w
  1742. Determine how steep is the filter's shelf transition.
  1743. @item channels, c
  1744. Specify which channels to filter, by default all available are filtered.
  1745. @end table
  1746. @subsection Commands
  1747. This filter supports the following commands:
  1748. @table @option
  1749. @item frequency, f
  1750. Change bass frequency.
  1751. Syntax for the command is : "@var{frequency}"
  1752. @item width_type, t
  1753. Change bass width_type.
  1754. Syntax for the command is : "@var{width_type}"
  1755. @item width, w
  1756. Change bass width.
  1757. Syntax for the command is : "@var{width}"
  1758. @item gain, g
  1759. Change bass gain.
  1760. Syntax for the command is : "@var{gain}"
  1761. @end table
  1762. @section biquad
  1763. Apply a biquad IIR filter with the given coefficients.
  1764. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1765. are the numerator and denominator coefficients respectively.
  1766. and @var{channels}, @var{c} specify which channels to filter, by default all
  1767. available are filtered.
  1768. @subsection Commands
  1769. This filter supports the following commands:
  1770. @table @option
  1771. @item a0
  1772. @item a1
  1773. @item a2
  1774. @item b0
  1775. @item b1
  1776. @item b2
  1777. Change biquad parameter.
  1778. Syntax for the command is : "@var{value}"
  1779. @end table
  1780. @section bs2b
  1781. Bauer stereo to binaural transformation, which improves headphone listening of
  1782. stereo audio records.
  1783. To enable compilation of this filter you need to configure FFmpeg with
  1784. @code{--enable-libbs2b}.
  1785. It accepts the following parameters:
  1786. @table @option
  1787. @item profile
  1788. Pre-defined crossfeed level.
  1789. @table @option
  1790. @item default
  1791. Default level (fcut=700, feed=50).
  1792. @item cmoy
  1793. Chu Moy circuit (fcut=700, feed=60).
  1794. @item jmeier
  1795. Jan Meier circuit (fcut=650, feed=95).
  1796. @end table
  1797. @item fcut
  1798. Cut frequency (in Hz).
  1799. @item feed
  1800. Feed level (in Hz).
  1801. @end table
  1802. @section channelmap
  1803. Remap input channels to new locations.
  1804. It accepts the following parameters:
  1805. @table @option
  1806. @item map
  1807. Map channels from input to output. The argument is a '|'-separated list of
  1808. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1809. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1810. channel (e.g. FL for front left) or its index in the input channel layout.
  1811. @var{out_channel} is the name of the output channel or its index in the output
  1812. channel layout. If @var{out_channel} is not given then it is implicitly an
  1813. index, starting with zero and increasing by one for each mapping.
  1814. @item channel_layout
  1815. The channel layout of the output stream.
  1816. @end table
  1817. If no mapping is present, the filter will implicitly map input channels to
  1818. output channels, preserving indices.
  1819. @subsection Examples
  1820. @itemize
  1821. @item
  1822. For example, assuming a 5.1+downmix input MOV file,
  1823. @example
  1824. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1825. @end example
  1826. will create an output WAV file tagged as stereo from the downmix channels of
  1827. the input.
  1828. @item
  1829. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1830. @example
  1831. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1832. @end example
  1833. @end itemize
  1834. @section channelsplit
  1835. Split each channel from an input audio stream into a separate output stream.
  1836. It accepts the following parameters:
  1837. @table @option
  1838. @item channel_layout
  1839. The channel layout of the input stream. The default is "stereo".
  1840. @item channels
  1841. A channel layout describing the channels to be extracted as separate output streams
  1842. or "all" to extract each input channel as a separate stream. The default is "all".
  1843. Choosing channels not present in channel layout in the input will result in an error.
  1844. @end table
  1845. @subsection Examples
  1846. @itemize
  1847. @item
  1848. For example, assuming a stereo input MP3 file,
  1849. @example
  1850. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1851. @end example
  1852. will create an output Matroska file with two audio streams, one containing only
  1853. the left channel and the other the right channel.
  1854. @item
  1855. Split a 5.1 WAV file into per-channel files:
  1856. @example
  1857. ffmpeg -i in.wav -filter_complex
  1858. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1859. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1860. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1861. side_right.wav
  1862. @end example
  1863. @item
  1864. Extract only LFE from a 5.1 WAV file:
  1865. @example
  1866. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1867. -map '[LFE]' lfe.wav
  1868. @end example
  1869. @end itemize
  1870. @section chorus
  1871. Add a chorus effect to the audio.
  1872. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1873. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1874. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1875. The modulation depth defines the range the modulated delay is played before or after
  1876. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1877. sound tuned around the original one, like in a chorus where some vocals are slightly
  1878. off key.
  1879. It accepts the following parameters:
  1880. @table @option
  1881. @item in_gain
  1882. Set input gain. Default is 0.4.
  1883. @item out_gain
  1884. Set output gain. Default is 0.4.
  1885. @item delays
  1886. Set delays. A typical delay is around 40ms to 60ms.
  1887. @item decays
  1888. Set decays.
  1889. @item speeds
  1890. Set speeds.
  1891. @item depths
  1892. Set depths.
  1893. @end table
  1894. @subsection Examples
  1895. @itemize
  1896. @item
  1897. A single delay:
  1898. @example
  1899. chorus=0.7:0.9:55:0.4:0.25:2
  1900. @end example
  1901. @item
  1902. Two delays:
  1903. @example
  1904. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1905. @end example
  1906. @item
  1907. Fuller sounding chorus with three delays:
  1908. @example
  1909. 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
  1910. @end example
  1911. @end itemize
  1912. @section compand
  1913. Compress or expand the audio's dynamic range.
  1914. It accepts the following parameters:
  1915. @table @option
  1916. @item attacks
  1917. @item decays
  1918. A list of times in seconds for each channel over which the instantaneous level
  1919. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1920. increase of volume and @var{decays} refers to decrease of volume. For most
  1921. situations, the attack time (response to the audio getting louder) should be
  1922. shorter than the decay time, because the human ear is more sensitive to sudden
  1923. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1924. a typical value for decay is 0.8 seconds.
  1925. If specified number of attacks & decays is lower than number of channels, the last
  1926. set attack/decay will be used for all remaining channels.
  1927. @item points
  1928. A list of points for the transfer function, specified in dB relative to the
  1929. maximum possible signal amplitude. Each key points list must be defined using
  1930. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1931. @code{x0/y0 x1/y1 x2/y2 ....}
  1932. The input values must be in strictly increasing order but the transfer function
  1933. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1934. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1935. function are @code{-70/-70|-60/-20|1/0}.
  1936. @item soft-knee
  1937. Set the curve radius in dB for all joints. It defaults to 0.01.
  1938. @item gain
  1939. Set the additional gain in dB to be applied at all points on the transfer
  1940. function. This allows for easy adjustment of the overall gain.
  1941. It defaults to 0.
  1942. @item volume
  1943. Set an initial volume, in dB, to be assumed for each channel when filtering
  1944. starts. This permits the user to supply a nominal level initially, so that, for
  1945. example, a very large gain is not applied to initial signal levels before the
  1946. companding has begun to operate. A typical value for audio which is initially
  1947. quiet is -90 dB. It defaults to 0.
  1948. @item delay
  1949. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1950. delayed before being fed to the volume adjuster. Specifying a delay
  1951. approximately equal to the attack/decay times allows the filter to effectively
  1952. operate in predictive rather than reactive mode. It defaults to 0.
  1953. @end table
  1954. @subsection Examples
  1955. @itemize
  1956. @item
  1957. Make music with both quiet and loud passages suitable for listening to in a
  1958. noisy environment:
  1959. @example
  1960. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1961. @end example
  1962. Another example for audio with whisper and explosion parts:
  1963. @example
  1964. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1965. @end example
  1966. @item
  1967. A noise gate for when the noise is at a lower level than the signal:
  1968. @example
  1969. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1970. @end example
  1971. @item
  1972. Here is another noise gate, this time for when the noise is at a higher level
  1973. than the signal (making it, in some ways, similar to squelch):
  1974. @example
  1975. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1976. @end example
  1977. @item
  1978. 2:1 compression starting at -6dB:
  1979. @example
  1980. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1981. @end example
  1982. @item
  1983. 2:1 compression starting at -9dB:
  1984. @example
  1985. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1986. @end example
  1987. @item
  1988. 2:1 compression starting at -12dB:
  1989. @example
  1990. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1991. @end example
  1992. @item
  1993. 2:1 compression starting at -18dB:
  1994. @example
  1995. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1996. @end example
  1997. @item
  1998. 3:1 compression starting at -15dB:
  1999. @example
  2000. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2001. @end example
  2002. @item
  2003. Compressor/Gate:
  2004. @example
  2005. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2006. @end example
  2007. @item
  2008. Expander:
  2009. @example
  2010. 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
  2011. @end example
  2012. @item
  2013. Hard limiter at -6dB:
  2014. @example
  2015. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2016. @end example
  2017. @item
  2018. Hard limiter at -12dB:
  2019. @example
  2020. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2021. @end example
  2022. @item
  2023. Hard noise gate at -35 dB:
  2024. @example
  2025. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2026. @end example
  2027. @item
  2028. Soft limiter:
  2029. @example
  2030. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2031. @end example
  2032. @end itemize
  2033. @section compensationdelay
  2034. Compensation Delay Line is a metric based delay to compensate differing
  2035. positions of microphones or speakers.
  2036. For example, you have recorded guitar with two microphones placed in
  2037. different location. Because the front of sound wave has fixed speed in
  2038. normal conditions, the phasing of microphones can vary and depends on
  2039. their location and interposition. The best sound mix can be achieved when
  2040. these microphones are in phase (synchronized). Note that distance of
  2041. ~30 cm between microphones makes one microphone to capture signal in
  2042. antiphase to another microphone. That makes the final mix sounding moody.
  2043. This filter helps to solve phasing problems by adding different delays
  2044. to each microphone track and make them synchronized.
  2045. The best result can be reached when you take one track as base and
  2046. synchronize other tracks one by one with it.
  2047. Remember that synchronization/delay tolerance depends on sample rate, too.
  2048. Higher sample rates will give more tolerance.
  2049. It accepts the following parameters:
  2050. @table @option
  2051. @item mm
  2052. Set millimeters distance. This is compensation distance for fine tuning.
  2053. Default is 0.
  2054. @item cm
  2055. Set cm distance. This is compensation distance for tightening distance setup.
  2056. Default is 0.
  2057. @item m
  2058. Set meters distance. This is compensation distance for hard distance setup.
  2059. Default is 0.
  2060. @item dry
  2061. Set dry amount. Amount of unprocessed (dry) signal.
  2062. Default is 0.
  2063. @item wet
  2064. Set wet amount. Amount of processed (wet) signal.
  2065. Default is 1.
  2066. @item temp
  2067. Set temperature degree in Celsius. This is the temperature of the environment.
  2068. Default is 20.
  2069. @end table
  2070. @section crossfeed
  2071. Apply headphone crossfeed filter.
  2072. Crossfeed is the process of blending the left and right channels of stereo
  2073. audio recording.
  2074. It is mainly used to reduce extreme stereo separation of low frequencies.
  2075. The intent is to produce more speaker like sound to the listener.
  2076. The filter accepts the following options:
  2077. @table @option
  2078. @item strength
  2079. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2080. This sets gain of low shelf filter for side part of stereo image.
  2081. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2082. @item range
  2083. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2084. This sets cut off frequency of low shelf filter. Default is cut off near
  2085. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2086. @item level_in
  2087. Set input gain. Default is 0.9.
  2088. @item level_out
  2089. Set output gain. Default is 1.
  2090. @end table
  2091. @section crystalizer
  2092. Simple algorithm to expand audio dynamic range.
  2093. The filter accepts the following options:
  2094. @table @option
  2095. @item i
  2096. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2097. (unchanged sound) to 10.0 (maximum effect).
  2098. @item c
  2099. Enable clipping. By default is enabled.
  2100. @end table
  2101. @section dcshift
  2102. Apply a DC shift to the audio.
  2103. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2104. in the recording chain) from the audio. The effect of a DC offset is reduced
  2105. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2106. a signal has a DC offset.
  2107. @table @option
  2108. @item shift
  2109. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2110. the audio.
  2111. @item limitergain
  2112. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2113. used to prevent clipping.
  2114. @end table
  2115. @section drmeter
  2116. Measure audio dynamic range.
  2117. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2118. is found in transition material. And anything less that 8 have very poor dynamics
  2119. and is very compressed.
  2120. The filter accepts the following options:
  2121. @table @option
  2122. @item length
  2123. Set window length in seconds used to split audio into segments of equal length.
  2124. Default is 3 seconds.
  2125. @end table
  2126. @section dynaudnorm
  2127. Dynamic Audio Normalizer.
  2128. This filter applies a certain amount of gain to the input audio in order
  2129. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2130. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2131. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2132. This allows for applying extra gain to the "quiet" sections of the audio
  2133. while avoiding distortions or clipping the "loud" sections. In other words:
  2134. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2135. sections, in the sense that the volume of each section is brought to the
  2136. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2137. this goal *without* applying "dynamic range compressing". It will retain 100%
  2138. of the dynamic range *within* each section of the audio file.
  2139. @table @option
  2140. @item f
  2141. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2142. Default is 500 milliseconds.
  2143. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2144. referred to as frames. This is required, because a peak magnitude has no
  2145. meaning for just a single sample value. Instead, we need to determine the
  2146. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2147. normalizer would simply use the peak magnitude of the complete file, the
  2148. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2149. frame. The length of a frame is specified in milliseconds. By default, the
  2150. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2151. been found to give good results with most files.
  2152. Note that the exact frame length, in number of samples, will be determined
  2153. automatically, based on the sampling rate of the individual input audio file.
  2154. @item g
  2155. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2156. number. Default is 31.
  2157. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2158. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2159. is specified in frames, centered around the current frame. For the sake of
  2160. simplicity, this must be an odd number. Consequently, the default value of 31
  2161. takes into account the current frame, as well as the 15 preceding frames and
  2162. the 15 subsequent frames. Using a larger window results in a stronger
  2163. smoothing effect and thus in less gain variation, i.e. slower gain
  2164. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2165. effect and thus in more gain variation, i.e. faster gain adaptation.
  2166. In other words, the more you increase this value, the more the Dynamic Audio
  2167. Normalizer will behave like a "traditional" normalization filter. On the
  2168. contrary, the more you decrease this value, the more the Dynamic Audio
  2169. Normalizer will behave like a dynamic range compressor.
  2170. @item p
  2171. Set the target peak value. This specifies the highest permissible magnitude
  2172. level for the normalized audio input. This filter will try to approach the
  2173. target peak magnitude as closely as possible, but at the same time it also
  2174. makes sure that the normalized signal will never exceed the peak magnitude.
  2175. A frame's maximum local gain factor is imposed directly by the target peak
  2176. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2177. It is not recommended to go above this value.
  2178. @item m
  2179. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2180. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2181. factor for each input frame, i.e. the maximum gain factor that does not
  2182. result in clipping or distortion. The maximum gain factor is determined by
  2183. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2184. additionally bounds the frame's maximum gain factor by a predetermined
  2185. (global) maximum gain factor. This is done in order to avoid excessive gain
  2186. factors in "silent" or almost silent frames. By default, the maximum gain
  2187. factor is 10.0, For most inputs the default value should be sufficient and
  2188. it usually is not recommended to increase this value. Though, for input
  2189. with an extremely low overall volume level, it may be necessary to allow even
  2190. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2191. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2192. Instead, a "sigmoid" threshold function will be applied. This way, the
  2193. gain factors will smoothly approach the threshold value, but never exceed that
  2194. value.
  2195. @item r
  2196. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2197. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2198. This means that the maximum local gain factor for each frame is defined
  2199. (only) by the frame's highest magnitude sample. This way, the samples can
  2200. be amplified as much as possible without exceeding the maximum signal
  2201. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2202. Normalizer can also take into account the frame's root mean square,
  2203. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2204. determine the power of a time-varying signal. It is therefore considered
  2205. that the RMS is a better approximation of the "perceived loudness" than
  2206. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2207. frames to a constant RMS value, a uniform "perceived loudness" can be
  2208. established. If a target RMS value has been specified, a frame's local gain
  2209. factor is defined as the factor that would result in exactly that RMS value.
  2210. Note, however, that the maximum local gain factor is still restricted by the
  2211. frame's highest magnitude sample, in order to prevent clipping.
  2212. @item n
  2213. Enable channels coupling. By default is enabled.
  2214. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2215. amount. This means the same gain factor will be applied to all channels, i.e.
  2216. the maximum possible gain factor is determined by the "loudest" channel.
  2217. However, in some recordings, it may happen that the volume of the different
  2218. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2219. In this case, this option can be used to disable the channel coupling. This way,
  2220. the gain factor will be determined independently for each channel, depending
  2221. only on the individual channel's highest magnitude sample. This allows for
  2222. harmonizing the volume of the different channels.
  2223. @item c
  2224. Enable DC bias correction. By default is disabled.
  2225. An audio signal (in the time domain) is a sequence of sample values.
  2226. In the Dynamic Audio Normalizer these sample values are represented in the
  2227. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2228. audio signal, or "waveform", should be centered around the zero point.
  2229. That means if we calculate the mean value of all samples in a file, or in a
  2230. single frame, then the result should be 0.0 or at least very close to that
  2231. value. If, however, there is a significant deviation of the mean value from
  2232. 0.0, in either positive or negative direction, this is referred to as a
  2233. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2234. Audio Normalizer provides optional DC bias correction.
  2235. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2236. the mean value, or "DC correction" offset, of each input frame and subtract
  2237. that value from all of the frame's sample values which ensures those samples
  2238. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2239. boundaries, the DC correction offset values will be interpolated smoothly
  2240. between neighbouring frames.
  2241. @item b
  2242. Enable alternative boundary mode. By default is disabled.
  2243. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2244. around each frame. This includes the preceding frames as well as the
  2245. subsequent frames. However, for the "boundary" frames, located at the very
  2246. beginning and at the very end of the audio file, not all neighbouring
  2247. frames are available. In particular, for the first few frames in the audio
  2248. file, the preceding frames are not known. And, similarly, for the last few
  2249. frames in the audio file, the subsequent frames are not known. Thus, the
  2250. question arises which gain factors should be assumed for the missing frames
  2251. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2252. to deal with this situation. The default boundary mode assumes a gain factor
  2253. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2254. "fade out" at the beginning and at the end of the input, respectively.
  2255. @item s
  2256. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2257. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2258. compression. This means that signal peaks will not be pruned and thus the
  2259. full dynamic range will be retained within each local neighbourhood. However,
  2260. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2261. normalization algorithm with a more "traditional" compression.
  2262. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2263. (thresholding) function. If (and only if) the compression feature is enabled,
  2264. all input frames will be processed by a soft knee thresholding function prior
  2265. to the actual normalization process. Put simply, the thresholding function is
  2266. going to prune all samples whose magnitude exceeds a certain threshold value.
  2267. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2268. value. Instead, the threshold value will be adjusted for each individual
  2269. frame.
  2270. In general, smaller parameters result in stronger compression, and vice versa.
  2271. Values below 3.0 are not recommended, because audible distortion may appear.
  2272. @end table
  2273. @section earwax
  2274. Make audio easier to listen to on headphones.
  2275. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2276. so that when listened to on headphones the stereo image is moved from
  2277. inside your head (standard for headphones) to outside and in front of
  2278. the listener (standard for speakers).
  2279. Ported from SoX.
  2280. @section equalizer
  2281. Apply a two-pole peaking equalisation (EQ) filter. With this
  2282. filter, the signal-level at and around a selected frequency can
  2283. be increased or decreased, whilst (unlike bandpass and bandreject
  2284. filters) that at all other frequencies is unchanged.
  2285. In order to produce complex equalisation curves, this filter can
  2286. be given several times, each with a different central frequency.
  2287. The filter accepts the following options:
  2288. @table @option
  2289. @item frequency, f
  2290. Set the filter's central frequency in Hz.
  2291. @item width_type, t
  2292. Set method to specify band-width of filter.
  2293. @table @option
  2294. @item h
  2295. Hz
  2296. @item q
  2297. Q-Factor
  2298. @item o
  2299. octave
  2300. @item s
  2301. slope
  2302. @item k
  2303. kHz
  2304. @end table
  2305. @item width, w
  2306. Specify the band-width of a filter in width_type units.
  2307. @item gain, g
  2308. Set the required gain or attenuation in dB.
  2309. Beware of clipping when using a positive gain.
  2310. @item channels, c
  2311. Specify which channels to filter, by default all available are filtered.
  2312. @end table
  2313. @subsection Examples
  2314. @itemize
  2315. @item
  2316. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2317. @example
  2318. equalizer=f=1000:t=h:width=200:g=-10
  2319. @end example
  2320. @item
  2321. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2322. @example
  2323. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2324. @end example
  2325. @end itemize
  2326. @subsection Commands
  2327. This filter supports the following commands:
  2328. @table @option
  2329. @item frequency, f
  2330. Change equalizer frequency.
  2331. Syntax for the command is : "@var{frequency}"
  2332. @item width_type, t
  2333. Change equalizer width_type.
  2334. Syntax for the command is : "@var{width_type}"
  2335. @item width, w
  2336. Change equalizer width.
  2337. Syntax for the command is : "@var{width}"
  2338. @item gain, g
  2339. Change equalizer gain.
  2340. Syntax for the command is : "@var{gain}"
  2341. @end table
  2342. @section extrastereo
  2343. Linearly increases the difference between left and right channels which
  2344. adds some sort of "live" effect to playback.
  2345. The filter accepts the following options:
  2346. @table @option
  2347. @item m
  2348. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2349. (average of both channels), with 1.0 sound will be unchanged, with
  2350. -1.0 left and right channels will be swapped.
  2351. @item c
  2352. Enable clipping. By default is enabled.
  2353. @end table
  2354. @section firequalizer
  2355. Apply FIR Equalization using arbitrary frequency response.
  2356. The filter accepts the following option:
  2357. @table @option
  2358. @item gain
  2359. Set gain curve equation (in dB). The expression can contain variables:
  2360. @table @option
  2361. @item f
  2362. the evaluated frequency
  2363. @item sr
  2364. sample rate
  2365. @item ch
  2366. channel number, set to 0 when multichannels evaluation is disabled
  2367. @item chid
  2368. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2369. multichannels evaluation is disabled
  2370. @item chs
  2371. number of channels
  2372. @item chlayout
  2373. channel_layout, see libavutil/channel_layout.h
  2374. @end table
  2375. and functions:
  2376. @table @option
  2377. @item gain_interpolate(f)
  2378. interpolate gain on frequency f based on gain_entry
  2379. @item cubic_interpolate(f)
  2380. same as gain_interpolate, but smoother
  2381. @end table
  2382. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2383. @item gain_entry
  2384. Set gain entry for gain_interpolate function. The expression can
  2385. contain functions:
  2386. @table @option
  2387. @item entry(f, g)
  2388. store gain entry at frequency f with value g
  2389. @end table
  2390. This option is also available as command.
  2391. @item delay
  2392. Set filter delay in seconds. Higher value means more accurate.
  2393. Default is @code{0.01}.
  2394. @item accuracy
  2395. Set filter accuracy in Hz. Lower value means more accurate.
  2396. Default is @code{5}.
  2397. @item wfunc
  2398. Set window function. Acceptable values are:
  2399. @table @option
  2400. @item rectangular
  2401. rectangular window, useful when gain curve is already smooth
  2402. @item hann
  2403. hann window (default)
  2404. @item hamming
  2405. hamming window
  2406. @item blackman
  2407. blackman window
  2408. @item nuttall3
  2409. 3-terms continuous 1st derivative nuttall window
  2410. @item mnuttall3
  2411. minimum 3-terms discontinuous nuttall window
  2412. @item nuttall
  2413. 4-terms continuous 1st derivative nuttall window
  2414. @item bnuttall
  2415. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2416. @item bharris
  2417. blackman-harris window
  2418. @item tukey
  2419. tukey window
  2420. @end table
  2421. @item fixed
  2422. If enabled, use fixed number of audio samples. This improves speed when
  2423. filtering with large delay. Default is disabled.
  2424. @item multi
  2425. Enable multichannels evaluation on gain. Default is disabled.
  2426. @item zero_phase
  2427. Enable zero phase mode by subtracting timestamp to compensate delay.
  2428. Default is disabled.
  2429. @item scale
  2430. Set scale used by gain. Acceptable values are:
  2431. @table @option
  2432. @item linlin
  2433. linear frequency, linear gain
  2434. @item linlog
  2435. linear frequency, logarithmic (in dB) gain (default)
  2436. @item loglin
  2437. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2438. @item loglog
  2439. logarithmic frequency, logarithmic gain
  2440. @end table
  2441. @item dumpfile
  2442. Set file for dumping, suitable for gnuplot.
  2443. @item dumpscale
  2444. Set scale for dumpfile. Acceptable values are same with scale option.
  2445. Default is linlog.
  2446. @item fft2
  2447. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2448. Default is disabled.
  2449. @item min_phase
  2450. Enable minimum phase impulse response. Default is disabled.
  2451. @end table
  2452. @subsection Examples
  2453. @itemize
  2454. @item
  2455. lowpass at 1000 Hz:
  2456. @example
  2457. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2458. @end example
  2459. @item
  2460. lowpass at 1000 Hz with gain_entry:
  2461. @example
  2462. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2463. @end example
  2464. @item
  2465. custom equalization:
  2466. @example
  2467. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2468. @end example
  2469. @item
  2470. higher delay with zero phase to compensate delay:
  2471. @example
  2472. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2473. @end example
  2474. @item
  2475. lowpass on left channel, highpass on right channel:
  2476. @example
  2477. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2478. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2479. @end example
  2480. @end itemize
  2481. @section flanger
  2482. Apply a flanging effect to the audio.
  2483. The filter accepts the following options:
  2484. @table @option
  2485. @item delay
  2486. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2487. @item depth
  2488. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2489. @item regen
  2490. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2491. Default value is 0.
  2492. @item width
  2493. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2494. Default value is 71.
  2495. @item speed
  2496. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2497. @item shape
  2498. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2499. Default value is @var{sinusoidal}.
  2500. @item phase
  2501. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2502. Default value is 25.
  2503. @item interp
  2504. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2505. Default is @var{linear}.
  2506. @end table
  2507. @section haas
  2508. Apply Haas effect to audio.
  2509. Note that this makes most sense to apply on mono signals.
  2510. With this filter applied to mono signals it give some directionality and
  2511. stretches its stereo image.
  2512. The filter accepts the following options:
  2513. @table @option
  2514. @item level_in
  2515. Set input level. By default is @var{1}, or 0dB
  2516. @item level_out
  2517. Set output level. By default is @var{1}, or 0dB.
  2518. @item side_gain
  2519. Set gain applied to side part of signal. By default is @var{1}.
  2520. @item middle_source
  2521. Set kind of middle source. Can be one of the following:
  2522. @table @samp
  2523. @item left
  2524. Pick left channel.
  2525. @item right
  2526. Pick right channel.
  2527. @item mid
  2528. Pick middle part signal of stereo image.
  2529. @item side
  2530. Pick side part signal of stereo image.
  2531. @end table
  2532. @item middle_phase
  2533. Change middle phase. By default is disabled.
  2534. @item left_delay
  2535. Set left channel delay. By default is @var{2.05} milliseconds.
  2536. @item left_balance
  2537. Set left channel balance. By default is @var{-1}.
  2538. @item left_gain
  2539. Set left channel gain. By default is @var{1}.
  2540. @item left_phase
  2541. Change left phase. By default is disabled.
  2542. @item right_delay
  2543. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2544. @item right_balance
  2545. Set right channel balance. By default is @var{1}.
  2546. @item right_gain
  2547. Set right channel gain. By default is @var{1}.
  2548. @item right_phase
  2549. Change right phase. By default is enabled.
  2550. @end table
  2551. @section hdcd
  2552. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2553. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2554. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2555. of HDCD, and detects the Transient Filter flag.
  2556. @example
  2557. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2558. @end example
  2559. When using the filter with wav, note the default encoding for wav is 16-bit,
  2560. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2561. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2562. @example
  2563. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2564. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2565. @end example
  2566. The filter accepts the following options:
  2567. @table @option
  2568. @item disable_autoconvert
  2569. Disable any automatic format conversion or resampling in the filter graph.
  2570. @item process_stereo
  2571. Process the stereo channels together. If target_gain does not match between
  2572. channels, consider it invalid and use the last valid target_gain.
  2573. @item cdt_ms
  2574. Set the code detect timer period in ms.
  2575. @item force_pe
  2576. Always extend peaks above -3dBFS even if PE isn't signaled.
  2577. @item analyze_mode
  2578. Replace audio with a solid tone and adjust the amplitude to signal some
  2579. specific aspect of the decoding process. The output file can be loaded in
  2580. an audio editor alongside the original to aid analysis.
  2581. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2582. Modes are:
  2583. @table @samp
  2584. @item 0, off
  2585. Disabled
  2586. @item 1, lle
  2587. Gain adjustment level at each sample
  2588. @item 2, pe
  2589. Samples where peak extend occurs
  2590. @item 3, cdt
  2591. Samples where the code detect timer is active
  2592. @item 4, tgm
  2593. Samples where the target gain does not match between channels
  2594. @end table
  2595. @end table
  2596. @section headphone
  2597. Apply head-related transfer functions (HRTFs) to create virtual
  2598. loudspeakers around the user for binaural listening via headphones.
  2599. The HRIRs are provided via additional streams, for each channel
  2600. one stereo input stream is needed.
  2601. The filter accepts the following options:
  2602. @table @option
  2603. @item map
  2604. Set mapping of input streams for convolution.
  2605. The argument is a '|'-separated list of channel names in order as they
  2606. are given as additional stream inputs for filter.
  2607. This also specify number of input streams. Number of input streams
  2608. must be not less than number of channels in first stream plus one.
  2609. @item gain
  2610. Set gain applied to audio. Value is in dB. Default is 0.
  2611. @item type
  2612. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2613. processing audio in time domain which is slow.
  2614. @var{freq} is processing audio in frequency domain which is fast.
  2615. Default is @var{freq}.
  2616. @item lfe
  2617. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2618. @item size
  2619. Set size of frame in number of samples which will be processed at once.
  2620. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2621. @item hrir
  2622. Set format of hrir stream.
  2623. Default value is @var{stereo}. Alternative value is @var{multich}.
  2624. If value is set to @var{stereo}, number of additional streams should
  2625. be greater or equal to number of input channels in first input stream.
  2626. Also each additional stream should have stereo number of channels.
  2627. If value is set to @var{multich}, number of additional streams should
  2628. be exactly one. Also number of input channels of additional stream
  2629. should be equal or greater than twice number of channels of first input
  2630. stream.
  2631. @end table
  2632. @subsection Examples
  2633. @itemize
  2634. @item
  2635. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2636. each amovie filter use stereo file with IR coefficients as input.
  2637. The files give coefficients for each position of virtual loudspeaker:
  2638. @example
  2639. 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"
  2640. output.wav
  2641. @end example
  2642. @item
  2643. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2644. but now in @var{multich} @var{hrir} format.
  2645. @example
  2646. 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"
  2647. output.wav
  2648. @end example
  2649. @end itemize
  2650. @section highpass
  2651. Apply a high-pass filter with 3dB point frequency.
  2652. The filter can be either single-pole, or double-pole (the default).
  2653. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2654. The filter accepts the following options:
  2655. @table @option
  2656. @item frequency, f
  2657. Set frequency in Hz. Default is 3000.
  2658. @item poles, p
  2659. Set number of poles. Default is 2.
  2660. @item width_type, t
  2661. Set method to specify band-width of filter.
  2662. @table @option
  2663. @item h
  2664. Hz
  2665. @item q
  2666. Q-Factor
  2667. @item o
  2668. octave
  2669. @item s
  2670. slope
  2671. @item k
  2672. kHz
  2673. @end table
  2674. @item width, w
  2675. Specify the band-width of a filter in width_type units.
  2676. Applies only to double-pole filter.
  2677. The default is 0.707q and gives a Butterworth response.
  2678. @item channels, c
  2679. Specify which channels to filter, by default all available are filtered.
  2680. @end table
  2681. @subsection Commands
  2682. This filter supports the following commands:
  2683. @table @option
  2684. @item frequency, f
  2685. Change highpass frequency.
  2686. Syntax for the command is : "@var{frequency}"
  2687. @item width_type, t
  2688. Change highpass width_type.
  2689. Syntax for the command is : "@var{width_type}"
  2690. @item width, w
  2691. Change highpass width.
  2692. Syntax for the command is : "@var{width}"
  2693. @end table
  2694. @section join
  2695. Join multiple input streams into one multi-channel stream.
  2696. It accepts the following parameters:
  2697. @table @option
  2698. @item inputs
  2699. The number of input streams. It defaults to 2.
  2700. @item channel_layout
  2701. The desired output channel layout. It defaults to stereo.
  2702. @item map
  2703. Map channels from inputs to output. The argument is a '|'-separated list of
  2704. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2705. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2706. can be either the name of the input channel (e.g. FL for front left) or its
  2707. index in the specified input stream. @var{out_channel} is the name of the output
  2708. channel.
  2709. @end table
  2710. The filter will attempt to guess the mappings when they are not specified
  2711. explicitly. It does so by first trying to find an unused matching input channel
  2712. and if that fails it picks the first unused input channel.
  2713. Join 3 inputs (with properly set channel layouts):
  2714. @example
  2715. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2716. @end example
  2717. Build a 5.1 output from 6 single-channel streams:
  2718. @example
  2719. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2720. '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'
  2721. out
  2722. @end example
  2723. @section ladspa
  2724. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2725. To enable compilation of this filter you need to configure FFmpeg with
  2726. @code{--enable-ladspa}.
  2727. @table @option
  2728. @item file, f
  2729. Specifies the name of LADSPA plugin library to load. If the environment
  2730. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2731. each one of the directories specified by the colon separated list in
  2732. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2733. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2734. @file{/usr/lib/ladspa/}.
  2735. @item plugin, p
  2736. Specifies the plugin within the library. Some libraries contain only
  2737. one plugin, but others contain many of them. If this is not set filter
  2738. will list all available plugins within the specified library.
  2739. @item controls, c
  2740. Set the '|' separated list of controls which are zero or more floating point
  2741. values that determine the behavior of the loaded plugin (for example delay,
  2742. threshold or gain).
  2743. Controls need to be defined using the following syntax:
  2744. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2745. @var{valuei} is the value set on the @var{i}-th control.
  2746. Alternatively they can be also defined using the following syntax:
  2747. @var{value0}|@var{value1}|@var{value2}|..., where
  2748. @var{valuei} is the value set on the @var{i}-th control.
  2749. If @option{controls} is set to @code{help}, all available controls and
  2750. their valid ranges are printed.
  2751. @item sample_rate, s
  2752. Specify the sample rate, default to 44100. Only used if plugin have
  2753. zero inputs.
  2754. @item nb_samples, n
  2755. Set the number of samples per channel per each output frame, default
  2756. is 1024. Only used if plugin have zero inputs.
  2757. @item duration, d
  2758. Set the minimum duration of the sourced audio. See
  2759. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2760. for the accepted syntax.
  2761. Note that the resulting duration may be greater than the specified duration,
  2762. as the generated audio is always cut at the end of a complete frame.
  2763. If not specified, or the expressed duration is negative, the audio is
  2764. supposed to be generated forever.
  2765. Only used if plugin have zero inputs.
  2766. @end table
  2767. @subsection Examples
  2768. @itemize
  2769. @item
  2770. List all available plugins within amp (LADSPA example plugin) library:
  2771. @example
  2772. ladspa=file=amp
  2773. @end example
  2774. @item
  2775. List all available controls and their valid ranges for @code{vcf_notch}
  2776. plugin from @code{VCF} library:
  2777. @example
  2778. ladspa=f=vcf:p=vcf_notch:c=help
  2779. @end example
  2780. @item
  2781. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2782. plugin library:
  2783. @example
  2784. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2785. @end example
  2786. @item
  2787. Add reverberation to the audio using TAP-plugins
  2788. (Tom's Audio Processing plugins):
  2789. @example
  2790. ladspa=file=tap_reverb:tap_reverb
  2791. @end example
  2792. @item
  2793. Generate white noise, with 0.2 amplitude:
  2794. @example
  2795. ladspa=file=cmt:noise_source_white:c=c0=.2
  2796. @end example
  2797. @item
  2798. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2799. @code{C* Audio Plugin Suite} (CAPS) library:
  2800. @example
  2801. ladspa=file=caps:Click:c=c1=20'
  2802. @end example
  2803. @item
  2804. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2805. @example
  2806. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2807. @end example
  2808. @item
  2809. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2810. @code{SWH Plugins} collection:
  2811. @example
  2812. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2813. @end example
  2814. @item
  2815. Attenuate low frequencies using Multiband EQ from Steve Harris
  2816. @code{SWH Plugins} collection:
  2817. @example
  2818. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2819. @end example
  2820. @item
  2821. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2822. (CAPS) library:
  2823. @example
  2824. ladspa=caps:Narrower
  2825. @end example
  2826. @item
  2827. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2828. @example
  2829. ladspa=caps:White:.2
  2830. @end example
  2831. @item
  2832. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2833. @example
  2834. ladspa=caps:Fractal:c=c1=1
  2835. @end example
  2836. @item
  2837. Dynamic volume normalization using @code{VLevel} plugin:
  2838. @example
  2839. ladspa=vlevel-ladspa:vlevel_mono
  2840. @end example
  2841. @end itemize
  2842. @subsection Commands
  2843. This filter supports the following commands:
  2844. @table @option
  2845. @item cN
  2846. Modify the @var{N}-th control value.
  2847. If the specified value is not valid, it is ignored and prior one is kept.
  2848. @end table
  2849. @section loudnorm
  2850. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2851. Support for both single pass (livestreams, files) and double pass (files) modes.
  2852. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2853. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2854. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2855. The filter accepts the following options:
  2856. @table @option
  2857. @item I, i
  2858. Set integrated loudness target.
  2859. Range is -70.0 - -5.0. Default value is -24.0.
  2860. @item LRA, lra
  2861. Set loudness range target.
  2862. Range is 1.0 - 20.0. Default value is 7.0.
  2863. @item TP, tp
  2864. Set maximum true peak.
  2865. Range is -9.0 - +0.0. Default value is -2.0.
  2866. @item measured_I, measured_i
  2867. Measured IL of input file.
  2868. Range is -99.0 - +0.0.
  2869. @item measured_LRA, measured_lra
  2870. Measured LRA of input file.
  2871. Range is 0.0 - 99.0.
  2872. @item measured_TP, measured_tp
  2873. Measured true peak of input file.
  2874. Range is -99.0 - +99.0.
  2875. @item measured_thresh
  2876. Measured threshold of input file.
  2877. Range is -99.0 - +0.0.
  2878. @item offset
  2879. Set offset gain. Gain is applied before the true-peak limiter.
  2880. Range is -99.0 - +99.0. Default is +0.0.
  2881. @item linear
  2882. Normalize linearly if possible.
  2883. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2884. to be specified in order to use this mode.
  2885. Options are true or false. Default is true.
  2886. @item dual_mono
  2887. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2888. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2889. If set to @code{true}, this option will compensate for this effect.
  2890. Multi-channel input files are not affected by this option.
  2891. Options are true or false. Default is false.
  2892. @item print_format
  2893. Set print format for stats. Options are summary, json, or none.
  2894. Default value is none.
  2895. @end table
  2896. @section lowpass
  2897. Apply a low-pass filter with 3dB point frequency.
  2898. The filter can be either single-pole or double-pole (the default).
  2899. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2900. The filter accepts the following options:
  2901. @table @option
  2902. @item frequency, f
  2903. Set frequency in Hz. Default is 500.
  2904. @item poles, p
  2905. Set number of poles. Default is 2.
  2906. @item width_type, t
  2907. Set method to specify band-width of filter.
  2908. @table @option
  2909. @item h
  2910. Hz
  2911. @item q
  2912. Q-Factor
  2913. @item o
  2914. octave
  2915. @item s
  2916. slope
  2917. @item k
  2918. kHz
  2919. @end table
  2920. @item width, w
  2921. Specify the band-width of a filter in width_type units.
  2922. Applies only to double-pole filter.
  2923. The default is 0.707q and gives a Butterworth response.
  2924. @item channels, c
  2925. Specify which channels to filter, by default all available are filtered.
  2926. @end table
  2927. @subsection Examples
  2928. @itemize
  2929. @item
  2930. Lowpass only LFE channel, it LFE is not present it does nothing:
  2931. @example
  2932. lowpass=c=LFE
  2933. @end example
  2934. @end itemize
  2935. @subsection Commands
  2936. This filter supports the following commands:
  2937. @table @option
  2938. @item frequency, f
  2939. Change lowpass frequency.
  2940. Syntax for the command is : "@var{frequency}"
  2941. @item width_type, t
  2942. Change lowpass width_type.
  2943. Syntax for the command is : "@var{width_type}"
  2944. @item width, w
  2945. Change lowpass width.
  2946. Syntax for the command is : "@var{width}"
  2947. @end table
  2948. @section lv2
  2949. Load a LV2 (LADSPA Version 2) plugin.
  2950. To enable compilation of this filter you need to configure FFmpeg with
  2951. @code{--enable-lv2}.
  2952. @table @option
  2953. @item plugin, p
  2954. Specifies the plugin URI. You may need to escape ':'.
  2955. @item controls, c
  2956. Set the '|' separated list of controls which are zero or more floating point
  2957. values that determine the behavior of the loaded plugin (for example delay,
  2958. threshold or gain).
  2959. If @option{controls} is set to @code{help}, all available controls and
  2960. their valid ranges are printed.
  2961. @item sample_rate, s
  2962. Specify the sample rate, default to 44100. Only used if plugin have
  2963. zero inputs.
  2964. @item nb_samples, n
  2965. Set the number of samples per channel per each output frame, default
  2966. is 1024. Only used if plugin have zero inputs.
  2967. @item duration, d
  2968. Set the minimum duration of the sourced audio. See
  2969. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2970. for the accepted syntax.
  2971. Note that the resulting duration may be greater than the specified duration,
  2972. as the generated audio is always cut at the end of a complete frame.
  2973. If not specified, or the expressed duration is negative, the audio is
  2974. supposed to be generated forever.
  2975. Only used if plugin have zero inputs.
  2976. @end table
  2977. @subsection Examples
  2978. @itemize
  2979. @item
  2980. Apply bass enhancer plugin from Calf:
  2981. @example
  2982. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2983. @end example
  2984. @item
  2985. Apply vinyl plugin from Calf:
  2986. @example
  2987. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2988. @end example
  2989. @item
  2990. Apply bit crusher plugin from ArtyFX:
  2991. @example
  2992. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2993. @end example
  2994. @end itemize
  2995. @section mcompand
  2996. Multiband Compress or expand the audio's dynamic range.
  2997. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2998. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2999. response when absent compander action.
  3000. It accepts the following parameters:
  3001. @table @option
  3002. @item args
  3003. This option syntax is:
  3004. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3005. For explanation of each item refer to compand filter documentation.
  3006. @end table
  3007. @anchor{pan}
  3008. @section pan
  3009. Mix channels with specific gain levels. The filter accepts the output
  3010. channel layout followed by a set of channels definitions.
  3011. This filter is also designed to efficiently remap the channels of an audio
  3012. stream.
  3013. The filter accepts parameters of the form:
  3014. "@var{l}|@var{outdef}|@var{outdef}|..."
  3015. @table @option
  3016. @item l
  3017. output channel layout or number of channels
  3018. @item outdef
  3019. output channel specification, of the form:
  3020. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3021. @item out_name
  3022. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3023. number (c0, c1, etc.)
  3024. @item gain
  3025. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3026. @item in_name
  3027. input channel to use, see out_name for details; it is not possible to mix
  3028. named and numbered input channels
  3029. @end table
  3030. If the `=' in a channel specification is replaced by `<', then the gains for
  3031. that specification will be renormalized so that the total is 1, thus
  3032. avoiding clipping noise.
  3033. @subsection Mixing examples
  3034. For example, if you want to down-mix from stereo to mono, but with a bigger
  3035. factor for the left channel:
  3036. @example
  3037. pan=1c|c0=0.9*c0+0.1*c1
  3038. @end example
  3039. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3040. 7-channels surround:
  3041. @example
  3042. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3043. @end example
  3044. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3045. that should be preferred (see "-ac" option) unless you have very specific
  3046. needs.
  3047. @subsection Remapping examples
  3048. The channel remapping will be effective if, and only if:
  3049. @itemize
  3050. @item gain coefficients are zeroes or ones,
  3051. @item only one input per channel output,
  3052. @end itemize
  3053. If all these conditions are satisfied, the filter will notify the user ("Pure
  3054. channel mapping detected"), and use an optimized and lossless method to do the
  3055. remapping.
  3056. For example, if you have a 5.1 source and want a stereo audio stream by
  3057. dropping the extra channels:
  3058. @example
  3059. pan="stereo| c0=FL | c1=FR"
  3060. @end example
  3061. Given the same source, you can also switch front left and front right channels
  3062. and keep the input channel layout:
  3063. @example
  3064. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3065. @end example
  3066. If the input is a stereo audio stream, you can mute the front left channel (and
  3067. still keep the stereo channel layout) with:
  3068. @example
  3069. pan="stereo|c1=c1"
  3070. @end example
  3071. Still with a stereo audio stream input, you can copy the right channel in both
  3072. front left and right:
  3073. @example
  3074. pan="stereo| c0=FR | c1=FR"
  3075. @end example
  3076. @section replaygain
  3077. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3078. outputs it unchanged.
  3079. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3080. @section resample
  3081. Convert the audio sample format, sample rate and channel layout. It is
  3082. not meant to be used directly.
  3083. @section rubberband
  3084. Apply time-stretching and pitch-shifting with librubberband.
  3085. To enable compilation of this filter, you need to configure FFmpeg with
  3086. @code{--enable-librubberband}.
  3087. The filter accepts the following options:
  3088. @table @option
  3089. @item tempo
  3090. Set tempo scale factor.
  3091. @item pitch
  3092. Set pitch scale factor.
  3093. @item transients
  3094. Set transients detector.
  3095. Possible values are:
  3096. @table @var
  3097. @item crisp
  3098. @item mixed
  3099. @item smooth
  3100. @end table
  3101. @item detector
  3102. Set detector.
  3103. Possible values are:
  3104. @table @var
  3105. @item compound
  3106. @item percussive
  3107. @item soft
  3108. @end table
  3109. @item phase
  3110. Set phase.
  3111. Possible values are:
  3112. @table @var
  3113. @item laminar
  3114. @item independent
  3115. @end table
  3116. @item window
  3117. Set processing window size.
  3118. Possible values are:
  3119. @table @var
  3120. @item standard
  3121. @item short
  3122. @item long
  3123. @end table
  3124. @item smoothing
  3125. Set smoothing.
  3126. Possible values are:
  3127. @table @var
  3128. @item off
  3129. @item on
  3130. @end table
  3131. @item formant
  3132. Enable formant preservation when shift pitching.
  3133. Possible values are:
  3134. @table @var
  3135. @item shifted
  3136. @item preserved
  3137. @end table
  3138. @item pitchq
  3139. Set pitch quality.
  3140. Possible values are:
  3141. @table @var
  3142. @item quality
  3143. @item speed
  3144. @item consistency
  3145. @end table
  3146. @item channels
  3147. Set channels.
  3148. Possible values are:
  3149. @table @var
  3150. @item apart
  3151. @item together
  3152. @end table
  3153. @end table
  3154. @section sidechaincompress
  3155. This filter acts like normal compressor but has the ability to compress
  3156. detected signal using second input signal.
  3157. It needs two input streams and returns one output stream.
  3158. First input stream will be processed depending on second stream signal.
  3159. The filtered signal then can be filtered with other filters in later stages of
  3160. processing. See @ref{pan} and @ref{amerge} filter.
  3161. The filter accepts the following options:
  3162. @table @option
  3163. @item level_in
  3164. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3165. @item threshold
  3166. If a signal of second stream raises above this level it will affect the gain
  3167. reduction of first stream.
  3168. By default is 0.125. Range is between 0.00097563 and 1.
  3169. @item ratio
  3170. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3171. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3172. Default is 2. Range is between 1 and 20.
  3173. @item attack
  3174. Amount of milliseconds the signal has to rise above the threshold before gain
  3175. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3176. @item release
  3177. Amount of milliseconds the signal has to fall below the threshold before
  3178. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3179. @item makeup
  3180. Set the amount by how much signal will be amplified after processing.
  3181. Default is 1. Range is from 1 to 64.
  3182. @item knee
  3183. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3184. Default is 2.82843. Range is between 1 and 8.
  3185. @item link
  3186. Choose if the @code{average} level between all channels of side-chain stream
  3187. or the louder(@code{maximum}) channel of side-chain stream affects the
  3188. reduction. Default is @code{average}.
  3189. @item detection
  3190. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3191. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3192. @item level_sc
  3193. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3194. @item mix
  3195. How much to use compressed signal in output. Default is 1.
  3196. Range is between 0 and 1.
  3197. @end table
  3198. @subsection Examples
  3199. @itemize
  3200. @item
  3201. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3202. depending on the signal of 2nd input and later compressed signal to be
  3203. merged with 2nd input:
  3204. @example
  3205. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3206. @end example
  3207. @end itemize
  3208. @section sidechaingate
  3209. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3210. filter the detected signal before sending it to the gain reduction stage.
  3211. Normally a gate uses the full range signal to detect a level above the
  3212. threshold.
  3213. For example: If you cut all lower frequencies from your sidechain signal
  3214. the gate will decrease the volume of your track only if not enough highs
  3215. appear. With this technique you are able to reduce the resonation of a
  3216. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3217. guitar.
  3218. It needs two input streams and returns one output stream.
  3219. First input stream will be processed depending on second stream signal.
  3220. The filter accepts the following options:
  3221. @table @option
  3222. @item level_in
  3223. Set input level before filtering.
  3224. Default is 1. Allowed range is from 0.015625 to 64.
  3225. @item range
  3226. Set the level of gain reduction when the signal is below the threshold.
  3227. Default is 0.06125. Allowed range is from 0 to 1.
  3228. @item threshold
  3229. If a signal rises above this level the gain reduction is released.
  3230. Default is 0.125. Allowed range is from 0 to 1.
  3231. @item ratio
  3232. Set a ratio about which the signal is reduced.
  3233. Default is 2. Allowed range is from 1 to 9000.
  3234. @item attack
  3235. Amount of milliseconds the signal has to rise above the threshold before gain
  3236. reduction stops.
  3237. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3238. @item release
  3239. Amount of milliseconds the signal has to fall below the threshold before the
  3240. reduction is increased again. Default is 250 milliseconds.
  3241. Allowed range is from 0.01 to 9000.
  3242. @item makeup
  3243. Set amount of amplification of signal after processing.
  3244. Default is 1. Allowed range is from 1 to 64.
  3245. @item knee
  3246. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3247. Default is 2.828427125. Allowed range is from 1 to 8.
  3248. @item detection
  3249. Choose if exact signal should be taken for detection or an RMS like one.
  3250. Default is rms. Can be peak or rms.
  3251. @item link
  3252. Choose if the average level between all channels or the louder channel affects
  3253. the reduction.
  3254. Default is average. Can be average or maximum.
  3255. @item level_sc
  3256. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3257. @end table
  3258. @section silencedetect
  3259. Detect silence in an audio stream.
  3260. This filter logs a message when it detects that the input audio volume is less
  3261. or equal to a noise tolerance value for a duration greater or equal to the
  3262. minimum detected noise duration.
  3263. The printed times and duration are expressed in seconds.
  3264. The filter accepts the following options:
  3265. @table @option
  3266. @item duration, d
  3267. Set silence duration until notification (default is 2 seconds).
  3268. @item noise, n
  3269. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3270. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3271. @end table
  3272. @subsection Examples
  3273. @itemize
  3274. @item
  3275. Detect 5 seconds of silence with -50dB noise tolerance:
  3276. @example
  3277. silencedetect=n=-50dB:d=5
  3278. @end example
  3279. @item
  3280. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3281. tolerance in @file{silence.mp3}:
  3282. @example
  3283. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3284. @end example
  3285. @end itemize
  3286. @section silenceremove
  3287. Remove silence from the beginning, middle or end of the audio.
  3288. The filter accepts the following options:
  3289. @table @option
  3290. @item start_periods
  3291. This value is used to indicate if audio should be trimmed at beginning of
  3292. the audio. A value of zero indicates no silence should be trimmed from the
  3293. beginning. When specifying a non-zero value, it trims audio up until it
  3294. finds non-silence. Normally, when trimming silence from beginning of audio
  3295. the @var{start_periods} will be @code{1} but it can be increased to higher
  3296. values to trim all audio up to specific count of non-silence periods.
  3297. Default value is @code{0}.
  3298. @item start_duration
  3299. Specify the amount of time that non-silence must be detected before it stops
  3300. trimming audio. By increasing the duration, bursts of noises can be treated
  3301. as silence and trimmed off. Default value is @code{0}.
  3302. @item start_threshold
  3303. This indicates what sample value should be treated as silence. For digital
  3304. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3305. you may wish to increase the value to account for background noise.
  3306. Can be specified in dB (in case "dB" is appended to the specified value)
  3307. or amplitude ratio. Default value is @code{0}.
  3308. @item stop_periods
  3309. Set the count for trimming silence from the end of audio.
  3310. To remove silence from the middle of a file, specify a @var{stop_periods}
  3311. that is negative. This value is then treated as a positive value and is
  3312. used to indicate the effect should restart processing as specified by
  3313. @var{start_periods}, making it suitable for removing periods of silence
  3314. in the middle of the audio.
  3315. Default value is @code{0}.
  3316. @item stop_duration
  3317. Specify a duration of silence that must exist before audio is not copied any
  3318. more. By specifying a higher duration, silence that is wanted can be left in
  3319. the audio.
  3320. Default value is @code{0}.
  3321. @item stop_threshold
  3322. This is the same as @option{start_threshold} but for trimming silence from
  3323. the end of audio.
  3324. Can be specified in dB (in case "dB" is appended to the specified value)
  3325. or amplitude ratio. Default value is @code{0}.
  3326. @item leave_silence
  3327. This indicates that @var{stop_duration} length of audio should be left intact
  3328. at the beginning of each period of silence.
  3329. For example, if you want to remove long pauses between words but do not want
  3330. to remove the pauses completely. Default value is @code{0}.
  3331. @item detection
  3332. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3333. and works better with digital silence which is exactly 0.
  3334. Default value is @code{rms}.
  3335. @item window
  3336. Set ratio used to calculate size of window for detecting silence.
  3337. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3338. @end table
  3339. @subsection Examples
  3340. @itemize
  3341. @item
  3342. The following example shows how this filter can be used to start a recording
  3343. that does not contain the delay at the start which usually occurs between
  3344. pressing the record button and the start of the performance:
  3345. @example
  3346. silenceremove=1:5:0.02
  3347. @end example
  3348. @item
  3349. Trim all silence encountered from beginning to end where there is more than 1
  3350. second of silence in audio:
  3351. @example
  3352. silenceremove=0:0:0:-1:1:-90dB
  3353. @end example
  3354. @end itemize
  3355. @section sofalizer
  3356. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3357. loudspeakers around the user for binaural listening via headphones (audio
  3358. formats up to 9 channels supported).
  3359. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3360. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3361. Austrian Academy of Sciences.
  3362. To enable compilation of this filter you need to configure FFmpeg with
  3363. @code{--enable-libmysofa}.
  3364. The filter accepts the following options:
  3365. @table @option
  3366. @item sofa
  3367. Set the SOFA file used for rendering.
  3368. @item gain
  3369. Set gain applied to audio. Value is in dB. Default is 0.
  3370. @item rotation
  3371. Set rotation of virtual loudspeakers in deg. Default is 0.
  3372. @item elevation
  3373. Set elevation of virtual speakers in deg. Default is 0.
  3374. @item radius
  3375. Set distance in meters between loudspeakers and the listener with near-field
  3376. HRTFs. Default is 1.
  3377. @item type
  3378. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3379. processing audio in time domain which is slow.
  3380. @var{freq} is processing audio in frequency domain which is fast.
  3381. Default is @var{freq}.
  3382. @item speakers
  3383. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3384. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3385. Each virtual loudspeaker is described with short channel name following with
  3386. azimuth and elevation in degrees.
  3387. Each virtual loudspeaker description is separated by '|'.
  3388. For example to override front left and front right channel positions use:
  3389. 'speakers=FL 45 15|FR 345 15'.
  3390. Descriptions with unrecognised channel names are ignored.
  3391. @item lfegain
  3392. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3393. @end table
  3394. @subsection Examples
  3395. @itemize
  3396. @item
  3397. Using ClubFritz6 sofa file:
  3398. @example
  3399. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3400. @end example
  3401. @item
  3402. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3403. @example
  3404. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3405. @end example
  3406. @item
  3407. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3408. and also with custom gain:
  3409. @example
  3410. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3411. @end example
  3412. @end itemize
  3413. @section stereotools
  3414. This filter has some handy utilities to manage stereo signals, for converting
  3415. M/S stereo recordings to L/R signal while having control over the parameters
  3416. or spreading the stereo image of master track.
  3417. The filter accepts the following options:
  3418. @table @option
  3419. @item level_in
  3420. Set input level before filtering for both channels. Defaults is 1.
  3421. Allowed range is from 0.015625 to 64.
  3422. @item level_out
  3423. Set output level after filtering for both channels. Defaults is 1.
  3424. Allowed range is from 0.015625 to 64.
  3425. @item balance_in
  3426. Set input balance between both channels. Default is 0.
  3427. Allowed range is from -1 to 1.
  3428. @item balance_out
  3429. Set output balance between both channels. Default is 0.
  3430. Allowed range is from -1 to 1.
  3431. @item softclip
  3432. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3433. clipping. Disabled by default.
  3434. @item mutel
  3435. Mute the left channel. Disabled by default.
  3436. @item muter
  3437. Mute the right channel. Disabled by default.
  3438. @item phasel
  3439. Change the phase of the left channel. Disabled by default.
  3440. @item phaser
  3441. Change the phase of the right channel. Disabled by default.
  3442. @item mode
  3443. Set stereo mode. Available values are:
  3444. @table @samp
  3445. @item lr>lr
  3446. Left/Right to Left/Right, this is default.
  3447. @item lr>ms
  3448. Left/Right to Mid/Side.
  3449. @item ms>lr
  3450. Mid/Side to Left/Right.
  3451. @item lr>ll
  3452. Left/Right to Left/Left.
  3453. @item lr>rr
  3454. Left/Right to Right/Right.
  3455. @item lr>l+r
  3456. Left/Right to Left + Right.
  3457. @item lr>rl
  3458. Left/Right to Right/Left.
  3459. @item ms>ll
  3460. Mid/Side to Left/Left.
  3461. @item ms>rr
  3462. Mid/Side to Right/Right.
  3463. @end table
  3464. @item slev
  3465. Set level of side signal. Default is 1.
  3466. Allowed range is from 0.015625 to 64.
  3467. @item sbal
  3468. Set balance of side signal. Default is 0.
  3469. Allowed range is from -1 to 1.
  3470. @item mlev
  3471. Set level of the middle signal. Default is 1.
  3472. Allowed range is from 0.015625 to 64.
  3473. @item mpan
  3474. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3475. @item base
  3476. Set stereo base between mono and inversed channels. Default is 0.
  3477. Allowed range is from -1 to 1.
  3478. @item delay
  3479. Set delay in milliseconds how much to delay left from right channel and
  3480. vice versa. Default is 0. Allowed range is from -20 to 20.
  3481. @item sclevel
  3482. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3483. @item phase
  3484. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3485. @item bmode_in, bmode_out
  3486. Set balance mode for balance_in/balance_out option.
  3487. Can be one of the following:
  3488. @table @samp
  3489. @item balance
  3490. Classic balance mode. Attenuate one channel at time.
  3491. Gain is raised up to 1.
  3492. @item amplitude
  3493. Similar as classic mode above but gain is raised up to 2.
  3494. @item power
  3495. Equal power distribution, from -6dB to +6dB range.
  3496. @end table
  3497. @end table
  3498. @subsection Examples
  3499. @itemize
  3500. @item
  3501. Apply karaoke like effect:
  3502. @example
  3503. stereotools=mlev=0.015625
  3504. @end example
  3505. @item
  3506. Convert M/S signal to L/R:
  3507. @example
  3508. "stereotools=mode=ms>lr"
  3509. @end example
  3510. @end itemize
  3511. @section stereowiden
  3512. This filter enhance the stereo effect by suppressing signal common to both
  3513. channels and by delaying the signal of left into right and vice versa,
  3514. thereby widening the stereo effect.
  3515. The filter accepts the following options:
  3516. @table @option
  3517. @item delay
  3518. Time in milliseconds of the delay of left signal into right and vice versa.
  3519. Default is 20 milliseconds.
  3520. @item feedback
  3521. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3522. effect of left signal in right output and vice versa which gives widening
  3523. effect. Default is 0.3.
  3524. @item crossfeed
  3525. Cross feed of left into right with inverted phase. This helps in suppressing
  3526. the mono. If the value is 1 it will cancel all the signal common to both
  3527. channels. Default is 0.3.
  3528. @item drymix
  3529. Set level of input signal of original channel. Default is 0.8.
  3530. @end table
  3531. @section superequalizer
  3532. Apply 18 band equalizer.
  3533. The filter accepts the following options:
  3534. @table @option
  3535. @item 1b
  3536. Set 65Hz band gain.
  3537. @item 2b
  3538. Set 92Hz band gain.
  3539. @item 3b
  3540. Set 131Hz band gain.
  3541. @item 4b
  3542. Set 185Hz band gain.
  3543. @item 5b
  3544. Set 262Hz band gain.
  3545. @item 6b
  3546. Set 370Hz band gain.
  3547. @item 7b
  3548. Set 523Hz band gain.
  3549. @item 8b
  3550. Set 740Hz band gain.
  3551. @item 9b
  3552. Set 1047Hz band gain.
  3553. @item 10b
  3554. Set 1480Hz band gain.
  3555. @item 11b
  3556. Set 2093Hz band gain.
  3557. @item 12b
  3558. Set 2960Hz band gain.
  3559. @item 13b
  3560. Set 4186Hz band gain.
  3561. @item 14b
  3562. Set 5920Hz band gain.
  3563. @item 15b
  3564. Set 8372Hz band gain.
  3565. @item 16b
  3566. Set 11840Hz band gain.
  3567. @item 17b
  3568. Set 16744Hz band gain.
  3569. @item 18b
  3570. Set 20000Hz band gain.
  3571. @end table
  3572. @section surround
  3573. Apply audio surround upmix filter.
  3574. This filter allows to produce multichannel output from audio stream.
  3575. The filter accepts the following options:
  3576. @table @option
  3577. @item chl_out
  3578. Set output channel layout. By default, this is @var{5.1}.
  3579. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3580. for the required syntax.
  3581. @item chl_in
  3582. Set input channel layout. By default, this is @var{stereo}.
  3583. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3584. for the required syntax.
  3585. @item level_in
  3586. Set input volume level. By default, this is @var{1}.
  3587. @item level_out
  3588. Set output volume level. By default, this is @var{1}.
  3589. @item lfe
  3590. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3591. @item lfe_low
  3592. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3593. @item lfe_high
  3594. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3595. @item fc_in
  3596. Set front center input volume. By default, this is @var{1}.
  3597. @item fc_out
  3598. Set front center output volume. By default, this is @var{1}.
  3599. @item lfe_in
  3600. Set LFE input volume. By default, this is @var{1}.
  3601. @item lfe_out
  3602. Set LFE output volume. By default, this is @var{1}.
  3603. @end table
  3604. @section treble, highshelf
  3605. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3606. shelving filter with a response similar to that of a standard
  3607. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3608. The filter accepts the following options:
  3609. @table @option
  3610. @item gain, g
  3611. Give the gain at whichever is the lower of ~22 kHz and the
  3612. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3613. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3614. @item frequency, f
  3615. Set the filter's central frequency and so can be used
  3616. to extend or reduce the frequency range to be boosted or cut.
  3617. The default value is @code{3000} Hz.
  3618. @item width_type, t
  3619. Set method to specify band-width of filter.
  3620. @table @option
  3621. @item h
  3622. Hz
  3623. @item q
  3624. Q-Factor
  3625. @item o
  3626. octave
  3627. @item s
  3628. slope
  3629. @item k
  3630. kHz
  3631. @end table
  3632. @item width, w
  3633. Determine how steep is the filter's shelf transition.
  3634. @item channels, c
  3635. Specify which channels to filter, by default all available are filtered.
  3636. @end table
  3637. @subsection Commands
  3638. This filter supports the following commands:
  3639. @table @option
  3640. @item frequency, f
  3641. Change treble frequency.
  3642. Syntax for the command is : "@var{frequency}"
  3643. @item width_type, t
  3644. Change treble width_type.
  3645. Syntax for the command is : "@var{width_type}"
  3646. @item width, w
  3647. Change treble width.
  3648. Syntax for the command is : "@var{width}"
  3649. @item gain, g
  3650. Change treble gain.
  3651. Syntax for the command is : "@var{gain}"
  3652. @end table
  3653. @section tremolo
  3654. Sinusoidal amplitude modulation.
  3655. The filter accepts the following options:
  3656. @table @option
  3657. @item f
  3658. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3659. (20 Hz or lower) will result in a tremolo effect.
  3660. This filter may also be used as a ring modulator by specifying
  3661. a modulation frequency higher than 20 Hz.
  3662. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3663. @item d
  3664. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3665. Default value is 0.5.
  3666. @end table
  3667. @section vibrato
  3668. Sinusoidal phase modulation.
  3669. The filter accepts the following options:
  3670. @table @option
  3671. @item f
  3672. Modulation frequency in Hertz.
  3673. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3674. @item d
  3675. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3676. Default value is 0.5.
  3677. @end table
  3678. @section volume
  3679. Adjust the input audio volume.
  3680. It accepts the following parameters:
  3681. @table @option
  3682. @item volume
  3683. Set audio volume expression.
  3684. Output values are clipped to the maximum value.
  3685. The output audio volume is given by the relation:
  3686. @example
  3687. @var{output_volume} = @var{volume} * @var{input_volume}
  3688. @end example
  3689. The default value for @var{volume} is "1.0".
  3690. @item precision
  3691. This parameter represents the mathematical precision.
  3692. It determines which input sample formats will be allowed, which affects the
  3693. precision of the volume scaling.
  3694. @table @option
  3695. @item fixed
  3696. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3697. @item float
  3698. 32-bit floating-point; this limits input sample format to FLT. (default)
  3699. @item double
  3700. 64-bit floating-point; this limits input sample format to DBL.
  3701. @end table
  3702. @item replaygain
  3703. Choose the behaviour on encountering ReplayGain side data in input frames.
  3704. @table @option
  3705. @item drop
  3706. Remove ReplayGain side data, ignoring its contents (the default).
  3707. @item ignore
  3708. Ignore ReplayGain side data, but leave it in the frame.
  3709. @item track
  3710. Prefer the track gain, if present.
  3711. @item album
  3712. Prefer the album gain, if present.
  3713. @end table
  3714. @item replaygain_preamp
  3715. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3716. Default value for @var{replaygain_preamp} is 0.0.
  3717. @item eval
  3718. Set when the volume expression is evaluated.
  3719. It accepts the following values:
  3720. @table @samp
  3721. @item once
  3722. only evaluate expression once during the filter initialization, or
  3723. when the @samp{volume} command is sent
  3724. @item frame
  3725. evaluate expression for each incoming frame
  3726. @end table
  3727. Default value is @samp{once}.
  3728. @end table
  3729. The volume expression can contain the following parameters.
  3730. @table @option
  3731. @item n
  3732. frame number (starting at zero)
  3733. @item nb_channels
  3734. number of channels
  3735. @item nb_consumed_samples
  3736. number of samples consumed by the filter
  3737. @item nb_samples
  3738. number of samples in the current frame
  3739. @item pos
  3740. original frame position in the file
  3741. @item pts
  3742. frame PTS
  3743. @item sample_rate
  3744. sample rate
  3745. @item startpts
  3746. PTS at start of stream
  3747. @item startt
  3748. time at start of stream
  3749. @item t
  3750. frame time
  3751. @item tb
  3752. timestamp timebase
  3753. @item volume
  3754. last set volume value
  3755. @end table
  3756. Note that when @option{eval} is set to @samp{once} only the
  3757. @var{sample_rate} and @var{tb} variables are available, all other
  3758. variables will evaluate to NAN.
  3759. @subsection Commands
  3760. This filter supports the following commands:
  3761. @table @option
  3762. @item volume
  3763. Modify the volume expression.
  3764. The command accepts the same syntax of the corresponding option.
  3765. If the specified expression is not valid, it is kept at its current
  3766. value.
  3767. @item replaygain_noclip
  3768. Prevent clipping by limiting the gain applied.
  3769. Default value for @var{replaygain_noclip} is 1.
  3770. @end table
  3771. @subsection Examples
  3772. @itemize
  3773. @item
  3774. Halve the input audio volume:
  3775. @example
  3776. volume=volume=0.5
  3777. volume=volume=1/2
  3778. volume=volume=-6.0206dB
  3779. @end example
  3780. In all the above example the named key for @option{volume} can be
  3781. omitted, for example like in:
  3782. @example
  3783. volume=0.5
  3784. @end example
  3785. @item
  3786. Increase input audio power by 6 decibels using fixed-point precision:
  3787. @example
  3788. volume=volume=6dB:precision=fixed
  3789. @end example
  3790. @item
  3791. Fade volume after time 10 with an annihilation period of 5 seconds:
  3792. @example
  3793. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3794. @end example
  3795. @end itemize
  3796. @section volumedetect
  3797. Detect the volume of the input video.
  3798. The filter has no parameters. The input is not modified. Statistics about
  3799. the volume will be printed in the log when the input stream end is reached.
  3800. In particular it will show the mean volume (root mean square), maximum
  3801. volume (on a per-sample basis), and the beginning of a histogram of the
  3802. registered volume values (from the maximum value to a cumulated 1/1000 of
  3803. the samples).
  3804. All volumes are in decibels relative to the maximum PCM value.
  3805. @subsection Examples
  3806. Here is an excerpt of the output:
  3807. @example
  3808. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3809. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3810. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3811. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3812. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3813. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3814. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3815. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3816. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3817. @end example
  3818. It means that:
  3819. @itemize
  3820. @item
  3821. The mean square energy is approximately -27 dB, or 10^-2.7.
  3822. @item
  3823. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3824. @item
  3825. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3826. @end itemize
  3827. In other words, raising the volume by +4 dB does not cause any clipping,
  3828. raising it by +5 dB causes clipping for 6 samples, etc.
  3829. @c man end AUDIO FILTERS
  3830. @chapter Audio Sources
  3831. @c man begin AUDIO SOURCES
  3832. Below is a description of the currently available audio sources.
  3833. @section abuffer
  3834. Buffer audio frames, and make them available to the filter chain.
  3835. This source is mainly intended for a programmatic use, in particular
  3836. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3837. It accepts the following parameters:
  3838. @table @option
  3839. @item time_base
  3840. The timebase which will be used for timestamps of submitted frames. It must be
  3841. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3842. @item sample_rate
  3843. The sample rate of the incoming audio buffers.
  3844. @item sample_fmt
  3845. The sample format of the incoming audio buffers.
  3846. Either a sample format name or its corresponding integer representation from
  3847. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3848. @item channel_layout
  3849. The channel layout of the incoming audio buffers.
  3850. Either a channel layout name from channel_layout_map in
  3851. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3852. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3853. @item channels
  3854. The number of channels of the incoming audio buffers.
  3855. If both @var{channels} and @var{channel_layout} are specified, then they
  3856. must be consistent.
  3857. @end table
  3858. @subsection Examples
  3859. @example
  3860. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3861. @end example
  3862. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3863. Since the sample format with name "s16p" corresponds to the number
  3864. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3865. equivalent to:
  3866. @example
  3867. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3868. @end example
  3869. @section aevalsrc
  3870. Generate an audio signal specified by an expression.
  3871. This source accepts in input one or more expressions (one for each
  3872. channel), which are evaluated and used to generate a corresponding
  3873. audio signal.
  3874. This source accepts the following options:
  3875. @table @option
  3876. @item exprs
  3877. Set the '|'-separated expressions list for each separate channel. In case the
  3878. @option{channel_layout} option is not specified, the selected channel layout
  3879. depends on the number of provided expressions. Otherwise the last
  3880. specified expression is applied to the remaining output channels.
  3881. @item channel_layout, c
  3882. Set the channel layout. The number of channels in the specified layout
  3883. must be equal to the number of specified expressions.
  3884. @item duration, d
  3885. Set the minimum duration of the sourced audio. See
  3886. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3887. for the accepted syntax.
  3888. Note that the resulting duration may be greater than the specified
  3889. duration, as the generated audio is always cut at the end of a
  3890. complete frame.
  3891. If not specified, or the expressed duration is negative, the audio is
  3892. supposed to be generated forever.
  3893. @item nb_samples, n
  3894. Set the number of samples per channel per each output frame,
  3895. default to 1024.
  3896. @item sample_rate, s
  3897. Specify the sample rate, default to 44100.
  3898. @end table
  3899. Each expression in @var{exprs} can contain the following constants:
  3900. @table @option
  3901. @item n
  3902. number of the evaluated sample, starting from 0
  3903. @item t
  3904. time of the evaluated sample expressed in seconds, starting from 0
  3905. @item s
  3906. sample rate
  3907. @end table
  3908. @subsection Examples
  3909. @itemize
  3910. @item
  3911. Generate silence:
  3912. @example
  3913. aevalsrc=0
  3914. @end example
  3915. @item
  3916. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3917. 8000 Hz:
  3918. @example
  3919. aevalsrc="sin(440*2*PI*t):s=8000"
  3920. @end example
  3921. @item
  3922. Generate a two channels signal, specify the channel layout (Front
  3923. Center + Back Center) explicitly:
  3924. @example
  3925. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3926. @end example
  3927. @item
  3928. Generate white noise:
  3929. @example
  3930. aevalsrc="-2+random(0)"
  3931. @end example
  3932. @item
  3933. Generate an amplitude modulated signal:
  3934. @example
  3935. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3936. @end example
  3937. @item
  3938. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3939. @example
  3940. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3941. @end example
  3942. @end itemize
  3943. @section anullsrc
  3944. The null audio source, return unprocessed audio frames. It is mainly useful
  3945. as a template and to be employed in analysis / debugging tools, or as
  3946. the source for filters which ignore the input data (for example the sox
  3947. synth filter).
  3948. This source accepts the following options:
  3949. @table @option
  3950. @item channel_layout, cl
  3951. Specifies the channel layout, and can be either an integer or a string
  3952. representing a channel layout. The default value of @var{channel_layout}
  3953. is "stereo".
  3954. Check the channel_layout_map definition in
  3955. @file{libavutil/channel_layout.c} for the mapping between strings and
  3956. channel layout values.
  3957. @item sample_rate, r
  3958. Specifies the sample rate, and defaults to 44100.
  3959. @item nb_samples, n
  3960. Set the number of samples per requested frames.
  3961. @end table
  3962. @subsection Examples
  3963. @itemize
  3964. @item
  3965. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3966. @example
  3967. anullsrc=r=48000:cl=4
  3968. @end example
  3969. @item
  3970. Do the same operation with a more obvious syntax:
  3971. @example
  3972. anullsrc=r=48000:cl=mono
  3973. @end example
  3974. @end itemize
  3975. All the parameters need to be explicitly defined.
  3976. @section flite
  3977. Synthesize a voice utterance using the libflite library.
  3978. To enable compilation of this filter you need to configure FFmpeg with
  3979. @code{--enable-libflite}.
  3980. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3981. The filter accepts the following options:
  3982. @table @option
  3983. @item list_voices
  3984. If set to 1, list the names of the available voices and exit
  3985. immediately. Default value is 0.
  3986. @item nb_samples, n
  3987. Set the maximum number of samples per frame. Default value is 512.
  3988. @item textfile
  3989. Set the filename containing the text to speak.
  3990. @item text
  3991. Set the text to speak.
  3992. @item voice, v
  3993. Set the voice to use for the speech synthesis. Default value is
  3994. @code{kal}. See also the @var{list_voices} option.
  3995. @end table
  3996. @subsection Examples
  3997. @itemize
  3998. @item
  3999. Read from file @file{speech.txt}, and synthesize the text using the
  4000. standard flite voice:
  4001. @example
  4002. flite=textfile=speech.txt
  4003. @end example
  4004. @item
  4005. Read the specified text selecting the @code{slt} voice:
  4006. @example
  4007. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4008. @end example
  4009. @item
  4010. Input text to ffmpeg:
  4011. @example
  4012. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4013. @end example
  4014. @item
  4015. Make @file{ffplay} speak the specified text, using @code{flite} and
  4016. the @code{lavfi} device:
  4017. @example
  4018. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4019. @end example
  4020. @end itemize
  4021. For more information about libflite, check:
  4022. @url{http://www.festvox.org/flite/}
  4023. @section anoisesrc
  4024. Generate a noise audio signal.
  4025. The filter accepts the following options:
  4026. @table @option
  4027. @item sample_rate, r
  4028. Specify the sample rate. Default value is 48000 Hz.
  4029. @item amplitude, a
  4030. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4031. is 1.0.
  4032. @item duration, d
  4033. Specify the duration of the generated audio stream. Not specifying this option
  4034. results in noise with an infinite length.
  4035. @item color, colour, c
  4036. Specify the color of noise. Available noise colors are white, pink, brown,
  4037. blue and violet. Default color is white.
  4038. @item seed, s
  4039. Specify a value used to seed the PRNG.
  4040. @item nb_samples, n
  4041. Set the number of samples per each output frame, default is 1024.
  4042. @end table
  4043. @subsection Examples
  4044. @itemize
  4045. @item
  4046. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4047. @example
  4048. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4049. @end example
  4050. @end itemize
  4051. @section hilbert
  4052. Generate odd-tap Hilbert transform FIR coefficients.
  4053. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4054. the signal by 90 degrees.
  4055. This is used in many matrix coding schemes and for analytic signal generation.
  4056. The process is often written as a multiplication by i (or j), the imaginary unit.
  4057. The filter accepts the following options:
  4058. @table @option
  4059. @item sample_rate, s
  4060. Set sample rate, default is 44100.
  4061. @item taps, t
  4062. Set length of FIR filter, default is 22051.
  4063. @item nb_samples, n
  4064. Set number of samples per each frame.
  4065. @item win_func, w
  4066. Set window function to be used when generating FIR coefficients.
  4067. @end table
  4068. @section sine
  4069. Generate an audio signal made of a sine wave with amplitude 1/8.
  4070. The audio signal is bit-exact.
  4071. The filter accepts the following options:
  4072. @table @option
  4073. @item frequency, f
  4074. Set the carrier frequency. Default is 440 Hz.
  4075. @item beep_factor, b
  4076. Enable a periodic beep every second with frequency @var{beep_factor} times
  4077. the carrier frequency. Default is 0, meaning the beep is disabled.
  4078. @item sample_rate, r
  4079. Specify the sample rate, default is 44100.
  4080. @item duration, d
  4081. Specify the duration of the generated audio stream.
  4082. @item samples_per_frame
  4083. Set the number of samples per output frame.
  4084. The expression can contain the following constants:
  4085. @table @option
  4086. @item n
  4087. The (sequential) number of the output audio frame, starting from 0.
  4088. @item pts
  4089. The PTS (Presentation TimeStamp) of the output audio frame,
  4090. expressed in @var{TB} units.
  4091. @item t
  4092. The PTS of the output audio frame, expressed in seconds.
  4093. @item TB
  4094. The timebase of the output audio frames.
  4095. @end table
  4096. Default is @code{1024}.
  4097. @end table
  4098. @subsection Examples
  4099. @itemize
  4100. @item
  4101. Generate a simple 440 Hz sine wave:
  4102. @example
  4103. sine
  4104. @end example
  4105. @item
  4106. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4107. @example
  4108. sine=220:4:d=5
  4109. sine=f=220:b=4:d=5
  4110. sine=frequency=220:beep_factor=4:duration=5
  4111. @end example
  4112. @item
  4113. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4114. pattern:
  4115. @example
  4116. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4117. @end example
  4118. @end itemize
  4119. @c man end AUDIO SOURCES
  4120. @chapter Audio Sinks
  4121. @c man begin AUDIO SINKS
  4122. Below is a description of the currently available audio sinks.
  4123. @section abuffersink
  4124. Buffer audio frames, and make them available to the end of filter chain.
  4125. This sink is mainly intended for programmatic use, in particular
  4126. through the interface defined in @file{libavfilter/buffersink.h}
  4127. or the options system.
  4128. It accepts a pointer to an AVABufferSinkContext structure, which
  4129. defines the incoming buffers' formats, to be passed as the opaque
  4130. parameter to @code{avfilter_init_filter} for initialization.
  4131. @section anullsink
  4132. Null audio sink; do absolutely nothing with the input audio. It is
  4133. mainly useful as a template and for use in analysis / debugging
  4134. tools.
  4135. @c man end AUDIO SINKS
  4136. @chapter Video Filters
  4137. @c man begin VIDEO FILTERS
  4138. When you configure your FFmpeg build, you can disable any of the
  4139. existing filters using @code{--disable-filters}.
  4140. The configure output will show the video filters included in your
  4141. build.
  4142. Below is a description of the currently available video filters.
  4143. @section alphaextract
  4144. Extract the alpha component from the input as a grayscale video. This
  4145. is especially useful with the @var{alphamerge} filter.
  4146. @section alphamerge
  4147. Add or replace the alpha component of the primary input with the
  4148. grayscale value of a second input. This is intended for use with
  4149. @var{alphaextract} to allow the transmission or storage of frame
  4150. sequences that have alpha in a format that doesn't support an alpha
  4151. channel.
  4152. For example, to reconstruct full frames from a normal YUV-encoded video
  4153. and a separate video created with @var{alphaextract}, you might use:
  4154. @example
  4155. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4156. @end example
  4157. Since this filter is designed for reconstruction, it operates on frame
  4158. sequences without considering timestamps, and terminates when either
  4159. input reaches end of stream. This will cause problems if your encoding
  4160. pipeline drops frames. If you're trying to apply an image as an
  4161. overlay to a video stream, consider the @var{overlay} filter instead.
  4162. @section amplify
  4163. Amplify differences between current pixel and pixels of adjacent frames in
  4164. same pixel location.
  4165. This filter accepts the following options:
  4166. @table @option
  4167. @item radius
  4168. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4169. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4170. @item factor
  4171. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4172. @item threshold
  4173. Set threshold for difference amplification. Any differrence greater or equal to
  4174. this value will not alter source pixel. Default is 10.
  4175. Allowed range is from 0 to 65535.
  4176. @item low
  4177. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4178. This option controls maximum possible value that will decrease source pixel value.
  4179. @item high
  4180. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4181. This option controls maximum possible value that will increase source pixel value.
  4182. @item planes
  4183. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4184. @end table
  4185. @section ass
  4186. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4187. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4188. Substation Alpha) subtitles files.
  4189. This filter accepts the following option in addition to the common options from
  4190. the @ref{subtitles} filter:
  4191. @table @option
  4192. @item shaping
  4193. Set the shaping engine
  4194. Available values are:
  4195. @table @samp
  4196. @item auto
  4197. The default libass shaping engine, which is the best available.
  4198. @item simple
  4199. Fast, font-agnostic shaper that can do only substitutions
  4200. @item complex
  4201. Slower shaper using OpenType for substitutions and positioning
  4202. @end table
  4203. The default is @code{auto}.
  4204. @end table
  4205. @section atadenoise
  4206. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4207. The filter accepts the following options:
  4208. @table @option
  4209. @item 0a
  4210. Set threshold A for 1st plane. Default is 0.02.
  4211. Valid range is 0 to 0.3.
  4212. @item 0b
  4213. Set threshold B for 1st plane. Default is 0.04.
  4214. Valid range is 0 to 5.
  4215. @item 1a
  4216. Set threshold A for 2nd plane. Default is 0.02.
  4217. Valid range is 0 to 0.3.
  4218. @item 1b
  4219. Set threshold B for 2nd plane. Default is 0.04.
  4220. Valid range is 0 to 5.
  4221. @item 2a
  4222. Set threshold A for 3rd plane. Default is 0.02.
  4223. Valid range is 0 to 0.3.
  4224. @item 2b
  4225. Set threshold B for 3rd plane. Default is 0.04.
  4226. Valid range is 0 to 5.
  4227. Threshold A is designed to react on abrupt changes in the input signal and
  4228. threshold B is designed to react on continuous changes in the input signal.
  4229. @item s
  4230. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4231. number in range [5, 129].
  4232. @item p
  4233. Set what planes of frame filter will use for averaging. Default is all.
  4234. @end table
  4235. @section avgblur
  4236. Apply average blur filter.
  4237. The filter accepts the following options:
  4238. @table @option
  4239. @item sizeX
  4240. Set horizontal radius size.
  4241. @item planes
  4242. Set which planes to filter. By default all planes are filtered.
  4243. @item sizeY
  4244. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4245. Default is @code{0}.
  4246. @end table
  4247. @section bbox
  4248. Compute the bounding box for the non-black pixels in the input frame
  4249. luminance plane.
  4250. This filter computes the bounding box containing all the pixels with a
  4251. luminance value greater than the minimum allowed value.
  4252. The parameters describing the bounding box are printed on the filter
  4253. log.
  4254. The filter accepts the following option:
  4255. @table @option
  4256. @item min_val
  4257. Set the minimal luminance value. Default is @code{16}.
  4258. @end table
  4259. @section bitplanenoise
  4260. Show and measure bit plane noise.
  4261. The filter accepts the following options:
  4262. @table @option
  4263. @item bitplane
  4264. Set which plane to analyze. Default is @code{1}.
  4265. @item filter
  4266. Filter out noisy pixels from @code{bitplane} set above.
  4267. Default is disabled.
  4268. @end table
  4269. @section blackdetect
  4270. Detect video intervals that are (almost) completely black. Can be
  4271. useful to detect chapter transitions, commercials, or invalid
  4272. recordings. Output lines contains the time for the start, end and
  4273. duration of the detected black interval expressed in seconds.
  4274. In order to display the output lines, you need to set the loglevel at
  4275. least to the AV_LOG_INFO value.
  4276. The filter accepts the following options:
  4277. @table @option
  4278. @item black_min_duration, d
  4279. Set the minimum detected black duration expressed in seconds. It must
  4280. be a non-negative floating point number.
  4281. Default value is 2.0.
  4282. @item picture_black_ratio_th, pic_th
  4283. Set the threshold for considering a picture "black".
  4284. Express the minimum value for the ratio:
  4285. @example
  4286. @var{nb_black_pixels} / @var{nb_pixels}
  4287. @end example
  4288. for which a picture is considered black.
  4289. Default value is 0.98.
  4290. @item pixel_black_th, pix_th
  4291. Set the threshold for considering a pixel "black".
  4292. The threshold expresses the maximum pixel luminance value for which a
  4293. pixel is considered "black". The provided value is scaled according to
  4294. the following equation:
  4295. @example
  4296. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4297. @end example
  4298. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4299. the input video format, the range is [0-255] for YUV full-range
  4300. formats and [16-235] for YUV non full-range formats.
  4301. Default value is 0.10.
  4302. @end table
  4303. The following example sets the maximum pixel threshold to the minimum
  4304. value, and detects only black intervals of 2 or more seconds:
  4305. @example
  4306. blackdetect=d=2:pix_th=0.00
  4307. @end example
  4308. @section blackframe
  4309. Detect frames that are (almost) completely black. Can be useful to
  4310. detect chapter transitions or commercials. Output lines consist of
  4311. the frame number of the detected frame, the percentage of blackness,
  4312. the position in the file if known or -1 and the timestamp in seconds.
  4313. In order to display the output lines, you need to set the loglevel at
  4314. least to the AV_LOG_INFO value.
  4315. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4316. The value represents the percentage of pixels in the picture that
  4317. are below the threshold value.
  4318. It accepts the following parameters:
  4319. @table @option
  4320. @item amount
  4321. The percentage of the pixels that have to be below the threshold; it defaults to
  4322. @code{98}.
  4323. @item threshold, thresh
  4324. The threshold below which a pixel value is considered black; it defaults to
  4325. @code{32}.
  4326. @end table
  4327. @section blend, tblend
  4328. Blend two video frames into each other.
  4329. The @code{blend} filter takes two input streams and outputs one
  4330. stream, the first input is the "top" layer and second input is
  4331. "bottom" layer. By default, the output terminates when the longest input terminates.
  4332. The @code{tblend} (time blend) filter takes two consecutive frames
  4333. from one single stream, and outputs the result obtained by blending
  4334. the new frame on top of the old frame.
  4335. A description of the accepted options follows.
  4336. @table @option
  4337. @item c0_mode
  4338. @item c1_mode
  4339. @item c2_mode
  4340. @item c3_mode
  4341. @item all_mode
  4342. Set blend mode for specific pixel component or all pixel components in case
  4343. of @var{all_mode}. Default value is @code{normal}.
  4344. Available values for component modes are:
  4345. @table @samp
  4346. @item addition
  4347. @item grainmerge
  4348. @item and
  4349. @item average
  4350. @item burn
  4351. @item darken
  4352. @item difference
  4353. @item grainextract
  4354. @item divide
  4355. @item dodge
  4356. @item freeze
  4357. @item exclusion
  4358. @item extremity
  4359. @item glow
  4360. @item hardlight
  4361. @item hardmix
  4362. @item heat
  4363. @item lighten
  4364. @item linearlight
  4365. @item multiply
  4366. @item multiply128
  4367. @item negation
  4368. @item normal
  4369. @item or
  4370. @item overlay
  4371. @item phoenix
  4372. @item pinlight
  4373. @item reflect
  4374. @item screen
  4375. @item softlight
  4376. @item subtract
  4377. @item vividlight
  4378. @item xor
  4379. @end table
  4380. @item c0_opacity
  4381. @item c1_opacity
  4382. @item c2_opacity
  4383. @item c3_opacity
  4384. @item all_opacity
  4385. Set blend opacity for specific pixel component or all pixel components in case
  4386. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4387. @item c0_expr
  4388. @item c1_expr
  4389. @item c2_expr
  4390. @item c3_expr
  4391. @item all_expr
  4392. Set blend expression for specific pixel component or all pixel components in case
  4393. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4394. The expressions can use the following variables:
  4395. @table @option
  4396. @item N
  4397. The sequential number of the filtered frame, starting from @code{0}.
  4398. @item X
  4399. @item Y
  4400. the coordinates of the current sample
  4401. @item W
  4402. @item H
  4403. the width and height of currently filtered plane
  4404. @item SW
  4405. @item SH
  4406. Width and height scale for the plane being filtered. It is the
  4407. ratio between the dimensions of the current plane to the luma plane,
  4408. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4409. the luma plane and @code{0.5,0.5} for the chroma planes.
  4410. @item T
  4411. Time of the current frame, expressed in seconds.
  4412. @item TOP, A
  4413. Value of pixel component at current location for first video frame (top layer).
  4414. @item BOTTOM, B
  4415. Value of pixel component at current location for second video frame (bottom layer).
  4416. @end table
  4417. @end table
  4418. The @code{blend} filter also supports the @ref{framesync} options.
  4419. @subsection Examples
  4420. @itemize
  4421. @item
  4422. Apply transition from bottom layer to top layer in first 10 seconds:
  4423. @example
  4424. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4425. @end example
  4426. @item
  4427. Apply linear horizontal transition from top layer to bottom layer:
  4428. @example
  4429. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4430. @end example
  4431. @item
  4432. Apply 1x1 checkerboard effect:
  4433. @example
  4434. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4435. @end example
  4436. @item
  4437. Apply uncover left effect:
  4438. @example
  4439. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4440. @end example
  4441. @item
  4442. Apply uncover down effect:
  4443. @example
  4444. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4445. @end example
  4446. @item
  4447. Apply uncover up-left effect:
  4448. @example
  4449. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4450. @end example
  4451. @item
  4452. Split diagonally video and shows top and bottom layer on each side:
  4453. @example
  4454. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4455. @end example
  4456. @item
  4457. Display differences between the current and the previous frame:
  4458. @example
  4459. tblend=all_mode=grainextract
  4460. @end example
  4461. @end itemize
  4462. @section bm3d
  4463. Denoise frames using Block-Matching 3D algorithm.
  4464. The filter accepts the following options.
  4465. @table @option
  4466. @item sigma
  4467. Set denoising strength. Default value is 1.
  4468. Allowed range is from 0 to 999.9.
  4469. The denoising algorith is very sensitive to sigma, so adjust it
  4470. according to the source.
  4471. @item block
  4472. Set local patch size. This sets dimensions in 2D.
  4473. @item bstep
  4474. Set sliding step for processing blocks. Default value is 4.
  4475. Allowed range is from 1 to 64.
  4476. Smaller values allows processing more reference blocks and is slower.
  4477. @item group
  4478. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4479. When set to 1, no block matching is done. Larger values allows more blocks
  4480. in single group.
  4481. Allowed range is from 1 to 256.
  4482. @item range
  4483. Set radius for search block matching. Default is 9.
  4484. Allowed range is from 1 to INT32_MAX.
  4485. @item mstep
  4486. Set step between two search locations for block matching. Default is 1.
  4487. Allowed range is from 1 to 64. Smaller is slower.
  4488. @item thmse
  4489. Set threshold of mean square error for block matching. Valid range is 0 to
  4490. INT32_MAX.
  4491. @item hdthr
  4492. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4493. Larger values results in stronger hard-thresholding filtering in frequency
  4494. domain.
  4495. @item estim
  4496. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4497. Default is @code{basic}.
  4498. @item ref
  4499. If enabled, filter will use 2nd stream for block matching.
  4500. Default is disabled for @code{basic} value of @var{estim} option,
  4501. and always enabled if value of @var{estim} is @code{final}.
  4502. @item planes
  4503. Set planes to filter. Default is all available except alpha.
  4504. @end table
  4505. @subsection Examples
  4506. @itemize
  4507. @item
  4508. Basic filtering with bm3d:
  4509. @example
  4510. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4511. @end example
  4512. @item
  4513. Same as above, but filtering only luma:
  4514. @example
  4515. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4516. @end example
  4517. @item
  4518. Same as above, but with both estimation modes:
  4519. @example
  4520. split[a][b],[a]bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
  4521. @end example
  4522. @item
  4523. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4524. @example
  4525. split[a][b],[a]nlmeans=s=3:r=7:p=3[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
  4526. @end example
  4527. @end itemize
  4528. @section boxblur
  4529. Apply a boxblur algorithm to the input video.
  4530. It accepts the following parameters:
  4531. @table @option
  4532. @item luma_radius, lr
  4533. @item luma_power, lp
  4534. @item chroma_radius, cr
  4535. @item chroma_power, cp
  4536. @item alpha_radius, ar
  4537. @item alpha_power, ap
  4538. @end table
  4539. A description of the accepted options follows.
  4540. @table @option
  4541. @item luma_radius, lr
  4542. @item chroma_radius, cr
  4543. @item alpha_radius, ar
  4544. Set an expression for the box radius in pixels used for blurring the
  4545. corresponding input plane.
  4546. The radius value must be a non-negative number, and must not be
  4547. greater than the value of the expression @code{min(w,h)/2} for the
  4548. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4549. planes.
  4550. Default value for @option{luma_radius} is "2". If not specified,
  4551. @option{chroma_radius} and @option{alpha_radius} default to the
  4552. corresponding value set for @option{luma_radius}.
  4553. The expressions can contain the following constants:
  4554. @table @option
  4555. @item w
  4556. @item h
  4557. The input width and height in pixels.
  4558. @item cw
  4559. @item ch
  4560. The input chroma image width and height in pixels.
  4561. @item hsub
  4562. @item vsub
  4563. The horizontal and vertical chroma subsample values. For example, for the
  4564. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4565. @end table
  4566. @item luma_power, lp
  4567. @item chroma_power, cp
  4568. @item alpha_power, ap
  4569. Specify how many times the boxblur filter is applied to the
  4570. corresponding plane.
  4571. Default value for @option{luma_power} is 2. If not specified,
  4572. @option{chroma_power} and @option{alpha_power} default to the
  4573. corresponding value set for @option{luma_power}.
  4574. A value of 0 will disable the effect.
  4575. @end table
  4576. @subsection Examples
  4577. @itemize
  4578. @item
  4579. Apply a boxblur filter with the luma, chroma, and alpha radii
  4580. set to 2:
  4581. @example
  4582. boxblur=luma_radius=2:luma_power=1
  4583. boxblur=2:1
  4584. @end example
  4585. @item
  4586. Set the luma radius to 2, and alpha and chroma radius to 0:
  4587. @example
  4588. boxblur=2:1:cr=0:ar=0
  4589. @end example
  4590. @item
  4591. Set the luma and chroma radii to a fraction of the video dimension:
  4592. @example
  4593. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4594. @end example
  4595. @end itemize
  4596. @section bwdif
  4597. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4598. Deinterlacing Filter").
  4599. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4600. interpolation algorithms.
  4601. It accepts the following parameters:
  4602. @table @option
  4603. @item mode
  4604. The interlacing mode to adopt. It accepts one of the following values:
  4605. @table @option
  4606. @item 0, send_frame
  4607. Output one frame for each frame.
  4608. @item 1, send_field
  4609. Output one frame for each field.
  4610. @end table
  4611. The default value is @code{send_field}.
  4612. @item parity
  4613. The picture field parity assumed for the input interlaced video. It accepts one
  4614. of the following values:
  4615. @table @option
  4616. @item 0, tff
  4617. Assume the top field is first.
  4618. @item 1, bff
  4619. Assume the bottom field is first.
  4620. @item -1, auto
  4621. Enable automatic detection of field parity.
  4622. @end table
  4623. The default value is @code{auto}.
  4624. If the interlacing is unknown or the decoder does not export this information,
  4625. top field first will be assumed.
  4626. @item deint
  4627. Specify which frames to deinterlace. Accept one of the following
  4628. values:
  4629. @table @option
  4630. @item 0, all
  4631. Deinterlace all frames.
  4632. @item 1, interlaced
  4633. Only deinterlace frames marked as interlaced.
  4634. @end table
  4635. The default value is @code{all}.
  4636. @end table
  4637. @section chromakey
  4638. YUV colorspace color/chroma keying.
  4639. The filter accepts the following options:
  4640. @table @option
  4641. @item color
  4642. The color which will be replaced with transparency.
  4643. @item similarity
  4644. Similarity percentage with the key color.
  4645. 0.01 matches only the exact key color, while 1.0 matches everything.
  4646. @item blend
  4647. Blend percentage.
  4648. 0.0 makes pixels either fully transparent, or not transparent at all.
  4649. Higher values result in semi-transparent pixels, with a higher transparency
  4650. the more similar the pixels color is to the key color.
  4651. @item yuv
  4652. Signals that the color passed is already in YUV instead of RGB.
  4653. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4654. This can be used to pass exact YUV values as hexadecimal numbers.
  4655. @end table
  4656. @subsection Examples
  4657. @itemize
  4658. @item
  4659. Make every green pixel in the input image transparent:
  4660. @example
  4661. ffmpeg -i input.png -vf chromakey=green out.png
  4662. @end example
  4663. @item
  4664. Overlay a greenscreen-video on top of a static black background.
  4665. @example
  4666. 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
  4667. @end example
  4668. @end itemize
  4669. @section ciescope
  4670. Display CIE color diagram with pixels overlaid onto it.
  4671. The filter accepts the following options:
  4672. @table @option
  4673. @item system
  4674. Set color system.
  4675. @table @samp
  4676. @item ntsc, 470m
  4677. @item ebu, 470bg
  4678. @item smpte
  4679. @item 240m
  4680. @item apple
  4681. @item widergb
  4682. @item cie1931
  4683. @item rec709, hdtv
  4684. @item uhdtv, rec2020
  4685. @end table
  4686. @item cie
  4687. Set CIE system.
  4688. @table @samp
  4689. @item xyy
  4690. @item ucs
  4691. @item luv
  4692. @end table
  4693. @item gamuts
  4694. Set what gamuts to draw.
  4695. See @code{system} option for available values.
  4696. @item size, s
  4697. Set ciescope size, by default set to 512.
  4698. @item intensity, i
  4699. Set intensity used to map input pixel values to CIE diagram.
  4700. @item contrast
  4701. Set contrast used to draw tongue colors that are out of active color system gamut.
  4702. @item corrgamma
  4703. Correct gamma displayed on scope, by default enabled.
  4704. @item showwhite
  4705. Show white point on CIE diagram, by default disabled.
  4706. @item gamma
  4707. Set input gamma. Used only with XYZ input color space.
  4708. @end table
  4709. @section codecview
  4710. Visualize information exported by some codecs.
  4711. Some codecs can export information through frames using side-data or other
  4712. means. For example, some MPEG based codecs export motion vectors through the
  4713. @var{export_mvs} flag in the codec @option{flags2} option.
  4714. The filter accepts the following option:
  4715. @table @option
  4716. @item mv
  4717. Set motion vectors to visualize.
  4718. Available flags for @var{mv} are:
  4719. @table @samp
  4720. @item pf
  4721. forward predicted MVs of P-frames
  4722. @item bf
  4723. forward predicted MVs of B-frames
  4724. @item bb
  4725. backward predicted MVs of B-frames
  4726. @end table
  4727. @item qp
  4728. Display quantization parameters using the chroma planes.
  4729. @item mv_type, mvt
  4730. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4731. Available flags for @var{mv_type} are:
  4732. @table @samp
  4733. @item fp
  4734. forward predicted MVs
  4735. @item bp
  4736. backward predicted MVs
  4737. @end table
  4738. @item frame_type, ft
  4739. Set frame type to visualize motion vectors of.
  4740. Available flags for @var{frame_type} are:
  4741. @table @samp
  4742. @item if
  4743. intra-coded frames (I-frames)
  4744. @item pf
  4745. predicted frames (P-frames)
  4746. @item bf
  4747. bi-directionally predicted frames (B-frames)
  4748. @end table
  4749. @end table
  4750. @subsection Examples
  4751. @itemize
  4752. @item
  4753. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4754. @example
  4755. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4756. @end example
  4757. @item
  4758. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4759. @example
  4760. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4761. @end example
  4762. @end itemize
  4763. @section colorbalance
  4764. Modify intensity of primary colors (red, green and blue) of input frames.
  4765. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4766. regions for the red-cyan, green-magenta or blue-yellow balance.
  4767. A positive adjustment value shifts the balance towards the primary color, a negative
  4768. value towards the complementary color.
  4769. The filter accepts the following options:
  4770. @table @option
  4771. @item rs
  4772. @item gs
  4773. @item bs
  4774. Adjust red, green and blue shadows (darkest pixels).
  4775. @item rm
  4776. @item gm
  4777. @item bm
  4778. Adjust red, green and blue midtones (medium pixels).
  4779. @item rh
  4780. @item gh
  4781. @item bh
  4782. Adjust red, green and blue highlights (brightest pixels).
  4783. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4784. @end table
  4785. @subsection Examples
  4786. @itemize
  4787. @item
  4788. Add red color cast to shadows:
  4789. @example
  4790. colorbalance=rs=.3
  4791. @end example
  4792. @end itemize
  4793. @section colorkey
  4794. RGB colorspace color keying.
  4795. The filter accepts the following options:
  4796. @table @option
  4797. @item color
  4798. The color which will be replaced with transparency.
  4799. @item similarity
  4800. Similarity percentage with the key color.
  4801. 0.01 matches only the exact key color, while 1.0 matches everything.
  4802. @item blend
  4803. Blend percentage.
  4804. 0.0 makes pixels either fully transparent, or not transparent at all.
  4805. Higher values result in semi-transparent pixels, with a higher transparency
  4806. the more similar the pixels color is to the key color.
  4807. @end table
  4808. @subsection Examples
  4809. @itemize
  4810. @item
  4811. Make every green pixel in the input image transparent:
  4812. @example
  4813. ffmpeg -i input.png -vf colorkey=green out.png
  4814. @end example
  4815. @item
  4816. Overlay a greenscreen-video on top of a static background image.
  4817. @example
  4818. 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
  4819. @end example
  4820. @end itemize
  4821. @section colorlevels
  4822. Adjust video input frames using levels.
  4823. The filter accepts the following options:
  4824. @table @option
  4825. @item rimin
  4826. @item gimin
  4827. @item bimin
  4828. @item aimin
  4829. Adjust red, green, blue and alpha input black point.
  4830. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4831. @item rimax
  4832. @item gimax
  4833. @item bimax
  4834. @item aimax
  4835. Adjust red, green, blue and alpha input white point.
  4836. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4837. Input levels are used to lighten highlights (bright tones), darken shadows
  4838. (dark tones), change the balance of bright and dark tones.
  4839. @item romin
  4840. @item gomin
  4841. @item bomin
  4842. @item aomin
  4843. Adjust red, green, blue and alpha output black point.
  4844. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4845. @item romax
  4846. @item gomax
  4847. @item bomax
  4848. @item aomax
  4849. Adjust red, green, blue and alpha output white point.
  4850. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4851. Output levels allows manual selection of a constrained output level range.
  4852. @end table
  4853. @subsection Examples
  4854. @itemize
  4855. @item
  4856. Make video output darker:
  4857. @example
  4858. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4859. @end example
  4860. @item
  4861. Increase contrast:
  4862. @example
  4863. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4864. @end example
  4865. @item
  4866. Make video output lighter:
  4867. @example
  4868. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4869. @end example
  4870. @item
  4871. Increase brightness:
  4872. @example
  4873. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4874. @end example
  4875. @end itemize
  4876. @section colorchannelmixer
  4877. Adjust video input frames by re-mixing color channels.
  4878. This filter modifies a color channel by adding the values associated to
  4879. the other channels of the same pixels. For example if the value to
  4880. modify is red, the output value will be:
  4881. @example
  4882. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4883. @end example
  4884. The filter accepts the following options:
  4885. @table @option
  4886. @item rr
  4887. @item rg
  4888. @item rb
  4889. @item ra
  4890. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4891. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4892. @item gr
  4893. @item gg
  4894. @item gb
  4895. @item ga
  4896. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4897. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4898. @item br
  4899. @item bg
  4900. @item bb
  4901. @item ba
  4902. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4903. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4904. @item ar
  4905. @item ag
  4906. @item ab
  4907. @item aa
  4908. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4909. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4910. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4911. @end table
  4912. @subsection Examples
  4913. @itemize
  4914. @item
  4915. Convert source to grayscale:
  4916. @example
  4917. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4918. @end example
  4919. @item
  4920. Simulate sepia tones:
  4921. @example
  4922. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4923. @end example
  4924. @end itemize
  4925. @section colormatrix
  4926. Convert color matrix.
  4927. The filter accepts the following options:
  4928. @table @option
  4929. @item src
  4930. @item dst
  4931. Specify the source and destination color matrix. Both values must be
  4932. specified.
  4933. The accepted values are:
  4934. @table @samp
  4935. @item bt709
  4936. BT.709
  4937. @item fcc
  4938. FCC
  4939. @item bt601
  4940. BT.601
  4941. @item bt470
  4942. BT.470
  4943. @item bt470bg
  4944. BT.470BG
  4945. @item smpte170m
  4946. SMPTE-170M
  4947. @item smpte240m
  4948. SMPTE-240M
  4949. @item bt2020
  4950. BT.2020
  4951. @end table
  4952. @end table
  4953. For example to convert from BT.601 to SMPTE-240M, use the command:
  4954. @example
  4955. colormatrix=bt601:smpte240m
  4956. @end example
  4957. @section colorspace
  4958. Convert colorspace, transfer characteristics or color primaries.
  4959. Input video needs to have an even size.
  4960. The filter accepts the following options:
  4961. @table @option
  4962. @anchor{all}
  4963. @item all
  4964. Specify all color properties at once.
  4965. The accepted values are:
  4966. @table @samp
  4967. @item bt470m
  4968. BT.470M
  4969. @item bt470bg
  4970. BT.470BG
  4971. @item bt601-6-525
  4972. BT.601-6 525
  4973. @item bt601-6-625
  4974. BT.601-6 625
  4975. @item bt709
  4976. BT.709
  4977. @item smpte170m
  4978. SMPTE-170M
  4979. @item smpte240m
  4980. SMPTE-240M
  4981. @item bt2020
  4982. BT.2020
  4983. @end table
  4984. @anchor{space}
  4985. @item space
  4986. Specify output colorspace.
  4987. The accepted values are:
  4988. @table @samp
  4989. @item bt709
  4990. BT.709
  4991. @item fcc
  4992. FCC
  4993. @item bt470bg
  4994. BT.470BG or BT.601-6 625
  4995. @item smpte170m
  4996. SMPTE-170M or BT.601-6 525
  4997. @item smpte240m
  4998. SMPTE-240M
  4999. @item ycgco
  5000. YCgCo
  5001. @item bt2020ncl
  5002. BT.2020 with non-constant luminance
  5003. @end table
  5004. @anchor{trc}
  5005. @item trc
  5006. Specify output transfer characteristics.
  5007. The accepted values are:
  5008. @table @samp
  5009. @item bt709
  5010. BT.709
  5011. @item bt470m
  5012. BT.470M
  5013. @item bt470bg
  5014. BT.470BG
  5015. @item gamma22
  5016. Constant gamma of 2.2
  5017. @item gamma28
  5018. Constant gamma of 2.8
  5019. @item smpte170m
  5020. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5021. @item smpte240m
  5022. SMPTE-240M
  5023. @item srgb
  5024. SRGB
  5025. @item iec61966-2-1
  5026. iec61966-2-1
  5027. @item iec61966-2-4
  5028. iec61966-2-4
  5029. @item xvycc
  5030. xvycc
  5031. @item bt2020-10
  5032. BT.2020 for 10-bits content
  5033. @item bt2020-12
  5034. BT.2020 for 12-bits content
  5035. @end table
  5036. @anchor{primaries}
  5037. @item primaries
  5038. Specify output color primaries.
  5039. The accepted values are:
  5040. @table @samp
  5041. @item bt709
  5042. BT.709
  5043. @item bt470m
  5044. BT.470M
  5045. @item bt470bg
  5046. BT.470BG or BT.601-6 625
  5047. @item smpte170m
  5048. SMPTE-170M or BT.601-6 525
  5049. @item smpte240m
  5050. SMPTE-240M
  5051. @item film
  5052. film
  5053. @item smpte431
  5054. SMPTE-431
  5055. @item smpte432
  5056. SMPTE-432
  5057. @item bt2020
  5058. BT.2020
  5059. @item jedec-p22
  5060. JEDEC P22 phosphors
  5061. @end table
  5062. @anchor{range}
  5063. @item range
  5064. Specify output color range.
  5065. The accepted values are:
  5066. @table @samp
  5067. @item tv
  5068. TV (restricted) range
  5069. @item mpeg
  5070. MPEG (restricted) range
  5071. @item pc
  5072. PC (full) range
  5073. @item jpeg
  5074. JPEG (full) range
  5075. @end table
  5076. @item format
  5077. Specify output color format.
  5078. The accepted values are:
  5079. @table @samp
  5080. @item yuv420p
  5081. YUV 4:2:0 planar 8-bits
  5082. @item yuv420p10
  5083. YUV 4:2:0 planar 10-bits
  5084. @item yuv420p12
  5085. YUV 4:2:0 planar 12-bits
  5086. @item yuv422p
  5087. YUV 4:2:2 planar 8-bits
  5088. @item yuv422p10
  5089. YUV 4:2:2 planar 10-bits
  5090. @item yuv422p12
  5091. YUV 4:2:2 planar 12-bits
  5092. @item yuv444p
  5093. YUV 4:4:4 planar 8-bits
  5094. @item yuv444p10
  5095. YUV 4:4:4 planar 10-bits
  5096. @item yuv444p12
  5097. YUV 4:4:4 planar 12-bits
  5098. @end table
  5099. @item fast
  5100. Do a fast conversion, which skips gamma/primary correction. This will take
  5101. significantly less CPU, but will be mathematically incorrect. To get output
  5102. compatible with that produced by the colormatrix filter, use fast=1.
  5103. @item dither
  5104. Specify dithering mode.
  5105. The accepted values are:
  5106. @table @samp
  5107. @item none
  5108. No dithering
  5109. @item fsb
  5110. Floyd-Steinberg dithering
  5111. @end table
  5112. @item wpadapt
  5113. Whitepoint adaptation mode.
  5114. The accepted values are:
  5115. @table @samp
  5116. @item bradford
  5117. Bradford whitepoint adaptation
  5118. @item vonkries
  5119. von Kries whitepoint adaptation
  5120. @item identity
  5121. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5122. @end table
  5123. @item iall
  5124. Override all input properties at once. Same accepted values as @ref{all}.
  5125. @item ispace
  5126. Override input colorspace. Same accepted values as @ref{space}.
  5127. @item iprimaries
  5128. Override input color primaries. Same accepted values as @ref{primaries}.
  5129. @item itrc
  5130. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5131. @item irange
  5132. Override input color range. Same accepted values as @ref{range}.
  5133. @end table
  5134. The filter converts the transfer characteristics, color space and color
  5135. primaries to the specified user values. The output value, if not specified,
  5136. is set to a default value based on the "all" property. If that property is
  5137. also not specified, the filter will log an error. The output color range and
  5138. format default to the same value as the input color range and format. The
  5139. input transfer characteristics, color space, color primaries and color range
  5140. should be set on the input data. If any of these are missing, the filter will
  5141. log an error and no conversion will take place.
  5142. For example to convert the input to SMPTE-240M, use the command:
  5143. @example
  5144. colorspace=smpte240m
  5145. @end example
  5146. @section convolution
  5147. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5148. The filter accepts the following options:
  5149. @table @option
  5150. @item 0m
  5151. @item 1m
  5152. @item 2m
  5153. @item 3m
  5154. Set matrix for each plane.
  5155. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5156. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5157. @item 0rdiv
  5158. @item 1rdiv
  5159. @item 2rdiv
  5160. @item 3rdiv
  5161. Set multiplier for calculated value for each plane.
  5162. If unset or 0, it will be sum of all matrix elements.
  5163. @item 0bias
  5164. @item 1bias
  5165. @item 2bias
  5166. @item 3bias
  5167. Set bias for each plane. This value is added to the result of the multiplication.
  5168. Useful for making the overall image brighter or darker. Default is 0.0.
  5169. @item 0mode
  5170. @item 1mode
  5171. @item 2mode
  5172. @item 3mode
  5173. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5174. Default is @var{square}.
  5175. @end table
  5176. @subsection Examples
  5177. @itemize
  5178. @item
  5179. Apply sharpen:
  5180. @example
  5181. 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"
  5182. @end example
  5183. @item
  5184. Apply blur:
  5185. @example
  5186. 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"
  5187. @end example
  5188. @item
  5189. Apply edge enhance:
  5190. @example
  5191. 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"
  5192. @end example
  5193. @item
  5194. Apply edge detect:
  5195. @example
  5196. 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"
  5197. @end example
  5198. @item
  5199. Apply laplacian edge detector which includes diagonals:
  5200. @example
  5201. 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"
  5202. @end example
  5203. @item
  5204. Apply emboss:
  5205. @example
  5206. 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"
  5207. @end example
  5208. @end itemize
  5209. @section convolve
  5210. Apply 2D convolution of video stream in frequency domain using second stream
  5211. as impulse.
  5212. The filter accepts the following options:
  5213. @table @option
  5214. @item planes
  5215. Set which planes to process.
  5216. @item impulse
  5217. Set which impulse video frames will be processed, can be @var{first}
  5218. or @var{all}. Default is @var{all}.
  5219. @end table
  5220. The @code{convolve} filter also supports the @ref{framesync} options.
  5221. @section copy
  5222. Copy the input video source unchanged to the output. This is mainly useful for
  5223. testing purposes.
  5224. @anchor{coreimage}
  5225. @section coreimage
  5226. Video filtering on GPU using Apple's CoreImage API on OSX.
  5227. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5228. processed by video hardware. However, software-based OpenGL implementations
  5229. exist which means there is no guarantee for hardware processing. It depends on
  5230. the respective OSX.
  5231. There are many filters and image generators provided by Apple that come with a
  5232. large variety of options. The filter has to be referenced by its name along
  5233. with its options.
  5234. The coreimage filter accepts the following options:
  5235. @table @option
  5236. @item list_filters
  5237. List all available filters and generators along with all their respective
  5238. options as well as possible minimum and maximum values along with the default
  5239. values.
  5240. @example
  5241. list_filters=true
  5242. @end example
  5243. @item filter
  5244. Specify all filters by their respective name and options.
  5245. Use @var{list_filters} to determine all valid filter names and options.
  5246. Numerical options are specified by a float value and are automatically clamped
  5247. to their respective value range. Vector and color options have to be specified
  5248. by a list of space separated float values. Character escaping has to be done.
  5249. A special option name @code{default} is available to use default options for a
  5250. filter.
  5251. It is required to specify either @code{default} or at least one of the filter options.
  5252. All omitted options are used with their default values.
  5253. The syntax of the filter string is as follows:
  5254. @example
  5255. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5256. @end example
  5257. @item output_rect
  5258. Specify a rectangle where the output of the filter chain is copied into the
  5259. input image. It is given by a list of space separated float values:
  5260. @example
  5261. output_rect=x\ y\ width\ height
  5262. @end example
  5263. If not given, the output rectangle equals the dimensions of the input image.
  5264. The output rectangle is automatically cropped at the borders of the input
  5265. image. Negative values are valid for each component.
  5266. @example
  5267. output_rect=25\ 25\ 100\ 100
  5268. @end example
  5269. @end table
  5270. Several filters can be chained for successive processing without GPU-HOST
  5271. transfers allowing for fast processing of complex filter chains.
  5272. Currently, only filters with zero (generators) or exactly one (filters) input
  5273. image and one output image are supported. Also, transition filters are not yet
  5274. usable as intended.
  5275. Some filters generate output images with additional padding depending on the
  5276. respective filter kernel. The padding is automatically removed to ensure the
  5277. filter output has the same size as the input image.
  5278. For image generators, the size of the output image is determined by the
  5279. previous output image of the filter chain or the input image of the whole
  5280. filterchain, respectively. The generators do not use the pixel information of
  5281. this image to generate their output. However, the generated output is
  5282. blended onto this image, resulting in partial or complete coverage of the
  5283. output image.
  5284. The @ref{coreimagesrc} video source can be used for generating input images
  5285. which are directly fed into the filter chain. By using it, providing input
  5286. images by another video source or an input video is not required.
  5287. @subsection Examples
  5288. @itemize
  5289. @item
  5290. List all filters available:
  5291. @example
  5292. coreimage=list_filters=true
  5293. @end example
  5294. @item
  5295. Use the CIBoxBlur filter with default options to blur an image:
  5296. @example
  5297. coreimage=filter=CIBoxBlur@@default
  5298. @end example
  5299. @item
  5300. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5301. its center at 100x100 and a radius of 50 pixels:
  5302. @example
  5303. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5304. @end example
  5305. @item
  5306. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5307. given as complete and escaped command-line for Apple's standard bash shell:
  5308. @example
  5309. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5310. @end example
  5311. @end itemize
  5312. @section crop
  5313. Crop the input video to given dimensions.
  5314. It accepts the following parameters:
  5315. @table @option
  5316. @item w, out_w
  5317. The width of the output video. It defaults to @code{iw}.
  5318. This expression is evaluated only once during the filter
  5319. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5320. @item h, out_h
  5321. The height of the output video. It defaults to @code{ih}.
  5322. This expression is evaluated only once during the filter
  5323. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5324. @item x
  5325. The horizontal position, in the input video, of the left edge of the output
  5326. video. It defaults to @code{(in_w-out_w)/2}.
  5327. This expression is evaluated per-frame.
  5328. @item y
  5329. The vertical position, in the input video, of the top edge of the output video.
  5330. It defaults to @code{(in_h-out_h)/2}.
  5331. This expression is evaluated per-frame.
  5332. @item keep_aspect
  5333. If set to 1 will force the output display aspect ratio
  5334. to be the same of the input, by changing the output sample aspect
  5335. ratio. It defaults to 0.
  5336. @item exact
  5337. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5338. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5339. It defaults to 0.
  5340. @end table
  5341. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5342. expressions containing the following constants:
  5343. @table @option
  5344. @item x
  5345. @item y
  5346. The computed values for @var{x} and @var{y}. They are evaluated for
  5347. each new frame.
  5348. @item in_w
  5349. @item in_h
  5350. The input width and height.
  5351. @item iw
  5352. @item ih
  5353. These are the same as @var{in_w} and @var{in_h}.
  5354. @item out_w
  5355. @item out_h
  5356. The output (cropped) width and height.
  5357. @item ow
  5358. @item oh
  5359. These are the same as @var{out_w} and @var{out_h}.
  5360. @item a
  5361. same as @var{iw} / @var{ih}
  5362. @item sar
  5363. input sample aspect ratio
  5364. @item dar
  5365. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5366. @item hsub
  5367. @item vsub
  5368. horizontal and vertical chroma subsample values. For example for the
  5369. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5370. @item n
  5371. The number of the input frame, starting from 0.
  5372. @item pos
  5373. the position in the file of the input frame, NAN if unknown
  5374. @item t
  5375. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5376. @end table
  5377. The expression for @var{out_w} may depend on the value of @var{out_h},
  5378. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5379. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5380. evaluated after @var{out_w} and @var{out_h}.
  5381. The @var{x} and @var{y} parameters specify the expressions for the
  5382. position of the top-left corner of the output (non-cropped) area. They
  5383. are evaluated for each frame. If the evaluated value is not valid, it
  5384. is approximated to the nearest valid value.
  5385. The expression for @var{x} may depend on @var{y}, and the expression
  5386. for @var{y} may depend on @var{x}.
  5387. @subsection Examples
  5388. @itemize
  5389. @item
  5390. Crop area with size 100x100 at position (12,34).
  5391. @example
  5392. crop=100:100:12:34
  5393. @end example
  5394. Using named options, the example above becomes:
  5395. @example
  5396. crop=w=100:h=100:x=12:y=34
  5397. @end example
  5398. @item
  5399. Crop the central input area with size 100x100:
  5400. @example
  5401. crop=100:100
  5402. @end example
  5403. @item
  5404. Crop the central input area with size 2/3 of the input video:
  5405. @example
  5406. crop=2/3*in_w:2/3*in_h
  5407. @end example
  5408. @item
  5409. Crop the input video central square:
  5410. @example
  5411. crop=out_w=in_h
  5412. crop=in_h
  5413. @end example
  5414. @item
  5415. Delimit the rectangle with the top-left corner placed at position
  5416. 100:100 and the right-bottom corner corresponding to the right-bottom
  5417. corner of the input image.
  5418. @example
  5419. crop=in_w-100:in_h-100:100:100
  5420. @end example
  5421. @item
  5422. Crop 10 pixels from the left and right borders, and 20 pixels from
  5423. the top and bottom borders
  5424. @example
  5425. crop=in_w-2*10:in_h-2*20
  5426. @end example
  5427. @item
  5428. Keep only the bottom right quarter of the input image:
  5429. @example
  5430. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5431. @end example
  5432. @item
  5433. Crop height for getting Greek harmony:
  5434. @example
  5435. crop=in_w:1/PHI*in_w
  5436. @end example
  5437. @item
  5438. Apply trembling effect:
  5439. @example
  5440. 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)
  5441. @end example
  5442. @item
  5443. Apply erratic camera effect depending on timestamp:
  5444. @example
  5445. 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)"
  5446. @end example
  5447. @item
  5448. Set x depending on the value of y:
  5449. @example
  5450. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5451. @end example
  5452. @end itemize
  5453. @subsection Commands
  5454. This filter supports the following commands:
  5455. @table @option
  5456. @item w, out_w
  5457. @item h, out_h
  5458. @item x
  5459. @item y
  5460. Set width/height of the output video and the horizontal/vertical position
  5461. in the input video.
  5462. The command accepts the same syntax of the corresponding option.
  5463. If the specified expression is not valid, it is kept at its current
  5464. value.
  5465. @end table
  5466. @section cropdetect
  5467. Auto-detect the crop size.
  5468. It calculates the necessary cropping parameters and prints the
  5469. recommended parameters via the logging system. The detected dimensions
  5470. correspond to the non-black area of the input video.
  5471. It accepts the following parameters:
  5472. @table @option
  5473. @item limit
  5474. Set higher black value threshold, which can be optionally specified
  5475. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5476. value greater to the set value is considered non-black. It defaults to 24.
  5477. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5478. on the bitdepth of the pixel format.
  5479. @item round
  5480. The value which the width/height should be divisible by. It defaults to
  5481. 16. The offset is automatically adjusted to center the video. Use 2 to
  5482. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5483. encoding to most video codecs.
  5484. @item reset_count, reset
  5485. Set the counter that determines after how many frames cropdetect will
  5486. reset the previously detected largest video area and start over to
  5487. detect the current optimal crop area. Default value is 0.
  5488. This can be useful when channel logos distort the video area. 0
  5489. indicates 'never reset', and returns the largest area encountered during
  5490. playback.
  5491. @end table
  5492. @anchor{cue}
  5493. @section cue
  5494. Delay video filtering until a given wallclock timestamp. The filter first
  5495. passes on @option{preroll} amount of frames, then it buffers at most
  5496. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5497. it forwards the buffered frames and also any subsequent frames coming in its
  5498. input.
  5499. The filter can be used synchronize the output of multiple ffmpeg processes for
  5500. realtime output devices like decklink. By putting the delay in the filtering
  5501. chain and pre-buffering frames the process can pass on data to output almost
  5502. immediately after the target wallclock timestamp is reached.
  5503. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5504. some use cases.
  5505. @table @option
  5506. @item cue
  5507. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5508. @item preroll
  5509. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5510. @item buffer
  5511. The maximum duration of content to buffer before waiting for the cue expressed
  5512. in seconds. Default is 0.
  5513. @end table
  5514. @anchor{curves}
  5515. @section curves
  5516. Apply color adjustments using curves.
  5517. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5518. component (red, green and blue) has its values defined by @var{N} key points
  5519. tied from each other using a smooth curve. The x-axis represents the pixel
  5520. values from the input frame, and the y-axis the new pixel values to be set for
  5521. the output frame.
  5522. By default, a component curve is defined by the two points @var{(0;0)} and
  5523. @var{(1;1)}. This creates a straight line where each original pixel value is
  5524. "adjusted" to its own value, which means no change to the image.
  5525. The filter allows you to redefine these two points and add some more. A new
  5526. curve (using a natural cubic spline interpolation) will be define to pass
  5527. smoothly through all these new coordinates. The new defined points needs to be
  5528. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5529. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5530. the vector spaces, the values will be clipped accordingly.
  5531. The filter accepts the following options:
  5532. @table @option
  5533. @item preset
  5534. Select one of the available color presets. This option can be used in addition
  5535. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5536. options takes priority on the preset values.
  5537. Available presets are:
  5538. @table @samp
  5539. @item none
  5540. @item color_negative
  5541. @item cross_process
  5542. @item darker
  5543. @item increase_contrast
  5544. @item lighter
  5545. @item linear_contrast
  5546. @item medium_contrast
  5547. @item negative
  5548. @item strong_contrast
  5549. @item vintage
  5550. @end table
  5551. Default is @code{none}.
  5552. @item master, m
  5553. Set the master key points. These points will define a second pass mapping. It
  5554. is sometimes called a "luminance" or "value" mapping. It can be used with
  5555. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5556. post-processing LUT.
  5557. @item red, r
  5558. Set the key points for the red component.
  5559. @item green, g
  5560. Set the key points for the green component.
  5561. @item blue, b
  5562. Set the key points for the blue component.
  5563. @item all
  5564. Set the key points for all components (not including master).
  5565. Can be used in addition to the other key points component
  5566. options. In this case, the unset component(s) will fallback on this
  5567. @option{all} setting.
  5568. @item psfile
  5569. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5570. @item plot
  5571. Save Gnuplot script of the curves in specified file.
  5572. @end table
  5573. To avoid some filtergraph syntax conflicts, each key points list need to be
  5574. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5575. @subsection Examples
  5576. @itemize
  5577. @item
  5578. Increase slightly the middle level of blue:
  5579. @example
  5580. curves=blue='0/0 0.5/0.58 1/1'
  5581. @end example
  5582. @item
  5583. Vintage effect:
  5584. @example
  5585. 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'
  5586. @end example
  5587. Here we obtain the following coordinates for each components:
  5588. @table @var
  5589. @item red
  5590. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5591. @item green
  5592. @code{(0;0) (0.50;0.48) (1;1)}
  5593. @item blue
  5594. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5595. @end table
  5596. @item
  5597. The previous example can also be achieved with the associated built-in preset:
  5598. @example
  5599. curves=preset=vintage
  5600. @end example
  5601. @item
  5602. Or simply:
  5603. @example
  5604. curves=vintage
  5605. @end example
  5606. @item
  5607. Use a Photoshop preset and redefine the points of the green component:
  5608. @example
  5609. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5610. @end example
  5611. @item
  5612. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5613. and @command{gnuplot}:
  5614. @example
  5615. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5616. gnuplot -p /tmp/curves.plt
  5617. @end example
  5618. @end itemize
  5619. @section datascope
  5620. Video data analysis filter.
  5621. This filter shows hexadecimal pixel values of part of video.
  5622. The filter accepts the following options:
  5623. @table @option
  5624. @item size, s
  5625. Set output video size.
  5626. @item x
  5627. Set x offset from where to pick pixels.
  5628. @item y
  5629. Set y offset from where to pick pixels.
  5630. @item mode
  5631. Set scope mode, can be one of the following:
  5632. @table @samp
  5633. @item mono
  5634. Draw hexadecimal pixel values with white color on black background.
  5635. @item color
  5636. Draw hexadecimal pixel values with input video pixel color on black
  5637. background.
  5638. @item color2
  5639. Draw hexadecimal pixel values on color background picked from input video,
  5640. the text color is picked in such way so its always visible.
  5641. @end table
  5642. @item axis
  5643. Draw rows and columns numbers on left and top of video.
  5644. @item opacity
  5645. Set background opacity.
  5646. @end table
  5647. @section dctdnoiz
  5648. Denoise frames using 2D DCT (frequency domain filtering).
  5649. This filter is not designed for real time.
  5650. The filter accepts the following options:
  5651. @table @option
  5652. @item sigma, s
  5653. Set the noise sigma constant.
  5654. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5655. coefficient (absolute value) below this threshold with be dropped.
  5656. If you need a more advanced filtering, see @option{expr}.
  5657. Default is @code{0}.
  5658. @item overlap
  5659. Set number overlapping pixels for each block. Since the filter can be slow, you
  5660. may want to reduce this value, at the cost of a less effective filter and the
  5661. risk of various artefacts.
  5662. If the overlapping value doesn't permit processing the whole input width or
  5663. height, a warning will be displayed and according borders won't be denoised.
  5664. Default value is @var{blocksize}-1, which is the best possible setting.
  5665. @item expr, e
  5666. Set the coefficient factor expression.
  5667. For each coefficient of a DCT block, this expression will be evaluated as a
  5668. multiplier value for the coefficient.
  5669. If this is option is set, the @option{sigma} option will be ignored.
  5670. The absolute value of the coefficient can be accessed through the @var{c}
  5671. variable.
  5672. @item n
  5673. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5674. @var{blocksize}, which is the width and height of the processed blocks.
  5675. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5676. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5677. on the speed processing. Also, a larger block size does not necessarily means a
  5678. better de-noising.
  5679. @end table
  5680. @subsection Examples
  5681. Apply a denoise with a @option{sigma} of @code{4.5}:
  5682. @example
  5683. dctdnoiz=4.5
  5684. @end example
  5685. The same operation can be achieved using the expression system:
  5686. @example
  5687. dctdnoiz=e='gte(c, 4.5*3)'
  5688. @end example
  5689. Violent denoise using a block size of @code{16x16}:
  5690. @example
  5691. dctdnoiz=15:n=4
  5692. @end example
  5693. @section deband
  5694. Remove banding artifacts from input video.
  5695. It works by replacing banded pixels with average value of referenced pixels.
  5696. The filter accepts the following options:
  5697. @table @option
  5698. @item 1thr
  5699. @item 2thr
  5700. @item 3thr
  5701. @item 4thr
  5702. Set banding detection threshold for each plane. Default is 0.02.
  5703. Valid range is 0.00003 to 0.5.
  5704. If difference between current pixel and reference pixel is less than threshold,
  5705. it will be considered as banded.
  5706. @item range, r
  5707. Banding detection range in pixels. Default is 16. If positive, random number
  5708. in range 0 to set value will be used. If negative, exact absolute value
  5709. will be used.
  5710. The range defines square of four pixels around current pixel.
  5711. @item direction, d
  5712. Set direction in radians from which four pixel will be compared. If positive,
  5713. random direction from 0 to set direction will be picked. If negative, exact of
  5714. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5715. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5716. column.
  5717. @item blur, b
  5718. If enabled, current pixel is compared with average value of all four
  5719. surrounding pixels. The default is enabled. If disabled current pixel is
  5720. compared with all four surrounding pixels. The pixel is considered banded
  5721. if only all four differences with surrounding pixels are less than threshold.
  5722. @item coupling, c
  5723. If enabled, current pixel is changed if and only if all pixel components are banded,
  5724. e.g. banding detection threshold is triggered for all color components.
  5725. The default is disabled.
  5726. @end table
  5727. @section deblock
  5728. Remove blocking artifacts from input video.
  5729. The filter accepts the following options:
  5730. @table @option
  5731. @item filter
  5732. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  5733. This controls what kind of deblocking is applied.
  5734. @item block
  5735. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  5736. @item alpha
  5737. @item beta
  5738. @item gamma
  5739. @item delta
  5740. Set blocking detection thresholds. Allowed range is 0 to 1.
  5741. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  5742. Using higher threshold gives more deblocking strength.
  5743. Setting @var{alpha} controls threshold detection at exact edge of block.
  5744. Remaining options controls threshold detection near the edge. Each one for
  5745. below/above or left/right. Setting any of those to @var{0} disables
  5746. deblocking.
  5747. @item planes
  5748. Set planes to filter. Default is to filter all available planes.
  5749. @end table
  5750. @subsection Examples
  5751. @itemize
  5752. @item
  5753. Deblock using weak filter and block size of 4 pixels.
  5754. @example
  5755. deblock=filter=weak:block=4
  5756. @end example
  5757. @item
  5758. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  5759. deblocking more edges.
  5760. @example
  5761. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  5762. @end example
  5763. @item
  5764. Similar as above, but filter only first plane.
  5765. @example
  5766. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  5767. @end example
  5768. @item
  5769. Similar as above, but filter only second and third plane.
  5770. @example
  5771. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  5772. @end example
  5773. @end itemize
  5774. @anchor{decimate}
  5775. @section decimate
  5776. Drop duplicated frames at regular intervals.
  5777. The filter accepts the following options:
  5778. @table @option
  5779. @item cycle
  5780. Set the number of frames from which one will be dropped. Setting this to
  5781. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5782. Default is @code{5}.
  5783. @item dupthresh
  5784. Set the threshold for duplicate detection. If the difference metric for a frame
  5785. is less than or equal to this value, then it is declared as duplicate. Default
  5786. is @code{1.1}
  5787. @item scthresh
  5788. Set scene change threshold. Default is @code{15}.
  5789. @item blockx
  5790. @item blocky
  5791. Set the size of the x and y-axis blocks used during metric calculations.
  5792. Larger blocks give better noise suppression, but also give worse detection of
  5793. small movements. Must be a power of two. Default is @code{32}.
  5794. @item ppsrc
  5795. Mark main input as a pre-processed input and activate clean source input
  5796. stream. This allows the input to be pre-processed with various filters to help
  5797. the metrics calculation while keeping the frame selection lossless. When set to
  5798. @code{1}, the first stream is for the pre-processed input, and the second
  5799. stream is the clean source from where the kept frames are chosen. Default is
  5800. @code{0}.
  5801. @item chroma
  5802. Set whether or not chroma is considered in the metric calculations. Default is
  5803. @code{1}.
  5804. @end table
  5805. @section deconvolve
  5806. Apply 2D deconvolution of video stream in frequency domain using second stream
  5807. as impulse.
  5808. The filter accepts the following options:
  5809. @table @option
  5810. @item planes
  5811. Set which planes to process.
  5812. @item impulse
  5813. Set which impulse video frames will be processed, can be @var{first}
  5814. or @var{all}. Default is @var{all}.
  5815. @item noise
  5816. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5817. and height are not same and not power of 2 or if stream prior to convolving
  5818. had noise.
  5819. @end table
  5820. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5821. @section deflate
  5822. Apply deflate effect to the video.
  5823. This filter replaces the pixel by the local(3x3) average by taking into account
  5824. only values lower than the pixel.
  5825. It accepts the following options:
  5826. @table @option
  5827. @item threshold0
  5828. @item threshold1
  5829. @item threshold2
  5830. @item threshold3
  5831. Limit the maximum change for each plane, default is 65535.
  5832. If 0, plane will remain unchanged.
  5833. @end table
  5834. @section deflicker
  5835. Remove temporal frame luminance variations.
  5836. It accepts the following options:
  5837. @table @option
  5838. @item size, s
  5839. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5840. @item mode, m
  5841. Set averaging mode to smooth temporal luminance variations.
  5842. Available values are:
  5843. @table @samp
  5844. @item am
  5845. Arithmetic mean
  5846. @item gm
  5847. Geometric mean
  5848. @item hm
  5849. Harmonic mean
  5850. @item qm
  5851. Quadratic mean
  5852. @item cm
  5853. Cubic mean
  5854. @item pm
  5855. Power mean
  5856. @item median
  5857. Median
  5858. @end table
  5859. @item bypass
  5860. Do not actually modify frame. Useful when one only wants metadata.
  5861. @end table
  5862. @section dejudder
  5863. Remove judder produced by partially interlaced telecined content.
  5864. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5865. source was partially telecined content then the output of @code{pullup,dejudder}
  5866. will have a variable frame rate. May change the recorded frame rate of the
  5867. container. Aside from that change, this filter will not affect constant frame
  5868. rate video.
  5869. The option available in this filter is:
  5870. @table @option
  5871. @item cycle
  5872. Specify the length of the window over which the judder repeats.
  5873. Accepts any integer greater than 1. Useful values are:
  5874. @table @samp
  5875. @item 4
  5876. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5877. @item 5
  5878. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5879. @item 20
  5880. If a mixture of the two.
  5881. @end table
  5882. The default is @samp{4}.
  5883. @end table
  5884. @section delogo
  5885. Suppress a TV station logo by a simple interpolation of the surrounding
  5886. pixels. Just set a rectangle covering the logo and watch it disappear
  5887. (and sometimes something even uglier appear - your mileage may vary).
  5888. It accepts the following parameters:
  5889. @table @option
  5890. @item x
  5891. @item y
  5892. Specify the top left corner coordinates of the logo. They must be
  5893. specified.
  5894. @item w
  5895. @item h
  5896. Specify the width and height of the logo to clear. They must be
  5897. specified.
  5898. @item band, t
  5899. Specify the thickness of the fuzzy edge of the rectangle (added to
  5900. @var{w} and @var{h}). The default value is 1. This option is
  5901. deprecated, setting higher values should no longer be necessary and
  5902. is not recommended.
  5903. @item show
  5904. When set to 1, a green rectangle is drawn on the screen to simplify
  5905. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5906. The default value is 0.
  5907. The rectangle is drawn on the outermost pixels which will be (partly)
  5908. replaced with interpolated values. The values of the next pixels
  5909. immediately outside this rectangle in each direction will be used to
  5910. compute the interpolated pixel values inside the rectangle.
  5911. @end table
  5912. @subsection Examples
  5913. @itemize
  5914. @item
  5915. Set a rectangle covering the area with top left corner coordinates 0,0
  5916. and size 100x77, and a band of size 10:
  5917. @example
  5918. delogo=x=0:y=0:w=100:h=77:band=10
  5919. @end example
  5920. @end itemize
  5921. @section deshake
  5922. Attempt to fix small changes in horizontal and/or vertical shift. This
  5923. filter helps remove camera shake from hand-holding a camera, bumping a
  5924. tripod, moving on a vehicle, etc.
  5925. The filter accepts the following options:
  5926. @table @option
  5927. @item x
  5928. @item y
  5929. @item w
  5930. @item h
  5931. Specify a rectangular area where to limit the search for motion
  5932. vectors.
  5933. If desired the search for motion vectors can be limited to a
  5934. rectangular area of the frame defined by its top left corner, width
  5935. and height. These parameters have the same meaning as the drawbox
  5936. filter which can be used to visualise the position of the bounding
  5937. box.
  5938. This is useful when simultaneous movement of subjects within the frame
  5939. might be confused for camera motion by the motion vector search.
  5940. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5941. then the full frame is used. This allows later options to be set
  5942. without specifying the bounding box for the motion vector search.
  5943. Default - search the whole frame.
  5944. @item rx
  5945. @item ry
  5946. Specify the maximum extent of movement in x and y directions in the
  5947. range 0-64 pixels. Default 16.
  5948. @item edge
  5949. Specify how to generate pixels to fill blanks at the edge of the
  5950. frame. Available values are:
  5951. @table @samp
  5952. @item blank, 0
  5953. Fill zeroes at blank locations
  5954. @item original, 1
  5955. Original image at blank locations
  5956. @item clamp, 2
  5957. Extruded edge value at blank locations
  5958. @item mirror, 3
  5959. Mirrored edge at blank locations
  5960. @end table
  5961. Default value is @samp{mirror}.
  5962. @item blocksize
  5963. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5964. default 8.
  5965. @item contrast
  5966. Specify the contrast threshold for blocks. Only blocks with more than
  5967. the specified contrast (difference between darkest and lightest
  5968. pixels) will be considered. Range 1-255, default 125.
  5969. @item search
  5970. Specify the search strategy. Available values are:
  5971. @table @samp
  5972. @item exhaustive, 0
  5973. Set exhaustive search
  5974. @item less, 1
  5975. Set less exhaustive search.
  5976. @end table
  5977. Default value is @samp{exhaustive}.
  5978. @item filename
  5979. If set then a detailed log of the motion search is written to the
  5980. specified file.
  5981. @end table
  5982. @section despill
  5983. Remove unwanted contamination of foreground colors, caused by reflected color of
  5984. greenscreen or bluescreen.
  5985. This filter accepts the following options:
  5986. @table @option
  5987. @item type
  5988. Set what type of despill to use.
  5989. @item mix
  5990. Set how spillmap will be generated.
  5991. @item expand
  5992. Set how much to get rid of still remaining spill.
  5993. @item red
  5994. Controls amount of red in spill area.
  5995. @item green
  5996. Controls amount of green in spill area.
  5997. Should be -1 for greenscreen.
  5998. @item blue
  5999. Controls amount of blue in spill area.
  6000. Should be -1 for bluescreen.
  6001. @item brightness
  6002. Controls brightness of spill area, preserving colors.
  6003. @item alpha
  6004. Modify alpha from generated spillmap.
  6005. @end table
  6006. @section detelecine
  6007. Apply an exact inverse of the telecine operation. It requires a predefined
  6008. pattern specified using the pattern option which must be the same as that passed
  6009. to the telecine filter.
  6010. This filter accepts the following options:
  6011. @table @option
  6012. @item first_field
  6013. @table @samp
  6014. @item top, t
  6015. top field first
  6016. @item bottom, b
  6017. bottom field first
  6018. The default value is @code{top}.
  6019. @end table
  6020. @item pattern
  6021. A string of numbers representing the pulldown pattern you wish to apply.
  6022. The default value is @code{23}.
  6023. @item start_frame
  6024. A number representing position of the first frame with respect to the telecine
  6025. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6026. @end table
  6027. @section dilation
  6028. Apply dilation effect to the video.
  6029. This filter replaces the pixel by the local(3x3) maximum.
  6030. It accepts the following options:
  6031. @table @option
  6032. @item threshold0
  6033. @item threshold1
  6034. @item threshold2
  6035. @item threshold3
  6036. Limit the maximum change for each plane, default is 65535.
  6037. If 0, plane will remain unchanged.
  6038. @item coordinates
  6039. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6040. pixels are used.
  6041. Flags to local 3x3 coordinates maps like this:
  6042. 1 2 3
  6043. 4 5
  6044. 6 7 8
  6045. @end table
  6046. @section displace
  6047. Displace pixels as indicated by second and third input stream.
  6048. It takes three input streams and outputs one stream, the first input is the
  6049. source, and second and third input are displacement maps.
  6050. The second input specifies how much to displace pixels along the
  6051. x-axis, while the third input specifies how much to displace pixels
  6052. along the y-axis.
  6053. If one of displacement map streams terminates, last frame from that
  6054. displacement map will be used.
  6055. Note that once generated, displacements maps can be reused over and over again.
  6056. A description of the accepted options follows.
  6057. @table @option
  6058. @item edge
  6059. Set displace behavior for pixels that are out of range.
  6060. Available values are:
  6061. @table @samp
  6062. @item blank
  6063. Missing pixels are replaced by black pixels.
  6064. @item smear
  6065. Adjacent pixels will spread out to replace missing pixels.
  6066. @item wrap
  6067. Out of range pixels are wrapped so they point to pixels of other side.
  6068. @item mirror
  6069. Out of range pixels will be replaced with mirrored pixels.
  6070. @end table
  6071. Default is @samp{smear}.
  6072. @end table
  6073. @subsection Examples
  6074. @itemize
  6075. @item
  6076. Add ripple effect to rgb input of video size hd720:
  6077. @example
  6078. 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
  6079. @end example
  6080. @item
  6081. Add wave effect to rgb input of video size hd720:
  6082. @example
  6083. 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
  6084. @end example
  6085. @end itemize
  6086. @section drawbox
  6087. Draw a colored box on the input image.
  6088. It accepts the following parameters:
  6089. @table @option
  6090. @item x
  6091. @item y
  6092. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6093. @item width, w
  6094. @item height, h
  6095. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6096. the input width and height. It defaults to 0.
  6097. @item color, c
  6098. Specify the color of the box to write. For the general syntax of this option,
  6099. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6100. value @code{invert} is used, the box edge color is the same as the
  6101. video with inverted luma.
  6102. @item thickness, t
  6103. The expression which sets the thickness of the box edge.
  6104. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6105. See below for the list of accepted constants.
  6106. @item replace
  6107. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6108. will overwrite the video's color and alpha pixels.
  6109. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6110. @end table
  6111. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6112. following constants:
  6113. @table @option
  6114. @item dar
  6115. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6116. @item hsub
  6117. @item vsub
  6118. horizontal and vertical chroma subsample values. For example for the
  6119. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6120. @item in_h, ih
  6121. @item in_w, iw
  6122. The input width and height.
  6123. @item sar
  6124. The input sample aspect ratio.
  6125. @item x
  6126. @item y
  6127. The x and y offset coordinates where the box is drawn.
  6128. @item w
  6129. @item h
  6130. The width and height of the drawn box.
  6131. @item t
  6132. The thickness of the drawn box.
  6133. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6134. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6135. @end table
  6136. @subsection Examples
  6137. @itemize
  6138. @item
  6139. Draw a black box around the edge of the input image:
  6140. @example
  6141. drawbox
  6142. @end example
  6143. @item
  6144. Draw a box with color red and an opacity of 50%:
  6145. @example
  6146. drawbox=10:20:200:60:red@@0.5
  6147. @end example
  6148. The previous example can be specified as:
  6149. @example
  6150. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6151. @end example
  6152. @item
  6153. Fill the box with pink color:
  6154. @example
  6155. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6156. @end example
  6157. @item
  6158. Draw a 2-pixel red 2.40:1 mask:
  6159. @example
  6160. 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
  6161. @end example
  6162. @end itemize
  6163. @section drawgrid
  6164. Draw a grid on the input image.
  6165. It accepts the following parameters:
  6166. @table @option
  6167. @item x
  6168. @item y
  6169. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6170. @item width, w
  6171. @item height, h
  6172. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6173. input width and height, respectively, minus @code{thickness}, so image gets
  6174. framed. Default to 0.
  6175. @item color, c
  6176. Specify the color of the grid. For the general syntax of this option,
  6177. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6178. value @code{invert} is used, the grid color is the same as the
  6179. video with inverted luma.
  6180. @item thickness, t
  6181. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6182. See below for the list of accepted constants.
  6183. @item replace
  6184. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6185. will overwrite the video's color and alpha pixels.
  6186. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6187. @end table
  6188. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6189. following constants:
  6190. @table @option
  6191. @item dar
  6192. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6193. @item hsub
  6194. @item vsub
  6195. horizontal and vertical chroma subsample values. For example for the
  6196. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6197. @item in_h, ih
  6198. @item in_w, iw
  6199. The input grid cell width and height.
  6200. @item sar
  6201. The input sample aspect ratio.
  6202. @item x
  6203. @item y
  6204. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6205. @item w
  6206. @item h
  6207. The width and height of the drawn cell.
  6208. @item t
  6209. The thickness of the drawn cell.
  6210. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6211. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6212. @end table
  6213. @subsection Examples
  6214. @itemize
  6215. @item
  6216. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6217. @example
  6218. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6219. @end example
  6220. @item
  6221. Draw a white 3x3 grid with an opacity of 50%:
  6222. @example
  6223. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6224. @end example
  6225. @end itemize
  6226. @anchor{drawtext}
  6227. @section drawtext
  6228. Draw a text string or text from a specified file on top of a video, using the
  6229. libfreetype library.
  6230. To enable compilation of this filter, you need to configure FFmpeg with
  6231. @code{--enable-libfreetype}.
  6232. To enable default font fallback and the @var{font} option you need to
  6233. configure FFmpeg with @code{--enable-libfontconfig}.
  6234. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6235. @code{--enable-libfribidi}.
  6236. @subsection Syntax
  6237. It accepts the following parameters:
  6238. @table @option
  6239. @item box
  6240. Used to draw a box around text using the background color.
  6241. The value must be either 1 (enable) or 0 (disable).
  6242. The default value of @var{box} is 0.
  6243. @item boxborderw
  6244. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6245. The default value of @var{boxborderw} is 0.
  6246. @item boxcolor
  6247. The color to be used for drawing box around text. For the syntax of this
  6248. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6249. The default value of @var{boxcolor} is "white".
  6250. @item line_spacing
  6251. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6252. The default value of @var{line_spacing} is 0.
  6253. @item borderw
  6254. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6255. The default value of @var{borderw} is 0.
  6256. @item bordercolor
  6257. Set the color to be used for drawing border around text. For the syntax of this
  6258. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6259. The default value of @var{bordercolor} is "black".
  6260. @item expansion
  6261. Select how the @var{text} is expanded. Can be either @code{none},
  6262. @code{strftime} (deprecated) or
  6263. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6264. below for details.
  6265. @item basetime
  6266. Set a start time for the count. Value is in microseconds. Only applied
  6267. in the deprecated strftime expansion mode. To emulate in normal expansion
  6268. mode use the @code{pts} function, supplying the start time (in seconds)
  6269. as the second argument.
  6270. @item fix_bounds
  6271. If true, check and fix text coords to avoid clipping.
  6272. @item fontcolor
  6273. The color to be used for drawing fonts. For the syntax of this option, check
  6274. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6275. The default value of @var{fontcolor} is "black".
  6276. @item fontcolor_expr
  6277. String which is expanded the same way as @var{text} to obtain dynamic
  6278. @var{fontcolor} value. By default this option has empty value and is not
  6279. processed. When this option is set, it overrides @var{fontcolor} option.
  6280. @item font
  6281. The font family to be used for drawing text. By default Sans.
  6282. @item fontfile
  6283. The font file to be used for drawing text. The path must be included.
  6284. This parameter is mandatory if the fontconfig support is disabled.
  6285. @item alpha
  6286. Draw the text applying alpha blending. The value can
  6287. be a number between 0.0 and 1.0.
  6288. The expression accepts the same variables @var{x, y} as well.
  6289. The default value is 1.
  6290. Please see @var{fontcolor_expr}.
  6291. @item fontsize
  6292. The font size to be used for drawing text.
  6293. The default value of @var{fontsize} is 16.
  6294. @item text_shaping
  6295. If set to 1, attempt to shape the text (for example, reverse the order of
  6296. right-to-left text and join Arabic characters) before drawing it.
  6297. Otherwise, just draw the text exactly as given.
  6298. By default 1 (if supported).
  6299. @item ft_load_flags
  6300. The flags to be used for loading the fonts.
  6301. The flags map the corresponding flags supported by libfreetype, and are
  6302. a combination of the following values:
  6303. @table @var
  6304. @item default
  6305. @item no_scale
  6306. @item no_hinting
  6307. @item render
  6308. @item no_bitmap
  6309. @item vertical_layout
  6310. @item force_autohint
  6311. @item crop_bitmap
  6312. @item pedantic
  6313. @item ignore_global_advance_width
  6314. @item no_recurse
  6315. @item ignore_transform
  6316. @item monochrome
  6317. @item linear_design
  6318. @item no_autohint
  6319. @end table
  6320. Default value is "default".
  6321. For more information consult the documentation for the FT_LOAD_*
  6322. libfreetype flags.
  6323. @item shadowcolor
  6324. The color to be used for drawing a shadow behind the drawn text. For the
  6325. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6326. ffmpeg-utils manual,ffmpeg-utils}.
  6327. The default value of @var{shadowcolor} is "black".
  6328. @item shadowx
  6329. @item shadowy
  6330. The x and y offsets for the text shadow position with respect to the
  6331. position of the text. They can be either positive or negative
  6332. values. The default value for both is "0".
  6333. @item start_number
  6334. The starting frame number for the n/frame_num variable. The default value
  6335. is "0".
  6336. @item tabsize
  6337. The size in number of spaces to use for rendering the tab.
  6338. Default value is 4.
  6339. @item timecode
  6340. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6341. format. It can be used with or without text parameter. @var{timecode_rate}
  6342. option must be specified.
  6343. @item timecode_rate, rate, r
  6344. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6345. integer. Minimum value is "1".
  6346. Drop-frame timecode is supported for frame rates 30 & 60.
  6347. @item tc24hmax
  6348. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6349. Default is 0 (disabled).
  6350. @item text
  6351. The text string to be drawn. The text must be a sequence of UTF-8
  6352. encoded characters.
  6353. This parameter is mandatory if no file is specified with the parameter
  6354. @var{textfile}.
  6355. @item textfile
  6356. A text file containing text to be drawn. The text must be a sequence
  6357. of UTF-8 encoded characters.
  6358. This parameter is mandatory if no text string is specified with the
  6359. parameter @var{text}.
  6360. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6361. @item reload
  6362. If set to 1, the @var{textfile} will be reloaded before each frame.
  6363. Be sure to update it atomically, or it may be read partially, or even fail.
  6364. @item x
  6365. @item y
  6366. The expressions which specify the offsets where text will be drawn
  6367. within the video frame. They are relative to the top/left border of the
  6368. output image.
  6369. The default value of @var{x} and @var{y} is "0".
  6370. See below for the list of accepted constants and functions.
  6371. @end table
  6372. The parameters for @var{x} and @var{y} are expressions containing the
  6373. following constants and functions:
  6374. @table @option
  6375. @item dar
  6376. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6377. @item hsub
  6378. @item vsub
  6379. horizontal and vertical chroma subsample values. For example for the
  6380. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6381. @item line_h, lh
  6382. the height of each text line
  6383. @item main_h, h, H
  6384. the input height
  6385. @item main_w, w, W
  6386. the input width
  6387. @item max_glyph_a, ascent
  6388. the maximum distance from the baseline to the highest/upper grid
  6389. coordinate used to place a glyph outline point, for all the rendered
  6390. glyphs.
  6391. It is a positive value, due to the grid's orientation with the Y axis
  6392. upwards.
  6393. @item max_glyph_d, descent
  6394. the maximum distance from the baseline to the lowest grid coordinate
  6395. used to place a glyph outline point, for all the rendered glyphs.
  6396. This is a negative value, due to the grid's orientation, with the Y axis
  6397. upwards.
  6398. @item max_glyph_h
  6399. maximum glyph height, that is the maximum height for all the glyphs
  6400. contained in the rendered text, it is equivalent to @var{ascent} -
  6401. @var{descent}.
  6402. @item max_glyph_w
  6403. maximum glyph width, that is the maximum width for all the glyphs
  6404. contained in the rendered text
  6405. @item n
  6406. the number of input frame, starting from 0
  6407. @item rand(min, max)
  6408. return a random number included between @var{min} and @var{max}
  6409. @item sar
  6410. The input sample aspect ratio.
  6411. @item t
  6412. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6413. @item text_h, th
  6414. the height of the rendered text
  6415. @item text_w, tw
  6416. the width of the rendered text
  6417. @item x
  6418. @item y
  6419. the x and y offset coordinates where the text is drawn.
  6420. These parameters allow the @var{x} and @var{y} expressions to refer
  6421. each other, so you can for example specify @code{y=x/dar}.
  6422. @end table
  6423. @anchor{drawtext_expansion}
  6424. @subsection Text expansion
  6425. If @option{expansion} is set to @code{strftime},
  6426. the filter recognizes strftime() sequences in the provided text and
  6427. expands them accordingly. Check the documentation of strftime(). This
  6428. feature is deprecated.
  6429. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6430. If @option{expansion} is set to @code{normal} (which is the default),
  6431. the following expansion mechanism is used.
  6432. The backslash character @samp{\}, followed by any character, always expands to
  6433. the second character.
  6434. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6435. braces is a function name, possibly followed by arguments separated by ':'.
  6436. If the arguments contain special characters or delimiters (':' or '@}'),
  6437. they should be escaped.
  6438. Note that they probably must also be escaped as the value for the
  6439. @option{text} option in the filter argument string and as the filter
  6440. argument in the filtergraph description, and possibly also for the shell,
  6441. that makes up to four levels of escaping; using a text file avoids these
  6442. problems.
  6443. The following functions are available:
  6444. @table @command
  6445. @item expr, e
  6446. The expression evaluation result.
  6447. It must take one argument specifying the expression to be evaluated,
  6448. which accepts the same constants and functions as the @var{x} and
  6449. @var{y} values. Note that not all constants should be used, for
  6450. example the text size is not known when evaluating the expression, so
  6451. the constants @var{text_w} and @var{text_h} will have an undefined
  6452. value.
  6453. @item expr_int_format, eif
  6454. Evaluate the expression's value and output as formatted integer.
  6455. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6456. The second argument specifies the output format. Allowed values are @samp{x},
  6457. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6458. @code{printf} function.
  6459. The third parameter is optional and sets the number of positions taken by the output.
  6460. It can be used to add padding with zeros from the left.
  6461. @item gmtime
  6462. The time at which the filter is running, expressed in UTC.
  6463. It can accept an argument: a strftime() format string.
  6464. @item localtime
  6465. The time at which the filter is running, expressed in the local time zone.
  6466. It can accept an argument: a strftime() format string.
  6467. @item metadata
  6468. Frame metadata. Takes one or two arguments.
  6469. The first argument is mandatory and specifies the metadata key.
  6470. The second argument is optional and specifies a default value, used when the
  6471. metadata key is not found or empty.
  6472. @item n, frame_num
  6473. The frame number, starting from 0.
  6474. @item pict_type
  6475. A 1 character description of the current picture type.
  6476. @item pts
  6477. The timestamp of the current frame.
  6478. It can take up to three arguments.
  6479. The first argument is the format of the timestamp; it defaults to @code{flt}
  6480. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6481. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6482. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6483. @code{localtime} stands for the timestamp of the frame formatted as
  6484. local time zone time.
  6485. The second argument is an offset added to the timestamp.
  6486. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6487. supplied to present the hour part of the formatted timestamp in 24h format
  6488. (00-23).
  6489. If the format is set to @code{localtime} or @code{gmtime},
  6490. a third argument may be supplied: a strftime() format string.
  6491. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6492. @end table
  6493. @subsection Examples
  6494. @itemize
  6495. @item
  6496. Draw "Test Text" with font FreeSerif, using the default values for the
  6497. optional parameters.
  6498. @example
  6499. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6500. @end example
  6501. @item
  6502. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6503. and y=50 (counting from the top-left corner of the screen), text is
  6504. yellow with a red box around it. Both the text and the box have an
  6505. opacity of 20%.
  6506. @example
  6507. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6508. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6509. @end example
  6510. Note that the double quotes are not necessary if spaces are not used
  6511. within the parameter list.
  6512. @item
  6513. Show the text at the center of the video frame:
  6514. @example
  6515. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6516. @end example
  6517. @item
  6518. Show the text at a random position, switching to a new position every 30 seconds:
  6519. @example
  6520. 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)"
  6521. @end example
  6522. @item
  6523. Show a text line sliding from right to left in the last row of the video
  6524. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6525. with no newlines.
  6526. @example
  6527. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6528. @end example
  6529. @item
  6530. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6531. @example
  6532. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6533. @end example
  6534. @item
  6535. Draw a single green letter "g", at the center of the input video.
  6536. The glyph baseline is placed at half screen height.
  6537. @example
  6538. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6539. @end example
  6540. @item
  6541. Show text for 1 second every 3 seconds:
  6542. @example
  6543. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6544. @end example
  6545. @item
  6546. Use fontconfig to set the font. Note that the colons need to be escaped.
  6547. @example
  6548. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6549. @end example
  6550. @item
  6551. Print the date of a real-time encoding (see strftime(3)):
  6552. @example
  6553. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6554. @end example
  6555. @item
  6556. Show text fading in and out (appearing/disappearing):
  6557. @example
  6558. #!/bin/sh
  6559. DS=1.0 # display start
  6560. DE=10.0 # display end
  6561. FID=1.5 # fade in duration
  6562. FOD=5 # fade out duration
  6563. 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 @}"
  6564. @end example
  6565. @item
  6566. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6567. and the @option{fontsize} value are included in the @option{y} offset.
  6568. @example
  6569. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6570. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6571. @end example
  6572. @end itemize
  6573. For more information about libfreetype, check:
  6574. @url{http://www.freetype.org/}.
  6575. For more information about fontconfig, check:
  6576. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6577. For more information about libfribidi, check:
  6578. @url{http://fribidi.org/}.
  6579. @section edgedetect
  6580. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6581. The filter accepts the following options:
  6582. @table @option
  6583. @item low
  6584. @item high
  6585. Set low and high threshold values used by the Canny thresholding
  6586. algorithm.
  6587. The high threshold selects the "strong" edge pixels, which are then
  6588. connected through 8-connectivity with the "weak" edge pixels selected
  6589. by the low threshold.
  6590. @var{low} and @var{high} threshold values must be chosen in the range
  6591. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6592. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6593. is @code{50/255}.
  6594. @item mode
  6595. Define the drawing mode.
  6596. @table @samp
  6597. @item wires
  6598. Draw white/gray wires on black background.
  6599. @item colormix
  6600. Mix the colors to create a paint/cartoon effect.
  6601. @item canny
  6602. Apply Canny edge detector on all selected planes.
  6603. @end table
  6604. Default value is @var{wires}.
  6605. @item planes
  6606. Select planes for filtering. By default all available planes are filtered.
  6607. @end table
  6608. @subsection Examples
  6609. @itemize
  6610. @item
  6611. Standard edge detection with custom values for the hysteresis thresholding:
  6612. @example
  6613. edgedetect=low=0.1:high=0.4
  6614. @end example
  6615. @item
  6616. Painting effect without thresholding:
  6617. @example
  6618. edgedetect=mode=colormix:high=0
  6619. @end example
  6620. @end itemize
  6621. @section eq
  6622. Set brightness, contrast, saturation and approximate gamma adjustment.
  6623. The filter accepts the following options:
  6624. @table @option
  6625. @item contrast
  6626. Set the contrast expression. The value must be a float value in range
  6627. @code{-2.0} to @code{2.0}. The default value is "1".
  6628. @item brightness
  6629. Set the brightness expression. The value must be a float value in
  6630. range @code{-1.0} to @code{1.0}. The default value is "0".
  6631. @item saturation
  6632. Set the saturation expression. The value must be a float in
  6633. range @code{0.0} to @code{3.0}. The default value is "1".
  6634. @item gamma
  6635. Set the gamma expression. The value must be a float in range
  6636. @code{0.1} to @code{10.0}. The default value is "1".
  6637. @item gamma_r
  6638. Set the gamma expression for red. The value must be a float in
  6639. range @code{0.1} to @code{10.0}. The default value is "1".
  6640. @item gamma_g
  6641. Set the gamma expression for green. The value must be a float in range
  6642. @code{0.1} to @code{10.0}. The default value is "1".
  6643. @item gamma_b
  6644. Set the gamma expression for blue. The value must be a float in range
  6645. @code{0.1} to @code{10.0}. The default value is "1".
  6646. @item gamma_weight
  6647. Set the gamma weight expression. It can be used to reduce the effect
  6648. of a high gamma value on bright image areas, e.g. keep them from
  6649. getting overamplified and just plain white. The value must be a float
  6650. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6651. gamma correction all the way down while @code{1.0} leaves it at its
  6652. full strength. Default is "1".
  6653. @item eval
  6654. Set when the expressions for brightness, contrast, saturation and
  6655. gamma expressions are evaluated.
  6656. It accepts the following values:
  6657. @table @samp
  6658. @item init
  6659. only evaluate expressions once during the filter initialization or
  6660. when a command is processed
  6661. @item frame
  6662. evaluate expressions for each incoming frame
  6663. @end table
  6664. Default value is @samp{init}.
  6665. @end table
  6666. The expressions accept the following parameters:
  6667. @table @option
  6668. @item n
  6669. frame count of the input frame starting from 0
  6670. @item pos
  6671. byte position of the corresponding packet in the input file, NAN if
  6672. unspecified
  6673. @item r
  6674. frame rate of the input video, NAN if the input frame rate is unknown
  6675. @item t
  6676. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6677. @end table
  6678. @subsection Commands
  6679. The filter supports the following commands:
  6680. @table @option
  6681. @item contrast
  6682. Set the contrast expression.
  6683. @item brightness
  6684. Set the brightness expression.
  6685. @item saturation
  6686. Set the saturation expression.
  6687. @item gamma
  6688. Set the gamma expression.
  6689. @item gamma_r
  6690. Set the gamma_r expression.
  6691. @item gamma_g
  6692. Set gamma_g expression.
  6693. @item gamma_b
  6694. Set gamma_b expression.
  6695. @item gamma_weight
  6696. Set gamma_weight expression.
  6697. The command accepts the same syntax of the corresponding option.
  6698. If the specified expression is not valid, it is kept at its current
  6699. value.
  6700. @end table
  6701. @section erosion
  6702. Apply erosion effect to the video.
  6703. This filter replaces the pixel by the local(3x3) minimum.
  6704. It accepts the following options:
  6705. @table @option
  6706. @item threshold0
  6707. @item threshold1
  6708. @item threshold2
  6709. @item threshold3
  6710. Limit the maximum change for each plane, default is 65535.
  6711. If 0, plane will remain unchanged.
  6712. @item coordinates
  6713. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6714. pixels are used.
  6715. Flags to local 3x3 coordinates maps like this:
  6716. 1 2 3
  6717. 4 5
  6718. 6 7 8
  6719. @end table
  6720. @section extractplanes
  6721. Extract color channel components from input video stream into
  6722. separate grayscale video streams.
  6723. The filter accepts the following option:
  6724. @table @option
  6725. @item planes
  6726. Set plane(s) to extract.
  6727. Available values for planes are:
  6728. @table @samp
  6729. @item y
  6730. @item u
  6731. @item v
  6732. @item a
  6733. @item r
  6734. @item g
  6735. @item b
  6736. @end table
  6737. Choosing planes not available in the input will result in an error.
  6738. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6739. with @code{y}, @code{u}, @code{v} planes at same time.
  6740. @end table
  6741. @subsection Examples
  6742. @itemize
  6743. @item
  6744. Extract luma, u and v color channel component from input video frame
  6745. into 3 grayscale outputs:
  6746. @example
  6747. 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
  6748. @end example
  6749. @end itemize
  6750. @section elbg
  6751. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6752. For each input image, the filter will compute the optimal mapping from
  6753. the input to the output given the codebook length, that is the number
  6754. of distinct output colors.
  6755. This filter accepts the following options.
  6756. @table @option
  6757. @item codebook_length, l
  6758. Set codebook length. The value must be a positive integer, and
  6759. represents the number of distinct output colors. Default value is 256.
  6760. @item nb_steps, n
  6761. Set the maximum number of iterations to apply for computing the optimal
  6762. mapping. The higher the value the better the result and the higher the
  6763. computation time. Default value is 1.
  6764. @item seed, s
  6765. Set a random seed, must be an integer included between 0 and
  6766. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6767. will try to use a good random seed on a best effort basis.
  6768. @item pal8
  6769. Set pal8 output pixel format. This option does not work with codebook
  6770. length greater than 256.
  6771. @end table
  6772. @section entropy
  6773. Measure graylevel entropy in histogram of color channels of video frames.
  6774. It accepts the following parameters:
  6775. @table @option
  6776. @item mode
  6777. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6778. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6779. between neighbour histogram values.
  6780. @end table
  6781. @section fade
  6782. Apply a fade-in/out effect to the input video.
  6783. It accepts the following parameters:
  6784. @table @option
  6785. @item type, t
  6786. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6787. effect.
  6788. Default is @code{in}.
  6789. @item start_frame, s
  6790. Specify the number of the frame to start applying the fade
  6791. effect at. Default is 0.
  6792. @item nb_frames, n
  6793. The number of frames that the fade effect lasts. At the end of the
  6794. fade-in effect, the output video will have the same intensity as the input video.
  6795. At the end of the fade-out transition, the output video will be filled with the
  6796. selected @option{color}.
  6797. Default is 25.
  6798. @item alpha
  6799. If set to 1, fade only alpha channel, if one exists on the input.
  6800. Default value is 0.
  6801. @item start_time, st
  6802. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6803. effect. If both start_frame and start_time are specified, the fade will start at
  6804. whichever comes last. Default is 0.
  6805. @item duration, d
  6806. The number of seconds for which the fade effect has to last. At the end of the
  6807. fade-in effect the output video will have the same intensity as the input video,
  6808. at the end of the fade-out transition the output video will be filled with the
  6809. selected @option{color}.
  6810. If both duration and nb_frames are specified, duration is used. Default is 0
  6811. (nb_frames is used by default).
  6812. @item color, c
  6813. Specify the color of the fade. Default is "black".
  6814. @end table
  6815. @subsection Examples
  6816. @itemize
  6817. @item
  6818. Fade in the first 30 frames of video:
  6819. @example
  6820. fade=in:0:30
  6821. @end example
  6822. The command above is equivalent to:
  6823. @example
  6824. fade=t=in:s=0:n=30
  6825. @end example
  6826. @item
  6827. Fade out the last 45 frames of a 200-frame video:
  6828. @example
  6829. fade=out:155:45
  6830. fade=type=out:start_frame=155:nb_frames=45
  6831. @end example
  6832. @item
  6833. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6834. @example
  6835. fade=in:0:25, fade=out:975:25
  6836. @end example
  6837. @item
  6838. Make the first 5 frames yellow, then fade in from frame 5-24:
  6839. @example
  6840. fade=in:5:20:color=yellow
  6841. @end example
  6842. @item
  6843. Fade in alpha over first 25 frames of video:
  6844. @example
  6845. fade=in:0:25:alpha=1
  6846. @end example
  6847. @item
  6848. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6849. @example
  6850. fade=t=in:st=5.5:d=0.5
  6851. @end example
  6852. @end itemize
  6853. @section fftfilt
  6854. Apply arbitrary expressions to samples in frequency domain
  6855. @table @option
  6856. @item dc_Y
  6857. Adjust the dc value (gain) of the luma plane of the image. The filter
  6858. accepts an integer value in range @code{0} to @code{1000}. The default
  6859. value is set to @code{0}.
  6860. @item dc_U
  6861. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6862. filter accepts an integer value in range @code{0} to @code{1000}. The
  6863. default value is set to @code{0}.
  6864. @item dc_V
  6865. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6866. filter accepts an integer value in range @code{0} to @code{1000}. The
  6867. default value is set to @code{0}.
  6868. @item weight_Y
  6869. Set the frequency domain weight expression for the luma plane.
  6870. @item weight_U
  6871. Set the frequency domain weight expression for the 1st chroma plane.
  6872. @item weight_V
  6873. Set the frequency domain weight expression for the 2nd chroma plane.
  6874. @item eval
  6875. Set when the expressions are evaluated.
  6876. It accepts the following values:
  6877. @table @samp
  6878. @item init
  6879. Only evaluate expressions once during the filter initialization.
  6880. @item frame
  6881. Evaluate expressions for each incoming frame.
  6882. @end table
  6883. Default value is @samp{init}.
  6884. The filter accepts the following variables:
  6885. @item X
  6886. @item Y
  6887. The coordinates of the current sample.
  6888. @item W
  6889. @item H
  6890. The width and height of the image.
  6891. @item N
  6892. The number of input frame, starting from 0.
  6893. @end table
  6894. @subsection Examples
  6895. @itemize
  6896. @item
  6897. High-pass:
  6898. @example
  6899. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6900. @end example
  6901. @item
  6902. Low-pass:
  6903. @example
  6904. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6905. @end example
  6906. @item
  6907. Sharpen:
  6908. @example
  6909. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6910. @end example
  6911. @item
  6912. Blur:
  6913. @example
  6914. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6915. @end example
  6916. @end itemize
  6917. @section fftdnoiz
  6918. Denoise frames using 3D FFT (frequency domain filtering).
  6919. The filter accepts the following options:
  6920. @table @option
  6921. @item sigma
  6922. Set the noise sigma constant. This sets denoising strength.
  6923. Default value is 1. Allowed range is from 0 to 30.
  6924. Using very high sigma with low overlap may give blocking artifacts.
  6925. @item amount
  6926. Set amount of denoising. By default all detected noise is reduced.
  6927. Default value is 1. Allowed range is from 0 to 1.
  6928. @item block
  6929. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  6930. Actual size of block in pixels is 2 to power of @var{block}, so by default
  6931. block size in pixels is 2^4 which is 16.
  6932. @item overlap
  6933. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  6934. @item prev
  6935. Set number of previous frames to use for denoising. By default is set to 0.
  6936. @item next
  6937. Set number of next frames to to use for denoising. By default is set to 0.
  6938. @item planes
  6939. Set planes which will be filtered, by default are all available filtered
  6940. except alpha.
  6941. @end table
  6942. @section field
  6943. Extract a single field from an interlaced image using stride
  6944. arithmetic to avoid wasting CPU time. The output frames are marked as
  6945. non-interlaced.
  6946. The filter accepts the following options:
  6947. @table @option
  6948. @item type
  6949. Specify whether to extract the top (if the value is @code{0} or
  6950. @code{top}) or the bottom field (if the value is @code{1} or
  6951. @code{bottom}).
  6952. @end table
  6953. @section fieldhint
  6954. Create new frames by copying the top and bottom fields from surrounding frames
  6955. supplied as numbers by the hint file.
  6956. @table @option
  6957. @item hint
  6958. Set file containing hints: absolute/relative frame numbers.
  6959. There must be one line for each frame in a clip. Each line must contain two
  6960. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6961. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6962. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6963. for @code{relative} mode. First number tells from which frame to pick up top
  6964. field and second number tells from which frame to pick up bottom field.
  6965. If optionally followed by @code{+} output frame will be marked as interlaced,
  6966. else if followed by @code{-} output frame will be marked as progressive, else
  6967. it will be marked same as input frame.
  6968. If line starts with @code{#} or @code{;} that line is skipped.
  6969. @item mode
  6970. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6971. @end table
  6972. Example of first several lines of @code{hint} file for @code{relative} mode:
  6973. @example
  6974. 0,0 - # first frame
  6975. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6976. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6977. 1,0 -
  6978. 0,0 -
  6979. 0,0 -
  6980. 1,0 -
  6981. 1,0 -
  6982. 1,0 -
  6983. 0,0 -
  6984. 0,0 -
  6985. 1,0 -
  6986. 1,0 -
  6987. 1,0 -
  6988. 0,0 -
  6989. @end example
  6990. @section fieldmatch
  6991. Field matching filter for inverse telecine. It is meant to reconstruct the
  6992. progressive frames from a telecined stream. The filter does not drop duplicated
  6993. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6994. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6995. The separation of the field matching and the decimation is notably motivated by
  6996. the possibility of inserting a de-interlacing filter fallback between the two.
  6997. If the source has mixed telecined and real interlaced content,
  6998. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6999. But these remaining combed frames will be marked as interlaced, and thus can be
  7000. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7001. In addition to the various configuration options, @code{fieldmatch} can take an
  7002. optional second stream, activated through the @option{ppsrc} option. If
  7003. enabled, the frames reconstruction will be based on the fields and frames from
  7004. this second stream. This allows the first input to be pre-processed in order to
  7005. help the various algorithms of the filter, while keeping the output lossless
  7006. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7007. or brightness/contrast adjustments can help.
  7008. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7009. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7010. which @code{fieldmatch} is based on. While the semantic and usage are very
  7011. close, some behaviour and options names can differ.
  7012. The @ref{decimate} filter currently only works for constant frame rate input.
  7013. If your input has mixed telecined (30fps) and progressive content with a lower
  7014. framerate like 24fps use the following filterchain to produce the necessary cfr
  7015. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7016. The filter accepts the following options:
  7017. @table @option
  7018. @item order
  7019. Specify the assumed field order of the input stream. Available values are:
  7020. @table @samp
  7021. @item auto
  7022. Auto detect parity (use FFmpeg's internal parity value).
  7023. @item bff
  7024. Assume bottom field first.
  7025. @item tff
  7026. Assume top field first.
  7027. @end table
  7028. Note that it is sometimes recommended not to trust the parity announced by the
  7029. stream.
  7030. Default value is @var{auto}.
  7031. @item mode
  7032. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7033. sense that it won't risk creating jerkiness due to duplicate frames when
  7034. possible, but if there are bad edits or blended fields it will end up
  7035. outputting combed frames when a good match might actually exist. On the other
  7036. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7037. but will almost always find a good frame if there is one. The other values are
  7038. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7039. jerkiness and creating duplicate frames versus finding good matches in sections
  7040. with bad edits, orphaned fields, blended fields, etc.
  7041. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7042. Available values are:
  7043. @table @samp
  7044. @item pc
  7045. 2-way matching (p/c)
  7046. @item pc_n
  7047. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7048. @item pc_u
  7049. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7050. @item pc_n_ub
  7051. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7052. still combed (p/c + n + u/b)
  7053. @item pcn
  7054. 3-way matching (p/c/n)
  7055. @item pcn_ub
  7056. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7057. detected as combed (p/c/n + u/b)
  7058. @end table
  7059. The parenthesis at the end indicate the matches that would be used for that
  7060. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7061. @var{top}).
  7062. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7063. the slowest.
  7064. Default value is @var{pc_n}.
  7065. @item ppsrc
  7066. Mark the main input stream as a pre-processed input, and enable the secondary
  7067. input stream as the clean source to pick the fields from. See the filter
  7068. introduction for more details. It is similar to the @option{clip2} feature from
  7069. VFM/TFM.
  7070. Default value is @code{0} (disabled).
  7071. @item field
  7072. Set the field to match from. It is recommended to set this to the same value as
  7073. @option{order} unless you experience matching failures with that setting. In
  7074. certain circumstances changing the field that is used to match from can have a
  7075. large impact on matching performance. Available values are:
  7076. @table @samp
  7077. @item auto
  7078. Automatic (same value as @option{order}).
  7079. @item bottom
  7080. Match from the bottom field.
  7081. @item top
  7082. Match from the top field.
  7083. @end table
  7084. Default value is @var{auto}.
  7085. @item mchroma
  7086. Set whether or not chroma is included during the match comparisons. In most
  7087. cases it is recommended to leave this enabled. You should set this to @code{0}
  7088. only if your clip has bad chroma problems such as heavy rainbowing or other
  7089. artifacts. Setting this to @code{0} could also be used to speed things up at
  7090. the cost of some accuracy.
  7091. Default value is @code{1}.
  7092. @item y0
  7093. @item y1
  7094. These define an exclusion band which excludes the lines between @option{y0} and
  7095. @option{y1} from being included in the field matching decision. An exclusion
  7096. band can be used to ignore subtitles, a logo, or other things that may
  7097. interfere with the matching. @option{y0} sets the starting scan line and
  7098. @option{y1} sets the ending line; all lines in between @option{y0} and
  7099. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7100. @option{y0} and @option{y1} to the same value will disable the feature.
  7101. @option{y0} and @option{y1} defaults to @code{0}.
  7102. @item scthresh
  7103. Set the scene change detection threshold as a percentage of maximum change on
  7104. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7105. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7106. @option{scthresh} is @code{[0.0, 100.0]}.
  7107. Default value is @code{12.0}.
  7108. @item combmatch
  7109. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7110. account the combed scores of matches when deciding what match to use as the
  7111. final match. Available values are:
  7112. @table @samp
  7113. @item none
  7114. No final matching based on combed scores.
  7115. @item sc
  7116. Combed scores are only used when a scene change is detected.
  7117. @item full
  7118. Use combed scores all the time.
  7119. @end table
  7120. Default is @var{sc}.
  7121. @item combdbg
  7122. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7123. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7124. Available values are:
  7125. @table @samp
  7126. @item none
  7127. No forced calculation.
  7128. @item pcn
  7129. Force p/c/n calculations.
  7130. @item pcnub
  7131. Force p/c/n/u/b calculations.
  7132. @end table
  7133. Default value is @var{none}.
  7134. @item cthresh
  7135. This is the area combing threshold used for combed frame detection. This
  7136. essentially controls how "strong" or "visible" combing must be to be detected.
  7137. Larger values mean combing must be more visible and smaller values mean combing
  7138. can be less visible or strong and still be detected. Valid settings are from
  7139. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7140. be detected as combed). This is basically a pixel difference value. A good
  7141. range is @code{[8, 12]}.
  7142. Default value is @code{9}.
  7143. @item chroma
  7144. Sets whether or not chroma is considered in the combed frame decision. Only
  7145. disable this if your source has chroma problems (rainbowing, etc.) that are
  7146. causing problems for the combed frame detection with chroma enabled. Actually,
  7147. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7148. where there is chroma only combing in the source.
  7149. Default value is @code{0}.
  7150. @item blockx
  7151. @item blocky
  7152. Respectively set the x-axis and y-axis size of the window used during combed
  7153. frame detection. This has to do with the size of the area in which
  7154. @option{combpel} pixels are required to be detected as combed for a frame to be
  7155. declared combed. See the @option{combpel} parameter description for more info.
  7156. Possible values are any number that is a power of 2 starting at 4 and going up
  7157. to 512.
  7158. Default value is @code{16}.
  7159. @item combpel
  7160. The number of combed pixels inside any of the @option{blocky} by
  7161. @option{blockx} size blocks on the frame for the frame to be detected as
  7162. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7163. setting controls "how much" combing there must be in any localized area (a
  7164. window defined by the @option{blockx} and @option{blocky} settings) on the
  7165. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7166. which point no frames will ever be detected as combed). This setting is known
  7167. as @option{MI} in TFM/VFM vocabulary.
  7168. Default value is @code{80}.
  7169. @end table
  7170. @anchor{p/c/n/u/b meaning}
  7171. @subsection p/c/n/u/b meaning
  7172. @subsubsection p/c/n
  7173. We assume the following telecined stream:
  7174. @example
  7175. Top fields: 1 2 2 3 4
  7176. Bottom fields: 1 2 3 4 4
  7177. @end example
  7178. The numbers correspond to the progressive frame the fields relate to. Here, the
  7179. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7180. When @code{fieldmatch} is configured to run a matching from bottom
  7181. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7182. @example
  7183. Input stream:
  7184. T 1 2 2 3 4
  7185. B 1 2 3 4 4 <-- matching reference
  7186. Matches: c c n n c
  7187. Output stream:
  7188. T 1 2 3 4 4
  7189. B 1 2 3 4 4
  7190. @end example
  7191. As a result of the field matching, we can see that some frames get duplicated.
  7192. To perform a complete inverse telecine, you need to rely on a decimation filter
  7193. after this operation. See for instance the @ref{decimate} filter.
  7194. The same operation now matching from top fields (@option{field}=@var{top})
  7195. looks like this:
  7196. @example
  7197. Input stream:
  7198. T 1 2 2 3 4 <-- matching reference
  7199. B 1 2 3 4 4
  7200. Matches: c c p p c
  7201. Output stream:
  7202. T 1 2 2 3 4
  7203. B 1 2 2 3 4
  7204. @end example
  7205. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7206. basically, they refer to the frame and field of the opposite parity:
  7207. @itemize
  7208. @item @var{p} matches the field of the opposite parity in the previous frame
  7209. @item @var{c} matches the field of the opposite parity in the current frame
  7210. @item @var{n} matches the field of the opposite parity in the next frame
  7211. @end itemize
  7212. @subsubsection u/b
  7213. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7214. from the opposite parity flag. In the following examples, we assume that we are
  7215. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7216. 'x' is placed above and below each matched fields.
  7217. With bottom matching (@option{field}=@var{bottom}):
  7218. @example
  7219. Match: c p n b u
  7220. x x x x x
  7221. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7222. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7223. x x x x x
  7224. Output frames:
  7225. 2 1 2 2 2
  7226. 2 2 2 1 3
  7227. @end example
  7228. With top matching (@option{field}=@var{top}):
  7229. @example
  7230. Match: c p n b u
  7231. x x x x x
  7232. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7233. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7234. x x x x x
  7235. Output frames:
  7236. 2 2 2 1 2
  7237. 2 1 3 2 2
  7238. @end example
  7239. @subsection Examples
  7240. Simple IVTC of a top field first telecined stream:
  7241. @example
  7242. fieldmatch=order=tff:combmatch=none, decimate
  7243. @end example
  7244. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7245. @example
  7246. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7247. @end example
  7248. @section fieldorder
  7249. Transform the field order of the input video.
  7250. It accepts the following parameters:
  7251. @table @option
  7252. @item order
  7253. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7254. for bottom field first.
  7255. @end table
  7256. The default value is @samp{tff}.
  7257. The transformation is done by shifting the picture content up or down
  7258. by one line, and filling the remaining line with appropriate picture content.
  7259. This method is consistent with most broadcast field order converters.
  7260. If the input video is not flagged as being interlaced, or it is already
  7261. flagged as being of the required output field order, then this filter does
  7262. not alter the incoming video.
  7263. It is very useful when converting to or from PAL DV material,
  7264. which is bottom field first.
  7265. For example:
  7266. @example
  7267. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7268. @end example
  7269. @section fifo, afifo
  7270. Buffer input images and send them when they are requested.
  7271. It is mainly useful when auto-inserted by the libavfilter
  7272. framework.
  7273. It does not take parameters.
  7274. @section fillborders
  7275. Fill borders of the input video, without changing video stream dimensions.
  7276. Sometimes video can have garbage at the four edges and you may not want to
  7277. crop video input to keep size multiple of some number.
  7278. This filter accepts the following options:
  7279. @table @option
  7280. @item left
  7281. Number of pixels to fill from left border.
  7282. @item right
  7283. Number of pixels to fill from right border.
  7284. @item top
  7285. Number of pixels to fill from top border.
  7286. @item bottom
  7287. Number of pixels to fill from bottom border.
  7288. @item mode
  7289. Set fill mode.
  7290. It accepts the following values:
  7291. @table @samp
  7292. @item smear
  7293. fill pixels using outermost pixels
  7294. @item mirror
  7295. fill pixels using mirroring
  7296. @item fixed
  7297. fill pixels with constant value
  7298. @end table
  7299. Default is @var{smear}.
  7300. @item color
  7301. Set color for pixels in fixed mode. Default is @var{black}.
  7302. @end table
  7303. @section find_rect
  7304. Find a rectangular object
  7305. It accepts the following options:
  7306. @table @option
  7307. @item object
  7308. Filepath of the object image, needs to be in gray8.
  7309. @item threshold
  7310. Detection threshold, default is 0.5.
  7311. @item mipmaps
  7312. Number of mipmaps, default is 3.
  7313. @item xmin, ymin, xmax, ymax
  7314. Specifies the rectangle in which to search.
  7315. @end table
  7316. @subsection Examples
  7317. @itemize
  7318. @item
  7319. Generate a representative palette of a given video using @command{ffmpeg}:
  7320. @example
  7321. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7322. @end example
  7323. @end itemize
  7324. @section cover_rect
  7325. Cover a rectangular object
  7326. It accepts the following options:
  7327. @table @option
  7328. @item cover
  7329. Filepath of the optional cover image, needs to be in yuv420.
  7330. @item mode
  7331. Set covering mode.
  7332. It accepts the following values:
  7333. @table @samp
  7334. @item cover
  7335. cover it by the supplied image
  7336. @item blur
  7337. cover it by interpolating the surrounding pixels
  7338. @end table
  7339. Default value is @var{blur}.
  7340. @end table
  7341. @subsection Examples
  7342. @itemize
  7343. @item
  7344. Generate a representative palette of a given video using @command{ffmpeg}:
  7345. @example
  7346. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7347. @end example
  7348. @end itemize
  7349. @section floodfill
  7350. Flood area with values of same pixel components with another values.
  7351. It accepts the following options:
  7352. @table @option
  7353. @item x
  7354. Set pixel x coordinate.
  7355. @item y
  7356. Set pixel y coordinate.
  7357. @item s0
  7358. Set source #0 component value.
  7359. @item s1
  7360. Set source #1 component value.
  7361. @item s2
  7362. Set source #2 component value.
  7363. @item s3
  7364. Set source #3 component value.
  7365. @item d0
  7366. Set destination #0 component value.
  7367. @item d1
  7368. Set destination #1 component value.
  7369. @item d2
  7370. Set destination #2 component value.
  7371. @item d3
  7372. Set destination #3 component value.
  7373. @end table
  7374. @anchor{format}
  7375. @section format
  7376. Convert the input video to one of the specified pixel formats.
  7377. Libavfilter will try to pick one that is suitable as input to
  7378. the next filter.
  7379. It accepts the following parameters:
  7380. @table @option
  7381. @item pix_fmts
  7382. A '|'-separated list of pixel format names, such as
  7383. "pix_fmts=yuv420p|monow|rgb24".
  7384. @end table
  7385. @subsection Examples
  7386. @itemize
  7387. @item
  7388. Convert the input video to the @var{yuv420p} format
  7389. @example
  7390. format=pix_fmts=yuv420p
  7391. @end example
  7392. Convert the input video to any of the formats in the list
  7393. @example
  7394. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7395. @end example
  7396. @end itemize
  7397. @anchor{fps}
  7398. @section fps
  7399. Convert the video to specified constant frame rate by duplicating or dropping
  7400. frames as necessary.
  7401. It accepts the following parameters:
  7402. @table @option
  7403. @item fps
  7404. The desired output frame rate. The default is @code{25}.
  7405. @item start_time
  7406. Assume the first PTS should be the given value, in seconds. This allows for
  7407. padding/trimming at the start of stream. By default, no assumption is made
  7408. about the first frame's expected PTS, so no padding or trimming is done.
  7409. For example, this could be set to 0 to pad the beginning with duplicates of
  7410. the first frame if a video stream starts after the audio stream or to trim any
  7411. frames with a negative PTS.
  7412. @item round
  7413. Timestamp (PTS) rounding method.
  7414. Possible values are:
  7415. @table @option
  7416. @item zero
  7417. round towards 0
  7418. @item inf
  7419. round away from 0
  7420. @item down
  7421. round towards -infinity
  7422. @item up
  7423. round towards +infinity
  7424. @item near
  7425. round to nearest
  7426. @end table
  7427. The default is @code{near}.
  7428. @item eof_action
  7429. Action performed when reading the last frame.
  7430. Possible values are:
  7431. @table @option
  7432. @item round
  7433. Use same timestamp rounding method as used for other frames.
  7434. @item pass
  7435. Pass through last frame if input duration has not been reached yet.
  7436. @end table
  7437. The default is @code{round}.
  7438. @end table
  7439. Alternatively, the options can be specified as a flat string:
  7440. @var{fps}[:@var{start_time}[:@var{round}]].
  7441. See also the @ref{setpts} filter.
  7442. @subsection Examples
  7443. @itemize
  7444. @item
  7445. A typical usage in order to set the fps to 25:
  7446. @example
  7447. fps=fps=25
  7448. @end example
  7449. @item
  7450. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7451. @example
  7452. fps=fps=film:round=near
  7453. @end example
  7454. @end itemize
  7455. @section framepack
  7456. Pack two different video streams into a stereoscopic video, setting proper
  7457. metadata on supported codecs. The two views should have the same size and
  7458. framerate and processing will stop when the shorter video ends. Please note
  7459. that you may conveniently adjust view properties with the @ref{scale} and
  7460. @ref{fps} filters.
  7461. It accepts the following parameters:
  7462. @table @option
  7463. @item format
  7464. The desired packing format. Supported values are:
  7465. @table @option
  7466. @item sbs
  7467. The views are next to each other (default).
  7468. @item tab
  7469. The views are on top of each other.
  7470. @item lines
  7471. The views are packed by line.
  7472. @item columns
  7473. The views are packed by column.
  7474. @item frameseq
  7475. The views are temporally interleaved.
  7476. @end table
  7477. @end table
  7478. Some examples:
  7479. @example
  7480. # Convert left and right views into a frame-sequential video
  7481. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7482. # Convert views into a side-by-side video with the same output resolution as the input
  7483. 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
  7484. @end example
  7485. @section framerate
  7486. Change the frame rate by interpolating new video output frames from the source
  7487. frames.
  7488. This filter is not designed to function correctly with interlaced media. If
  7489. you wish to change the frame rate of interlaced media then you are required
  7490. to deinterlace before this filter and re-interlace after this filter.
  7491. A description of the accepted options follows.
  7492. @table @option
  7493. @item fps
  7494. Specify the output frames per second. This option can also be specified
  7495. as a value alone. The default is @code{50}.
  7496. @item interp_start
  7497. Specify the start of a range where the output frame will be created as a
  7498. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7499. the default is @code{15}.
  7500. @item interp_end
  7501. Specify the end of a range where the output frame will be created as a
  7502. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7503. the default is @code{240}.
  7504. @item scene
  7505. Specify the level at which a scene change is detected as a value between
  7506. 0 and 100 to indicate a new scene; a low value reflects a low
  7507. probability for the current frame to introduce a new scene, while a higher
  7508. value means the current frame is more likely to be one.
  7509. The default is @code{8.2}.
  7510. @item flags
  7511. Specify flags influencing the filter process.
  7512. Available value for @var{flags} is:
  7513. @table @option
  7514. @item scene_change_detect, scd
  7515. Enable scene change detection using the value of the option @var{scene}.
  7516. This flag is enabled by default.
  7517. @end table
  7518. @end table
  7519. @section framestep
  7520. Select one frame every N-th frame.
  7521. This filter accepts the following option:
  7522. @table @option
  7523. @item step
  7524. Select frame after every @code{step} frames.
  7525. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7526. @end table
  7527. @anchor{frei0r}
  7528. @section frei0r
  7529. Apply a frei0r effect to the input video.
  7530. To enable the compilation of this filter, you need to install the frei0r
  7531. header and configure FFmpeg with @code{--enable-frei0r}.
  7532. It accepts the following parameters:
  7533. @table @option
  7534. @item filter_name
  7535. The name of the frei0r effect to load. If the environment variable
  7536. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7537. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7538. Otherwise, the standard frei0r paths are searched, in this order:
  7539. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7540. @file{/usr/lib/frei0r-1/}.
  7541. @item filter_params
  7542. A '|'-separated list of parameters to pass to the frei0r effect.
  7543. @end table
  7544. A frei0r effect parameter can be a boolean (its value is either
  7545. "y" or "n"), a double, a color (specified as
  7546. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7547. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7548. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7549. a position (specified as @var{X}/@var{Y}, where
  7550. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7551. The number and types of parameters depend on the loaded effect. If an
  7552. effect parameter is not specified, the default value is set.
  7553. @subsection Examples
  7554. @itemize
  7555. @item
  7556. Apply the distort0r effect, setting the first two double parameters:
  7557. @example
  7558. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7559. @end example
  7560. @item
  7561. Apply the colordistance effect, taking a color as the first parameter:
  7562. @example
  7563. frei0r=colordistance:0.2/0.3/0.4
  7564. frei0r=colordistance:violet
  7565. frei0r=colordistance:0x112233
  7566. @end example
  7567. @item
  7568. Apply the perspective effect, specifying the top left and top right image
  7569. positions:
  7570. @example
  7571. frei0r=perspective:0.2/0.2|0.8/0.2
  7572. @end example
  7573. @end itemize
  7574. For more information, see
  7575. @url{http://frei0r.dyne.org}
  7576. @section fspp
  7577. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7578. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7579. processing filter, one of them is performed once per block, not per pixel.
  7580. This allows for much higher speed.
  7581. The filter accepts the following options:
  7582. @table @option
  7583. @item quality
  7584. Set quality. This option defines the number of levels for averaging. It accepts
  7585. an integer in the range 4-5. Default value is @code{4}.
  7586. @item qp
  7587. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7588. If not set, the filter will use the QP from the video stream (if available).
  7589. @item strength
  7590. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7591. more details but also more artifacts, while higher values make the image smoother
  7592. but also blurrier. Default value is @code{0} − PSNR optimal.
  7593. @item use_bframe_qp
  7594. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7595. option may cause flicker since the B-Frames have often larger QP. Default is
  7596. @code{0} (not enabled).
  7597. @end table
  7598. @section gblur
  7599. Apply Gaussian blur filter.
  7600. The filter accepts the following options:
  7601. @table @option
  7602. @item sigma
  7603. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7604. @item steps
  7605. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7606. @item planes
  7607. Set which planes to filter. By default all planes are filtered.
  7608. @item sigmaV
  7609. Set vertical sigma, if negative it will be same as @code{sigma}.
  7610. Default is @code{-1}.
  7611. @end table
  7612. @section geq
  7613. The filter accepts the following options:
  7614. @table @option
  7615. @item lum_expr, lum
  7616. Set the luminance expression.
  7617. @item cb_expr, cb
  7618. Set the chrominance blue expression.
  7619. @item cr_expr, cr
  7620. Set the chrominance red expression.
  7621. @item alpha_expr, a
  7622. Set the alpha expression.
  7623. @item red_expr, r
  7624. Set the red expression.
  7625. @item green_expr, g
  7626. Set the green expression.
  7627. @item blue_expr, b
  7628. Set the blue expression.
  7629. @end table
  7630. The colorspace is selected according to the specified options. If one
  7631. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7632. options is specified, the filter will automatically select a YCbCr
  7633. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7634. @option{blue_expr} options is specified, it will select an RGB
  7635. colorspace.
  7636. If one of the chrominance expression is not defined, it falls back on the other
  7637. one. If no alpha expression is specified it will evaluate to opaque value.
  7638. If none of chrominance expressions are specified, they will evaluate
  7639. to the luminance expression.
  7640. The expressions can use the following variables and functions:
  7641. @table @option
  7642. @item N
  7643. The sequential number of the filtered frame, starting from @code{0}.
  7644. @item X
  7645. @item Y
  7646. The coordinates of the current sample.
  7647. @item W
  7648. @item H
  7649. The width and height of the image.
  7650. @item SW
  7651. @item SH
  7652. Width and height scale depending on the currently filtered plane. It is the
  7653. ratio between the corresponding luma plane number of pixels and the current
  7654. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7655. @code{0.5,0.5} for chroma planes.
  7656. @item T
  7657. Time of the current frame, expressed in seconds.
  7658. @item p(x, y)
  7659. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7660. plane.
  7661. @item lum(x, y)
  7662. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7663. plane.
  7664. @item cb(x, y)
  7665. Return the value of the pixel at location (@var{x},@var{y}) of the
  7666. blue-difference chroma plane. Return 0 if there is no such plane.
  7667. @item cr(x, y)
  7668. Return the value of the pixel at location (@var{x},@var{y}) of the
  7669. red-difference chroma plane. Return 0 if there is no such plane.
  7670. @item r(x, y)
  7671. @item g(x, y)
  7672. @item b(x, y)
  7673. Return the value of the pixel at location (@var{x},@var{y}) of the
  7674. red/green/blue component. Return 0 if there is no such component.
  7675. @item alpha(x, y)
  7676. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7677. plane. Return 0 if there is no such plane.
  7678. @end table
  7679. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7680. automatically clipped to the closer edge.
  7681. @subsection Examples
  7682. @itemize
  7683. @item
  7684. Flip the image horizontally:
  7685. @example
  7686. geq=p(W-X\,Y)
  7687. @end example
  7688. @item
  7689. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7690. wavelength of 100 pixels:
  7691. @example
  7692. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7693. @end example
  7694. @item
  7695. Generate a fancy enigmatic moving light:
  7696. @example
  7697. 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
  7698. @end example
  7699. @item
  7700. Generate a quick emboss effect:
  7701. @example
  7702. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7703. @end example
  7704. @item
  7705. Modify RGB components depending on pixel position:
  7706. @example
  7707. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7708. @end example
  7709. @item
  7710. Create a radial gradient that is the same size as the input (also see
  7711. the @ref{vignette} filter):
  7712. @example
  7713. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7714. @end example
  7715. @end itemize
  7716. @section gradfun
  7717. Fix the banding artifacts that are sometimes introduced into nearly flat
  7718. regions by truncation to 8-bit color depth.
  7719. Interpolate the gradients that should go where the bands are, and
  7720. dither them.
  7721. It is designed for playback only. Do not use it prior to
  7722. lossy compression, because compression tends to lose the dither and
  7723. bring back the bands.
  7724. It accepts the following parameters:
  7725. @table @option
  7726. @item strength
  7727. The maximum amount by which the filter will change any one pixel. This is also
  7728. the threshold for detecting nearly flat regions. Acceptable values range from
  7729. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7730. valid range.
  7731. @item radius
  7732. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7733. gradients, but also prevents the filter from modifying the pixels near detailed
  7734. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7735. values will be clipped to the valid range.
  7736. @end table
  7737. Alternatively, the options can be specified as a flat string:
  7738. @var{strength}[:@var{radius}]
  7739. @subsection Examples
  7740. @itemize
  7741. @item
  7742. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7743. @example
  7744. gradfun=3.5:8
  7745. @end example
  7746. @item
  7747. Specify radius, omitting the strength (which will fall-back to the default
  7748. value):
  7749. @example
  7750. gradfun=radius=8
  7751. @end example
  7752. @end itemize
  7753. @section greyedge
  7754. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  7755. and corrects the scene colors accordingly.
  7756. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  7757. The filter accepts the following options:
  7758. @table @option
  7759. @item difford
  7760. The order of differentiation to be applied on the scene. Must be chosen in the range
  7761. [0,2] and default value is 1.
  7762. @item minknorm
  7763. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  7764. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  7765. max value instead of calculating Minkowski distance.
  7766. @item sigma
  7767. The standard deviation of Gaussian blur to be applied on the scene. Must be
  7768. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  7769. can't be euqal to 0 if @var{difford} is greater than 0.
  7770. @end table
  7771. @subsection Examples
  7772. @itemize
  7773. @item
  7774. Grey Edge:
  7775. @example
  7776. greyedge=difford=1:minknorm=5:sigma=2
  7777. @end example
  7778. @item
  7779. Max Edge:
  7780. @example
  7781. greyedge=difford=1:minknorm=0:sigma=2
  7782. @end example
  7783. @end itemize
  7784. @anchor{haldclut}
  7785. @section haldclut
  7786. Apply a Hald CLUT to a video stream.
  7787. First input is the video stream to process, and second one is the Hald CLUT.
  7788. The Hald CLUT input can be a simple picture or a complete video stream.
  7789. The filter accepts the following options:
  7790. @table @option
  7791. @item shortest
  7792. Force termination when the shortest input terminates. Default is @code{0}.
  7793. @item repeatlast
  7794. Continue applying the last CLUT after the end of the stream. A value of
  7795. @code{0} disable the filter after the last frame of the CLUT is reached.
  7796. Default is @code{1}.
  7797. @end table
  7798. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7799. filters share the same internals).
  7800. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7801. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7802. @subsection Workflow examples
  7803. @subsubsection Hald CLUT video stream
  7804. Generate an identity Hald CLUT stream altered with various effects:
  7805. @example
  7806. 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
  7807. @end example
  7808. Note: make sure you use a lossless codec.
  7809. Then use it with @code{haldclut} to apply it on some random stream:
  7810. @example
  7811. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7812. @end example
  7813. The Hald CLUT will be applied to the 10 first seconds (duration of
  7814. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7815. to the remaining frames of the @code{mandelbrot} stream.
  7816. @subsubsection Hald CLUT with preview
  7817. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7818. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7819. biggest possible square starting at the top left of the picture. The remaining
  7820. padding pixels (bottom or right) will be ignored. This area can be used to add
  7821. a preview of the Hald CLUT.
  7822. Typically, the following generated Hald CLUT will be supported by the
  7823. @code{haldclut} filter:
  7824. @example
  7825. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7826. pad=iw+320 [padded_clut];
  7827. smptebars=s=320x256, split [a][b];
  7828. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7829. [main][b] overlay=W-320" -frames:v 1 clut.png
  7830. @end example
  7831. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7832. bars are displayed on the right-top, and below the same color bars processed by
  7833. the color changes.
  7834. Then, the effect of this Hald CLUT can be visualized with:
  7835. @example
  7836. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7837. @end example
  7838. @section hflip
  7839. Flip the input video horizontally.
  7840. For example, to horizontally flip the input video with @command{ffmpeg}:
  7841. @example
  7842. ffmpeg -i in.avi -vf "hflip" out.avi
  7843. @end example
  7844. @section histeq
  7845. This filter applies a global color histogram equalization on a
  7846. per-frame basis.
  7847. It can be used to correct video that has a compressed range of pixel
  7848. intensities. The filter redistributes the pixel intensities to
  7849. equalize their distribution across the intensity range. It may be
  7850. viewed as an "automatically adjusting contrast filter". This filter is
  7851. useful only for correcting degraded or poorly captured source
  7852. video.
  7853. The filter accepts the following options:
  7854. @table @option
  7855. @item strength
  7856. Determine the amount of equalization to be applied. As the strength
  7857. is reduced, the distribution of pixel intensities more-and-more
  7858. approaches that of the input frame. The value must be a float number
  7859. in the range [0,1] and defaults to 0.200.
  7860. @item intensity
  7861. Set the maximum intensity that can generated and scale the output
  7862. values appropriately. The strength should be set as desired and then
  7863. the intensity can be limited if needed to avoid washing-out. The value
  7864. must be a float number in the range [0,1] and defaults to 0.210.
  7865. @item antibanding
  7866. Set the antibanding level. If enabled the filter will randomly vary
  7867. the luminance of output pixels by a small amount to avoid banding of
  7868. the histogram. Possible values are @code{none}, @code{weak} or
  7869. @code{strong}. It defaults to @code{none}.
  7870. @end table
  7871. @section histogram
  7872. Compute and draw a color distribution histogram for the input video.
  7873. The computed histogram is a representation of the color component
  7874. distribution in an image.
  7875. Standard histogram displays the color components distribution in an image.
  7876. Displays color graph for each color component. Shows distribution of
  7877. the Y, U, V, A or R, G, B components, depending on input format, in the
  7878. current frame. Below each graph a color component scale meter is shown.
  7879. The filter accepts the following options:
  7880. @table @option
  7881. @item level_height
  7882. Set height of level. Default value is @code{200}.
  7883. Allowed range is [50, 2048].
  7884. @item scale_height
  7885. Set height of color scale. Default value is @code{12}.
  7886. Allowed range is [0, 40].
  7887. @item display_mode
  7888. Set display mode.
  7889. It accepts the following values:
  7890. @table @samp
  7891. @item stack
  7892. Per color component graphs are placed below each other.
  7893. @item parade
  7894. Per color component graphs are placed side by side.
  7895. @item overlay
  7896. Presents information identical to that in the @code{parade}, except
  7897. that the graphs representing color components are superimposed directly
  7898. over one another.
  7899. @end table
  7900. Default is @code{stack}.
  7901. @item levels_mode
  7902. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7903. Default is @code{linear}.
  7904. @item components
  7905. Set what color components to display.
  7906. Default is @code{7}.
  7907. @item fgopacity
  7908. Set foreground opacity. Default is @code{0.7}.
  7909. @item bgopacity
  7910. Set background opacity. Default is @code{0.5}.
  7911. @end table
  7912. @subsection Examples
  7913. @itemize
  7914. @item
  7915. Calculate and draw histogram:
  7916. @example
  7917. ffplay -i input -vf histogram
  7918. @end example
  7919. @end itemize
  7920. @anchor{hqdn3d}
  7921. @section hqdn3d
  7922. This is a high precision/quality 3d denoise filter. It aims to reduce
  7923. image noise, producing smooth images and making still images really
  7924. still. It should enhance compressibility.
  7925. It accepts the following optional parameters:
  7926. @table @option
  7927. @item luma_spatial
  7928. A non-negative floating point number which specifies spatial luma strength.
  7929. It defaults to 4.0.
  7930. @item chroma_spatial
  7931. A non-negative floating point number which specifies spatial chroma strength.
  7932. It defaults to 3.0*@var{luma_spatial}/4.0.
  7933. @item luma_tmp
  7934. A floating point number which specifies luma temporal strength. It defaults to
  7935. 6.0*@var{luma_spatial}/4.0.
  7936. @item chroma_tmp
  7937. A floating point number which specifies chroma temporal strength. It defaults to
  7938. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7939. @end table
  7940. @section hwdownload
  7941. Download hardware frames to system memory.
  7942. The input must be in hardware frames, and the output a non-hardware format.
  7943. Not all formats will be supported on the output - it may be necessary to insert
  7944. an additional @option{format} filter immediately following in the graph to get
  7945. the output in a supported format.
  7946. @section hwmap
  7947. Map hardware frames to system memory or to another device.
  7948. This filter has several different modes of operation; which one is used depends
  7949. on the input and output formats:
  7950. @itemize
  7951. @item
  7952. Hardware frame input, normal frame output
  7953. Map the input frames to system memory and pass them to the output. If the
  7954. original hardware frame is later required (for example, after overlaying
  7955. something else on part of it), the @option{hwmap} filter can be used again
  7956. in the next mode to retrieve it.
  7957. @item
  7958. Normal frame input, hardware frame output
  7959. If the input is actually a software-mapped hardware frame, then unmap it -
  7960. that is, return the original hardware frame.
  7961. Otherwise, a device must be provided. Create new hardware surfaces on that
  7962. device for the output, then map them back to the software format at the input
  7963. and give those frames to the preceding filter. This will then act like the
  7964. @option{hwupload} filter, but may be able to avoid an additional copy when
  7965. the input is already in a compatible format.
  7966. @item
  7967. Hardware frame input and output
  7968. A device must be supplied for the output, either directly or with the
  7969. @option{derive_device} option. The input and output devices must be of
  7970. different types and compatible - the exact meaning of this is
  7971. system-dependent, but typically it means that they must refer to the same
  7972. underlying hardware context (for example, refer to the same graphics card).
  7973. If the input frames were originally created on the output device, then unmap
  7974. to retrieve the original frames.
  7975. Otherwise, map the frames to the output device - create new hardware frames
  7976. on the output corresponding to the frames on the input.
  7977. @end itemize
  7978. The following additional parameters are accepted:
  7979. @table @option
  7980. @item mode
  7981. Set the frame mapping mode. Some combination of:
  7982. @table @var
  7983. @item read
  7984. The mapped frame should be readable.
  7985. @item write
  7986. The mapped frame should be writeable.
  7987. @item overwrite
  7988. The mapping will always overwrite the entire frame.
  7989. This may improve performance in some cases, as the original contents of the
  7990. frame need not be loaded.
  7991. @item direct
  7992. The mapping must not involve any copying.
  7993. Indirect mappings to copies of frames are created in some cases where either
  7994. direct mapping is not possible or it would have unexpected properties.
  7995. Setting this flag ensures that the mapping is direct and will fail if that is
  7996. not possible.
  7997. @end table
  7998. Defaults to @var{read+write} if not specified.
  7999. @item derive_device @var{type}
  8000. Rather than using the device supplied at initialisation, instead derive a new
  8001. device of type @var{type} from the device the input frames exist on.
  8002. @item reverse
  8003. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8004. and map them back to the source. This may be necessary in some cases where
  8005. a mapping in one direction is required but only the opposite direction is
  8006. supported by the devices being used.
  8007. This option is dangerous - it may break the preceding filter in undefined
  8008. ways if there are any additional constraints on that filter's output.
  8009. Do not use it without fully understanding the implications of its use.
  8010. @end table
  8011. @section hwupload
  8012. Upload system memory frames to hardware surfaces.
  8013. The device to upload to must be supplied when the filter is initialised. If
  8014. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8015. option.
  8016. @anchor{hwupload_cuda}
  8017. @section hwupload_cuda
  8018. Upload system memory frames to a CUDA device.
  8019. It accepts the following optional parameters:
  8020. @table @option
  8021. @item device
  8022. The number of the CUDA device to use
  8023. @end table
  8024. @section hqx
  8025. Apply a high-quality magnification filter designed for pixel art. This filter
  8026. was originally created by Maxim Stepin.
  8027. It accepts the following option:
  8028. @table @option
  8029. @item n
  8030. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8031. @code{hq3x} and @code{4} for @code{hq4x}.
  8032. Default is @code{3}.
  8033. @end table
  8034. @section hstack
  8035. Stack input videos horizontally.
  8036. All streams must be of same pixel format and of same height.
  8037. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8038. to create same output.
  8039. The filter accept the following option:
  8040. @table @option
  8041. @item inputs
  8042. Set number of input streams. Default is 2.
  8043. @item shortest
  8044. If set to 1, force the output to terminate when the shortest input
  8045. terminates. Default value is 0.
  8046. @end table
  8047. @section hue
  8048. Modify the hue and/or the saturation of the input.
  8049. It accepts the following parameters:
  8050. @table @option
  8051. @item h
  8052. Specify the hue angle as a number of degrees. It accepts an expression,
  8053. and defaults to "0".
  8054. @item s
  8055. Specify the saturation in the [-10,10] range. It accepts an expression and
  8056. defaults to "1".
  8057. @item H
  8058. Specify the hue angle as a number of radians. It accepts an
  8059. expression, and defaults to "0".
  8060. @item b
  8061. Specify the brightness in the [-10,10] range. It accepts an expression and
  8062. defaults to "0".
  8063. @end table
  8064. @option{h} and @option{H} are mutually exclusive, and can't be
  8065. specified at the same time.
  8066. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8067. expressions containing the following constants:
  8068. @table @option
  8069. @item n
  8070. frame count of the input frame starting from 0
  8071. @item pts
  8072. presentation timestamp of the input frame expressed in time base units
  8073. @item r
  8074. frame rate of the input video, NAN if the input frame rate is unknown
  8075. @item t
  8076. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8077. @item tb
  8078. time base of the input video
  8079. @end table
  8080. @subsection Examples
  8081. @itemize
  8082. @item
  8083. Set the hue to 90 degrees and the saturation to 1.0:
  8084. @example
  8085. hue=h=90:s=1
  8086. @end example
  8087. @item
  8088. Same command but expressing the hue in radians:
  8089. @example
  8090. hue=H=PI/2:s=1
  8091. @end example
  8092. @item
  8093. Rotate hue and make the saturation swing between 0
  8094. and 2 over a period of 1 second:
  8095. @example
  8096. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8097. @end example
  8098. @item
  8099. Apply a 3 seconds saturation fade-in effect starting at 0:
  8100. @example
  8101. hue="s=min(t/3\,1)"
  8102. @end example
  8103. The general fade-in expression can be written as:
  8104. @example
  8105. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8106. @end example
  8107. @item
  8108. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8109. @example
  8110. hue="s=max(0\, min(1\, (8-t)/3))"
  8111. @end example
  8112. The general fade-out expression can be written as:
  8113. @example
  8114. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8115. @end example
  8116. @end itemize
  8117. @subsection Commands
  8118. This filter supports the following commands:
  8119. @table @option
  8120. @item b
  8121. @item s
  8122. @item h
  8123. @item H
  8124. Modify the hue and/or the saturation and/or brightness of the input video.
  8125. The command accepts the same syntax of the corresponding option.
  8126. If the specified expression is not valid, it is kept at its current
  8127. value.
  8128. @end table
  8129. @section hysteresis
  8130. Grow first stream into second stream by connecting components.
  8131. This makes it possible to build more robust edge masks.
  8132. This filter accepts the following options:
  8133. @table @option
  8134. @item planes
  8135. Set which planes will be processed as bitmap, unprocessed planes will be
  8136. copied from first stream.
  8137. By default value 0xf, all planes will be processed.
  8138. @item threshold
  8139. Set threshold which is used in filtering. If pixel component value is higher than
  8140. this value filter algorithm for connecting components is activated.
  8141. By default value is 0.
  8142. @end table
  8143. @section idet
  8144. Detect video interlacing type.
  8145. This filter tries to detect if the input frames are interlaced, progressive,
  8146. top or bottom field first. It will also try to detect fields that are
  8147. repeated between adjacent frames (a sign of telecine).
  8148. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8149. Multiple frame detection incorporates the classification history of previous frames.
  8150. The filter will log these metadata values:
  8151. @table @option
  8152. @item single.current_frame
  8153. Detected type of current frame using single-frame detection. One of:
  8154. ``tff'' (top field first), ``bff'' (bottom field first),
  8155. ``progressive'', or ``undetermined''
  8156. @item single.tff
  8157. Cumulative number of frames detected as top field first using single-frame detection.
  8158. @item multiple.tff
  8159. Cumulative number of frames detected as top field first using multiple-frame detection.
  8160. @item single.bff
  8161. Cumulative number of frames detected as bottom field first using single-frame detection.
  8162. @item multiple.current_frame
  8163. Detected type of current frame using multiple-frame detection. One of:
  8164. ``tff'' (top field first), ``bff'' (bottom field first),
  8165. ``progressive'', or ``undetermined''
  8166. @item multiple.bff
  8167. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8168. @item single.progressive
  8169. Cumulative number of frames detected as progressive using single-frame detection.
  8170. @item multiple.progressive
  8171. Cumulative number of frames detected as progressive using multiple-frame detection.
  8172. @item single.undetermined
  8173. Cumulative number of frames that could not be classified using single-frame detection.
  8174. @item multiple.undetermined
  8175. Cumulative number of frames that could not be classified using multiple-frame detection.
  8176. @item repeated.current_frame
  8177. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8178. @item repeated.neither
  8179. Cumulative number of frames with no repeated field.
  8180. @item repeated.top
  8181. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8182. @item repeated.bottom
  8183. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8184. @end table
  8185. The filter accepts the following options:
  8186. @table @option
  8187. @item intl_thres
  8188. Set interlacing threshold.
  8189. @item prog_thres
  8190. Set progressive threshold.
  8191. @item rep_thres
  8192. Threshold for repeated field detection.
  8193. @item half_life
  8194. Number of frames after which a given frame's contribution to the
  8195. statistics is halved (i.e., it contributes only 0.5 to its
  8196. classification). The default of 0 means that all frames seen are given
  8197. full weight of 1.0 forever.
  8198. @item analyze_interlaced_flag
  8199. When this is not 0 then idet will use the specified number of frames to determine
  8200. if the interlaced flag is accurate, it will not count undetermined frames.
  8201. If the flag is found to be accurate it will be used without any further
  8202. computations, if it is found to be inaccurate it will be cleared without any
  8203. further computations. This allows inserting the idet filter as a low computational
  8204. method to clean up the interlaced flag
  8205. @end table
  8206. @section il
  8207. Deinterleave or interleave fields.
  8208. This filter allows one to process interlaced images fields without
  8209. deinterlacing them. Deinterleaving splits the input frame into 2
  8210. fields (so called half pictures). Odd lines are moved to the top
  8211. half of the output image, even lines to the bottom half.
  8212. You can process (filter) them independently and then re-interleave them.
  8213. The filter accepts the following options:
  8214. @table @option
  8215. @item luma_mode, l
  8216. @item chroma_mode, c
  8217. @item alpha_mode, a
  8218. Available values for @var{luma_mode}, @var{chroma_mode} and
  8219. @var{alpha_mode} are:
  8220. @table @samp
  8221. @item none
  8222. Do nothing.
  8223. @item deinterleave, d
  8224. Deinterleave fields, placing one above the other.
  8225. @item interleave, i
  8226. Interleave fields. Reverse the effect of deinterleaving.
  8227. @end table
  8228. Default value is @code{none}.
  8229. @item luma_swap, ls
  8230. @item chroma_swap, cs
  8231. @item alpha_swap, as
  8232. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8233. @end table
  8234. @section inflate
  8235. Apply inflate effect to the video.
  8236. This filter replaces the pixel by the local(3x3) average by taking into account
  8237. only values higher than the pixel.
  8238. It accepts the following options:
  8239. @table @option
  8240. @item threshold0
  8241. @item threshold1
  8242. @item threshold2
  8243. @item threshold3
  8244. Limit the maximum change for each plane, default is 65535.
  8245. If 0, plane will remain unchanged.
  8246. @end table
  8247. @section interlace
  8248. Simple interlacing filter from progressive contents. This interleaves upper (or
  8249. lower) lines from odd frames with lower (or upper) lines from even frames,
  8250. halving the frame rate and preserving image height.
  8251. @example
  8252. Original Original New Frame
  8253. Frame 'j' Frame 'j+1' (tff)
  8254. ========== =========== ==================
  8255. Line 0 --------------------> Frame 'j' Line 0
  8256. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8257. Line 2 ---------------------> Frame 'j' Line 2
  8258. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8259. ... ... ...
  8260. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8261. @end example
  8262. It accepts the following optional parameters:
  8263. @table @option
  8264. @item scan
  8265. This determines whether the interlaced frame is taken from the even
  8266. (tff - default) or odd (bff) lines of the progressive frame.
  8267. @item lowpass
  8268. Vertical lowpass filter to avoid twitter interlacing and
  8269. reduce moire patterns.
  8270. @table @samp
  8271. @item 0, off
  8272. Disable vertical lowpass filter
  8273. @item 1, linear
  8274. Enable linear filter (default)
  8275. @item 2, complex
  8276. Enable complex filter. This will slightly less reduce twitter and moire
  8277. but better retain detail and subjective sharpness impression.
  8278. @end table
  8279. @end table
  8280. @section kerndeint
  8281. Deinterlace input video by applying Donald Graft's adaptive kernel
  8282. deinterling. Work on interlaced parts of a video to produce
  8283. progressive frames.
  8284. The description of the accepted parameters follows.
  8285. @table @option
  8286. @item thresh
  8287. Set the threshold which affects the filter's tolerance when
  8288. determining if a pixel line must be processed. It must be an integer
  8289. in the range [0,255] and defaults to 10. A value of 0 will result in
  8290. applying the process on every pixels.
  8291. @item map
  8292. Paint pixels exceeding the threshold value to white if set to 1.
  8293. Default is 0.
  8294. @item order
  8295. Set the fields order. Swap fields if set to 1, leave fields alone if
  8296. 0. Default is 0.
  8297. @item sharp
  8298. Enable additional sharpening if set to 1. Default is 0.
  8299. @item twoway
  8300. Enable twoway sharpening if set to 1. Default is 0.
  8301. @end table
  8302. @subsection Examples
  8303. @itemize
  8304. @item
  8305. Apply default values:
  8306. @example
  8307. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8308. @end example
  8309. @item
  8310. Enable additional sharpening:
  8311. @example
  8312. kerndeint=sharp=1
  8313. @end example
  8314. @item
  8315. Paint processed pixels in white:
  8316. @example
  8317. kerndeint=map=1
  8318. @end example
  8319. @end itemize
  8320. @section lenscorrection
  8321. Correct radial lens distortion
  8322. This filter can be used to correct for radial distortion as can result from the use
  8323. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8324. one can use tools available for example as part of opencv or simply trial-and-error.
  8325. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8326. and extract the k1 and k2 coefficients from the resulting matrix.
  8327. Note that effectively the same filter is available in the open-source tools Krita and
  8328. Digikam from the KDE project.
  8329. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8330. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8331. brightness distribution, so you may want to use both filters together in certain
  8332. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8333. be applied before or after lens correction.
  8334. @subsection Options
  8335. The filter accepts the following options:
  8336. @table @option
  8337. @item cx
  8338. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8339. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8340. width. Default is 0.5.
  8341. @item cy
  8342. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8343. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8344. height. Default is 0.5.
  8345. @item k1
  8346. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8347. no correction. Default is 0.
  8348. @item k2
  8349. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8350. 0 means no correction. Default is 0.
  8351. @end table
  8352. The formula that generates the correction is:
  8353. @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)
  8354. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8355. distances from the focal point in the source and target images, respectively.
  8356. @section lensfun
  8357. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8358. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8359. to apply the lens correction. The filter will load the lensfun database and
  8360. query it to find the corresponding camera and lens entries in the database. As
  8361. long as these entries can be found with the given options, the filter can
  8362. perform corrections on frames. Note that incomplete strings will result in the
  8363. filter choosing the best match with the given options, and the filter will
  8364. output the chosen camera and lens models (logged with level "info"). You must
  8365. provide the make, camera model, and lens model as they are required.
  8366. The filter accepts the following options:
  8367. @table @option
  8368. @item make
  8369. The make of the camera (for example, "Canon"). This option is required.
  8370. @item model
  8371. The model of the camera (for example, "Canon EOS 100D"). This option is
  8372. required.
  8373. @item lens_model
  8374. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8375. option is required.
  8376. @item mode
  8377. The type of correction to apply. The following values are valid options:
  8378. @table @samp
  8379. @item vignetting
  8380. Enables fixing lens vignetting.
  8381. @item geometry
  8382. Enables fixing lens geometry. This is the default.
  8383. @item subpixel
  8384. Enables fixing chromatic aberrations.
  8385. @item vig_geo
  8386. Enables fixing lens vignetting and lens geometry.
  8387. @item vig_subpixel
  8388. Enables fixing lens vignetting and chromatic aberrations.
  8389. @item distortion
  8390. Enables fixing both lens geometry and chromatic aberrations.
  8391. @item all
  8392. Enables all possible corrections.
  8393. @end table
  8394. @item focal_length
  8395. The focal length of the image/video (zoom; expected constant for video). For
  8396. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8397. range should be chosen when using that lens. Default 18.
  8398. @item aperture
  8399. The aperture of the image/video (expected constant for video). Note that
  8400. aperture is only used for vignetting correction. Default 3.5.
  8401. @item focus_distance
  8402. The focus distance of the image/video (expected constant for video). Note that
  8403. focus distance is only used for vignetting and only slightly affects the
  8404. vignetting correction process. If unknown, leave it at the default value (which
  8405. is 1000).
  8406. @item target_geometry
  8407. The target geometry of the output image/video. The following values are valid
  8408. options:
  8409. @table @samp
  8410. @item rectilinear (default)
  8411. @item fisheye
  8412. @item panoramic
  8413. @item equirectangular
  8414. @item fisheye_orthographic
  8415. @item fisheye_stereographic
  8416. @item fisheye_equisolid
  8417. @item fisheye_thoby
  8418. @end table
  8419. @item reverse
  8420. Apply the reverse of image correction (instead of correcting distortion, apply
  8421. it).
  8422. @item interpolation
  8423. The type of interpolation used when correcting distortion. The following values
  8424. are valid options:
  8425. @table @samp
  8426. @item nearest
  8427. @item linear (default)
  8428. @item lanczos
  8429. @end table
  8430. @end table
  8431. @subsection Examples
  8432. @itemize
  8433. @item
  8434. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  8435. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  8436. aperture of "8.0".
  8437. @example
  8438. 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
  8439. @end example
  8440. @item
  8441. Apply the same as before, but only for the first 5 seconds of video.
  8442. @example
  8443. 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
  8444. @end example
  8445. @end itemize
  8446. @section libvmaf
  8447. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8448. score between two input videos.
  8449. The obtained VMAF score is printed through the logging system.
  8450. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8451. After installing the library it can be enabled using:
  8452. @code{./configure --enable-libvmaf --enable-version3}.
  8453. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8454. The filter has following options:
  8455. @table @option
  8456. @item model_path
  8457. Set the model path which is to be used for SVM.
  8458. Default value: @code{"vmaf_v0.6.1.pkl"}
  8459. @item log_path
  8460. Set the file path to be used to store logs.
  8461. @item log_fmt
  8462. Set the format of the log file (xml or json).
  8463. @item enable_transform
  8464. Enables transform for computing vmaf.
  8465. @item phone_model
  8466. Invokes the phone model which will generate VMAF scores higher than in the
  8467. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8468. @item psnr
  8469. Enables computing psnr along with vmaf.
  8470. @item ssim
  8471. Enables computing ssim along with vmaf.
  8472. @item ms_ssim
  8473. Enables computing ms_ssim along with vmaf.
  8474. @item pool
  8475. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8476. @item n_threads
  8477. Set number of threads to be used when computing vmaf.
  8478. @item n_subsample
  8479. Set interval for frame subsampling used when computing vmaf.
  8480. @item enable_conf_interval
  8481. Enables confidence interval.
  8482. @end table
  8483. This filter also supports the @ref{framesync} options.
  8484. On the below examples the input file @file{main.mpg} being processed is
  8485. compared with the reference file @file{ref.mpg}.
  8486. @example
  8487. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8488. @end example
  8489. Example with options:
  8490. @example
  8491. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  8492. @end example
  8493. @section limiter
  8494. Limits the pixel components values to the specified range [min, max].
  8495. The filter accepts the following options:
  8496. @table @option
  8497. @item min
  8498. Lower bound. Defaults to the lowest allowed value for the input.
  8499. @item max
  8500. Upper bound. Defaults to the highest allowed value for the input.
  8501. @item planes
  8502. Specify which planes will be processed. Defaults to all available.
  8503. @end table
  8504. @section loop
  8505. Loop video frames.
  8506. The filter accepts the following options:
  8507. @table @option
  8508. @item loop
  8509. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8510. Default is 0.
  8511. @item size
  8512. Set maximal size in number of frames. Default is 0.
  8513. @item start
  8514. Set first frame of loop. Default is 0.
  8515. @end table
  8516. @section lut1d
  8517. Apply a 1D LUT to an input video.
  8518. The filter accepts the following options:
  8519. @table @option
  8520. @item file
  8521. Set the 1D LUT file name.
  8522. Currently supported formats:
  8523. @table @samp
  8524. @item cube
  8525. Iridas
  8526. @end table
  8527. @item interp
  8528. Select interpolation mode.
  8529. Available values are:
  8530. @table @samp
  8531. @item nearest
  8532. Use values from the nearest defined point.
  8533. @item linear
  8534. Interpolate values using the linear interpolation.
  8535. @item cubic
  8536. Interpolate values using the cubic interpolation.
  8537. @end table
  8538. @end table
  8539. @anchor{lut3d}
  8540. @section lut3d
  8541. Apply a 3D LUT to an input video.
  8542. The filter accepts the following options:
  8543. @table @option
  8544. @item file
  8545. Set the 3D LUT file name.
  8546. Currently supported formats:
  8547. @table @samp
  8548. @item 3dl
  8549. AfterEffects
  8550. @item cube
  8551. Iridas
  8552. @item dat
  8553. DaVinci
  8554. @item m3d
  8555. Pandora
  8556. @end table
  8557. @item interp
  8558. Select interpolation mode.
  8559. Available values are:
  8560. @table @samp
  8561. @item nearest
  8562. Use values from the nearest defined point.
  8563. @item trilinear
  8564. Interpolate values using the 8 points defining a cube.
  8565. @item tetrahedral
  8566. Interpolate values using a tetrahedron.
  8567. @end table
  8568. @end table
  8569. This filter also supports the @ref{framesync} options.
  8570. @section lumakey
  8571. Turn certain luma values into transparency.
  8572. The filter accepts the following options:
  8573. @table @option
  8574. @item threshold
  8575. Set the luma which will be used as base for transparency.
  8576. Default value is @code{0}.
  8577. @item tolerance
  8578. Set the range of luma values to be keyed out.
  8579. Default value is @code{0}.
  8580. @item softness
  8581. Set the range of softness. Default value is @code{0}.
  8582. Use this to control gradual transition from zero to full transparency.
  8583. @end table
  8584. @section lut, lutrgb, lutyuv
  8585. Compute a look-up table for binding each pixel component input value
  8586. to an output value, and apply it to the input video.
  8587. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8588. to an RGB input video.
  8589. These filters accept the following parameters:
  8590. @table @option
  8591. @item c0
  8592. set first pixel component expression
  8593. @item c1
  8594. set second pixel component expression
  8595. @item c2
  8596. set third pixel component expression
  8597. @item c3
  8598. set fourth pixel component expression, corresponds to the alpha component
  8599. @item r
  8600. set red component expression
  8601. @item g
  8602. set green component expression
  8603. @item b
  8604. set blue component expression
  8605. @item a
  8606. alpha component expression
  8607. @item y
  8608. set Y/luminance component expression
  8609. @item u
  8610. set U/Cb component expression
  8611. @item v
  8612. set V/Cr component expression
  8613. @end table
  8614. Each of them specifies the expression to use for computing the lookup table for
  8615. the corresponding pixel component values.
  8616. The exact component associated to each of the @var{c*} options depends on the
  8617. format in input.
  8618. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8619. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8620. The expressions can contain the following constants and functions:
  8621. @table @option
  8622. @item w
  8623. @item h
  8624. The input width and height.
  8625. @item val
  8626. The input value for the pixel component.
  8627. @item clipval
  8628. The input value, clipped to the @var{minval}-@var{maxval} range.
  8629. @item maxval
  8630. The maximum value for the pixel component.
  8631. @item minval
  8632. The minimum value for the pixel component.
  8633. @item negval
  8634. The negated value for the pixel component value, clipped to the
  8635. @var{minval}-@var{maxval} range; it corresponds to the expression
  8636. "maxval-clipval+minval".
  8637. @item clip(val)
  8638. The computed value in @var{val}, clipped to the
  8639. @var{minval}-@var{maxval} range.
  8640. @item gammaval(gamma)
  8641. The computed gamma correction value of the pixel component value,
  8642. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8643. expression
  8644. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8645. @end table
  8646. All expressions default to "val".
  8647. @subsection Examples
  8648. @itemize
  8649. @item
  8650. Negate input video:
  8651. @example
  8652. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8653. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8654. @end example
  8655. The above is the same as:
  8656. @example
  8657. lutrgb="r=negval:g=negval:b=negval"
  8658. lutyuv="y=negval:u=negval:v=negval"
  8659. @end example
  8660. @item
  8661. Negate luminance:
  8662. @example
  8663. lutyuv=y=negval
  8664. @end example
  8665. @item
  8666. Remove chroma components, turning the video into a graytone image:
  8667. @example
  8668. lutyuv="u=128:v=128"
  8669. @end example
  8670. @item
  8671. Apply a luma burning effect:
  8672. @example
  8673. lutyuv="y=2*val"
  8674. @end example
  8675. @item
  8676. Remove green and blue components:
  8677. @example
  8678. lutrgb="g=0:b=0"
  8679. @end example
  8680. @item
  8681. Set a constant alpha channel value on input:
  8682. @example
  8683. format=rgba,lutrgb=a="maxval-minval/2"
  8684. @end example
  8685. @item
  8686. Correct luminance gamma by a factor of 0.5:
  8687. @example
  8688. lutyuv=y=gammaval(0.5)
  8689. @end example
  8690. @item
  8691. Discard least significant bits of luma:
  8692. @example
  8693. lutyuv=y='bitand(val, 128+64+32)'
  8694. @end example
  8695. @item
  8696. Technicolor like effect:
  8697. @example
  8698. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8699. @end example
  8700. @end itemize
  8701. @section lut2, tlut2
  8702. The @code{lut2} filter takes two input streams and outputs one
  8703. stream.
  8704. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8705. from one single stream.
  8706. This filter accepts the following parameters:
  8707. @table @option
  8708. @item c0
  8709. set first pixel component expression
  8710. @item c1
  8711. set second pixel component expression
  8712. @item c2
  8713. set third pixel component expression
  8714. @item c3
  8715. set fourth pixel component expression, corresponds to the alpha component
  8716. @end table
  8717. Each of them specifies the expression to use for computing the lookup table for
  8718. the corresponding pixel component values.
  8719. The exact component associated to each of the @var{c*} options depends on the
  8720. format in inputs.
  8721. The expressions can contain the following constants:
  8722. @table @option
  8723. @item w
  8724. @item h
  8725. The input width and height.
  8726. @item x
  8727. The first input value for the pixel component.
  8728. @item y
  8729. The second input value for the pixel component.
  8730. @item bdx
  8731. The first input video bit depth.
  8732. @item bdy
  8733. The second input video bit depth.
  8734. @end table
  8735. All expressions default to "x".
  8736. @subsection Examples
  8737. @itemize
  8738. @item
  8739. Highlight differences between two RGB video streams:
  8740. @example
  8741. 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)'
  8742. @end example
  8743. @item
  8744. Highlight differences between two YUV video streams:
  8745. @example
  8746. 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)'
  8747. @end example
  8748. @item
  8749. Show max difference between two video streams:
  8750. @example
  8751. 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)))'
  8752. @end example
  8753. @end itemize
  8754. @section maskedclamp
  8755. Clamp the first input stream with the second input and third input stream.
  8756. Returns the value of first stream to be between second input
  8757. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8758. This filter accepts the following options:
  8759. @table @option
  8760. @item undershoot
  8761. Default value is @code{0}.
  8762. @item overshoot
  8763. Default value is @code{0}.
  8764. @item planes
  8765. Set which planes will be processed as bitmap, unprocessed planes will be
  8766. copied from first stream.
  8767. By default value 0xf, all planes will be processed.
  8768. @end table
  8769. @section maskedmerge
  8770. Merge the first input stream with the second input stream using per pixel
  8771. weights in the third input stream.
  8772. A value of 0 in the third stream pixel component means that pixel component
  8773. from first stream is returned unchanged, while maximum value (eg. 255 for
  8774. 8-bit videos) means that pixel component from second stream is returned
  8775. unchanged. Intermediate values define the amount of merging between both
  8776. input stream's pixel components.
  8777. This filter accepts the following options:
  8778. @table @option
  8779. @item planes
  8780. Set which planes will be processed as bitmap, unprocessed planes will be
  8781. copied from first stream.
  8782. By default value 0xf, all planes will be processed.
  8783. @end table
  8784. @section mcdeint
  8785. Apply motion-compensation deinterlacing.
  8786. It needs one field per frame as input and must thus be used together
  8787. with yadif=1/3 or equivalent.
  8788. This filter accepts the following options:
  8789. @table @option
  8790. @item mode
  8791. Set the deinterlacing mode.
  8792. It accepts one of the following values:
  8793. @table @samp
  8794. @item fast
  8795. @item medium
  8796. @item slow
  8797. use iterative motion estimation
  8798. @item extra_slow
  8799. like @samp{slow}, but use multiple reference frames.
  8800. @end table
  8801. Default value is @samp{fast}.
  8802. @item parity
  8803. Set the picture field parity assumed for the input video. It must be
  8804. one of the following values:
  8805. @table @samp
  8806. @item 0, tff
  8807. assume top field first
  8808. @item 1, bff
  8809. assume bottom field first
  8810. @end table
  8811. Default value is @samp{bff}.
  8812. @item qp
  8813. Set per-block quantization parameter (QP) used by the internal
  8814. encoder.
  8815. Higher values should result in a smoother motion vector field but less
  8816. optimal individual vectors. Default value is 1.
  8817. @end table
  8818. @section mergeplanes
  8819. Merge color channel components from several video streams.
  8820. The filter accepts up to 4 input streams, and merge selected input
  8821. planes to the output video.
  8822. This filter accepts the following options:
  8823. @table @option
  8824. @item mapping
  8825. Set input to output plane mapping. Default is @code{0}.
  8826. The mappings is specified as a bitmap. It should be specified as a
  8827. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8828. mapping for the first plane of the output stream. 'A' sets the number of
  8829. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8830. corresponding input to use (from 0 to 3). The rest of the mappings is
  8831. similar, 'Bb' describes the mapping for the output stream second
  8832. plane, 'Cc' describes the mapping for the output stream third plane and
  8833. 'Dd' describes the mapping for the output stream fourth plane.
  8834. @item format
  8835. Set output pixel format. Default is @code{yuva444p}.
  8836. @end table
  8837. @subsection Examples
  8838. @itemize
  8839. @item
  8840. Merge three gray video streams of same width and height into single video stream:
  8841. @example
  8842. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8843. @end example
  8844. @item
  8845. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8846. @example
  8847. [a0][a1]mergeplanes=0x00010210:yuva444p
  8848. @end example
  8849. @item
  8850. Swap Y and A plane in yuva444p stream:
  8851. @example
  8852. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8853. @end example
  8854. @item
  8855. Swap U and V plane in yuv420p stream:
  8856. @example
  8857. format=yuv420p,mergeplanes=0x000201:yuv420p
  8858. @end example
  8859. @item
  8860. Cast a rgb24 clip to yuv444p:
  8861. @example
  8862. format=rgb24,mergeplanes=0x000102:yuv444p
  8863. @end example
  8864. @end itemize
  8865. @section mestimate
  8866. Estimate and export motion vectors using block matching algorithms.
  8867. Motion vectors are stored in frame side data to be used by other filters.
  8868. This filter accepts the following options:
  8869. @table @option
  8870. @item method
  8871. Specify the motion estimation method. Accepts one of the following values:
  8872. @table @samp
  8873. @item esa
  8874. Exhaustive search algorithm.
  8875. @item tss
  8876. Three step search algorithm.
  8877. @item tdls
  8878. Two dimensional logarithmic search algorithm.
  8879. @item ntss
  8880. New three step search algorithm.
  8881. @item fss
  8882. Four step search algorithm.
  8883. @item ds
  8884. Diamond search algorithm.
  8885. @item hexbs
  8886. Hexagon-based search algorithm.
  8887. @item epzs
  8888. Enhanced predictive zonal search algorithm.
  8889. @item umh
  8890. Uneven multi-hexagon search algorithm.
  8891. @end table
  8892. Default value is @samp{esa}.
  8893. @item mb_size
  8894. Macroblock size. Default @code{16}.
  8895. @item search_param
  8896. Search parameter. Default @code{7}.
  8897. @end table
  8898. @section midequalizer
  8899. Apply Midway Image Equalization effect using two video streams.
  8900. Midway Image Equalization adjusts a pair of images to have the same
  8901. histogram, while maintaining their dynamics as much as possible. It's
  8902. useful for e.g. matching exposures from a pair of stereo cameras.
  8903. This filter has two inputs and one output, which must be of same pixel format, but
  8904. may be of different sizes. The output of filter is first input adjusted with
  8905. midway histogram of both inputs.
  8906. This filter accepts the following option:
  8907. @table @option
  8908. @item planes
  8909. Set which planes to process. Default is @code{15}, which is all available planes.
  8910. @end table
  8911. @section minterpolate
  8912. Convert the video to specified frame rate using motion interpolation.
  8913. This filter accepts the following options:
  8914. @table @option
  8915. @item fps
  8916. 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}.
  8917. @item mi_mode
  8918. Motion interpolation mode. Following values are accepted:
  8919. @table @samp
  8920. @item dup
  8921. Duplicate previous or next frame for interpolating new ones.
  8922. @item blend
  8923. Blend source frames. Interpolated frame is mean of previous and next frames.
  8924. @item mci
  8925. Motion compensated interpolation. Following options are effective when this mode is selected:
  8926. @table @samp
  8927. @item mc_mode
  8928. Motion compensation mode. Following values are accepted:
  8929. @table @samp
  8930. @item obmc
  8931. Overlapped block motion compensation.
  8932. @item aobmc
  8933. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8934. @end table
  8935. Default mode is @samp{obmc}.
  8936. @item me_mode
  8937. Motion estimation mode. Following values are accepted:
  8938. @table @samp
  8939. @item bidir
  8940. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8941. @item bilat
  8942. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8943. @end table
  8944. Default mode is @samp{bilat}.
  8945. @item me
  8946. The algorithm to be used for motion estimation. Following values are accepted:
  8947. @table @samp
  8948. @item esa
  8949. Exhaustive search algorithm.
  8950. @item tss
  8951. Three step search algorithm.
  8952. @item tdls
  8953. Two dimensional logarithmic search algorithm.
  8954. @item ntss
  8955. New three step search algorithm.
  8956. @item fss
  8957. Four step search algorithm.
  8958. @item ds
  8959. Diamond search algorithm.
  8960. @item hexbs
  8961. Hexagon-based search algorithm.
  8962. @item epzs
  8963. Enhanced predictive zonal search algorithm.
  8964. @item umh
  8965. Uneven multi-hexagon search algorithm.
  8966. @end table
  8967. Default algorithm is @samp{epzs}.
  8968. @item mb_size
  8969. Macroblock size. Default @code{16}.
  8970. @item search_param
  8971. Motion estimation search parameter. Default @code{32}.
  8972. @item vsbmc
  8973. 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).
  8974. @end table
  8975. @end table
  8976. @item scd
  8977. 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:
  8978. @table @samp
  8979. @item none
  8980. Disable scene change detection.
  8981. @item fdiff
  8982. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8983. @end table
  8984. Default method is @samp{fdiff}.
  8985. @item scd_threshold
  8986. Scene change detection threshold. Default is @code{5.0}.
  8987. @end table
  8988. @section mix
  8989. Mix several video input streams into one video stream.
  8990. A description of the accepted options follows.
  8991. @table @option
  8992. @item nb_inputs
  8993. The number of inputs. If unspecified, it defaults to 2.
  8994. @item weights
  8995. Specify weight of each input video stream as sequence.
  8996. Each weight is separated by space. If number of weights
  8997. is smaller than number of @var{frames} last specified
  8998. weight will be used for all remaining unset weights.
  8999. @item scale
  9000. Specify scale, if it is set it will be multiplied with sum
  9001. of each weight multiplied with pixel values to give final destination
  9002. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9003. @item duration
  9004. Specify how end of stream is determined.
  9005. @table @samp
  9006. @item longest
  9007. The duration of the longest input. (default)
  9008. @item shortest
  9009. The duration of the shortest input.
  9010. @item first
  9011. The duration of the first input.
  9012. @end table
  9013. @end table
  9014. @section mpdecimate
  9015. Drop frames that do not differ greatly from the previous frame in
  9016. order to reduce frame rate.
  9017. The main use of this filter is for very-low-bitrate encoding
  9018. (e.g. streaming over dialup modem), but it could in theory be used for
  9019. fixing movies that were inverse-telecined incorrectly.
  9020. A description of the accepted options follows.
  9021. @table @option
  9022. @item max
  9023. Set the maximum number of consecutive frames which can be dropped (if
  9024. positive), or the minimum interval between dropped frames (if
  9025. negative). If the value is 0, the frame is dropped disregarding the
  9026. number of previous sequentially dropped frames.
  9027. Default value is 0.
  9028. @item hi
  9029. @item lo
  9030. @item frac
  9031. Set the dropping threshold values.
  9032. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9033. represent actual pixel value differences, so a threshold of 64
  9034. corresponds to 1 unit of difference for each pixel, or the same spread
  9035. out differently over the block.
  9036. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9037. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9038. meaning the whole image) differ by more than a threshold of @option{lo}.
  9039. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9040. 64*5, and default value for @option{frac} is 0.33.
  9041. @end table
  9042. @section negate
  9043. Negate (invert) the input video.
  9044. It accepts the following option:
  9045. @table @option
  9046. @item negate_alpha
  9047. With value 1, it negates the alpha component, if present. Default value is 0.
  9048. @end table
  9049. @anchor{nlmeans}
  9050. @section nlmeans
  9051. Denoise frames using Non-Local Means algorithm.
  9052. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9053. context similarity is defined by comparing their surrounding patches of size
  9054. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9055. around the pixel.
  9056. Note that the research area defines centers for patches, which means some
  9057. patches will be made of pixels outside that research area.
  9058. The filter accepts the following options.
  9059. @table @option
  9060. @item s
  9061. Set denoising strength.
  9062. @item p
  9063. Set patch size.
  9064. @item pc
  9065. Same as @option{p} but for chroma planes.
  9066. The default value is @var{0} and means automatic.
  9067. @item r
  9068. Set research size.
  9069. @item rc
  9070. Same as @option{r} but for chroma planes.
  9071. The default value is @var{0} and means automatic.
  9072. @end table
  9073. @section nnedi
  9074. Deinterlace video using neural network edge directed interpolation.
  9075. This filter accepts the following options:
  9076. @table @option
  9077. @item weights
  9078. Mandatory option, without binary file filter can not work.
  9079. Currently file can be found here:
  9080. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9081. @item deint
  9082. Set which frames to deinterlace, by default it is @code{all}.
  9083. Can be @code{all} or @code{interlaced}.
  9084. @item field
  9085. Set mode of operation.
  9086. Can be one of the following:
  9087. @table @samp
  9088. @item af
  9089. Use frame flags, both fields.
  9090. @item a
  9091. Use frame flags, single field.
  9092. @item t
  9093. Use top field only.
  9094. @item b
  9095. Use bottom field only.
  9096. @item tf
  9097. Use both fields, top first.
  9098. @item bf
  9099. Use both fields, bottom first.
  9100. @end table
  9101. @item planes
  9102. Set which planes to process, by default filter process all frames.
  9103. @item nsize
  9104. Set size of local neighborhood around each pixel, used by the predictor neural
  9105. network.
  9106. Can be one of the following:
  9107. @table @samp
  9108. @item s8x6
  9109. @item s16x6
  9110. @item s32x6
  9111. @item s48x6
  9112. @item s8x4
  9113. @item s16x4
  9114. @item s32x4
  9115. @end table
  9116. @item nns
  9117. Set the number of neurons in predictor neural network.
  9118. Can be one of the following:
  9119. @table @samp
  9120. @item n16
  9121. @item n32
  9122. @item n64
  9123. @item n128
  9124. @item n256
  9125. @end table
  9126. @item qual
  9127. Controls the number of different neural network predictions that are blended
  9128. together to compute the final output value. Can be @code{fast}, default or
  9129. @code{slow}.
  9130. @item etype
  9131. Set which set of weights to use in the predictor.
  9132. Can be one of the following:
  9133. @table @samp
  9134. @item a
  9135. weights trained to minimize absolute error
  9136. @item s
  9137. weights trained to minimize squared error
  9138. @end table
  9139. @item pscrn
  9140. Controls whether or not the prescreener neural network is used to decide
  9141. which pixels should be processed by the predictor neural network and which
  9142. can be handled by simple cubic interpolation.
  9143. The prescreener is trained to know whether cubic interpolation will be
  9144. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9145. The computational complexity of the prescreener nn is much less than that of
  9146. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9147. using the prescreener generally results in much faster processing.
  9148. The prescreener is pretty accurate, so the difference between using it and not
  9149. using it is almost always unnoticeable.
  9150. Can be one of the following:
  9151. @table @samp
  9152. @item none
  9153. @item original
  9154. @item new
  9155. @end table
  9156. Default is @code{new}.
  9157. @item fapprox
  9158. Set various debugging flags.
  9159. @end table
  9160. @section noformat
  9161. Force libavfilter not to use any of the specified pixel formats for the
  9162. input to the next filter.
  9163. It accepts the following parameters:
  9164. @table @option
  9165. @item pix_fmts
  9166. A '|'-separated list of pixel format names, such as
  9167. pix_fmts=yuv420p|monow|rgb24".
  9168. @end table
  9169. @subsection Examples
  9170. @itemize
  9171. @item
  9172. Force libavfilter to use a format different from @var{yuv420p} for the
  9173. input to the vflip filter:
  9174. @example
  9175. noformat=pix_fmts=yuv420p,vflip
  9176. @end example
  9177. @item
  9178. Convert the input video to any of the formats not contained in the list:
  9179. @example
  9180. noformat=yuv420p|yuv444p|yuv410p
  9181. @end example
  9182. @end itemize
  9183. @section noise
  9184. Add noise on video input frame.
  9185. The filter accepts the following options:
  9186. @table @option
  9187. @item all_seed
  9188. @item c0_seed
  9189. @item c1_seed
  9190. @item c2_seed
  9191. @item c3_seed
  9192. Set noise seed for specific pixel component or all pixel components in case
  9193. of @var{all_seed}. Default value is @code{123457}.
  9194. @item all_strength, alls
  9195. @item c0_strength, c0s
  9196. @item c1_strength, c1s
  9197. @item c2_strength, c2s
  9198. @item c3_strength, c3s
  9199. Set noise strength for specific pixel component or all pixel components in case
  9200. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9201. @item all_flags, allf
  9202. @item c0_flags, c0f
  9203. @item c1_flags, c1f
  9204. @item c2_flags, c2f
  9205. @item c3_flags, c3f
  9206. Set pixel component flags or set flags for all components if @var{all_flags}.
  9207. Available values for component flags are:
  9208. @table @samp
  9209. @item a
  9210. averaged temporal noise (smoother)
  9211. @item p
  9212. mix random noise with a (semi)regular pattern
  9213. @item t
  9214. temporal noise (noise pattern changes between frames)
  9215. @item u
  9216. uniform noise (gaussian otherwise)
  9217. @end table
  9218. @end table
  9219. @subsection Examples
  9220. Add temporal and uniform noise to input video:
  9221. @example
  9222. noise=alls=20:allf=t+u
  9223. @end example
  9224. @section normalize
  9225. Normalize RGB video (aka histogram stretching, contrast stretching).
  9226. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9227. For each channel of each frame, the filter computes the input range and maps
  9228. it linearly to the user-specified output range. The output range defaults
  9229. to the full dynamic range from pure black to pure white.
  9230. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9231. changes in brightness) caused when small dark or bright objects enter or leave
  9232. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9233. video camera, and, like a video camera, it may cause a period of over- or
  9234. under-exposure of the video.
  9235. The R,G,B channels can be normalized independently, which may cause some
  9236. color shifting, or linked together as a single channel, which prevents
  9237. color shifting. Linked normalization preserves hue. Independent normalization
  9238. does not, so it can be used to remove some color casts. Independent and linked
  9239. normalization can be combined in any ratio.
  9240. The normalize filter accepts the following options:
  9241. @table @option
  9242. @item blackpt
  9243. @item whitept
  9244. Colors which define the output range. The minimum input value is mapped to
  9245. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9246. The defaults are black and white respectively. Specifying white for
  9247. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9248. normalized video. Shades of grey can be used to reduce the dynamic range
  9249. (contrast). Specifying saturated colors here can create some interesting
  9250. effects.
  9251. @item smoothing
  9252. The number of previous frames to use for temporal smoothing. The input range
  9253. of each channel is smoothed using a rolling average over the current frame
  9254. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9255. smoothing).
  9256. @item independence
  9257. Controls the ratio of independent (color shifting) channel normalization to
  9258. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9259. independent. Defaults to 1.0 (fully independent).
  9260. @item strength
  9261. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9262. expensive no-op. Defaults to 1.0 (full strength).
  9263. @end table
  9264. @subsection Examples
  9265. Stretch video contrast to use the full dynamic range, with no temporal
  9266. smoothing; may flicker depending on the source content:
  9267. @example
  9268. normalize=blackpt=black:whitept=white:smoothing=0
  9269. @end example
  9270. As above, but with 50 frames of temporal smoothing; flicker should be
  9271. reduced, depending on the source content:
  9272. @example
  9273. normalize=blackpt=black:whitept=white:smoothing=50
  9274. @end example
  9275. As above, but with hue-preserving linked channel normalization:
  9276. @example
  9277. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9278. @end example
  9279. As above, but with half strength:
  9280. @example
  9281. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9282. @end example
  9283. Map the darkest input color to red, the brightest input color to cyan:
  9284. @example
  9285. normalize=blackpt=red:whitept=cyan
  9286. @end example
  9287. @section null
  9288. Pass the video source unchanged to the output.
  9289. @section ocr
  9290. Optical Character Recognition
  9291. This filter uses Tesseract for optical character recognition. To enable
  9292. compilation of this filter, you need to configure FFmpeg with
  9293. @code{--enable-libtesseract}.
  9294. It accepts the following options:
  9295. @table @option
  9296. @item datapath
  9297. Set datapath to tesseract data. Default is to use whatever was
  9298. set at installation.
  9299. @item language
  9300. Set language, default is "eng".
  9301. @item whitelist
  9302. Set character whitelist.
  9303. @item blacklist
  9304. Set character blacklist.
  9305. @end table
  9306. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9307. @section ocv
  9308. Apply a video transform using libopencv.
  9309. To enable this filter, install the libopencv library and headers and
  9310. configure FFmpeg with @code{--enable-libopencv}.
  9311. It accepts the following parameters:
  9312. @table @option
  9313. @item filter_name
  9314. The name of the libopencv filter to apply.
  9315. @item filter_params
  9316. The parameters to pass to the libopencv filter. If not specified, the default
  9317. values are assumed.
  9318. @end table
  9319. Refer to the official libopencv documentation for more precise
  9320. information:
  9321. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9322. Several libopencv filters are supported; see the following subsections.
  9323. @anchor{dilate}
  9324. @subsection dilate
  9325. Dilate an image by using a specific structuring element.
  9326. It corresponds to the libopencv function @code{cvDilate}.
  9327. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9328. @var{struct_el} represents a structuring element, and has the syntax:
  9329. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9330. @var{cols} and @var{rows} represent the number of columns and rows of
  9331. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9332. point, and @var{shape} the shape for the structuring element. @var{shape}
  9333. must be "rect", "cross", "ellipse", or "custom".
  9334. If the value for @var{shape} is "custom", it must be followed by a
  9335. string of the form "=@var{filename}". The file with name
  9336. @var{filename} is assumed to represent a binary image, with each
  9337. printable character corresponding to a bright pixel. When a custom
  9338. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9339. or columns and rows of the read file are assumed instead.
  9340. The default value for @var{struct_el} is "3x3+0x0/rect".
  9341. @var{nb_iterations} specifies the number of times the transform is
  9342. applied to the image, and defaults to 1.
  9343. Some examples:
  9344. @example
  9345. # Use the default values
  9346. ocv=dilate
  9347. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9348. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9349. # Read the shape from the file diamond.shape, iterating two times.
  9350. # The file diamond.shape may contain a pattern of characters like this
  9351. # *
  9352. # ***
  9353. # *****
  9354. # ***
  9355. # *
  9356. # The specified columns and rows are ignored
  9357. # but the anchor point coordinates are not
  9358. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9359. @end example
  9360. @subsection erode
  9361. Erode an image by using a specific structuring element.
  9362. It corresponds to the libopencv function @code{cvErode}.
  9363. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9364. with the same syntax and semantics as the @ref{dilate} filter.
  9365. @subsection smooth
  9366. Smooth the input video.
  9367. The filter takes the following parameters:
  9368. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9369. @var{type} is the type of smooth filter to apply, and must be one of
  9370. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9371. or "bilateral". The default value is "gaussian".
  9372. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9373. depend on the smooth type. @var{param1} and
  9374. @var{param2} accept integer positive values or 0. @var{param3} and
  9375. @var{param4} accept floating point values.
  9376. The default value for @var{param1} is 3. The default value for the
  9377. other parameters is 0.
  9378. These parameters correspond to the parameters assigned to the
  9379. libopencv function @code{cvSmooth}.
  9380. @section oscilloscope
  9381. 2D Video Oscilloscope.
  9382. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9383. It accepts the following parameters:
  9384. @table @option
  9385. @item x
  9386. Set scope center x position.
  9387. @item y
  9388. Set scope center y position.
  9389. @item s
  9390. Set scope size, relative to frame diagonal.
  9391. @item t
  9392. Set scope tilt/rotation.
  9393. @item o
  9394. Set trace opacity.
  9395. @item tx
  9396. Set trace center x position.
  9397. @item ty
  9398. Set trace center y position.
  9399. @item tw
  9400. Set trace width, relative to width of frame.
  9401. @item th
  9402. Set trace height, relative to height of frame.
  9403. @item c
  9404. Set which components to trace. By default it traces first three components.
  9405. @item g
  9406. Draw trace grid. By default is enabled.
  9407. @item st
  9408. Draw some statistics. By default is enabled.
  9409. @item sc
  9410. Draw scope. By default is enabled.
  9411. @end table
  9412. @subsection Examples
  9413. @itemize
  9414. @item
  9415. Inspect full first row of video frame.
  9416. @example
  9417. oscilloscope=x=0.5:y=0:s=1
  9418. @end example
  9419. @item
  9420. Inspect full last row of video frame.
  9421. @example
  9422. oscilloscope=x=0.5:y=1:s=1
  9423. @end example
  9424. @item
  9425. Inspect full 5th line of video frame of height 1080.
  9426. @example
  9427. oscilloscope=x=0.5:y=5/1080:s=1
  9428. @end example
  9429. @item
  9430. Inspect full last column of video frame.
  9431. @example
  9432. oscilloscope=x=1:y=0.5:s=1:t=1
  9433. @end example
  9434. @end itemize
  9435. @anchor{overlay}
  9436. @section overlay
  9437. Overlay one video on top of another.
  9438. It takes two inputs and has one output. The first input is the "main"
  9439. video on which the second input is overlaid.
  9440. It accepts the following parameters:
  9441. A description of the accepted options follows.
  9442. @table @option
  9443. @item x
  9444. @item y
  9445. Set the expression for the x and y coordinates of the overlaid video
  9446. on the main video. Default value is "0" for both expressions. In case
  9447. the expression is invalid, it is set to a huge value (meaning that the
  9448. overlay will not be displayed within the output visible area).
  9449. @item eof_action
  9450. See @ref{framesync}.
  9451. @item eval
  9452. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9453. It accepts the following values:
  9454. @table @samp
  9455. @item init
  9456. only evaluate expressions once during the filter initialization or
  9457. when a command is processed
  9458. @item frame
  9459. evaluate expressions for each incoming frame
  9460. @end table
  9461. Default value is @samp{frame}.
  9462. @item shortest
  9463. See @ref{framesync}.
  9464. @item format
  9465. Set the format for the output video.
  9466. It accepts the following values:
  9467. @table @samp
  9468. @item yuv420
  9469. force YUV420 output
  9470. @item yuv422
  9471. force YUV422 output
  9472. @item yuv444
  9473. force YUV444 output
  9474. @item rgb
  9475. force packed RGB output
  9476. @item gbrp
  9477. force planar RGB output
  9478. @item auto
  9479. automatically pick format
  9480. @end table
  9481. Default value is @samp{yuv420}.
  9482. @item repeatlast
  9483. See @ref{framesync}.
  9484. @item alpha
  9485. Set format of alpha of the overlaid video, it can be @var{straight} or
  9486. @var{premultiplied}. Default is @var{straight}.
  9487. @end table
  9488. The @option{x}, and @option{y} expressions can contain the following
  9489. parameters.
  9490. @table @option
  9491. @item main_w, W
  9492. @item main_h, H
  9493. The main input width and height.
  9494. @item overlay_w, w
  9495. @item overlay_h, h
  9496. The overlay input width and height.
  9497. @item x
  9498. @item y
  9499. The computed values for @var{x} and @var{y}. They are evaluated for
  9500. each new frame.
  9501. @item hsub
  9502. @item vsub
  9503. horizontal and vertical chroma subsample values of the output
  9504. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9505. @var{vsub} is 1.
  9506. @item n
  9507. the number of input frame, starting from 0
  9508. @item pos
  9509. the position in the file of the input frame, NAN if unknown
  9510. @item t
  9511. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9512. @end table
  9513. This filter also supports the @ref{framesync} options.
  9514. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9515. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9516. when @option{eval} is set to @samp{init}.
  9517. Be aware that frames are taken from each input video in timestamp
  9518. order, hence, if their initial timestamps differ, it is a good idea
  9519. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9520. have them begin in the same zero timestamp, as the example for
  9521. the @var{movie} filter does.
  9522. You can chain together more overlays but you should test the
  9523. efficiency of such approach.
  9524. @subsection Commands
  9525. This filter supports the following commands:
  9526. @table @option
  9527. @item x
  9528. @item y
  9529. Modify the x and y of the overlay input.
  9530. The command accepts the same syntax of the corresponding option.
  9531. If the specified expression is not valid, it is kept at its current
  9532. value.
  9533. @end table
  9534. @subsection Examples
  9535. @itemize
  9536. @item
  9537. Draw the overlay at 10 pixels from the bottom right corner of the main
  9538. video:
  9539. @example
  9540. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9541. @end example
  9542. Using named options the example above becomes:
  9543. @example
  9544. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9545. @end example
  9546. @item
  9547. Insert a transparent PNG logo in the bottom left corner of the input,
  9548. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9549. @example
  9550. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9551. @end example
  9552. @item
  9553. Insert 2 different transparent PNG logos (second logo on bottom
  9554. right corner) using the @command{ffmpeg} tool:
  9555. @example
  9556. 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
  9557. @end example
  9558. @item
  9559. Add a transparent color layer on top of the main video; @code{WxH}
  9560. must specify the size of the main input to the overlay filter:
  9561. @example
  9562. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9563. @end example
  9564. @item
  9565. Play an original video and a filtered version (here with the deshake
  9566. filter) side by side using the @command{ffplay} tool:
  9567. @example
  9568. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9569. @end example
  9570. The above command is the same as:
  9571. @example
  9572. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9573. @end example
  9574. @item
  9575. Make a sliding overlay appearing from the left to the right top part of the
  9576. screen starting since time 2:
  9577. @example
  9578. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9579. @end example
  9580. @item
  9581. Compose output by putting two input videos side to side:
  9582. @example
  9583. ffmpeg -i left.avi -i right.avi -filter_complex "
  9584. nullsrc=size=200x100 [background];
  9585. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9586. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9587. [background][left] overlay=shortest=1 [background+left];
  9588. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9589. "
  9590. @end example
  9591. @item
  9592. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9593. @example
  9594. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9595. -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]'
  9596. masked.avi
  9597. @end example
  9598. @item
  9599. Chain several overlays in cascade:
  9600. @example
  9601. nullsrc=s=200x200 [bg];
  9602. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9603. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9604. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9605. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9606. [in3] null, [mid2] overlay=100:100 [out0]
  9607. @end example
  9608. @end itemize
  9609. @section owdenoise
  9610. Apply Overcomplete Wavelet denoiser.
  9611. The filter accepts the following options:
  9612. @table @option
  9613. @item depth
  9614. Set depth.
  9615. Larger depth values will denoise lower frequency components more, but
  9616. slow down filtering.
  9617. Must be an int in the range 8-16, default is @code{8}.
  9618. @item luma_strength, ls
  9619. Set luma strength.
  9620. Must be a double value in the range 0-1000, default is @code{1.0}.
  9621. @item chroma_strength, cs
  9622. Set chroma strength.
  9623. Must be a double value in the range 0-1000, default is @code{1.0}.
  9624. @end table
  9625. @anchor{pad}
  9626. @section pad
  9627. Add paddings to the input image, and place the original input at the
  9628. provided @var{x}, @var{y} coordinates.
  9629. It accepts the following parameters:
  9630. @table @option
  9631. @item width, w
  9632. @item height, h
  9633. Specify an expression for the size of the output image with the
  9634. paddings added. If the value for @var{width} or @var{height} is 0, the
  9635. corresponding input size is used for the output.
  9636. The @var{width} expression can reference the value set by the
  9637. @var{height} expression, and vice versa.
  9638. The default value of @var{width} and @var{height} is 0.
  9639. @item x
  9640. @item y
  9641. Specify the offsets to place the input image at within the padded area,
  9642. with respect to the top/left border of the output image.
  9643. The @var{x} expression can reference the value set by the @var{y}
  9644. expression, and vice versa.
  9645. The default value of @var{x} and @var{y} is 0.
  9646. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9647. so the input image is centered on the padded area.
  9648. @item color
  9649. Specify the color of the padded area. For the syntax of this option,
  9650. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9651. manual,ffmpeg-utils}.
  9652. The default value of @var{color} is "black".
  9653. @item eval
  9654. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9655. It accepts the following values:
  9656. @table @samp
  9657. @item init
  9658. Only evaluate expressions once during the filter initialization or when
  9659. a command is processed.
  9660. @item frame
  9661. Evaluate expressions for each incoming frame.
  9662. @end table
  9663. Default value is @samp{init}.
  9664. @item aspect
  9665. Pad to aspect instead to a resolution.
  9666. @end table
  9667. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9668. options are expressions containing the following constants:
  9669. @table @option
  9670. @item in_w
  9671. @item in_h
  9672. The input video width and height.
  9673. @item iw
  9674. @item ih
  9675. These are the same as @var{in_w} and @var{in_h}.
  9676. @item out_w
  9677. @item out_h
  9678. The output width and height (the size of the padded area), as
  9679. specified by the @var{width} and @var{height} expressions.
  9680. @item ow
  9681. @item oh
  9682. These are the same as @var{out_w} and @var{out_h}.
  9683. @item x
  9684. @item y
  9685. The x and y offsets as specified by the @var{x} and @var{y}
  9686. expressions, or NAN if not yet specified.
  9687. @item a
  9688. same as @var{iw} / @var{ih}
  9689. @item sar
  9690. input sample aspect ratio
  9691. @item dar
  9692. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9693. @item hsub
  9694. @item vsub
  9695. The horizontal and vertical chroma subsample values. For example for the
  9696. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9697. @end table
  9698. @subsection Examples
  9699. @itemize
  9700. @item
  9701. Add paddings with the color "violet" to the input video. The output video
  9702. size is 640x480, and the top-left corner of the input video is placed at
  9703. column 0, row 40
  9704. @example
  9705. pad=640:480:0:40:violet
  9706. @end example
  9707. The example above is equivalent to the following command:
  9708. @example
  9709. pad=width=640:height=480:x=0:y=40:color=violet
  9710. @end example
  9711. @item
  9712. Pad the input to get an output with dimensions increased by 3/2,
  9713. and put the input video at the center of the padded area:
  9714. @example
  9715. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9716. @end example
  9717. @item
  9718. Pad the input to get a squared output with size equal to the maximum
  9719. value between the input width and height, and put the input video at
  9720. the center of the padded area:
  9721. @example
  9722. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9723. @end example
  9724. @item
  9725. Pad the input to get a final w/h ratio of 16:9:
  9726. @example
  9727. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9728. @end example
  9729. @item
  9730. In case of anamorphic video, in order to set the output display aspect
  9731. correctly, it is necessary to use @var{sar} in the expression,
  9732. according to the relation:
  9733. @example
  9734. (ih * X / ih) * sar = output_dar
  9735. X = output_dar / sar
  9736. @end example
  9737. Thus the previous example needs to be modified to:
  9738. @example
  9739. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9740. @end example
  9741. @item
  9742. Double the output size and put the input video in the bottom-right
  9743. corner of the output padded area:
  9744. @example
  9745. pad="2*iw:2*ih:ow-iw:oh-ih"
  9746. @end example
  9747. @end itemize
  9748. @anchor{palettegen}
  9749. @section palettegen
  9750. Generate one palette for a whole video stream.
  9751. It accepts the following options:
  9752. @table @option
  9753. @item max_colors
  9754. Set the maximum number of colors to quantize in the palette.
  9755. Note: the palette will still contain 256 colors; the unused palette entries
  9756. will be black.
  9757. @item reserve_transparent
  9758. Create a palette of 255 colors maximum and reserve the last one for
  9759. transparency. Reserving the transparency color is useful for GIF optimization.
  9760. If not set, the maximum of colors in the palette will be 256. You probably want
  9761. to disable this option for a standalone image.
  9762. Set by default.
  9763. @item transparency_color
  9764. Set the color that will be used as background for transparency.
  9765. @item stats_mode
  9766. Set statistics mode.
  9767. It accepts the following values:
  9768. @table @samp
  9769. @item full
  9770. Compute full frame histograms.
  9771. @item diff
  9772. Compute histograms only for the part that differs from previous frame. This
  9773. might be relevant to give more importance to the moving part of your input if
  9774. the background is static.
  9775. @item single
  9776. Compute new histogram for each frame.
  9777. @end table
  9778. Default value is @var{full}.
  9779. @end table
  9780. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9781. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9782. color quantization of the palette. This information is also visible at
  9783. @var{info} logging level.
  9784. @subsection Examples
  9785. @itemize
  9786. @item
  9787. Generate a representative palette of a given video using @command{ffmpeg}:
  9788. @example
  9789. ffmpeg -i input.mkv -vf palettegen palette.png
  9790. @end example
  9791. @end itemize
  9792. @section paletteuse
  9793. Use a palette to downsample an input video stream.
  9794. The filter takes two inputs: one video stream and a palette. The palette must
  9795. be a 256 pixels image.
  9796. It accepts the following options:
  9797. @table @option
  9798. @item dither
  9799. Select dithering mode. Available algorithms are:
  9800. @table @samp
  9801. @item bayer
  9802. Ordered 8x8 bayer dithering (deterministic)
  9803. @item heckbert
  9804. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9805. Note: this dithering is sometimes considered "wrong" and is included as a
  9806. reference.
  9807. @item floyd_steinberg
  9808. Floyd and Steingberg dithering (error diffusion)
  9809. @item sierra2
  9810. Frankie Sierra dithering v2 (error diffusion)
  9811. @item sierra2_4a
  9812. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9813. @end table
  9814. Default is @var{sierra2_4a}.
  9815. @item bayer_scale
  9816. When @var{bayer} dithering is selected, this option defines the scale of the
  9817. pattern (how much the crosshatch pattern is visible). A low value means more
  9818. visible pattern for less banding, and higher value means less visible pattern
  9819. at the cost of more banding.
  9820. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9821. @item diff_mode
  9822. If set, define the zone to process
  9823. @table @samp
  9824. @item rectangle
  9825. Only the changing rectangle will be reprocessed. This is similar to GIF
  9826. cropping/offsetting compression mechanism. This option can be useful for speed
  9827. if only a part of the image is changing, and has use cases such as limiting the
  9828. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9829. moving scene (it leads to more deterministic output if the scene doesn't change
  9830. much, and as a result less moving noise and better GIF compression).
  9831. @end table
  9832. Default is @var{none}.
  9833. @item new
  9834. Take new palette for each output frame.
  9835. @item alpha_threshold
  9836. Sets the alpha threshold for transparency. Alpha values above this threshold
  9837. will be treated as completely opaque, and values below this threshold will be
  9838. treated as completely transparent.
  9839. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9840. @end table
  9841. @subsection Examples
  9842. @itemize
  9843. @item
  9844. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9845. using @command{ffmpeg}:
  9846. @example
  9847. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9848. @end example
  9849. @end itemize
  9850. @section perspective
  9851. Correct perspective of video not recorded perpendicular to the screen.
  9852. A description of the accepted parameters follows.
  9853. @table @option
  9854. @item x0
  9855. @item y0
  9856. @item x1
  9857. @item y1
  9858. @item x2
  9859. @item y2
  9860. @item x3
  9861. @item y3
  9862. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9863. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9864. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9865. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9866. then the corners of the source will be sent to the specified coordinates.
  9867. The expressions can use the following variables:
  9868. @table @option
  9869. @item W
  9870. @item H
  9871. the width and height of video frame.
  9872. @item in
  9873. Input frame count.
  9874. @item on
  9875. Output frame count.
  9876. @end table
  9877. @item interpolation
  9878. Set interpolation for perspective correction.
  9879. It accepts the following values:
  9880. @table @samp
  9881. @item linear
  9882. @item cubic
  9883. @end table
  9884. Default value is @samp{linear}.
  9885. @item sense
  9886. Set interpretation of coordinate options.
  9887. It accepts the following values:
  9888. @table @samp
  9889. @item 0, source
  9890. Send point in the source specified by the given coordinates to
  9891. the corners of the destination.
  9892. @item 1, destination
  9893. Send the corners of the source to the point in the destination specified
  9894. by the given coordinates.
  9895. Default value is @samp{source}.
  9896. @end table
  9897. @item eval
  9898. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9899. It accepts the following values:
  9900. @table @samp
  9901. @item init
  9902. only evaluate expressions once during the filter initialization or
  9903. when a command is processed
  9904. @item frame
  9905. evaluate expressions for each incoming frame
  9906. @end table
  9907. Default value is @samp{init}.
  9908. @end table
  9909. @section phase
  9910. Delay interlaced video by one field time so that the field order changes.
  9911. The intended use is to fix PAL movies that have been captured with the
  9912. opposite field order to the film-to-video transfer.
  9913. A description of the accepted parameters follows.
  9914. @table @option
  9915. @item mode
  9916. Set phase mode.
  9917. It accepts the following values:
  9918. @table @samp
  9919. @item t
  9920. Capture field order top-first, transfer bottom-first.
  9921. Filter will delay the bottom field.
  9922. @item b
  9923. Capture field order bottom-first, transfer top-first.
  9924. Filter will delay the top field.
  9925. @item p
  9926. Capture and transfer with the same field order. This mode only exists
  9927. for the documentation of the other options to refer to, but if you
  9928. actually select it, the filter will faithfully do nothing.
  9929. @item a
  9930. Capture field order determined automatically by field flags, transfer
  9931. opposite.
  9932. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9933. basis using field flags. If no field information is available,
  9934. then this works just like @samp{u}.
  9935. @item u
  9936. Capture unknown or varying, transfer opposite.
  9937. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9938. analyzing the images and selecting the alternative that produces best
  9939. match between the fields.
  9940. @item T
  9941. Capture top-first, transfer unknown or varying.
  9942. Filter selects among @samp{t} and @samp{p} using image analysis.
  9943. @item B
  9944. Capture bottom-first, transfer unknown or varying.
  9945. Filter selects among @samp{b} and @samp{p} using image analysis.
  9946. @item A
  9947. Capture determined by field flags, transfer unknown or varying.
  9948. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9949. image analysis. If no field information is available, then this works just
  9950. like @samp{U}. This is the default mode.
  9951. @item U
  9952. Both capture and transfer unknown or varying.
  9953. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9954. @end table
  9955. @end table
  9956. @section pixdesctest
  9957. Pixel format descriptor test filter, mainly useful for internal
  9958. testing. The output video should be equal to the input video.
  9959. For example:
  9960. @example
  9961. format=monow, pixdesctest
  9962. @end example
  9963. can be used to test the monowhite pixel format descriptor definition.
  9964. @section pixscope
  9965. Display sample values of color channels. Mainly useful for checking color
  9966. and levels. Minimum supported resolution is 640x480.
  9967. The filters accept the following options:
  9968. @table @option
  9969. @item x
  9970. Set scope X position, relative offset on X axis.
  9971. @item y
  9972. Set scope Y position, relative offset on Y axis.
  9973. @item w
  9974. Set scope width.
  9975. @item h
  9976. Set scope height.
  9977. @item o
  9978. Set window opacity. This window also holds statistics about pixel area.
  9979. @item wx
  9980. Set window X position, relative offset on X axis.
  9981. @item wy
  9982. Set window Y position, relative offset on Y axis.
  9983. @end table
  9984. @section pp
  9985. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9986. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9987. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9988. Each subfilter and some options have a short and a long name that can be used
  9989. interchangeably, i.e. dr/dering are the same.
  9990. The filters accept the following options:
  9991. @table @option
  9992. @item subfilters
  9993. Set postprocessing subfilters string.
  9994. @end table
  9995. All subfilters share common options to determine their scope:
  9996. @table @option
  9997. @item a/autoq
  9998. Honor the quality commands for this subfilter.
  9999. @item c/chrom
  10000. Do chrominance filtering, too (default).
  10001. @item y/nochrom
  10002. Do luminance filtering only (no chrominance).
  10003. @item n/noluma
  10004. Do chrominance filtering only (no luminance).
  10005. @end table
  10006. These options can be appended after the subfilter name, separated by a '|'.
  10007. Available subfilters are:
  10008. @table @option
  10009. @item hb/hdeblock[|difference[|flatness]]
  10010. Horizontal deblocking filter
  10011. @table @option
  10012. @item difference
  10013. Difference factor where higher values mean more deblocking (default: @code{32}).
  10014. @item flatness
  10015. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10016. @end table
  10017. @item vb/vdeblock[|difference[|flatness]]
  10018. Vertical deblocking filter
  10019. @table @option
  10020. @item difference
  10021. Difference factor where higher values mean more deblocking (default: @code{32}).
  10022. @item flatness
  10023. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10024. @end table
  10025. @item ha/hadeblock[|difference[|flatness]]
  10026. Accurate horizontal deblocking filter
  10027. @table @option
  10028. @item difference
  10029. Difference factor where higher values mean more deblocking (default: @code{32}).
  10030. @item flatness
  10031. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10032. @end table
  10033. @item va/vadeblock[|difference[|flatness]]
  10034. Accurate vertical deblocking filter
  10035. @table @option
  10036. @item difference
  10037. Difference factor where higher values mean more deblocking (default: @code{32}).
  10038. @item flatness
  10039. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10040. @end table
  10041. @end table
  10042. The horizontal and vertical deblocking filters share the difference and
  10043. flatness values so you cannot set different horizontal and vertical
  10044. thresholds.
  10045. @table @option
  10046. @item h1/x1hdeblock
  10047. Experimental horizontal deblocking filter
  10048. @item v1/x1vdeblock
  10049. Experimental vertical deblocking filter
  10050. @item dr/dering
  10051. Deringing filter
  10052. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10053. @table @option
  10054. @item threshold1
  10055. larger -> stronger filtering
  10056. @item threshold2
  10057. larger -> stronger filtering
  10058. @item threshold3
  10059. larger -> stronger filtering
  10060. @end table
  10061. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10062. @table @option
  10063. @item f/fullyrange
  10064. Stretch luminance to @code{0-255}.
  10065. @end table
  10066. @item lb/linblenddeint
  10067. Linear blend deinterlacing filter that deinterlaces the given block by
  10068. filtering all lines with a @code{(1 2 1)} filter.
  10069. @item li/linipoldeint
  10070. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10071. linearly interpolating every second line.
  10072. @item ci/cubicipoldeint
  10073. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10074. cubically interpolating every second line.
  10075. @item md/mediandeint
  10076. Median deinterlacing filter that deinterlaces the given block by applying a
  10077. median filter to every second line.
  10078. @item fd/ffmpegdeint
  10079. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10080. second line with a @code{(-1 4 2 4 -1)} filter.
  10081. @item l5/lowpass5
  10082. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10083. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10084. @item fq/forceQuant[|quantizer]
  10085. Overrides the quantizer table from the input with the constant quantizer you
  10086. specify.
  10087. @table @option
  10088. @item quantizer
  10089. Quantizer to use
  10090. @end table
  10091. @item de/default
  10092. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10093. @item fa/fast
  10094. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10095. @item ac
  10096. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10097. @end table
  10098. @subsection Examples
  10099. @itemize
  10100. @item
  10101. Apply horizontal and vertical deblocking, deringing and automatic
  10102. brightness/contrast:
  10103. @example
  10104. pp=hb/vb/dr/al
  10105. @end example
  10106. @item
  10107. Apply default filters without brightness/contrast correction:
  10108. @example
  10109. pp=de/-al
  10110. @end example
  10111. @item
  10112. Apply default filters and temporal denoiser:
  10113. @example
  10114. pp=default/tmpnoise|1|2|3
  10115. @end example
  10116. @item
  10117. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10118. automatically depending on available CPU time:
  10119. @example
  10120. pp=hb|y/vb|a
  10121. @end example
  10122. @end itemize
  10123. @section pp7
  10124. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10125. similar to spp = 6 with 7 point DCT, where only the center sample is
  10126. used after IDCT.
  10127. The filter accepts the following options:
  10128. @table @option
  10129. @item qp
  10130. Force a constant quantization parameter. It accepts an integer in range
  10131. 0 to 63. If not set, the filter will use the QP from the video stream
  10132. (if available).
  10133. @item mode
  10134. Set thresholding mode. Available modes are:
  10135. @table @samp
  10136. @item hard
  10137. Set hard thresholding.
  10138. @item soft
  10139. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10140. @item medium
  10141. Set medium thresholding (good results, default).
  10142. @end table
  10143. @end table
  10144. @section premultiply
  10145. Apply alpha premultiply effect to input video stream using first plane
  10146. of second stream as alpha.
  10147. Both streams must have same dimensions and same pixel format.
  10148. The filter accepts the following option:
  10149. @table @option
  10150. @item planes
  10151. Set which planes will be processed, unprocessed planes will be copied.
  10152. By default value 0xf, all planes will be processed.
  10153. @item inplace
  10154. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10155. @end table
  10156. @section prewitt
  10157. Apply prewitt operator to input video stream.
  10158. The filter accepts the following option:
  10159. @table @option
  10160. @item planes
  10161. Set which planes will be processed, unprocessed planes will be copied.
  10162. By default value 0xf, all planes will be processed.
  10163. @item scale
  10164. Set value which will be multiplied with filtered result.
  10165. @item delta
  10166. Set value which will be added to filtered result.
  10167. @end table
  10168. @anchor{program_opencl}
  10169. @section program_opencl
  10170. Filter video using an OpenCL program.
  10171. @table @option
  10172. @item source
  10173. OpenCL program source file.
  10174. @item kernel
  10175. Kernel name in program.
  10176. @item inputs
  10177. Number of inputs to the filter. Defaults to 1.
  10178. @item size, s
  10179. Size of output frames. Defaults to the same as the first input.
  10180. @end table
  10181. The program source file must contain a kernel function with the given name,
  10182. which will be run once for each plane of the output. Each run on a plane
  10183. gets enqueued as a separate 2D global NDRange with one work-item for each
  10184. pixel to be generated. The global ID offset for each work-item is therefore
  10185. the coordinates of a pixel in the destination image.
  10186. The kernel function needs to take the following arguments:
  10187. @itemize
  10188. @item
  10189. Destination image, @var{__write_only image2d_t}.
  10190. This image will become the output; the kernel should write all of it.
  10191. @item
  10192. Frame index, @var{unsigned int}.
  10193. This is a counter starting from zero and increasing by one for each frame.
  10194. @item
  10195. Source images, @var{__read_only image2d_t}.
  10196. These are the most recent images on each input. The kernel may read from
  10197. them to generate the output, but they can't be written to.
  10198. @end itemize
  10199. Example programs:
  10200. @itemize
  10201. @item
  10202. Copy the input to the output (output must be the same size as the input).
  10203. @verbatim
  10204. __kernel void copy(__write_only image2d_t destination,
  10205. unsigned int index,
  10206. __read_only image2d_t source)
  10207. {
  10208. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10209. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10210. float4 value = read_imagef(source, sampler, location);
  10211. write_imagef(destination, location, value);
  10212. }
  10213. @end verbatim
  10214. @item
  10215. Apply a simple transformation, rotating the input by an amount increasing
  10216. with the index counter. Pixel values are linearly interpolated by the
  10217. sampler, and the output need not have the same dimensions as the input.
  10218. @verbatim
  10219. __kernel void rotate_image(__write_only image2d_t dst,
  10220. unsigned int index,
  10221. __read_only image2d_t src)
  10222. {
  10223. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10224. CLK_FILTER_LINEAR);
  10225. float angle = (float)index / 100.0f;
  10226. float2 dst_dim = convert_float2(get_image_dim(dst));
  10227. float2 src_dim = convert_float2(get_image_dim(src));
  10228. float2 dst_cen = dst_dim / 2.0f;
  10229. float2 src_cen = src_dim / 2.0f;
  10230. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10231. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10232. float2 src_pos = {
  10233. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10234. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10235. };
  10236. src_pos = src_pos * src_dim / dst_dim;
  10237. float2 src_loc = src_pos + src_cen;
  10238. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10239. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10240. write_imagef(dst, dst_loc, 0.5f);
  10241. else
  10242. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10243. }
  10244. @end verbatim
  10245. @item
  10246. Blend two inputs together, with the amount of each input used varying
  10247. with the index counter.
  10248. @verbatim
  10249. __kernel void blend_images(__write_only image2d_t dst,
  10250. unsigned int index,
  10251. __read_only image2d_t src1,
  10252. __read_only image2d_t src2)
  10253. {
  10254. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10255. CLK_FILTER_LINEAR);
  10256. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10257. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10258. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10259. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10260. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10261. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10262. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10263. }
  10264. @end verbatim
  10265. @end itemize
  10266. @section pseudocolor
  10267. Alter frame colors in video with pseudocolors.
  10268. This filter accept the following options:
  10269. @table @option
  10270. @item c0
  10271. set pixel first component expression
  10272. @item c1
  10273. set pixel second component expression
  10274. @item c2
  10275. set pixel third component expression
  10276. @item c3
  10277. set pixel fourth component expression, corresponds to the alpha component
  10278. @item i
  10279. set component to use as base for altering colors
  10280. @end table
  10281. Each of them specifies the expression to use for computing the lookup table for
  10282. the corresponding pixel component values.
  10283. The expressions can contain the following constants and functions:
  10284. @table @option
  10285. @item w
  10286. @item h
  10287. The input width and height.
  10288. @item val
  10289. The input value for the pixel component.
  10290. @item ymin, umin, vmin, amin
  10291. The minimum allowed component value.
  10292. @item ymax, umax, vmax, amax
  10293. The maximum allowed component value.
  10294. @end table
  10295. All expressions default to "val".
  10296. @subsection Examples
  10297. @itemize
  10298. @item
  10299. Change too high luma values to gradient:
  10300. @example
  10301. 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'"
  10302. @end example
  10303. @end itemize
  10304. @section psnr
  10305. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10306. Ratio) between two input videos.
  10307. This filter takes in input two input videos, the first input is
  10308. considered the "main" source and is passed unchanged to the
  10309. output. The second input is used as a "reference" video for computing
  10310. the PSNR.
  10311. Both video inputs must have the same resolution and pixel format for
  10312. this filter to work correctly. Also it assumes that both inputs
  10313. have the same number of frames, which are compared one by one.
  10314. The obtained average PSNR is printed through the logging system.
  10315. The filter stores the accumulated MSE (mean squared error) of each
  10316. frame, and at the end of the processing it is averaged across all frames
  10317. equally, and the following formula is applied to obtain the PSNR:
  10318. @example
  10319. PSNR = 10*log10(MAX^2/MSE)
  10320. @end example
  10321. Where MAX is the average of the maximum values of each component of the
  10322. image.
  10323. The description of the accepted parameters follows.
  10324. @table @option
  10325. @item stats_file, f
  10326. If specified the filter will use the named file to save the PSNR of
  10327. each individual frame. When filename equals "-" the data is sent to
  10328. standard output.
  10329. @item stats_version
  10330. Specifies which version of the stats file format to use. Details of
  10331. each format are written below.
  10332. Default value is 1.
  10333. @item stats_add_max
  10334. Determines whether the max value is output to the stats log.
  10335. Default value is 0.
  10336. Requires stats_version >= 2. If this is set and stats_version < 2,
  10337. the filter will return an error.
  10338. @end table
  10339. This filter also supports the @ref{framesync} options.
  10340. The file printed if @var{stats_file} is selected, contains a sequence of
  10341. key/value pairs of the form @var{key}:@var{value} for each compared
  10342. couple of frames.
  10343. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10344. the list of per-frame-pair stats, with key value pairs following the frame
  10345. format with the following parameters:
  10346. @table @option
  10347. @item psnr_log_version
  10348. The version of the log file format. Will match @var{stats_version}.
  10349. @item fields
  10350. A comma separated list of the per-frame-pair parameters included in
  10351. the log.
  10352. @end table
  10353. A description of each shown per-frame-pair parameter follows:
  10354. @table @option
  10355. @item n
  10356. sequential number of the input frame, starting from 1
  10357. @item mse_avg
  10358. Mean Square Error pixel-by-pixel average difference of the compared
  10359. frames, averaged over all the image components.
  10360. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10361. Mean Square Error pixel-by-pixel average difference of the compared
  10362. frames for the component specified by the suffix.
  10363. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10364. Peak Signal to Noise ratio of the compared frames for the component
  10365. specified by the suffix.
  10366. @item max_avg, max_y, max_u, max_v
  10367. Maximum allowed value for each channel, and average over all
  10368. channels.
  10369. @end table
  10370. For example:
  10371. @example
  10372. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10373. [main][ref] psnr="stats_file=stats.log" [out]
  10374. @end example
  10375. On this example the input file being processed is compared with the
  10376. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10377. is stored in @file{stats.log}.
  10378. @anchor{pullup}
  10379. @section pullup
  10380. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10381. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10382. content.
  10383. The pullup filter is designed to take advantage of future context in making
  10384. its decisions. This filter is stateless in the sense that it does not lock
  10385. onto a pattern to follow, but it instead looks forward to the following
  10386. fields in order to identify matches and rebuild progressive frames.
  10387. To produce content with an even framerate, insert the fps filter after
  10388. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10389. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10390. The filter accepts the following options:
  10391. @table @option
  10392. @item jl
  10393. @item jr
  10394. @item jt
  10395. @item jb
  10396. These options set the amount of "junk" to ignore at the left, right, top, and
  10397. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10398. while top and bottom are in units of 2 lines.
  10399. The default is 8 pixels on each side.
  10400. @item sb
  10401. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10402. filter generating an occasional mismatched frame, but it may also cause an
  10403. excessive number of frames to be dropped during high motion sequences.
  10404. Conversely, setting it to -1 will make filter match fields more easily.
  10405. This may help processing of video where there is slight blurring between
  10406. the fields, but may also cause there to be interlaced frames in the output.
  10407. Default value is @code{0}.
  10408. @item mp
  10409. Set the metric plane to use. It accepts the following values:
  10410. @table @samp
  10411. @item l
  10412. Use luma plane.
  10413. @item u
  10414. Use chroma blue plane.
  10415. @item v
  10416. Use chroma red plane.
  10417. @end table
  10418. This option may be set to use chroma plane instead of the default luma plane
  10419. for doing filter's computations. This may improve accuracy on very clean
  10420. source material, but more likely will decrease accuracy, especially if there
  10421. is chroma noise (rainbow effect) or any grayscale video.
  10422. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10423. load and make pullup usable in realtime on slow machines.
  10424. @end table
  10425. For best results (without duplicated frames in the output file) it is
  10426. necessary to change the output frame rate. For example, to inverse
  10427. telecine NTSC input:
  10428. @example
  10429. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10430. @end example
  10431. @section qp
  10432. Change video quantization parameters (QP).
  10433. The filter accepts the following option:
  10434. @table @option
  10435. @item qp
  10436. Set expression for quantization parameter.
  10437. @end table
  10438. The expression is evaluated through the eval API and can contain, among others,
  10439. the following constants:
  10440. @table @var
  10441. @item known
  10442. 1 if index is not 129, 0 otherwise.
  10443. @item qp
  10444. Sequential index starting from -129 to 128.
  10445. @end table
  10446. @subsection Examples
  10447. @itemize
  10448. @item
  10449. Some equation like:
  10450. @example
  10451. qp=2+2*sin(PI*qp)
  10452. @end example
  10453. @end itemize
  10454. @section random
  10455. Flush video frames from internal cache of frames into a random order.
  10456. No frame is discarded.
  10457. Inspired by @ref{frei0r} nervous filter.
  10458. @table @option
  10459. @item frames
  10460. Set size in number of frames of internal cache, in range from @code{2} to
  10461. @code{512}. Default is @code{30}.
  10462. @item seed
  10463. Set seed for random number generator, must be an integer included between
  10464. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10465. less than @code{0}, the filter will try to use a good random seed on a
  10466. best effort basis.
  10467. @end table
  10468. @section readeia608
  10469. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10470. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10471. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10472. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10473. @table @option
  10474. @item lavfi.readeia608.X.cc
  10475. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10476. @item lavfi.readeia608.X.line
  10477. The number of the line on which the EIA-608 data was identified and read.
  10478. @end table
  10479. This filter accepts the following options:
  10480. @table @option
  10481. @item scan_min
  10482. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10483. @item scan_max
  10484. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10485. @item mac
  10486. Set minimal acceptable amplitude change for sync codes detection.
  10487. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10488. @item spw
  10489. Set the ratio of width reserved for sync code detection.
  10490. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10491. @item mhd
  10492. Set the max peaks height difference for sync code detection.
  10493. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10494. @item mpd
  10495. Set max peaks period difference for sync code detection.
  10496. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10497. @item msd
  10498. Set the first two max start code bits differences.
  10499. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10500. @item bhd
  10501. Set the minimum ratio of bits height compared to 3rd start code bit.
  10502. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10503. @item th_w
  10504. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10505. @item th_b
  10506. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10507. @item chp
  10508. Enable checking the parity bit. In the event of a parity error, the filter will output
  10509. @code{0x00} for that character. Default is false.
  10510. @end table
  10511. @subsection Examples
  10512. @itemize
  10513. @item
  10514. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10515. @example
  10516. 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
  10517. @end example
  10518. @end itemize
  10519. @section readvitc
  10520. Read vertical interval timecode (VITC) information from the top lines of a
  10521. video frame.
  10522. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10523. timecode value, if a valid timecode has been detected. Further metadata key
  10524. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10525. timecode data has been found or not.
  10526. This filter accepts the following options:
  10527. @table @option
  10528. @item scan_max
  10529. Set the maximum number of lines to scan for VITC data. If the value is set to
  10530. @code{-1} the full video frame is scanned. Default is @code{45}.
  10531. @item thr_b
  10532. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10533. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10534. @item thr_w
  10535. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10536. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10537. @end table
  10538. @subsection Examples
  10539. @itemize
  10540. @item
  10541. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10542. draw @code{--:--:--:--} as a placeholder:
  10543. @example
  10544. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10545. @end example
  10546. @end itemize
  10547. @section remap
  10548. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10549. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10550. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10551. value for pixel will be used for destination pixel.
  10552. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10553. will have Xmap/Ymap video stream dimensions.
  10554. Xmap and Ymap input video streams are 16bit depth, single channel.
  10555. @section removegrain
  10556. The removegrain filter is a spatial denoiser for progressive video.
  10557. @table @option
  10558. @item m0
  10559. Set mode for the first plane.
  10560. @item m1
  10561. Set mode for the second plane.
  10562. @item m2
  10563. Set mode for the third plane.
  10564. @item m3
  10565. Set mode for the fourth plane.
  10566. @end table
  10567. Range of mode is from 0 to 24. Description of each mode follows:
  10568. @table @var
  10569. @item 0
  10570. Leave input plane unchanged. Default.
  10571. @item 1
  10572. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10573. @item 2
  10574. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10575. @item 3
  10576. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10577. @item 4
  10578. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10579. This is equivalent to a median filter.
  10580. @item 5
  10581. Line-sensitive clipping giving the minimal change.
  10582. @item 6
  10583. Line-sensitive clipping, intermediate.
  10584. @item 7
  10585. Line-sensitive clipping, intermediate.
  10586. @item 8
  10587. Line-sensitive clipping, intermediate.
  10588. @item 9
  10589. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10590. @item 10
  10591. Replaces the target pixel with the closest neighbour.
  10592. @item 11
  10593. [1 2 1] horizontal and vertical kernel blur.
  10594. @item 12
  10595. Same as mode 11.
  10596. @item 13
  10597. Bob mode, interpolates top field from the line where the neighbours
  10598. pixels are the closest.
  10599. @item 14
  10600. Bob mode, interpolates bottom field from the line where the neighbours
  10601. pixels are the closest.
  10602. @item 15
  10603. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10604. interpolation formula.
  10605. @item 16
  10606. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10607. interpolation formula.
  10608. @item 17
  10609. Clips the pixel with the minimum and maximum of respectively the maximum and
  10610. minimum of each pair of opposite neighbour pixels.
  10611. @item 18
  10612. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10613. the current pixel is minimal.
  10614. @item 19
  10615. Replaces the pixel with the average of its 8 neighbours.
  10616. @item 20
  10617. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10618. @item 21
  10619. Clips pixels using the averages of opposite neighbour.
  10620. @item 22
  10621. Same as mode 21 but simpler and faster.
  10622. @item 23
  10623. Small edge and halo removal, but reputed useless.
  10624. @item 24
  10625. Similar as 23.
  10626. @end table
  10627. @section removelogo
  10628. Suppress a TV station logo, using an image file to determine which
  10629. pixels comprise the logo. It works by filling in the pixels that
  10630. comprise the logo with neighboring pixels.
  10631. The filter accepts the following options:
  10632. @table @option
  10633. @item filename, f
  10634. Set the filter bitmap file, which can be any image format supported by
  10635. libavformat. The width and height of the image file must match those of the
  10636. video stream being processed.
  10637. @end table
  10638. Pixels in the provided bitmap image with a value of zero are not
  10639. considered part of the logo, non-zero pixels are considered part of
  10640. the logo. If you use white (255) for the logo and black (0) for the
  10641. rest, you will be safe. For making the filter bitmap, it is
  10642. recommended to take a screen capture of a black frame with the logo
  10643. visible, and then using a threshold filter followed by the erode
  10644. filter once or twice.
  10645. If needed, little splotches can be fixed manually. Remember that if
  10646. logo pixels are not covered, the filter quality will be much
  10647. reduced. Marking too many pixels as part of the logo does not hurt as
  10648. much, but it will increase the amount of blurring needed to cover over
  10649. the image and will destroy more information than necessary, and extra
  10650. pixels will slow things down on a large logo.
  10651. @section repeatfields
  10652. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10653. fields based on its value.
  10654. @section reverse
  10655. Reverse a video clip.
  10656. Warning: This filter requires memory to buffer the entire clip, so trimming
  10657. is suggested.
  10658. @subsection Examples
  10659. @itemize
  10660. @item
  10661. Take the first 5 seconds of a clip, and reverse it.
  10662. @example
  10663. trim=end=5,reverse
  10664. @end example
  10665. @end itemize
  10666. @section roberts
  10667. Apply roberts cross operator to input video stream.
  10668. The filter accepts the following option:
  10669. @table @option
  10670. @item planes
  10671. Set which planes will be processed, unprocessed planes will be copied.
  10672. By default value 0xf, all planes will be processed.
  10673. @item scale
  10674. Set value which will be multiplied with filtered result.
  10675. @item delta
  10676. Set value which will be added to filtered result.
  10677. @end table
  10678. @section rotate
  10679. Rotate video by an arbitrary angle expressed in radians.
  10680. The filter accepts the following options:
  10681. A description of the optional parameters follows.
  10682. @table @option
  10683. @item angle, a
  10684. Set an expression for the angle by which to rotate the input video
  10685. clockwise, expressed as a number of radians. A negative value will
  10686. result in a counter-clockwise rotation. By default it is set to "0".
  10687. This expression is evaluated for each frame.
  10688. @item out_w, ow
  10689. Set the output width expression, default value is "iw".
  10690. This expression is evaluated just once during configuration.
  10691. @item out_h, oh
  10692. Set the output height expression, default value is "ih".
  10693. This expression is evaluated just once during configuration.
  10694. @item bilinear
  10695. Enable bilinear interpolation if set to 1, a value of 0 disables
  10696. it. Default value is 1.
  10697. @item fillcolor, c
  10698. Set the color used to fill the output area not covered by the rotated
  10699. image. For the general syntax of this option, check the
  10700. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10701. If the special value "none" is selected then no
  10702. background is printed (useful for example if the background is never shown).
  10703. Default value is "black".
  10704. @end table
  10705. The expressions for the angle and the output size can contain the
  10706. following constants and functions:
  10707. @table @option
  10708. @item n
  10709. sequential number of the input frame, starting from 0. It is always NAN
  10710. before the first frame is filtered.
  10711. @item t
  10712. time in seconds of the input frame, it is set to 0 when the filter is
  10713. configured. It is always NAN before the first frame is filtered.
  10714. @item hsub
  10715. @item vsub
  10716. horizontal and vertical chroma subsample values. For example for the
  10717. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10718. @item in_w, iw
  10719. @item in_h, ih
  10720. the input video width and height
  10721. @item out_w, ow
  10722. @item out_h, oh
  10723. the output width and height, that is the size of the padded area as
  10724. specified by the @var{width} and @var{height} expressions
  10725. @item rotw(a)
  10726. @item roth(a)
  10727. the minimal width/height required for completely containing the input
  10728. video rotated by @var{a} radians.
  10729. These are only available when computing the @option{out_w} and
  10730. @option{out_h} expressions.
  10731. @end table
  10732. @subsection Examples
  10733. @itemize
  10734. @item
  10735. Rotate the input by PI/6 radians clockwise:
  10736. @example
  10737. rotate=PI/6
  10738. @end example
  10739. @item
  10740. Rotate the input by PI/6 radians counter-clockwise:
  10741. @example
  10742. rotate=-PI/6
  10743. @end example
  10744. @item
  10745. Rotate the input by 45 degrees clockwise:
  10746. @example
  10747. rotate=45*PI/180
  10748. @end example
  10749. @item
  10750. Apply a constant rotation with period T, starting from an angle of PI/3:
  10751. @example
  10752. rotate=PI/3+2*PI*t/T
  10753. @end example
  10754. @item
  10755. Make the input video rotation oscillating with a period of T
  10756. seconds and an amplitude of A radians:
  10757. @example
  10758. rotate=A*sin(2*PI/T*t)
  10759. @end example
  10760. @item
  10761. Rotate the video, output size is chosen so that the whole rotating
  10762. input video is always completely contained in the output:
  10763. @example
  10764. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10765. @end example
  10766. @item
  10767. Rotate the video, reduce the output size so that no background is ever
  10768. shown:
  10769. @example
  10770. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10771. @end example
  10772. @end itemize
  10773. @subsection Commands
  10774. The filter supports the following commands:
  10775. @table @option
  10776. @item a, angle
  10777. Set the angle expression.
  10778. The command accepts the same syntax of the corresponding option.
  10779. If the specified expression is not valid, it is kept at its current
  10780. value.
  10781. @end table
  10782. @section sab
  10783. Apply Shape Adaptive Blur.
  10784. The filter accepts the following options:
  10785. @table @option
  10786. @item luma_radius, lr
  10787. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10788. value is 1.0. A greater value will result in a more blurred image, and
  10789. in slower processing.
  10790. @item luma_pre_filter_radius, lpfr
  10791. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10792. value is 1.0.
  10793. @item luma_strength, ls
  10794. Set luma maximum difference between pixels to still be considered, must
  10795. be a value in the 0.1-100.0 range, default value is 1.0.
  10796. @item chroma_radius, cr
  10797. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10798. greater value will result in a more blurred image, and in slower
  10799. processing.
  10800. @item chroma_pre_filter_radius, cpfr
  10801. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10802. @item chroma_strength, cs
  10803. Set chroma maximum difference between pixels to still be considered,
  10804. must be a value in the -0.9-100.0 range.
  10805. @end table
  10806. Each chroma option value, if not explicitly specified, is set to the
  10807. corresponding luma option value.
  10808. @anchor{scale}
  10809. @section scale
  10810. Scale (resize) the input video, using the libswscale library.
  10811. The scale filter forces the output display aspect ratio to be the same
  10812. of the input, by changing the output sample aspect ratio.
  10813. If the input image format is different from the format requested by
  10814. the next filter, the scale filter will convert the input to the
  10815. requested format.
  10816. @subsection Options
  10817. The filter accepts the following options, or any of the options
  10818. supported by the libswscale scaler.
  10819. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10820. the complete list of scaler options.
  10821. @table @option
  10822. @item width, w
  10823. @item height, h
  10824. Set the output video dimension expression. Default value is the input
  10825. dimension.
  10826. If the @var{width} or @var{w} value is 0, the input width is used for
  10827. the output. If the @var{height} or @var{h} value is 0, the input height
  10828. is used for the output.
  10829. If one and only one of the values is -n with n >= 1, the scale filter
  10830. will use a value that maintains the aspect ratio of the input image,
  10831. calculated from the other specified dimension. After that it will,
  10832. however, make sure that the calculated dimension is divisible by n and
  10833. adjust the value if necessary.
  10834. If both values are -n with n >= 1, the behavior will be identical to
  10835. both values being set to 0 as previously detailed.
  10836. See below for the list of accepted constants for use in the dimension
  10837. expression.
  10838. @item eval
  10839. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10840. @table @samp
  10841. @item init
  10842. Only evaluate expressions once during the filter initialization or when a command is processed.
  10843. @item frame
  10844. Evaluate expressions for each incoming frame.
  10845. @end table
  10846. Default value is @samp{init}.
  10847. @item interl
  10848. Set the interlacing mode. It accepts the following values:
  10849. @table @samp
  10850. @item 1
  10851. Force interlaced aware scaling.
  10852. @item 0
  10853. Do not apply interlaced scaling.
  10854. @item -1
  10855. Select interlaced aware scaling depending on whether the source frames
  10856. are flagged as interlaced or not.
  10857. @end table
  10858. Default value is @samp{0}.
  10859. @item flags
  10860. Set libswscale scaling flags. See
  10861. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10862. complete list of values. If not explicitly specified the filter applies
  10863. the default flags.
  10864. @item param0, param1
  10865. Set libswscale input parameters for scaling algorithms that need them. See
  10866. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10867. complete documentation. If not explicitly specified the filter applies
  10868. empty parameters.
  10869. @item size, s
  10870. Set the video size. For the syntax of this option, check the
  10871. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10872. @item in_color_matrix
  10873. @item out_color_matrix
  10874. Set in/output YCbCr color space type.
  10875. This allows the autodetected value to be overridden as well as allows forcing
  10876. a specific value used for the output and encoder.
  10877. If not specified, the color space type depends on the pixel format.
  10878. Possible values:
  10879. @table @samp
  10880. @item auto
  10881. Choose automatically.
  10882. @item bt709
  10883. Format conforming to International Telecommunication Union (ITU)
  10884. Recommendation BT.709.
  10885. @item fcc
  10886. Set color space conforming to the United States Federal Communications
  10887. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10888. @item bt601
  10889. Set color space conforming to:
  10890. @itemize
  10891. @item
  10892. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10893. @item
  10894. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10895. @item
  10896. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10897. @end itemize
  10898. @item smpte240m
  10899. Set color space conforming to SMPTE ST 240:1999.
  10900. @end table
  10901. @item in_range
  10902. @item out_range
  10903. Set in/output YCbCr sample range.
  10904. This allows the autodetected value to be overridden as well as allows forcing
  10905. a specific value used for the output and encoder. If not specified, the
  10906. range depends on the pixel format. Possible values:
  10907. @table @samp
  10908. @item auto/unknown
  10909. Choose automatically.
  10910. @item jpeg/full/pc
  10911. Set full range (0-255 in case of 8-bit luma).
  10912. @item mpeg/limited/tv
  10913. Set "MPEG" range (16-235 in case of 8-bit luma).
  10914. @end table
  10915. @item force_original_aspect_ratio
  10916. Enable decreasing or increasing output video width or height if necessary to
  10917. keep the original aspect ratio. Possible values:
  10918. @table @samp
  10919. @item disable
  10920. Scale the video as specified and disable this feature.
  10921. @item decrease
  10922. The output video dimensions will automatically be decreased if needed.
  10923. @item increase
  10924. The output video dimensions will automatically be increased if needed.
  10925. @end table
  10926. One useful instance of this option is that when you know a specific device's
  10927. maximum allowed resolution, you can use this to limit the output video to
  10928. that, while retaining the aspect ratio. For example, device A allows
  10929. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10930. decrease) and specifying 1280x720 to the command line makes the output
  10931. 1280x533.
  10932. Please note that this is a different thing than specifying -1 for @option{w}
  10933. or @option{h}, you still need to specify the output resolution for this option
  10934. to work.
  10935. @end table
  10936. The values of the @option{w} and @option{h} options are expressions
  10937. containing the following constants:
  10938. @table @var
  10939. @item in_w
  10940. @item in_h
  10941. The input width and height
  10942. @item iw
  10943. @item ih
  10944. These are the same as @var{in_w} and @var{in_h}.
  10945. @item out_w
  10946. @item out_h
  10947. The output (scaled) width and height
  10948. @item ow
  10949. @item oh
  10950. These are the same as @var{out_w} and @var{out_h}
  10951. @item a
  10952. The same as @var{iw} / @var{ih}
  10953. @item sar
  10954. input sample aspect ratio
  10955. @item dar
  10956. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10957. @item hsub
  10958. @item vsub
  10959. horizontal and vertical input chroma subsample values. For example for the
  10960. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10961. @item ohsub
  10962. @item ovsub
  10963. horizontal and vertical output chroma subsample values. For example for the
  10964. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10965. @end table
  10966. @subsection Examples
  10967. @itemize
  10968. @item
  10969. Scale the input video to a size of 200x100
  10970. @example
  10971. scale=w=200:h=100
  10972. @end example
  10973. This is equivalent to:
  10974. @example
  10975. scale=200:100
  10976. @end example
  10977. or:
  10978. @example
  10979. scale=200x100
  10980. @end example
  10981. @item
  10982. Specify a size abbreviation for the output size:
  10983. @example
  10984. scale=qcif
  10985. @end example
  10986. which can also be written as:
  10987. @example
  10988. scale=size=qcif
  10989. @end example
  10990. @item
  10991. Scale the input to 2x:
  10992. @example
  10993. scale=w=2*iw:h=2*ih
  10994. @end example
  10995. @item
  10996. The above is the same as:
  10997. @example
  10998. scale=2*in_w:2*in_h
  10999. @end example
  11000. @item
  11001. Scale the input to 2x with forced interlaced scaling:
  11002. @example
  11003. scale=2*iw:2*ih:interl=1
  11004. @end example
  11005. @item
  11006. Scale the input to half size:
  11007. @example
  11008. scale=w=iw/2:h=ih/2
  11009. @end example
  11010. @item
  11011. Increase the width, and set the height to the same size:
  11012. @example
  11013. scale=3/2*iw:ow
  11014. @end example
  11015. @item
  11016. Seek Greek harmony:
  11017. @example
  11018. scale=iw:1/PHI*iw
  11019. scale=ih*PHI:ih
  11020. @end example
  11021. @item
  11022. Increase the height, and set the width to 3/2 of the height:
  11023. @example
  11024. scale=w=3/2*oh:h=3/5*ih
  11025. @end example
  11026. @item
  11027. Increase the size, making the size a multiple of the chroma
  11028. subsample values:
  11029. @example
  11030. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11031. @end example
  11032. @item
  11033. Increase the width to a maximum of 500 pixels,
  11034. keeping the same aspect ratio as the input:
  11035. @example
  11036. scale=w='min(500\, iw*3/2):h=-1'
  11037. @end example
  11038. @item
  11039. Make pixels square by combining scale and setsar:
  11040. @example
  11041. scale='trunc(ih*dar):ih',setsar=1/1
  11042. @end example
  11043. @item
  11044. Make pixels square by combining scale and setsar,
  11045. making sure the resulting resolution is even (required by some codecs):
  11046. @example
  11047. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11048. @end example
  11049. @end itemize
  11050. @subsection Commands
  11051. This filter supports the following commands:
  11052. @table @option
  11053. @item width, w
  11054. @item height, h
  11055. Set the output video dimension expression.
  11056. The command accepts the same syntax of the corresponding option.
  11057. If the specified expression is not valid, it is kept at its current
  11058. value.
  11059. @end table
  11060. @section scale_npp
  11061. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11062. format conversion on CUDA video frames. Setting the output width and height
  11063. works in the same way as for the @var{scale} filter.
  11064. The following additional options are accepted:
  11065. @table @option
  11066. @item format
  11067. The pixel format of the output CUDA frames. If set to the string "same" (the
  11068. default), the input format will be kept. Note that automatic format negotiation
  11069. and conversion is not yet supported for hardware frames
  11070. @item interp_algo
  11071. The interpolation algorithm used for resizing. One of the following:
  11072. @table @option
  11073. @item nn
  11074. Nearest neighbour.
  11075. @item linear
  11076. @item cubic
  11077. @item cubic2p_bspline
  11078. 2-parameter cubic (B=1, C=0)
  11079. @item cubic2p_catmullrom
  11080. 2-parameter cubic (B=0, C=1/2)
  11081. @item cubic2p_b05c03
  11082. 2-parameter cubic (B=1/2, C=3/10)
  11083. @item super
  11084. Supersampling
  11085. @item lanczos
  11086. @end table
  11087. @end table
  11088. @section scale2ref
  11089. Scale (resize) the input video, based on a reference video.
  11090. See the scale filter for available options, scale2ref supports the same but
  11091. uses the reference video instead of the main input as basis. scale2ref also
  11092. supports the following additional constants for the @option{w} and
  11093. @option{h} options:
  11094. @table @var
  11095. @item main_w
  11096. @item main_h
  11097. The main input video's width and height
  11098. @item main_a
  11099. The same as @var{main_w} / @var{main_h}
  11100. @item main_sar
  11101. The main input video's sample aspect ratio
  11102. @item main_dar, mdar
  11103. The main input video's display aspect ratio. Calculated from
  11104. @code{(main_w / main_h) * main_sar}.
  11105. @item main_hsub
  11106. @item main_vsub
  11107. The main input video's horizontal and vertical chroma subsample values.
  11108. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11109. is 1.
  11110. @end table
  11111. @subsection Examples
  11112. @itemize
  11113. @item
  11114. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11115. @example
  11116. 'scale2ref[b][a];[a][b]overlay'
  11117. @end example
  11118. @end itemize
  11119. @anchor{selectivecolor}
  11120. @section selectivecolor
  11121. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11122. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11123. by the "purity" of the color (that is, how saturated it already is).
  11124. This filter is similar to the Adobe Photoshop Selective Color tool.
  11125. The filter accepts the following options:
  11126. @table @option
  11127. @item correction_method
  11128. Select color correction method.
  11129. Available values are:
  11130. @table @samp
  11131. @item absolute
  11132. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11133. component value).
  11134. @item relative
  11135. Specified adjustments are relative to the original component value.
  11136. @end table
  11137. Default is @code{absolute}.
  11138. @item reds
  11139. Adjustments for red pixels (pixels where the red component is the maximum)
  11140. @item yellows
  11141. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11142. @item greens
  11143. Adjustments for green pixels (pixels where the green component is the maximum)
  11144. @item cyans
  11145. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11146. @item blues
  11147. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11148. @item magentas
  11149. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11150. @item whites
  11151. Adjustments for white pixels (pixels where all components are greater than 128)
  11152. @item neutrals
  11153. Adjustments for all pixels except pure black and pure white
  11154. @item blacks
  11155. Adjustments for black pixels (pixels where all components are lesser than 128)
  11156. @item psfile
  11157. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11158. @end table
  11159. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11160. 4 space separated floating point adjustment values in the [-1,1] range,
  11161. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11162. pixels of its range.
  11163. @subsection Examples
  11164. @itemize
  11165. @item
  11166. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11167. increase magenta by 27% in blue areas:
  11168. @example
  11169. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11170. @end example
  11171. @item
  11172. Use a Photoshop selective color preset:
  11173. @example
  11174. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11175. @end example
  11176. @end itemize
  11177. @anchor{separatefields}
  11178. @section separatefields
  11179. The @code{separatefields} takes a frame-based video input and splits
  11180. each frame into its components fields, producing a new half height clip
  11181. with twice the frame rate and twice the frame count.
  11182. This filter use field-dominance information in frame to decide which
  11183. of each pair of fields to place first in the output.
  11184. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11185. @section setdar, setsar
  11186. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11187. output video.
  11188. This is done by changing the specified Sample (aka Pixel) Aspect
  11189. Ratio, according to the following equation:
  11190. @example
  11191. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11192. @end example
  11193. Keep in mind that the @code{setdar} filter does not modify the pixel
  11194. dimensions of the video frame. Also, the display aspect ratio set by
  11195. this filter may be changed by later filters in the filterchain,
  11196. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11197. applied.
  11198. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11199. the filter output video.
  11200. Note that as a consequence of the application of this filter, the
  11201. output display aspect ratio will change according to the equation
  11202. above.
  11203. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11204. filter may be changed by later filters in the filterchain, e.g. if
  11205. another "setsar" or a "setdar" filter is applied.
  11206. It accepts the following parameters:
  11207. @table @option
  11208. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11209. Set the aspect ratio used by the filter.
  11210. The parameter can be a floating point number string, an expression, or
  11211. a string of the form @var{num}:@var{den}, where @var{num} and
  11212. @var{den} are the numerator and denominator of the aspect ratio. If
  11213. the parameter is not specified, it is assumed the value "0".
  11214. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11215. should be escaped.
  11216. @item max
  11217. Set the maximum integer value to use for expressing numerator and
  11218. denominator when reducing the expressed aspect ratio to a rational.
  11219. Default value is @code{100}.
  11220. @end table
  11221. The parameter @var{sar} is an expression containing
  11222. the following constants:
  11223. @table @option
  11224. @item E, PI, PHI
  11225. These are approximated values for the mathematical constants e
  11226. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11227. @item w, h
  11228. The input width and height.
  11229. @item a
  11230. These are the same as @var{w} / @var{h}.
  11231. @item sar
  11232. The input sample aspect ratio.
  11233. @item dar
  11234. The input display aspect ratio. It is the same as
  11235. (@var{w} / @var{h}) * @var{sar}.
  11236. @item hsub, vsub
  11237. Horizontal and vertical chroma subsample values. For example, for the
  11238. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11239. @end table
  11240. @subsection Examples
  11241. @itemize
  11242. @item
  11243. To change the display aspect ratio to 16:9, specify one of the following:
  11244. @example
  11245. setdar=dar=1.77777
  11246. setdar=dar=16/9
  11247. @end example
  11248. @item
  11249. To change the sample aspect ratio to 10:11, specify:
  11250. @example
  11251. setsar=sar=10/11
  11252. @end example
  11253. @item
  11254. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11255. 1000 in the aspect ratio reduction, use the command:
  11256. @example
  11257. setdar=ratio=16/9:max=1000
  11258. @end example
  11259. @end itemize
  11260. @anchor{setfield}
  11261. @section setfield
  11262. Force field for the output video frame.
  11263. The @code{setfield} filter marks the interlace type field for the
  11264. output frames. It does not change the input frame, but only sets the
  11265. corresponding property, which affects how the frame is treated by
  11266. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11267. The filter accepts the following options:
  11268. @table @option
  11269. @item mode
  11270. Available values are:
  11271. @table @samp
  11272. @item auto
  11273. Keep the same field property.
  11274. @item bff
  11275. Mark the frame as bottom-field-first.
  11276. @item tff
  11277. Mark the frame as top-field-first.
  11278. @item prog
  11279. Mark the frame as progressive.
  11280. @end table
  11281. @end table
  11282. @section showinfo
  11283. Show a line containing various information for each input video frame.
  11284. The input video is not modified.
  11285. The shown line contains a sequence of key/value pairs of the form
  11286. @var{key}:@var{value}.
  11287. The following values are shown in the output:
  11288. @table @option
  11289. @item n
  11290. The (sequential) number of the input frame, starting from 0.
  11291. @item pts
  11292. The Presentation TimeStamp of the input frame, expressed as a number of
  11293. time base units. The time base unit depends on the filter input pad.
  11294. @item pts_time
  11295. The Presentation TimeStamp of the input frame, expressed as a number of
  11296. seconds.
  11297. @item pos
  11298. The position of the frame in the input stream, or -1 if this information is
  11299. unavailable and/or meaningless (for example in case of synthetic video).
  11300. @item fmt
  11301. The pixel format name.
  11302. @item sar
  11303. The sample aspect ratio of the input frame, expressed in the form
  11304. @var{num}/@var{den}.
  11305. @item s
  11306. The size of the input frame. For the syntax of this option, check the
  11307. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11308. @item i
  11309. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  11310. for bottom field first).
  11311. @item iskey
  11312. This is 1 if the frame is a key frame, 0 otherwise.
  11313. @item type
  11314. The picture type of the input frame ("I" for an I-frame, "P" for a
  11315. P-frame, "B" for a B-frame, or "?" for an unknown type).
  11316. Also refer to the documentation of the @code{AVPictureType} enum and of
  11317. the @code{av_get_picture_type_char} function defined in
  11318. @file{libavutil/avutil.h}.
  11319. @item checksum
  11320. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  11321. @item plane_checksum
  11322. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  11323. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  11324. @end table
  11325. @section showpalette
  11326. Displays the 256 colors palette of each frame. This filter is only relevant for
  11327. @var{pal8} pixel format frames.
  11328. It accepts the following option:
  11329. @table @option
  11330. @item s
  11331. Set the size of the box used to represent one palette color entry. Default is
  11332. @code{30} (for a @code{30x30} pixel box).
  11333. @end table
  11334. @section shuffleframes
  11335. Reorder and/or duplicate and/or drop video frames.
  11336. It accepts the following parameters:
  11337. @table @option
  11338. @item mapping
  11339. Set the destination indexes of input frames.
  11340. This is space or '|' separated list of indexes that maps input frames to output
  11341. frames. Number of indexes also sets maximal value that each index may have.
  11342. '-1' index have special meaning and that is to drop frame.
  11343. @end table
  11344. The first frame has the index 0. The default is to keep the input unchanged.
  11345. @subsection Examples
  11346. @itemize
  11347. @item
  11348. Swap second and third frame of every three frames of the input:
  11349. @example
  11350. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  11351. @end example
  11352. @item
  11353. Swap 10th and 1st frame of every ten frames of the input:
  11354. @example
  11355. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  11356. @end example
  11357. @end itemize
  11358. @section shuffleplanes
  11359. Reorder and/or duplicate video planes.
  11360. It accepts the following parameters:
  11361. @table @option
  11362. @item map0
  11363. The index of the input plane to be used as the first output plane.
  11364. @item map1
  11365. The index of the input plane to be used as the second output plane.
  11366. @item map2
  11367. The index of the input plane to be used as the third output plane.
  11368. @item map3
  11369. The index of the input plane to be used as the fourth output plane.
  11370. @end table
  11371. The first plane has the index 0. The default is to keep the input unchanged.
  11372. @subsection Examples
  11373. @itemize
  11374. @item
  11375. Swap the second and third planes of the input:
  11376. @example
  11377. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  11378. @end example
  11379. @end itemize
  11380. @anchor{signalstats}
  11381. @section signalstats
  11382. Evaluate various visual metrics that assist in determining issues associated
  11383. with the digitization of analog video media.
  11384. By default the filter will log these metadata values:
  11385. @table @option
  11386. @item YMIN
  11387. Display the minimal Y value contained within the input frame. Expressed in
  11388. range of [0-255].
  11389. @item YLOW
  11390. Display the Y value at the 10% percentile within the input frame. Expressed in
  11391. range of [0-255].
  11392. @item YAVG
  11393. Display the average Y value within the input frame. Expressed in range of
  11394. [0-255].
  11395. @item YHIGH
  11396. Display the Y value at the 90% percentile within the input frame. Expressed in
  11397. range of [0-255].
  11398. @item YMAX
  11399. Display the maximum Y value contained within the input frame. Expressed in
  11400. range of [0-255].
  11401. @item UMIN
  11402. Display the minimal U value contained within the input frame. Expressed in
  11403. range of [0-255].
  11404. @item ULOW
  11405. Display the U value at the 10% percentile within the input frame. Expressed in
  11406. range of [0-255].
  11407. @item UAVG
  11408. Display the average U value within the input frame. Expressed in range of
  11409. [0-255].
  11410. @item UHIGH
  11411. Display the U value at the 90% percentile within the input frame. Expressed in
  11412. range of [0-255].
  11413. @item UMAX
  11414. Display the maximum U value contained within the input frame. Expressed in
  11415. range of [0-255].
  11416. @item VMIN
  11417. Display the minimal V value contained within the input frame. Expressed in
  11418. range of [0-255].
  11419. @item VLOW
  11420. Display the V value at the 10% percentile within the input frame. Expressed in
  11421. range of [0-255].
  11422. @item VAVG
  11423. Display the average V value within the input frame. Expressed in range of
  11424. [0-255].
  11425. @item VHIGH
  11426. Display the V value at the 90% percentile within the input frame. Expressed in
  11427. range of [0-255].
  11428. @item VMAX
  11429. Display the maximum V value contained within the input frame. Expressed in
  11430. range of [0-255].
  11431. @item SATMIN
  11432. Display the minimal saturation value contained within the input frame.
  11433. Expressed in range of [0-~181.02].
  11434. @item SATLOW
  11435. Display the saturation value at the 10% percentile within the input frame.
  11436. Expressed in range of [0-~181.02].
  11437. @item SATAVG
  11438. Display the average saturation value within the input frame. Expressed in range
  11439. of [0-~181.02].
  11440. @item SATHIGH
  11441. Display the saturation value at the 90% percentile within the input frame.
  11442. Expressed in range of [0-~181.02].
  11443. @item SATMAX
  11444. Display the maximum saturation value contained within the input frame.
  11445. Expressed in range of [0-~181.02].
  11446. @item HUEMED
  11447. Display the median value for hue within the input frame. Expressed in range of
  11448. [0-360].
  11449. @item HUEAVG
  11450. Display the average value for hue within the input frame. Expressed in range of
  11451. [0-360].
  11452. @item YDIF
  11453. Display the average of sample value difference between all values of the Y
  11454. plane in the current frame and corresponding values of the previous input frame.
  11455. Expressed in range of [0-255].
  11456. @item UDIF
  11457. Display the average of sample value difference between all values of the U
  11458. plane in the current frame and corresponding values of the previous input frame.
  11459. Expressed in range of [0-255].
  11460. @item VDIF
  11461. Display the average of sample value difference between all values of the V
  11462. plane in the current frame and corresponding values of the previous input frame.
  11463. Expressed in range of [0-255].
  11464. @item YBITDEPTH
  11465. Display bit depth of Y plane in current frame.
  11466. Expressed in range of [0-16].
  11467. @item UBITDEPTH
  11468. Display bit depth of U plane in current frame.
  11469. Expressed in range of [0-16].
  11470. @item VBITDEPTH
  11471. Display bit depth of V plane in current frame.
  11472. Expressed in range of [0-16].
  11473. @end table
  11474. The filter accepts the following options:
  11475. @table @option
  11476. @item stat
  11477. @item out
  11478. @option{stat} specify an additional form of image analysis.
  11479. @option{out} output video with the specified type of pixel highlighted.
  11480. Both options accept the following values:
  11481. @table @samp
  11482. @item tout
  11483. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  11484. unlike the neighboring pixels of the same field. Examples of temporal outliers
  11485. include the results of video dropouts, head clogs, or tape tracking issues.
  11486. @item vrep
  11487. Identify @var{vertical line repetition}. Vertical line repetition includes
  11488. similar rows of pixels within a frame. In born-digital video vertical line
  11489. repetition is common, but this pattern is uncommon in video digitized from an
  11490. analog source. When it occurs in video that results from the digitization of an
  11491. analog source it can indicate concealment from a dropout compensator.
  11492. @item brng
  11493. Identify pixels that fall outside of legal broadcast range.
  11494. @end table
  11495. @item color, c
  11496. Set the highlight color for the @option{out} option. The default color is
  11497. yellow.
  11498. @end table
  11499. @subsection Examples
  11500. @itemize
  11501. @item
  11502. Output data of various video metrics:
  11503. @example
  11504. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11505. @end example
  11506. @item
  11507. Output specific data about the minimum and maximum values of the Y plane per frame:
  11508. @example
  11509. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11510. @end example
  11511. @item
  11512. Playback video while highlighting pixels that are outside of broadcast range in red.
  11513. @example
  11514. ffplay example.mov -vf signalstats="out=brng:color=red"
  11515. @end example
  11516. @item
  11517. Playback video with signalstats metadata drawn over the frame.
  11518. @example
  11519. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11520. @end example
  11521. The contents of signalstat_drawtext.txt used in the command are:
  11522. @example
  11523. time %@{pts:hms@}
  11524. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11525. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11526. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11527. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11528. @end example
  11529. @end itemize
  11530. @anchor{signature}
  11531. @section signature
  11532. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11533. input. In this case the matching between the inputs can be calculated additionally.
  11534. The filter always passes through the first input. The signature of each stream can
  11535. be written into a file.
  11536. It accepts the following options:
  11537. @table @option
  11538. @item detectmode
  11539. Enable or disable the matching process.
  11540. Available values are:
  11541. @table @samp
  11542. @item off
  11543. Disable the calculation of a matching (default).
  11544. @item full
  11545. Calculate the matching for the whole video and output whether the whole video
  11546. matches or only parts.
  11547. @item fast
  11548. Calculate only until a matching is found or the video ends. Should be faster in
  11549. some cases.
  11550. @end table
  11551. @item nb_inputs
  11552. Set the number of inputs. The option value must be a non negative integer.
  11553. Default value is 1.
  11554. @item filename
  11555. Set the path to which the output is written. If there is more than one input,
  11556. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11557. integer), that will be replaced with the input number. If no filename is
  11558. specified, no output will be written. This is the default.
  11559. @item format
  11560. Choose the output format.
  11561. Available values are:
  11562. @table @samp
  11563. @item binary
  11564. Use the specified binary representation (default).
  11565. @item xml
  11566. Use the specified xml representation.
  11567. @end table
  11568. @item th_d
  11569. Set threshold to detect one word as similar. The option value must be an integer
  11570. greater than zero. The default value is 9000.
  11571. @item th_dc
  11572. Set threshold to detect all words as similar. The option value must be an integer
  11573. greater than zero. The default value is 60000.
  11574. @item th_xh
  11575. Set threshold to detect frames as similar. The option value must be an integer
  11576. greater than zero. The default value is 116.
  11577. @item th_di
  11578. Set the minimum length of a sequence in frames to recognize it as matching
  11579. sequence. The option value must be a non negative integer value.
  11580. The default value is 0.
  11581. @item th_it
  11582. Set the minimum relation, that matching frames to all frames must have.
  11583. The option value must be a double value between 0 and 1. The default value is 0.5.
  11584. @end table
  11585. @subsection Examples
  11586. @itemize
  11587. @item
  11588. To calculate the signature of an input video and store it in signature.bin:
  11589. @example
  11590. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11591. @end example
  11592. @item
  11593. To detect whether two videos match and store the signatures in XML format in
  11594. signature0.xml and signature1.xml:
  11595. @example
  11596. 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 -
  11597. @end example
  11598. @end itemize
  11599. @anchor{smartblur}
  11600. @section smartblur
  11601. Blur the input video without impacting the outlines.
  11602. It accepts the following options:
  11603. @table @option
  11604. @item luma_radius, lr
  11605. Set the luma radius. The option value must be a float number in
  11606. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11607. used to blur the image (slower if larger). Default value is 1.0.
  11608. @item luma_strength, ls
  11609. Set the luma strength. The option value must be a float number
  11610. in the range [-1.0,1.0] that configures the blurring. A value included
  11611. in [0.0,1.0] will blur the image whereas a value included in
  11612. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11613. @item luma_threshold, lt
  11614. Set the luma threshold used as a coefficient to determine
  11615. whether a pixel should be blurred or not. The option value must be an
  11616. integer in the range [-30,30]. A value of 0 will filter all the image,
  11617. a value included in [0,30] will filter flat areas and a value included
  11618. in [-30,0] will filter edges. Default value is 0.
  11619. @item chroma_radius, cr
  11620. Set the chroma radius. The option value must be a float number in
  11621. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11622. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11623. @item chroma_strength, cs
  11624. Set the chroma strength. The option value must be a float number
  11625. in the range [-1.0,1.0] that configures the blurring. A value included
  11626. in [0.0,1.0] will blur the image whereas a value included in
  11627. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11628. @item chroma_threshold, ct
  11629. Set the chroma threshold used as a coefficient to determine
  11630. whether a pixel should be blurred or not. The option value must be an
  11631. integer in the range [-30,30]. A value of 0 will filter all the image,
  11632. a value included in [0,30] will filter flat areas and a value included
  11633. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11634. @end table
  11635. If a chroma option is not explicitly set, the corresponding luma value
  11636. is set.
  11637. @section ssim
  11638. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11639. This filter takes in input two input videos, the first input is
  11640. considered the "main" source and is passed unchanged to the
  11641. output. The second input is used as a "reference" video for computing
  11642. the SSIM.
  11643. Both video inputs must have the same resolution and pixel format for
  11644. this filter to work correctly. Also it assumes that both inputs
  11645. have the same number of frames, which are compared one by one.
  11646. The filter stores the calculated SSIM of each frame.
  11647. The description of the accepted parameters follows.
  11648. @table @option
  11649. @item stats_file, f
  11650. If specified the filter will use the named file to save the SSIM of
  11651. each individual frame. When filename equals "-" the data is sent to
  11652. standard output.
  11653. @end table
  11654. The file printed if @var{stats_file} is selected, contains a sequence of
  11655. key/value pairs of the form @var{key}:@var{value} for each compared
  11656. couple of frames.
  11657. A description of each shown parameter follows:
  11658. @table @option
  11659. @item n
  11660. sequential number of the input frame, starting from 1
  11661. @item Y, U, V, R, G, B
  11662. SSIM of the compared frames for the component specified by the suffix.
  11663. @item All
  11664. SSIM of the compared frames for the whole frame.
  11665. @item dB
  11666. Same as above but in dB representation.
  11667. @end table
  11668. This filter also supports the @ref{framesync} options.
  11669. For example:
  11670. @example
  11671. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11672. [main][ref] ssim="stats_file=stats.log" [out]
  11673. @end example
  11674. On this example the input file being processed is compared with the
  11675. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11676. is stored in @file{stats.log}.
  11677. Another example with both psnr and ssim at same time:
  11678. @example
  11679. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11680. @end example
  11681. @section stereo3d
  11682. Convert between different stereoscopic image formats.
  11683. The filters accept the following options:
  11684. @table @option
  11685. @item in
  11686. Set stereoscopic image format of input.
  11687. Available values for input image formats are:
  11688. @table @samp
  11689. @item sbsl
  11690. side by side parallel (left eye left, right eye right)
  11691. @item sbsr
  11692. side by side crosseye (right eye left, left eye right)
  11693. @item sbs2l
  11694. side by side parallel with half width resolution
  11695. (left eye left, right eye right)
  11696. @item sbs2r
  11697. side by side crosseye with half width resolution
  11698. (right eye left, left eye right)
  11699. @item abl
  11700. above-below (left eye above, right eye below)
  11701. @item abr
  11702. above-below (right eye above, left eye below)
  11703. @item ab2l
  11704. above-below with half height resolution
  11705. (left eye above, right eye below)
  11706. @item ab2r
  11707. above-below with half height resolution
  11708. (right eye above, left eye below)
  11709. @item al
  11710. alternating frames (left eye first, right eye second)
  11711. @item ar
  11712. alternating frames (right eye first, left eye second)
  11713. @item irl
  11714. interleaved rows (left eye has top row, right eye starts on next row)
  11715. @item irr
  11716. interleaved rows (right eye has top row, left eye starts on next row)
  11717. @item icl
  11718. interleaved columns, left eye first
  11719. @item icr
  11720. interleaved columns, right eye first
  11721. Default value is @samp{sbsl}.
  11722. @end table
  11723. @item out
  11724. Set stereoscopic image format of output.
  11725. @table @samp
  11726. @item sbsl
  11727. side by side parallel (left eye left, right eye right)
  11728. @item sbsr
  11729. side by side crosseye (right eye left, left eye right)
  11730. @item sbs2l
  11731. side by side parallel with half width resolution
  11732. (left eye left, right eye right)
  11733. @item sbs2r
  11734. side by side crosseye with half width resolution
  11735. (right eye left, left eye right)
  11736. @item abl
  11737. above-below (left eye above, right eye below)
  11738. @item abr
  11739. above-below (right eye above, left eye below)
  11740. @item ab2l
  11741. above-below with half height resolution
  11742. (left eye above, right eye below)
  11743. @item ab2r
  11744. above-below with half height resolution
  11745. (right eye above, left eye below)
  11746. @item al
  11747. alternating frames (left eye first, right eye second)
  11748. @item ar
  11749. alternating frames (right eye first, left eye second)
  11750. @item irl
  11751. interleaved rows (left eye has top row, right eye starts on next row)
  11752. @item irr
  11753. interleaved rows (right eye has top row, left eye starts on next row)
  11754. @item arbg
  11755. anaglyph red/blue gray
  11756. (red filter on left eye, blue filter on right eye)
  11757. @item argg
  11758. anaglyph red/green gray
  11759. (red filter on left eye, green filter on right eye)
  11760. @item arcg
  11761. anaglyph red/cyan gray
  11762. (red filter on left eye, cyan filter on right eye)
  11763. @item arch
  11764. anaglyph red/cyan half colored
  11765. (red filter on left eye, cyan filter on right eye)
  11766. @item arcc
  11767. anaglyph red/cyan color
  11768. (red filter on left eye, cyan filter on right eye)
  11769. @item arcd
  11770. anaglyph red/cyan color optimized with the least squares projection of dubois
  11771. (red filter on left eye, cyan filter on right eye)
  11772. @item agmg
  11773. anaglyph green/magenta gray
  11774. (green filter on left eye, magenta filter on right eye)
  11775. @item agmh
  11776. anaglyph green/magenta half colored
  11777. (green filter on left eye, magenta filter on right eye)
  11778. @item agmc
  11779. anaglyph green/magenta colored
  11780. (green filter on left eye, magenta filter on right eye)
  11781. @item agmd
  11782. anaglyph green/magenta color optimized with the least squares projection of dubois
  11783. (green filter on left eye, magenta filter on right eye)
  11784. @item aybg
  11785. anaglyph yellow/blue gray
  11786. (yellow filter on left eye, blue filter on right eye)
  11787. @item aybh
  11788. anaglyph yellow/blue half colored
  11789. (yellow filter on left eye, blue filter on right eye)
  11790. @item aybc
  11791. anaglyph yellow/blue colored
  11792. (yellow filter on left eye, blue filter on right eye)
  11793. @item aybd
  11794. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11795. (yellow filter on left eye, blue filter on right eye)
  11796. @item ml
  11797. mono output (left eye only)
  11798. @item mr
  11799. mono output (right eye only)
  11800. @item chl
  11801. checkerboard, left eye first
  11802. @item chr
  11803. checkerboard, right eye first
  11804. @item icl
  11805. interleaved columns, left eye first
  11806. @item icr
  11807. interleaved columns, right eye first
  11808. @item hdmi
  11809. HDMI frame pack
  11810. @end table
  11811. Default value is @samp{arcd}.
  11812. @end table
  11813. @subsection Examples
  11814. @itemize
  11815. @item
  11816. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11817. @example
  11818. stereo3d=sbsl:aybd
  11819. @end example
  11820. @item
  11821. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11822. @example
  11823. stereo3d=abl:sbsr
  11824. @end example
  11825. @end itemize
  11826. @section streamselect, astreamselect
  11827. Select video or audio streams.
  11828. The filter accepts the following options:
  11829. @table @option
  11830. @item inputs
  11831. Set number of inputs. Default is 2.
  11832. @item map
  11833. Set input indexes to remap to outputs.
  11834. @end table
  11835. @subsection Commands
  11836. The @code{streamselect} and @code{astreamselect} filter supports the following
  11837. commands:
  11838. @table @option
  11839. @item map
  11840. Set input indexes to remap to outputs.
  11841. @end table
  11842. @subsection Examples
  11843. @itemize
  11844. @item
  11845. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11846. @example
  11847. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11848. @end example
  11849. @item
  11850. Same as above, but for audio:
  11851. @example
  11852. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11853. @end example
  11854. @end itemize
  11855. @section sobel
  11856. Apply sobel operator to input video stream.
  11857. The filter accepts the following option:
  11858. @table @option
  11859. @item planes
  11860. Set which planes will be processed, unprocessed planes will be copied.
  11861. By default value 0xf, all planes will be processed.
  11862. @item scale
  11863. Set value which will be multiplied with filtered result.
  11864. @item delta
  11865. Set value which will be added to filtered result.
  11866. @end table
  11867. @anchor{spp}
  11868. @section spp
  11869. Apply a simple postprocessing filter that compresses and decompresses the image
  11870. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11871. and average the results.
  11872. The filter accepts the following options:
  11873. @table @option
  11874. @item quality
  11875. Set quality. This option defines the number of levels for averaging. It accepts
  11876. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11877. effect. A value of @code{6} means the higher quality. For each increment of
  11878. that value the speed drops by a factor of approximately 2. Default value is
  11879. @code{3}.
  11880. @item qp
  11881. Force a constant quantization parameter. If not set, the filter will use the QP
  11882. from the video stream (if available).
  11883. @item mode
  11884. Set thresholding mode. Available modes are:
  11885. @table @samp
  11886. @item hard
  11887. Set hard thresholding (default).
  11888. @item soft
  11889. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11890. @end table
  11891. @item use_bframe_qp
  11892. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11893. option may cause flicker since the B-Frames have often larger QP. Default is
  11894. @code{0} (not enabled).
  11895. @end table
  11896. @section sr
  11897. Scale the input by applying one of the super-resolution methods based on
  11898. convolutional neural networks. Supported models:
  11899. @itemize
  11900. @item
  11901. Super-Resolution Convolutional Neural Network model (SRCNN).
  11902. See @url{https://arxiv.org/abs/1501.00092}.
  11903. @item
  11904. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  11905. See @url{https://arxiv.org/abs/1609.05158}.
  11906. @end itemize
  11907. Training scripts as well as scripts for model generation are provided in
  11908. the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  11909. The filter accepts the following options:
  11910. @table @option
  11911. @item dnn_backend
  11912. Specify which DNN backend to use for model loading and execution. This option accepts
  11913. the following values:
  11914. @table @samp
  11915. @item native
  11916. Native implementation of DNN loading and execution.
  11917. @item tensorflow
  11918. TensorFlow backend. To enable this backend you
  11919. need to install the TensorFlow for C library (see
  11920. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  11921. @code{--enable-libtensorflow}
  11922. @end table
  11923. Default value is @samp{native}.
  11924. @item model
  11925. Set path to model file specifying network architecture and its parameters.
  11926. Note that different backends use different file formats. TensorFlow backend
  11927. can load files for both formats, while native backend can load files for only
  11928. its format.
  11929. @item scale_factor
  11930. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  11931. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  11932. input upscaled using bicubic upscaling with proper scale factor.
  11933. @end table
  11934. @anchor{subtitles}
  11935. @section subtitles
  11936. Draw subtitles on top of input video using the libass library.
  11937. To enable compilation of this filter you need to configure FFmpeg with
  11938. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11939. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11940. Alpha) subtitles format.
  11941. The filter accepts the following options:
  11942. @table @option
  11943. @item filename, f
  11944. Set the filename of the subtitle file to read. It must be specified.
  11945. @item original_size
  11946. Specify the size of the original video, the video for which the ASS file
  11947. was composed. For the syntax of this option, check the
  11948. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11949. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11950. correctly scale the fonts if the aspect ratio has been changed.
  11951. @item fontsdir
  11952. Set a directory path containing fonts that can be used by the filter.
  11953. These fonts will be used in addition to whatever the font provider uses.
  11954. @item alpha
  11955. Process alpha channel, by default alpha channel is untouched.
  11956. @item charenc
  11957. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11958. useful if not UTF-8.
  11959. @item stream_index, si
  11960. Set subtitles stream index. @code{subtitles} filter only.
  11961. @item force_style
  11962. Override default style or script info parameters of the subtitles. It accepts a
  11963. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11964. @end table
  11965. If the first key is not specified, it is assumed that the first value
  11966. specifies the @option{filename}.
  11967. For example, to render the file @file{sub.srt} on top of the input
  11968. video, use the command:
  11969. @example
  11970. subtitles=sub.srt
  11971. @end example
  11972. which is equivalent to:
  11973. @example
  11974. subtitles=filename=sub.srt
  11975. @end example
  11976. To render the default subtitles stream from file @file{video.mkv}, use:
  11977. @example
  11978. subtitles=video.mkv
  11979. @end example
  11980. To render the second subtitles stream from that file, use:
  11981. @example
  11982. subtitles=video.mkv:si=1
  11983. @end example
  11984. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  11985. @code{DejaVu Serif}, use:
  11986. @example
  11987. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  11988. @end example
  11989. @section super2xsai
  11990. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11991. Interpolate) pixel art scaling algorithm.
  11992. Useful for enlarging pixel art images without reducing sharpness.
  11993. @section swaprect
  11994. Swap two rectangular objects in video.
  11995. This filter accepts the following options:
  11996. @table @option
  11997. @item w
  11998. Set object width.
  11999. @item h
  12000. Set object height.
  12001. @item x1
  12002. Set 1st rect x coordinate.
  12003. @item y1
  12004. Set 1st rect y coordinate.
  12005. @item x2
  12006. Set 2nd rect x coordinate.
  12007. @item y2
  12008. Set 2nd rect y coordinate.
  12009. All expressions are evaluated once for each frame.
  12010. @end table
  12011. The all options are expressions containing the following constants:
  12012. @table @option
  12013. @item w
  12014. @item h
  12015. The input width and height.
  12016. @item a
  12017. same as @var{w} / @var{h}
  12018. @item sar
  12019. input sample aspect ratio
  12020. @item dar
  12021. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12022. @item n
  12023. The number of the input frame, starting from 0.
  12024. @item t
  12025. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12026. @item pos
  12027. the position in the file of the input frame, NAN if unknown
  12028. @end table
  12029. @section swapuv
  12030. Swap U & V plane.
  12031. @section telecine
  12032. Apply telecine process to the video.
  12033. This filter accepts the following options:
  12034. @table @option
  12035. @item first_field
  12036. @table @samp
  12037. @item top, t
  12038. top field first
  12039. @item bottom, b
  12040. bottom field first
  12041. The default value is @code{top}.
  12042. @end table
  12043. @item pattern
  12044. A string of numbers representing the pulldown pattern you wish to apply.
  12045. The default value is @code{23}.
  12046. @end table
  12047. @example
  12048. Some typical patterns:
  12049. NTSC output (30i):
  12050. 27.5p: 32222
  12051. 24p: 23 (classic)
  12052. 24p: 2332 (preferred)
  12053. 20p: 33
  12054. 18p: 334
  12055. 16p: 3444
  12056. PAL output (25i):
  12057. 27.5p: 12222
  12058. 24p: 222222222223 ("Euro pulldown")
  12059. 16.67p: 33
  12060. 16p: 33333334
  12061. @end example
  12062. @section threshold
  12063. Apply threshold effect to video stream.
  12064. This filter needs four video streams to perform thresholding.
  12065. First stream is stream we are filtering.
  12066. Second stream is holding threshold values, third stream is holding min values,
  12067. and last, fourth stream is holding max values.
  12068. The filter accepts the following option:
  12069. @table @option
  12070. @item planes
  12071. Set which planes will be processed, unprocessed planes will be copied.
  12072. By default value 0xf, all planes will be processed.
  12073. @end table
  12074. For example if first stream pixel's component value is less then threshold value
  12075. of pixel component from 2nd threshold stream, third stream value will picked,
  12076. otherwise fourth stream pixel component value will be picked.
  12077. Using color source filter one can perform various types of thresholding:
  12078. @subsection Examples
  12079. @itemize
  12080. @item
  12081. Binary threshold, using gray color as threshold:
  12082. @example
  12083. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12084. @end example
  12085. @item
  12086. Inverted binary threshold, using gray color as threshold:
  12087. @example
  12088. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12089. @end example
  12090. @item
  12091. Truncate binary threshold, using gray color as threshold:
  12092. @example
  12093. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12094. @end example
  12095. @item
  12096. Threshold to zero, using gray color as threshold:
  12097. @example
  12098. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12099. @end example
  12100. @item
  12101. Inverted threshold to zero, using gray color as threshold:
  12102. @example
  12103. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12104. @end example
  12105. @end itemize
  12106. @section thumbnail
  12107. Select the most representative frame in a given sequence of consecutive frames.
  12108. The filter accepts the following options:
  12109. @table @option
  12110. @item n
  12111. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12112. will pick one of them, and then handle the next batch of @var{n} frames until
  12113. the end. Default is @code{100}.
  12114. @end table
  12115. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12116. value will result in a higher memory usage, so a high value is not recommended.
  12117. @subsection Examples
  12118. @itemize
  12119. @item
  12120. Extract one picture each 50 frames:
  12121. @example
  12122. thumbnail=50
  12123. @end example
  12124. @item
  12125. Complete example of a thumbnail creation with @command{ffmpeg}:
  12126. @example
  12127. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12128. @end example
  12129. @end itemize
  12130. @section tile
  12131. Tile several successive frames together.
  12132. The filter accepts the following options:
  12133. @table @option
  12134. @item layout
  12135. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12136. this option, check the
  12137. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12138. @item nb_frames
  12139. Set the maximum number of frames to render in the given area. It must be less
  12140. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12141. the area will be used.
  12142. @item margin
  12143. Set the outer border margin in pixels.
  12144. @item padding
  12145. Set the inner border thickness (i.e. the number of pixels between frames). For
  12146. more advanced padding options (such as having different values for the edges),
  12147. refer to the pad video filter.
  12148. @item color
  12149. Specify the color of the unused area. For the syntax of this option, check the
  12150. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12151. The default value of @var{color} is "black".
  12152. @item overlap
  12153. Set the number of frames to overlap when tiling several successive frames together.
  12154. The value must be between @code{0} and @var{nb_frames - 1}.
  12155. @item init_padding
  12156. Set the number of frames to initially be empty before displaying first output frame.
  12157. This controls how soon will one get first output frame.
  12158. The value must be between @code{0} and @var{nb_frames - 1}.
  12159. @end table
  12160. @subsection Examples
  12161. @itemize
  12162. @item
  12163. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12164. @example
  12165. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12166. @end example
  12167. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12168. duplicating each output frame to accommodate the originally detected frame
  12169. rate.
  12170. @item
  12171. Display @code{5} pictures in an area of @code{3x2} frames,
  12172. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12173. mixed flat and named options:
  12174. @example
  12175. tile=3x2:nb_frames=5:padding=7:margin=2
  12176. @end example
  12177. @end itemize
  12178. @section tinterlace
  12179. Perform various types of temporal field interlacing.
  12180. Frames are counted starting from 1, so the first input frame is
  12181. considered odd.
  12182. The filter accepts the following options:
  12183. @table @option
  12184. @item mode
  12185. Specify the mode of the interlacing. This option can also be specified
  12186. as a value alone. See below for a list of values for this option.
  12187. Available values are:
  12188. @table @samp
  12189. @item merge, 0
  12190. Move odd frames into the upper field, even into the lower field,
  12191. generating a double height frame at half frame rate.
  12192. @example
  12193. ------> time
  12194. Input:
  12195. Frame 1 Frame 2 Frame 3 Frame 4
  12196. 11111 22222 33333 44444
  12197. 11111 22222 33333 44444
  12198. 11111 22222 33333 44444
  12199. 11111 22222 33333 44444
  12200. Output:
  12201. 11111 33333
  12202. 22222 44444
  12203. 11111 33333
  12204. 22222 44444
  12205. 11111 33333
  12206. 22222 44444
  12207. 11111 33333
  12208. 22222 44444
  12209. @end example
  12210. @item drop_even, 1
  12211. Only output odd frames, even frames are dropped, generating a frame with
  12212. unchanged height at half frame rate.
  12213. @example
  12214. ------> time
  12215. Input:
  12216. Frame 1 Frame 2 Frame 3 Frame 4
  12217. 11111 22222 33333 44444
  12218. 11111 22222 33333 44444
  12219. 11111 22222 33333 44444
  12220. 11111 22222 33333 44444
  12221. Output:
  12222. 11111 33333
  12223. 11111 33333
  12224. 11111 33333
  12225. 11111 33333
  12226. @end example
  12227. @item drop_odd, 2
  12228. Only output even frames, odd frames are dropped, generating a frame with
  12229. unchanged height at half frame rate.
  12230. @example
  12231. ------> time
  12232. Input:
  12233. Frame 1 Frame 2 Frame 3 Frame 4
  12234. 11111 22222 33333 44444
  12235. 11111 22222 33333 44444
  12236. 11111 22222 33333 44444
  12237. 11111 22222 33333 44444
  12238. Output:
  12239. 22222 44444
  12240. 22222 44444
  12241. 22222 44444
  12242. 22222 44444
  12243. @end example
  12244. @item pad, 3
  12245. Expand each frame to full height, but pad alternate lines with black,
  12246. generating a frame with double height at the same input frame rate.
  12247. @example
  12248. ------> time
  12249. Input:
  12250. Frame 1 Frame 2 Frame 3 Frame 4
  12251. 11111 22222 33333 44444
  12252. 11111 22222 33333 44444
  12253. 11111 22222 33333 44444
  12254. 11111 22222 33333 44444
  12255. Output:
  12256. 11111 ..... 33333 .....
  12257. ..... 22222 ..... 44444
  12258. 11111 ..... 33333 .....
  12259. ..... 22222 ..... 44444
  12260. 11111 ..... 33333 .....
  12261. ..... 22222 ..... 44444
  12262. 11111 ..... 33333 .....
  12263. ..... 22222 ..... 44444
  12264. @end example
  12265. @item interleave_top, 4
  12266. Interleave the upper field from odd frames with the lower field from
  12267. even frames, generating a frame with unchanged height at half frame rate.
  12268. @example
  12269. ------> time
  12270. Input:
  12271. Frame 1 Frame 2 Frame 3 Frame 4
  12272. 11111<- 22222 33333<- 44444
  12273. 11111 22222<- 33333 44444<-
  12274. 11111<- 22222 33333<- 44444
  12275. 11111 22222<- 33333 44444<-
  12276. Output:
  12277. 11111 33333
  12278. 22222 44444
  12279. 11111 33333
  12280. 22222 44444
  12281. @end example
  12282. @item interleave_bottom, 5
  12283. Interleave the lower field from odd frames with the upper field from
  12284. even frames, generating a frame with unchanged height at half frame rate.
  12285. @example
  12286. ------> time
  12287. Input:
  12288. Frame 1 Frame 2 Frame 3 Frame 4
  12289. 11111 22222<- 33333 44444<-
  12290. 11111<- 22222 33333<- 44444
  12291. 11111 22222<- 33333 44444<-
  12292. 11111<- 22222 33333<- 44444
  12293. Output:
  12294. 22222 44444
  12295. 11111 33333
  12296. 22222 44444
  12297. 11111 33333
  12298. @end example
  12299. @item interlacex2, 6
  12300. Double frame rate with unchanged height. Frames are inserted each
  12301. containing the second temporal field from the previous input frame and
  12302. the first temporal field from the next input frame. This mode relies on
  12303. the top_field_first flag. Useful for interlaced video displays with no
  12304. field synchronisation.
  12305. @example
  12306. ------> time
  12307. Input:
  12308. Frame 1 Frame 2 Frame 3 Frame 4
  12309. 11111 22222 33333 44444
  12310. 11111 22222 33333 44444
  12311. 11111 22222 33333 44444
  12312. 11111 22222 33333 44444
  12313. Output:
  12314. 11111 22222 22222 33333 33333 44444 44444
  12315. 11111 11111 22222 22222 33333 33333 44444
  12316. 11111 22222 22222 33333 33333 44444 44444
  12317. 11111 11111 22222 22222 33333 33333 44444
  12318. @end example
  12319. @item mergex2, 7
  12320. Move odd frames into the upper field, even into the lower field,
  12321. generating a double height frame at same frame rate.
  12322. @example
  12323. ------> time
  12324. Input:
  12325. Frame 1 Frame 2 Frame 3 Frame 4
  12326. 11111 22222 33333 44444
  12327. 11111 22222 33333 44444
  12328. 11111 22222 33333 44444
  12329. 11111 22222 33333 44444
  12330. Output:
  12331. 11111 33333 33333 55555
  12332. 22222 22222 44444 44444
  12333. 11111 33333 33333 55555
  12334. 22222 22222 44444 44444
  12335. 11111 33333 33333 55555
  12336. 22222 22222 44444 44444
  12337. 11111 33333 33333 55555
  12338. 22222 22222 44444 44444
  12339. @end example
  12340. @end table
  12341. Numeric values are deprecated but are accepted for backward
  12342. compatibility reasons.
  12343. Default mode is @code{merge}.
  12344. @item flags
  12345. Specify flags influencing the filter process.
  12346. Available value for @var{flags} is:
  12347. @table @option
  12348. @item low_pass_filter, vlfp
  12349. Enable linear vertical low-pass filtering in the filter.
  12350. Vertical low-pass filtering is required when creating an interlaced
  12351. destination from a progressive source which contains high-frequency
  12352. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  12353. patterning.
  12354. @item complex_filter, cvlfp
  12355. Enable complex vertical low-pass filtering.
  12356. This will slightly less reduce interlace 'twitter' and Moire
  12357. patterning but better retain detail and subjective sharpness impression.
  12358. @end table
  12359. Vertical low-pass filtering can only be enabled for @option{mode}
  12360. @var{interleave_top} and @var{interleave_bottom}.
  12361. @end table
  12362. @section tmix
  12363. Mix successive video frames.
  12364. A description of the accepted options follows.
  12365. @table @option
  12366. @item frames
  12367. The number of successive frames to mix. If unspecified, it defaults to 3.
  12368. @item weights
  12369. Specify weight of each input video frame.
  12370. Each weight is separated by space. If number of weights is smaller than
  12371. number of @var{frames} last specified weight will be used for all remaining
  12372. unset weights.
  12373. @item scale
  12374. Specify scale, if it is set it will be multiplied with sum
  12375. of each weight multiplied with pixel values to give final destination
  12376. pixel value. By default @var{scale} is auto scaled to sum of weights.
  12377. @end table
  12378. @subsection Examples
  12379. @itemize
  12380. @item
  12381. Average 7 successive frames:
  12382. @example
  12383. tmix=frames=7:weights="1 1 1 1 1 1 1"
  12384. @end example
  12385. @item
  12386. Apply simple temporal convolution:
  12387. @example
  12388. tmix=frames=3:weights="-1 3 -1"
  12389. @end example
  12390. @item
  12391. Similar as above but only showing temporal differences:
  12392. @example
  12393. tmix=frames=3:weights="-1 2 -1":scale=1
  12394. @end example
  12395. @end itemize
  12396. @section tonemap
  12397. Tone map colors from different dynamic ranges.
  12398. This filter expects data in single precision floating point, as it needs to
  12399. operate on (and can output) out-of-range values. Another filter, such as
  12400. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  12401. The tonemapping algorithms implemented only work on linear light, so input
  12402. data should be linearized beforehand (and possibly correctly tagged).
  12403. @example
  12404. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  12405. @end example
  12406. @subsection Options
  12407. The filter accepts the following options.
  12408. @table @option
  12409. @item tonemap
  12410. Set the tone map algorithm to use.
  12411. Possible values are:
  12412. @table @var
  12413. @item none
  12414. Do not apply any tone map, only desaturate overbright pixels.
  12415. @item clip
  12416. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  12417. in-range values, while distorting out-of-range values.
  12418. @item linear
  12419. Stretch the entire reference gamut to a linear multiple of the display.
  12420. @item gamma
  12421. Fit a logarithmic transfer between the tone curves.
  12422. @item reinhard
  12423. Preserve overall image brightness with a simple curve, using nonlinear
  12424. contrast, which results in flattening details and degrading color accuracy.
  12425. @item hable
  12426. Preserve both dark and bright details better than @var{reinhard}, at the cost
  12427. of slightly darkening everything. Use it when detail preservation is more
  12428. important than color and brightness accuracy.
  12429. @item mobius
  12430. Smoothly map out-of-range values, while retaining contrast and colors for
  12431. in-range material as much as possible. Use it when color accuracy is more
  12432. important than detail preservation.
  12433. @end table
  12434. Default is none.
  12435. @item param
  12436. Tune the tone mapping algorithm.
  12437. This affects the following algorithms:
  12438. @table @var
  12439. @item none
  12440. Ignored.
  12441. @item linear
  12442. Specifies the scale factor to use while stretching.
  12443. Default to 1.0.
  12444. @item gamma
  12445. Specifies the exponent of the function.
  12446. Default to 1.8.
  12447. @item clip
  12448. Specify an extra linear coefficient to multiply into the signal before clipping.
  12449. Default to 1.0.
  12450. @item reinhard
  12451. Specify the local contrast coefficient at the display peak.
  12452. Default to 0.5, which means that in-gamut values will be about half as bright
  12453. as when clipping.
  12454. @item hable
  12455. Ignored.
  12456. @item mobius
  12457. Specify the transition point from linear to mobius transform. Every value
  12458. below this point is guaranteed to be mapped 1:1. The higher the value, the
  12459. more accurate the result will be, at the cost of losing bright details.
  12460. Default to 0.3, which due to the steep initial slope still preserves in-range
  12461. colors fairly accurately.
  12462. @end table
  12463. @item desat
  12464. Apply desaturation for highlights that exceed this level of brightness. The
  12465. higher the parameter, the more color information will be preserved. This
  12466. setting helps prevent unnaturally blown-out colors for super-highlights, by
  12467. (smoothly) turning into white instead. This makes images feel more natural,
  12468. at the cost of reducing information about out-of-range colors.
  12469. The default of 2.0 is somewhat conservative and will mostly just apply to
  12470. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  12471. This option works only if the input frame has a supported color tag.
  12472. @item peak
  12473. Override signal/nominal/reference peak with this value. Useful when the
  12474. embedded peak information in display metadata is not reliable or when tone
  12475. mapping from a lower range to a higher range.
  12476. @end table
  12477. @anchor{transpose}
  12478. @section transpose
  12479. Transpose rows with columns in the input video and optionally flip it.
  12480. It accepts the following parameters:
  12481. @table @option
  12482. @item dir
  12483. Specify the transposition direction.
  12484. Can assume the following values:
  12485. @table @samp
  12486. @item 0, 4, cclock_flip
  12487. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  12488. @example
  12489. L.R L.l
  12490. . . -> . .
  12491. l.r R.r
  12492. @end example
  12493. @item 1, 5, clock
  12494. Rotate by 90 degrees clockwise, that is:
  12495. @example
  12496. L.R l.L
  12497. . . -> . .
  12498. l.r r.R
  12499. @end example
  12500. @item 2, 6, cclock
  12501. Rotate by 90 degrees counterclockwise, that is:
  12502. @example
  12503. L.R R.r
  12504. . . -> . .
  12505. l.r L.l
  12506. @end example
  12507. @item 3, 7, clock_flip
  12508. Rotate by 90 degrees clockwise and vertically flip, that is:
  12509. @example
  12510. L.R r.R
  12511. . . -> . .
  12512. l.r l.L
  12513. @end example
  12514. @end table
  12515. For values between 4-7, the transposition is only done if the input
  12516. video geometry is portrait and not landscape. These values are
  12517. deprecated, the @code{passthrough} option should be used instead.
  12518. Numerical values are deprecated, and should be dropped in favor of
  12519. symbolic constants.
  12520. @item passthrough
  12521. Do not apply the transposition if the input geometry matches the one
  12522. specified by the specified value. It accepts the following values:
  12523. @table @samp
  12524. @item none
  12525. Always apply transposition.
  12526. @item portrait
  12527. Preserve portrait geometry (when @var{height} >= @var{width}).
  12528. @item landscape
  12529. Preserve landscape geometry (when @var{width} >= @var{height}).
  12530. @end table
  12531. Default value is @code{none}.
  12532. @end table
  12533. For example to rotate by 90 degrees clockwise and preserve portrait
  12534. layout:
  12535. @example
  12536. transpose=dir=1:passthrough=portrait
  12537. @end example
  12538. The command above can also be specified as:
  12539. @example
  12540. transpose=1:portrait
  12541. @end example
  12542. @section transpose_npp
  12543. Transpose rows with columns in the input video and optionally flip it.
  12544. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  12545. It accepts the following parameters:
  12546. @table @option
  12547. @item dir
  12548. Specify the transposition direction.
  12549. Can assume the following values:
  12550. @table @samp
  12551. @item cclock_flip
  12552. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  12553. @item clock
  12554. Rotate by 90 degrees clockwise.
  12555. @item cclock
  12556. Rotate by 90 degrees counterclockwise.
  12557. @item clock_flip
  12558. Rotate by 90 degrees clockwise and vertically flip.
  12559. @end table
  12560. @item passthrough
  12561. Do not apply the transposition if the input geometry matches the one
  12562. specified by the specified value. It accepts the following values:
  12563. @table @samp
  12564. @item none
  12565. Always apply transposition. (default)
  12566. @item portrait
  12567. Preserve portrait geometry (when @var{height} >= @var{width}).
  12568. @item landscape
  12569. Preserve landscape geometry (when @var{width} >= @var{height}).
  12570. @end table
  12571. @end table
  12572. @section trim
  12573. Trim the input so that the output contains one continuous subpart of the input.
  12574. It accepts the following parameters:
  12575. @table @option
  12576. @item start
  12577. Specify the time of the start of the kept section, i.e. the frame with the
  12578. timestamp @var{start} will be the first frame in the output.
  12579. @item end
  12580. Specify the time of the first frame that will be dropped, i.e. the frame
  12581. immediately preceding the one with the timestamp @var{end} will be the last
  12582. frame in the output.
  12583. @item start_pts
  12584. This is the same as @var{start}, except this option sets the start timestamp
  12585. in timebase units instead of seconds.
  12586. @item end_pts
  12587. This is the same as @var{end}, except this option sets the end timestamp
  12588. in timebase units instead of seconds.
  12589. @item duration
  12590. The maximum duration of the output in seconds.
  12591. @item start_frame
  12592. The number of the first frame that should be passed to the output.
  12593. @item end_frame
  12594. The number of the first frame that should be dropped.
  12595. @end table
  12596. @option{start}, @option{end}, and @option{duration} are expressed as time
  12597. duration specifications; see
  12598. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12599. for the accepted syntax.
  12600. Note that the first two sets of the start/end options and the @option{duration}
  12601. option look at the frame timestamp, while the _frame variants simply count the
  12602. frames that pass through the filter. Also note that this filter does not modify
  12603. the timestamps. If you wish for the output timestamps to start at zero, insert a
  12604. setpts filter after the trim filter.
  12605. If multiple start or end options are set, this filter tries to be greedy and
  12606. keep all the frames that match at least one of the specified constraints. To keep
  12607. only the part that matches all the constraints at once, chain multiple trim
  12608. filters.
  12609. The defaults are such that all the input is kept. So it is possible to set e.g.
  12610. just the end values to keep everything before the specified time.
  12611. Examples:
  12612. @itemize
  12613. @item
  12614. Drop everything except the second minute of input:
  12615. @example
  12616. ffmpeg -i INPUT -vf trim=60:120
  12617. @end example
  12618. @item
  12619. Keep only the first second:
  12620. @example
  12621. ffmpeg -i INPUT -vf trim=duration=1
  12622. @end example
  12623. @end itemize
  12624. @section unpremultiply
  12625. Apply alpha unpremultiply effect to input video stream using first plane
  12626. of second stream as alpha.
  12627. Both streams must have same dimensions and same pixel format.
  12628. The filter accepts the following option:
  12629. @table @option
  12630. @item planes
  12631. Set which planes will be processed, unprocessed planes will be copied.
  12632. By default value 0xf, all planes will be processed.
  12633. If the format has 1 or 2 components, then luma is bit 0.
  12634. If the format has 3 or 4 components:
  12635. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  12636. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  12637. If present, the alpha channel is always the last bit.
  12638. @item inplace
  12639. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12640. @end table
  12641. @anchor{unsharp}
  12642. @section unsharp
  12643. Sharpen or blur the input video.
  12644. It accepts the following parameters:
  12645. @table @option
  12646. @item luma_msize_x, lx
  12647. Set the luma matrix horizontal size. It must be an odd integer between
  12648. 3 and 23. The default value is 5.
  12649. @item luma_msize_y, ly
  12650. Set the luma matrix vertical size. It must be an odd integer between 3
  12651. and 23. The default value is 5.
  12652. @item luma_amount, la
  12653. Set the luma effect strength. It must be a floating point number, reasonable
  12654. values lay between -1.5 and 1.5.
  12655. Negative values will blur the input video, while positive values will
  12656. sharpen it, a value of zero will disable the effect.
  12657. Default value is 1.0.
  12658. @item chroma_msize_x, cx
  12659. Set the chroma matrix horizontal size. It must be an odd integer
  12660. between 3 and 23. The default value is 5.
  12661. @item chroma_msize_y, cy
  12662. Set the chroma matrix vertical size. It must be an odd integer
  12663. between 3 and 23. The default value is 5.
  12664. @item chroma_amount, ca
  12665. Set the chroma effect strength. It must be a floating point number, reasonable
  12666. values lay between -1.5 and 1.5.
  12667. Negative values will blur the input video, while positive values will
  12668. sharpen it, a value of zero will disable the effect.
  12669. Default value is 0.0.
  12670. @end table
  12671. All parameters are optional and default to the equivalent of the
  12672. string '5:5:1.0:5:5:0.0'.
  12673. @subsection Examples
  12674. @itemize
  12675. @item
  12676. Apply strong luma sharpen effect:
  12677. @example
  12678. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12679. @end example
  12680. @item
  12681. Apply a strong blur of both luma and chroma parameters:
  12682. @example
  12683. unsharp=7:7:-2:7:7:-2
  12684. @end example
  12685. @end itemize
  12686. @section uspp
  12687. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12688. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12689. shifts and average the results.
  12690. The way this differs from the behavior of spp is that uspp actually encodes &
  12691. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12692. DCT similar to MJPEG.
  12693. The filter accepts the following options:
  12694. @table @option
  12695. @item quality
  12696. Set quality. This option defines the number of levels for averaging. It accepts
  12697. an integer in the range 0-8. If set to @code{0}, the filter will have no
  12698. effect. A value of @code{8} means the higher quality. For each increment of
  12699. that value the speed drops by a factor of approximately 2. Default value is
  12700. @code{3}.
  12701. @item qp
  12702. Force a constant quantization parameter. If not set, the filter will use the QP
  12703. from the video stream (if available).
  12704. @end table
  12705. @section vaguedenoiser
  12706. Apply a wavelet based denoiser.
  12707. It transforms each frame from the video input into the wavelet domain,
  12708. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  12709. the obtained coefficients. It does an inverse wavelet transform after.
  12710. Due to wavelet properties, it should give a nice smoothed result, and
  12711. reduced noise, without blurring picture features.
  12712. This filter accepts the following options:
  12713. @table @option
  12714. @item threshold
  12715. The filtering strength. The higher, the more filtered the video will be.
  12716. Hard thresholding can use a higher threshold than soft thresholding
  12717. before the video looks overfiltered. Default value is 2.
  12718. @item method
  12719. The filtering method the filter will use.
  12720. It accepts the following values:
  12721. @table @samp
  12722. @item hard
  12723. All values under the threshold will be zeroed.
  12724. @item soft
  12725. All values under the threshold will be zeroed. All values above will be
  12726. reduced by the threshold.
  12727. @item garrote
  12728. Scales or nullifies coefficients - intermediary between (more) soft and
  12729. (less) hard thresholding.
  12730. @end table
  12731. Default is garrote.
  12732. @item nsteps
  12733. Number of times, the wavelet will decompose the picture. Picture can't
  12734. be decomposed beyond a particular point (typically, 8 for a 640x480
  12735. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  12736. @item percent
  12737. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  12738. @item planes
  12739. A list of the planes to process. By default all planes are processed.
  12740. @end table
  12741. @section vectorscope
  12742. Display 2 color component values in the two dimensional graph (which is called
  12743. a vectorscope).
  12744. This filter accepts the following options:
  12745. @table @option
  12746. @item mode, m
  12747. Set vectorscope mode.
  12748. It accepts the following values:
  12749. @table @samp
  12750. @item gray
  12751. Gray values are displayed on graph, higher brightness means more pixels have
  12752. same component color value on location in graph. This is the default mode.
  12753. @item color
  12754. Gray values are displayed on graph. Surrounding pixels values which are not
  12755. present in video frame are drawn in gradient of 2 color components which are
  12756. set by option @code{x} and @code{y}. The 3rd color component is static.
  12757. @item color2
  12758. Actual color components values present in video frame are displayed on graph.
  12759. @item color3
  12760. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  12761. on graph increases value of another color component, which is luminance by
  12762. default values of @code{x} and @code{y}.
  12763. @item color4
  12764. Actual colors present in video frame are displayed on graph. If two different
  12765. colors map to same position on graph then color with higher value of component
  12766. not present in graph is picked.
  12767. @item color5
  12768. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  12769. component picked from radial gradient.
  12770. @end table
  12771. @item x
  12772. Set which color component will be represented on X-axis. Default is @code{1}.
  12773. @item y
  12774. Set which color component will be represented on Y-axis. Default is @code{2}.
  12775. @item intensity, i
  12776. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  12777. of color component which represents frequency of (X, Y) location in graph.
  12778. @item envelope, e
  12779. @table @samp
  12780. @item none
  12781. No envelope, this is default.
  12782. @item instant
  12783. Instant envelope, even darkest single pixel will be clearly highlighted.
  12784. @item peak
  12785. Hold maximum and minimum values presented in graph over time. This way you
  12786. can still spot out of range values without constantly looking at vectorscope.
  12787. @item peak+instant
  12788. Peak and instant envelope combined together.
  12789. @end table
  12790. @item graticule, g
  12791. Set what kind of graticule to draw.
  12792. @table @samp
  12793. @item none
  12794. @item green
  12795. @item color
  12796. @end table
  12797. @item opacity, o
  12798. Set graticule opacity.
  12799. @item flags, f
  12800. Set graticule flags.
  12801. @table @samp
  12802. @item white
  12803. Draw graticule for white point.
  12804. @item black
  12805. Draw graticule for black point.
  12806. @item name
  12807. Draw color points short names.
  12808. @end table
  12809. @item bgopacity, b
  12810. Set background opacity.
  12811. @item lthreshold, l
  12812. Set low threshold for color component not represented on X or Y axis.
  12813. Values lower than this value will be ignored. Default is 0.
  12814. Note this value is multiplied with actual max possible value one pixel component
  12815. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12816. is 0.1 * 255 = 25.
  12817. @item hthreshold, h
  12818. Set high threshold for color component not represented on X or Y axis.
  12819. Values higher than this value will be ignored. Default is 1.
  12820. Note this value is multiplied with actual max possible value one pixel component
  12821. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12822. is 0.9 * 255 = 230.
  12823. @item colorspace, c
  12824. Set what kind of colorspace to use when drawing graticule.
  12825. @table @samp
  12826. @item auto
  12827. @item 601
  12828. @item 709
  12829. @end table
  12830. Default is auto.
  12831. @end table
  12832. @anchor{vidstabdetect}
  12833. @section vidstabdetect
  12834. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12835. @ref{vidstabtransform} for pass 2.
  12836. This filter generates a file with relative translation and rotation
  12837. transform information about subsequent frames, which is then used by
  12838. the @ref{vidstabtransform} filter.
  12839. To enable compilation of this filter you need to configure FFmpeg with
  12840. @code{--enable-libvidstab}.
  12841. This filter accepts the following options:
  12842. @table @option
  12843. @item result
  12844. Set the path to the file used to write the transforms information.
  12845. Default value is @file{transforms.trf}.
  12846. @item shakiness
  12847. Set how shaky the video is and how quick the camera is. It accepts an
  12848. integer in the range 1-10, a value of 1 means little shakiness, a
  12849. value of 10 means strong shakiness. Default value is 5.
  12850. @item accuracy
  12851. Set the accuracy of the detection process. It must be a value in the
  12852. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  12853. accuracy. Default value is 15.
  12854. @item stepsize
  12855. Set stepsize of the search process. The region around minimum is
  12856. scanned with 1 pixel resolution. Default value is 6.
  12857. @item mincontrast
  12858. Set minimum contrast. Below this value a local measurement field is
  12859. discarded. Must be a floating point value in the range 0-1. Default
  12860. value is 0.3.
  12861. @item tripod
  12862. Set reference frame number for tripod mode.
  12863. If enabled, the motion of the frames is compared to a reference frame
  12864. in the filtered stream, identified by the specified number. The idea
  12865. is to compensate all movements in a more-or-less static scene and keep
  12866. the camera view absolutely still.
  12867. If set to 0, it is disabled. The frames are counted starting from 1.
  12868. @item show
  12869. Show fields and transforms in the resulting frames. It accepts an
  12870. integer in the range 0-2. Default value is 0, which disables any
  12871. visualization.
  12872. @end table
  12873. @subsection Examples
  12874. @itemize
  12875. @item
  12876. Use default values:
  12877. @example
  12878. vidstabdetect
  12879. @end example
  12880. @item
  12881. Analyze strongly shaky movie and put the results in file
  12882. @file{mytransforms.trf}:
  12883. @example
  12884. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12885. @end example
  12886. @item
  12887. Visualize the result of internal transformations in the resulting
  12888. video:
  12889. @example
  12890. vidstabdetect=show=1
  12891. @end example
  12892. @item
  12893. Analyze a video with medium shakiness using @command{ffmpeg}:
  12894. @example
  12895. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12896. @end example
  12897. @end itemize
  12898. @anchor{vidstabtransform}
  12899. @section vidstabtransform
  12900. Video stabilization/deshaking: pass 2 of 2,
  12901. see @ref{vidstabdetect} for pass 1.
  12902. Read a file with transform information for each frame and
  12903. apply/compensate them. Together with the @ref{vidstabdetect}
  12904. filter this can be used to deshake videos. See also
  12905. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12906. the @ref{unsharp} filter, see below.
  12907. To enable compilation of this filter you need to configure FFmpeg with
  12908. @code{--enable-libvidstab}.
  12909. @subsection Options
  12910. @table @option
  12911. @item input
  12912. Set path to the file used to read the transforms. Default value is
  12913. @file{transforms.trf}.
  12914. @item smoothing
  12915. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12916. camera movements. Default value is 10.
  12917. For example a number of 10 means that 21 frames are used (10 in the
  12918. past and 10 in the future) to smoothen the motion in the video. A
  12919. larger value leads to a smoother video, but limits the acceleration of
  12920. the camera (pan/tilt movements). 0 is a special case where a static
  12921. camera is simulated.
  12922. @item optalgo
  12923. Set the camera path optimization algorithm.
  12924. Accepted values are:
  12925. @table @samp
  12926. @item gauss
  12927. gaussian kernel low-pass filter on camera motion (default)
  12928. @item avg
  12929. averaging on transformations
  12930. @end table
  12931. @item maxshift
  12932. Set maximal number of pixels to translate frames. Default value is -1,
  12933. meaning no limit.
  12934. @item maxangle
  12935. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12936. value is -1, meaning no limit.
  12937. @item crop
  12938. Specify how to deal with borders that may be visible due to movement
  12939. compensation.
  12940. Available values are:
  12941. @table @samp
  12942. @item keep
  12943. keep image information from previous frame (default)
  12944. @item black
  12945. fill the border black
  12946. @end table
  12947. @item invert
  12948. Invert transforms if set to 1. Default value is 0.
  12949. @item relative
  12950. Consider transforms as relative to previous frame if set to 1,
  12951. absolute if set to 0. Default value is 0.
  12952. @item zoom
  12953. Set percentage to zoom. A positive value will result in a zoom-in
  12954. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12955. zoom).
  12956. @item optzoom
  12957. Set optimal zooming to avoid borders.
  12958. Accepted values are:
  12959. @table @samp
  12960. @item 0
  12961. disabled
  12962. @item 1
  12963. optimal static zoom value is determined (only very strong movements
  12964. will lead to visible borders) (default)
  12965. @item 2
  12966. optimal adaptive zoom value is determined (no borders will be
  12967. visible), see @option{zoomspeed}
  12968. @end table
  12969. Note that the value given at zoom is added to the one calculated here.
  12970. @item zoomspeed
  12971. Set percent to zoom maximally each frame (enabled when
  12972. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12973. 0.25.
  12974. @item interpol
  12975. Specify type of interpolation.
  12976. Available values are:
  12977. @table @samp
  12978. @item no
  12979. no interpolation
  12980. @item linear
  12981. linear only horizontal
  12982. @item bilinear
  12983. linear in both directions (default)
  12984. @item bicubic
  12985. cubic in both directions (slow)
  12986. @end table
  12987. @item tripod
  12988. Enable virtual tripod mode if set to 1, which is equivalent to
  12989. @code{relative=0:smoothing=0}. Default value is 0.
  12990. Use also @code{tripod} option of @ref{vidstabdetect}.
  12991. @item debug
  12992. Increase log verbosity if set to 1. Also the detected global motions
  12993. are written to the temporary file @file{global_motions.trf}. Default
  12994. value is 0.
  12995. @end table
  12996. @subsection Examples
  12997. @itemize
  12998. @item
  12999. Use @command{ffmpeg} for a typical stabilization with default values:
  13000. @example
  13001. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13002. @end example
  13003. Note the use of the @ref{unsharp} filter which is always recommended.
  13004. @item
  13005. Zoom in a bit more and load transform data from a given file:
  13006. @example
  13007. vidstabtransform=zoom=5:input="mytransforms.trf"
  13008. @end example
  13009. @item
  13010. Smoothen the video even more:
  13011. @example
  13012. vidstabtransform=smoothing=30
  13013. @end example
  13014. @end itemize
  13015. @section vflip
  13016. Flip the input video vertically.
  13017. For example, to vertically flip a video with @command{ffmpeg}:
  13018. @example
  13019. ffmpeg -i in.avi -vf "vflip" out.avi
  13020. @end example
  13021. @section vfrdet
  13022. Detect variable frame rate video.
  13023. This filter tries to detect if the input is variable or constant frame rate.
  13024. At end it will output number of frames detected as having variable delta pts,
  13025. and ones with constant delta pts.
  13026. If there was frames with variable delta, than it will also show min and max delta
  13027. encountered.
  13028. @anchor{vignette}
  13029. @section vignette
  13030. Make or reverse a natural vignetting effect.
  13031. The filter accepts the following options:
  13032. @table @option
  13033. @item angle, a
  13034. Set lens angle expression as a number of radians.
  13035. The value is clipped in the @code{[0,PI/2]} range.
  13036. Default value: @code{"PI/5"}
  13037. @item x0
  13038. @item y0
  13039. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13040. by default.
  13041. @item mode
  13042. Set forward/backward mode.
  13043. Available modes are:
  13044. @table @samp
  13045. @item forward
  13046. The larger the distance from the central point, the darker the image becomes.
  13047. @item backward
  13048. The larger the distance from the central point, the brighter the image becomes.
  13049. This can be used to reverse a vignette effect, though there is no automatic
  13050. detection to extract the lens @option{angle} and other settings (yet). It can
  13051. also be used to create a burning effect.
  13052. @end table
  13053. Default value is @samp{forward}.
  13054. @item eval
  13055. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13056. It accepts the following values:
  13057. @table @samp
  13058. @item init
  13059. Evaluate expressions only once during the filter initialization.
  13060. @item frame
  13061. Evaluate expressions for each incoming frame. This is way slower than the
  13062. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13063. allows advanced dynamic expressions.
  13064. @end table
  13065. Default value is @samp{init}.
  13066. @item dither
  13067. Set dithering to reduce the circular banding effects. Default is @code{1}
  13068. (enabled).
  13069. @item aspect
  13070. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13071. Setting this value to the SAR of the input will make a rectangular vignetting
  13072. following the dimensions of the video.
  13073. Default is @code{1/1}.
  13074. @end table
  13075. @subsection Expressions
  13076. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13077. following parameters.
  13078. @table @option
  13079. @item w
  13080. @item h
  13081. input width and height
  13082. @item n
  13083. the number of input frame, starting from 0
  13084. @item pts
  13085. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13086. @var{TB} units, NAN if undefined
  13087. @item r
  13088. frame rate of the input video, NAN if the input frame rate is unknown
  13089. @item t
  13090. the PTS (Presentation TimeStamp) of the filtered video frame,
  13091. expressed in seconds, NAN if undefined
  13092. @item tb
  13093. time base of the input video
  13094. @end table
  13095. @subsection Examples
  13096. @itemize
  13097. @item
  13098. Apply simple strong vignetting effect:
  13099. @example
  13100. vignette=PI/4
  13101. @end example
  13102. @item
  13103. Make a flickering vignetting:
  13104. @example
  13105. vignette='PI/4+random(1)*PI/50':eval=frame
  13106. @end example
  13107. @end itemize
  13108. @section vmafmotion
  13109. Obtain the average vmaf motion score of a video.
  13110. It is one of the component filters of VMAF.
  13111. The obtained average motion score is printed through the logging system.
  13112. In the below example the input file @file{ref.mpg} is being processed and score
  13113. is computed.
  13114. @example
  13115. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13116. @end example
  13117. @section vstack
  13118. Stack input videos vertically.
  13119. All streams must be of same pixel format and of same width.
  13120. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13121. to create same output.
  13122. The filter accept the following option:
  13123. @table @option
  13124. @item inputs
  13125. Set number of input streams. Default is 2.
  13126. @item shortest
  13127. If set to 1, force the output to terminate when the shortest input
  13128. terminates. Default value is 0.
  13129. @end table
  13130. @section w3fdif
  13131. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13132. Deinterlacing Filter").
  13133. Based on the process described by Martin Weston for BBC R&D, and
  13134. implemented based on the de-interlace algorithm written by Jim
  13135. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13136. uses filter coefficients calculated by BBC R&D.
  13137. There are two sets of filter coefficients, so called "simple":
  13138. and "complex". Which set of filter coefficients is used can
  13139. be set by passing an optional parameter:
  13140. @table @option
  13141. @item filter
  13142. Set the interlacing filter coefficients. Accepts one of the following values:
  13143. @table @samp
  13144. @item simple
  13145. Simple filter coefficient set.
  13146. @item complex
  13147. More-complex filter coefficient set.
  13148. @end table
  13149. Default value is @samp{complex}.
  13150. @item deint
  13151. Specify which frames to deinterlace. Accept one of the following values:
  13152. @table @samp
  13153. @item all
  13154. Deinterlace all frames,
  13155. @item interlaced
  13156. Only deinterlace frames marked as interlaced.
  13157. @end table
  13158. Default value is @samp{all}.
  13159. @end table
  13160. @section waveform
  13161. Video waveform monitor.
  13162. The waveform monitor plots color component intensity. By default luminance
  13163. only. Each column of the waveform corresponds to a column of pixels in the
  13164. source video.
  13165. It accepts the following options:
  13166. @table @option
  13167. @item mode, m
  13168. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13169. In row mode, the graph on the left side represents color component value 0 and
  13170. the right side represents value = 255. In column mode, the top side represents
  13171. color component value = 0 and bottom side represents value = 255.
  13172. @item intensity, i
  13173. Set intensity. Smaller values are useful to find out how many values of the same
  13174. luminance are distributed across input rows/columns.
  13175. Default value is @code{0.04}. Allowed range is [0, 1].
  13176. @item mirror, r
  13177. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13178. In mirrored mode, higher values will be represented on the left
  13179. side for @code{row} mode and at the top for @code{column} mode. Default is
  13180. @code{1} (mirrored).
  13181. @item display, d
  13182. Set display mode.
  13183. It accepts the following values:
  13184. @table @samp
  13185. @item overlay
  13186. Presents information identical to that in the @code{parade}, except
  13187. that the graphs representing color components are superimposed directly
  13188. over one another.
  13189. This display mode makes it easier to spot relative differences or similarities
  13190. in overlapping areas of the color components that are supposed to be identical,
  13191. such as neutral whites, grays, or blacks.
  13192. @item stack
  13193. Display separate graph for the color components side by side in
  13194. @code{row} mode or one below the other in @code{column} mode.
  13195. @item parade
  13196. Display separate graph for the color components side by side in
  13197. @code{column} mode or one below the other in @code{row} mode.
  13198. Using this display mode makes it easy to spot color casts in the highlights
  13199. and shadows of an image, by comparing the contours of the top and the bottom
  13200. graphs of each waveform. Since whites, grays, and blacks are characterized
  13201. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  13202. should display three waveforms of roughly equal width/height. If not, the
  13203. correction is easy to perform by making level adjustments the three waveforms.
  13204. @end table
  13205. Default is @code{stack}.
  13206. @item components, c
  13207. Set which color components to display. Default is 1, which means only luminance
  13208. or red color component if input is in RGB colorspace. If is set for example to
  13209. 7 it will display all 3 (if) available color components.
  13210. @item envelope, e
  13211. @table @samp
  13212. @item none
  13213. No envelope, this is default.
  13214. @item instant
  13215. Instant envelope, minimum and maximum values presented in graph will be easily
  13216. visible even with small @code{step} value.
  13217. @item peak
  13218. Hold minimum and maximum values presented in graph across time. This way you
  13219. can still spot out of range values without constantly looking at waveforms.
  13220. @item peak+instant
  13221. Peak and instant envelope combined together.
  13222. @end table
  13223. @item filter, f
  13224. @table @samp
  13225. @item lowpass
  13226. No filtering, this is default.
  13227. @item flat
  13228. Luma and chroma combined together.
  13229. @item aflat
  13230. Similar as above, but shows difference between blue and red chroma.
  13231. @item xflat
  13232. Similar as above, but use different colors.
  13233. @item chroma
  13234. Displays only chroma.
  13235. @item color
  13236. Displays actual color value on waveform.
  13237. @item acolor
  13238. Similar as above, but with luma showing frequency of chroma values.
  13239. @end table
  13240. @item graticule, g
  13241. Set which graticule to display.
  13242. @table @samp
  13243. @item none
  13244. Do not display graticule.
  13245. @item green
  13246. Display green graticule showing legal broadcast ranges.
  13247. @item orange
  13248. Display orange graticule showing legal broadcast ranges.
  13249. @end table
  13250. @item opacity, o
  13251. Set graticule opacity.
  13252. @item flags, fl
  13253. Set graticule flags.
  13254. @table @samp
  13255. @item numbers
  13256. Draw numbers above lines. By default enabled.
  13257. @item dots
  13258. Draw dots instead of lines.
  13259. @end table
  13260. @item scale, s
  13261. Set scale used for displaying graticule.
  13262. @table @samp
  13263. @item digital
  13264. @item millivolts
  13265. @item ire
  13266. @end table
  13267. Default is digital.
  13268. @item bgopacity, b
  13269. Set background opacity.
  13270. @end table
  13271. @section weave, doubleweave
  13272. The @code{weave} takes a field-based video input and join
  13273. each two sequential fields into single frame, producing a new double
  13274. height clip with half the frame rate and half the frame count.
  13275. The @code{doubleweave} works same as @code{weave} but without
  13276. halving frame rate and frame count.
  13277. It accepts the following option:
  13278. @table @option
  13279. @item first_field
  13280. Set first field. Available values are:
  13281. @table @samp
  13282. @item top, t
  13283. Set the frame as top-field-first.
  13284. @item bottom, b
  13285. Set the frame as bottom-field-first.
  13286. @end table
  13287. @end table
  13288. @subsection Examples
  13289. @itemize
  13290. @item
  13291. Interlace video using @ref{select} and @ref{separatefields} filter:
  13292. @example
  13293. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  13294. @end example
  13295. @end itemize
  13296. @section xbr
  13297. Apply the xBR high-quality magnification filter which is designed for pixel
  13298. art. It follows a set of edge-detection rules, see
  13299. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  13300. It accepts the following option:
  13301. @table @option
  13302. @item n
  13303. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  13304. @code{3xBR} and @code{4} for @code{4xBR}.
  13305. Default is @code{3}.
  13306. @end table
  13307. @anchor{yadif}
  13308. @section yadif
  13309. Deinterlace the input video ("yadif" means "yet another deinterlacing
  13310. filter").
  13311. It accepts the following parameters:
  13312. @table @option
  13313. @item mode
  13314. The interlacing mode to adopt. It accepts one of the following values:
  13315. @table @option
  13316. @item 0, send_frame
  13317. Output one frame for each frame.
  13318. @item 1, send_field
  13319. Output one frame for each field.
  13320. @item 2, send_frame_nospatial
  13321. Like @code{send_frame}, but it skips the spatial interlacing check.
  13322. @item 3, send_field_nospatial
  13323. Like @code{send_field}, but it skips the spatial interlacing check.
  13324. @end table
  13325. The default value is @code{send_frame}.
  13326. @item parity
  13327. The picture field parity assumed for the input interlaced video. It accepts one
  13328. of the following values:
  13329. @table @option
  13330. @item 0, tff
  13331. Assume the top field is first.
  13332. @item 1, bff
  13333. Assume the bottom field is first.
  13334. @item -1, auto
  13335. Enable automatic detection of field parity.
  13336. @end table
  13337. The default value is @code{auto}.
  13338. If the interlacing is unknown or the decoder does not export this information,
  13339. top field first will be assumed.
  13340. @item deint
  13341. Specify which frames to deinterlace. Accept one of the following
  13342. values:
  13343. @table @option
  13344. @item 0, all
  13345. Deinterlace all frames.
  13346. @item 1, interlaced
  13347. Only deinterlace frames marked as interlaced.
  13348. @end table
  13349. The default value is @code{all}.
  13350. @end table
  13351. @section zoompan
  13352. Apply Zoom & Pan effect.
  13353. This filter accepts the following options:
  13354. @table @option
  13355. @item zoom, z
  13356. Set the zoom expression. Default is 1.
  13357. @item x
  13358. @item y
  13359. Set the x and y expression. Default is 0.
  13360. @item d
  13361. Set the duration expression in number of frames.
  13362. This sets for how many number of frames effect will last for
  13363. single input image.
  13364. @item s
  13365. Set the output image size, default is 'hd720'.
  13366. @item fps
  13367. Set the output frame rate, default is '25'.
  13368. @end table
  13369. Each expression can contain the following constants:
  13370. @table @option
  13371. @item in_w, iw
  13372. Input width.
  13373. @item in_h, ih
  13374. Input height.
  13375. @item out_w, ow
  13376. Output width.
  13377. @item out_h, oh
  13378. Output height.
  13379. @item in
  13380. Input frame count.
  13381. @item on
  13382. Output frame count.
  13383. @item x
  13384. @item y
  13385. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  13386. for current input frame.
  13387. @item px
  13388. @item py
  13389. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  13390. not yet such frame (first input frame).
  13391. @item zoom
  13392. Last calculated zoom from 'z' expression for current input frame.
  13393. @item pzoom
  13394. Last calculated zoom of last output frame of previous input frame.
  13395. @item duration
  13396. Number of output frames for current input frame. Calculated from 'd' expression
  13397. for each input frame.
  13398. @item pduration
  13399. number of output frames created for previous input frame
  13400. @item a
  13401. Rational number: input width / input height
  13402. @item sar
  13403. sample aspect ratio
  13404. @item dar
  13405. display aspect ratio
  13406. @end table
  13407. @subsection Examples
  13408. @itemize
  13409. @item
  13410. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  13411. @example
  13412. 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
  13413. @end example
  13414. @item
  13415. Zoom-in up to 1.5 and pan always at center of picture:
  13416. @example
  13417. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13418. @end example
  13419. @item
  13420. Same as above but without pausing:
  13421. @example
  13422. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13423. @end example
  13424. @end itemize
  13425. @anchor{zscale}
  13426. @section zscale
  13427. Scale (resize) the input video, using the z.lib library:
  13428. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  13429. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  13430. The zscale filter forces the output display aspect ratio to be the same
  13431. as the input, by changing the output sample aspect ratio.
  13432. If the input image format is different from the format requested by
  13433. the next filter, the zscale filter will convert the input to the
  13434. requested format.
  13435. @subsection Options
  13436. The filter accepts the following options.
  13437. @table @option
  13438. @item width, w
  13439. @item height, h
  13440. Set the output video dimension expression. Default value is the input
  13441. dimension.
  13442. If the @var{width} or @var{w} value is 0, the input width is used for
  13443. the output. If the @var{height} or @var{h} value is 0, the input height
  13444. is used for the output.
  13445. If one and only one of the values is -n with n >= 1, the zscale filter
  13446. will use a value that maintains the aspect ratio of the input image,
  13447. calculated from the other specified dimension. After that it will,
  13448. however, make sure that the calculated dimension is divisible by n and
  13449. adjust the value if necessary.
  13450. If both values are -n with n >= 1, the behavior will be identical to
  13451. both values being set to 0 as previously detailed.
  13452. See below for the list of accepted constants for use in the dimension
  13453. expression.
  13454. @item size, s
  13455. Set the video size. For the syntax of this option, check the
  13456. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13457. @item dither, d
  13458. Set the dither type.
  13459. Possible values are:
  13460. @table @var
  13461. @item none
  13462. @item ordered
  13463. @item random
  13464. @item error_diffusion
  13465. @end table
  13466. Default is none.
  13467. @item filter, f
  13468. Set the resize filter type.
  13469. Possible values are:
  13470. @table @var
  13471. @item point
  13472. @item bilinear
  13473. @item bicubic
  13474. @item spline16
  13475. @item spline36
  13476. @item lanczos
  13477. @end table
  13478. Default is bilinear.
  13479. @item range, r
  13480. Set the color range.
  13481. Possible values are:
  13482. @table @var
  13483. @item input
  13484. @item limited
  13485. @item full
  13486. @end table
  13487. Default is same as input.
  13488. @item primaries, p
  13489. Set the color primaries.
  13490. Possible values are:
  13491. @table @var
  13492. @item input
  13493. @item 709
  13494. @item unspecified
  13495. @item 170m
  13496. @item 240m
  13497. @item 2020
  13498. @end table
  13499. Default is same as input.
  13500. @item transfer, t
  13501. Set the transfer characteristics.
  13502. Possible values are:
  13503. @table @var
  13504. @item input
  13505. @item 709
  13506. @item unspecified
  13507. @item 601
  13508. @item linear
  13509. @item 2020_10
  13510. @item 2020_12
  13511. @item smpte2084
  13512. @item iec61966-2-1
  13513. @item arib-std-b67
  13514. @end table
  13515. Default is same as input.
  13516. @item matrix, m
  13517. Set the colorspace matrix.
  13518. Possible value are:
  13519. @table @var
  13520. @item input
  13521. @item 709
  13522. @item unspecified
  13523. @item 470bg
  13524. @item 170m
  13525. @item 2020_ncl
  13526. @item 2020_cl
  13527. @end table
  13528. Default is same as input.
  13529. @item rangein, rin
  13530. Set the input color range.
  13531. Possible values are:
  13532. @table @var
  13533. @item input
  13534. @item limited
  13535. @item full
  13536. @end table
  13537. Default is same as input.
  13538. @item primariesin, pin
  13539. Set the input color primaries.
  13540. Possible values are:
  13541. @table @var
  13542. @item input
  13543. @item 709
  13544. @item unspecified
  13545. @item 170m
  13546. @item 240m
  13547. @item 2020
  13548. @end table
  13549. Default is same as input.
  13550. @item transferin, tin
  13551. Set the input transfer characteristics.
  13552. Possible values are:
  13553. @table @var
  13554. @item input
  13555. @item 709
  13556. @item unspecified
  13557. @item 601
  13558. @item linear
  13559. @item 2020_10
  13560. @item 2020_12
  13561. @end table
  13562. Default is same as input.
  13563. @item matrixin, min
  13564. Set the input colorspace matrix.
  13565. Possible value are:
  13566. @table @var
  13567. @item input
  13568. @item 709
  13569. @item unspecified
  13570. @item 470bg
  13571. @item 170m
  13572. @item 2020_ncl
  13573. @item 2020_cl
  13574. @end table
  13575. @item chromal, c
  13576. Set the output chroma location.
  13577. Possible values are:
  13578. @table @var
  13579. @item input
  13580. @item left
  13581. @item center
  13582. @item topleft
  13583. @item top
  13584. @item bottomleft
  13585. @item bottom
  13586. @end table
  13587. @item chromalin, cin
  13588. Set the input chroma location.
  13589. Possible values are:
  13590. @table @var
  13591. @item input
  13592. @item left
  13593. @item center
  13594. @item topleft
  13595. @item top
  13596. @item bottomleft
  13597. @item bottom
  13598. @end table
  13599. @item npl
  13600. Set the nominal peak luminance.
  13601. @end table
  13602. The values of the @option{w} and @option{h} options are expressions
  13603. containing the following constants:
  13604. @table @var
  13605. @item in_w
  13606. @item in_h
  13607. The input width and height
  13608. @item iw
  13609. @item ih
  13610. These are the same as @var{in_w} and @var{in_h}.
  13611. @item out_w
  13612. @item out_h
  13613. The output (scaled) width and height
  13614. @item ow
  13615. @item oh
  13616. These are the same as @var{out_w} and @var{out_h}
  13617. @item a
  13618. The same as @var{iw} / @var{ih}
  13619. @item sar
  13620. input sample aspect ratio
  13621. @item dar
  13622. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  13623. @item hsub
  13624. @item vsub
  13625. horizontal and vertical input chroma subsample values. For example for the
  13626. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13627. @item ohsub
  13628. @item ovsub
  13629. horizontal and vertical output chroma subsample values. For example for the
  13630. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13631. @end table
  13632. @table @option
  13633. @end table
  13634. @c man end VIDEO FILTERS
  13635. @chapter Video Sources
  13636. @c man begin VIDEO SOURCES
  13637. Below is a description of the currently available video sources.
  13638. @section buffer
  13639. Buffer video frames, and make them available to the filter chain.
  13640. This source is mainly intended for a programmatic use, in particular
  13641. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  13642. It accepts the following parameters:
  13643. @table @option
  13644. @item video_size
  13645. Specify the size (width and height) of the buffered video frames. For the
  13646. syntax of this option, check the
  13647. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13648. @item width
  13649. The input video width.
  13650. @item height
  13651. The input video height.
  13652. @item pix_fmt
  13653. A string representing the pixel format of the buffered video frames.
  13654. It may be a number corresponding to a pixel format, or a pixel format
  13655. name.
  13656. @item time_base
  13657. Specify the timebase assumed by the timestamps of the buffered frames.
  13658. @item frame_rate
  13659. Specify the frame rate expected for the video stream.
  13660. @item pixel_aspect, sar
  13661. The sample (pixel) aspect ratio of the input video.
  13662. @item sws_param
  13663. Specify the optional parameters to be used for the scale filter which
  13664. is automatically inserted when an input change is detected in the
  13665. input size or format.
  13666. @item hw_frames_ctx
  13667. When using a hardware pixel format, this should be a reference to an
  13668. AVHWFramesContext describing input frames.
  13669. @end table
  13670. For example:
  13671. @example
  13672. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  13673. @end example
  13674. will instruct the source to accept video frames with size 320x240 and
  13675. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  13676. square pixels (1:1 sample aspect ratio).
  13677. Since the pixel format with name "yuv410p" corresponds to the number 6
  13678. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  13679. this example corresponds to:
  13680. @example
  13681. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  13682. @end example
  13683. Alternatively, the options can be specified as a flat string, but this
  13684. syntax is deprecated:
  13685. @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}]
  13686. @section cellauto
  13687. Create a pattern generated by an elementary cellular automaton.
  13688. The initial state of the cellular automaton can be defined through the
  13689. @option{filename} and @option{pattern} options. If such options are
  13690. not specified an initial state is created randomly.
  13691. At each new frame a new row in the video is filled with the result of
  13692. the cellular automaton next generation. The behavior when the whole
  13693. frame is filled is defined by the @option{scroll} option.
  13694. This source accepts the following options:
  13695. @table @option
  13696. @item filename, f
  13697. Read the initial cellular automaton state, i.e. the starting row, from
  13698. the specified file.
  13699. In the file, each non-whitespace character is considered an alive
  13700. cell, a newline will terminate the row, and further characters in the
  13701. file will be ignored.
  13702. @item pattern, p
  13703. Read the initial cellular automaton state, i.e. the starting row, from
  13704. the specified string.
  13705. Each non-whitespace character in the string is considered an alive
  13706. cell, a newline will terminate the row, and further characters in the
  13707. string will be ignored.
  13708. @item rate, r
  13709. Set the video rate, that is the number of frames generated per second.
  13710. Default is 25.
  13711. @item random_fill_ratio, ratio
  13712. Set the random fill ratio for the initial cellular automaton row. It
  13713. is a floating point number value ranging from 0 to 1, defaults to
  13714. 1/PHI.
  13715. This option is ignored when a file or a pattern is specified.
  13716. @item random_seed, seed
  13717. Set the seed for filling randomly the initial row, must be an integer
  13718. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13719. set to -1, the filter will try to use a good random seed on a best
  13720. effort basis.
  13721. @item rule
  13722. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  13723. Default value is 110.
  13724. @item size, s
  13725. Set the size of the output video. For the syntax of this option, check the
  13726. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13727. If @option{filename} or @option{pattern} is specified, the size is set
  13728. by default to the width of the specified initial state row, and the
  13729. height is set to @var{width} * PHI.
  13730. If @option{size} is set, it must contain the width of the specified
  13731. pattern string, and the specified pattern will be centered in the
  13732. larger row.
  13733. If a filename or a pattern string is not specified, the size value
  13734. defaults to "320x518" (used for a randomly generated initial state).
  13735. @item scroll
  13736. If set to 1, scroll the output upward when all the rows in the output
  13737. have been already filled. If set to 0, the new generated row will be
  13738. written over the top row just after the bottom row is filled.
  13739. Defaults to 1.
  13740. @item start_full, full
  13741. If set to 1, completely fill the output with generated rows before
  13742. outputting the first frame.
  13743. This is the default behavior, for disabling set the value to 0.
  13744. @item stitch
  13745. If set to 1, stitch the left and right row edges together.
  13746. This is the default behavior, for disabling set the value to 0.
  13747. @end table
  13748. @subsection Examples
  13749. @itemize
  13750. @item
  13751. Read the initial state from @file{pattern}, and specify an output of
  13752. size 200x400.
  13753. @example
  13754. cellauto=f=pattern:s=200x400
  13755. @end example
  13756. @item
  13757. Generate a random initial row with a width of 200 cells, with a fill
  13758. ratio of 2/3:
  13759. @example
  13760. cellauto=ratio=2/3:s=200x200
  13761. @end example
  13762. @item
  13763. Create a pattern generated by rule 18 starting by a single alive cell
  13764. centered on an initial row with width 100:
  13765. @example
  13766. cellauto=p=@@:s=100x400:full=0:rule=18
  13767. @end example
  13768. @item
  13769. Specify a more elaborated initial pattern:
  13770. @example
  13771. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  13772. @end example
  13773. @end itemize
  13774. @anchor{coreimagesrc}
  13775. @section coreimagesrc
  13776. Video source generated on GPU using Apple's CoreImage API on OSX.
  13777. This video source is a specialized version of the @ref{coreimage} video filter.
  13778. Use a core image generator at the beginning of the applied filterchain to
  13779. generate the content.
  13780. The coreimagesrc video source accepts the following options:
  13781. @table @option
  13782. @item list_generators
  13783. List all available generators along with all their respective options as well as
  13784. possible minimum and maximum values along with the default values.
  13785. @example
  13786. list_generators=true
  13787. @end example
  13788. @item size, s
  13789. Specify the size of the sourced video. For the syntax of this option, check the
  13790. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13791. The default value is @code{320x240}.
  13792. @item rate, r
  13793. Specify the frame rate of the sourced video, as the number of frames
  13794. generated per second. It has to be a string in the format
  13795. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13796. number or a valid video frame rate abbreviation. The default value is
  13797. "25".
  13798. @item sar
  13799. Set the sample aspect ratio of the sourced video.
  13800. @item duration, d
  13801. Set the duration of the sourced video. See
  13802. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13803. for the accepted syntax.
  13804. If not specified, or the expressed duration is negative, the video is
  13805. supposed to be generated forever.
  13806. @end table
  13807. Additionally, all options of the @ref{coreimage} video filter are accepted.
  13808. A complete filterchain can be used for further processing of the
  13809. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  13810. and examples for details.
  13811. @subsection Examples
  13812. @itemize
  13813. @item
  13814. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  13815. given as complete and escaped command-line for Apple's standard bash shell:
  13816. @example
  13817. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13818. @end example
  13819. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13820. need for a nullsrc video source.
  13821. @end itemize
  13822. @section mandelbrot
  13823. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13824. point specified with @var{start_x} and @var{start_y}.
  13825. This source accepts the following options:
  13826. @table @option
  13827. @item end_pts
  13828. Set the terminal pts value. Default value is 400.
  13829. @item end_scale
  13830. Set the terminal scale value.
  13831. Must be a floating point value. Default value is 0.3.
  13832. @item inner
  13833. Set the inner coloring mode, that is the algorithm used to draw the
  13834. Mandelbrot fractal internal region.
  13835. It shall assume one of the following values:
  13836. @table @option
  13837. @item black
  13838. Set black mode.
  13839. @item convergence
  13840. Show time until convergence.
  13841. @item mincol
  13842. Set color based on point closest to the origin of the iterations.
  13843. @item period
  13844. Set period mode.
  13845. @end table
  13846. Default value is @var{mincol}.
  13847. @item bailout
  13848. Set the bailout value. Default value is 10.0.
  13849. @item maxiter
  13850. Set the maximum of iterations performed by the rendering
  13851. algorithm. Default value is 7189.
  13852. @item outer
  13853. Set outer coloring mode.
  13854. It shall assume one of following values:
  13855. @table @option
  13856. @item iteration_count
  13857. Set iteration cound mode.
  13858. @item normalized_iteration_count
  13859. set normalized iteration count mode.
  13860. @end table
  13861. Default value is @var{normalized_iteration_count}.
  13862. @item rate, r
  13863. Set frame rate, expressed as number of frames per second. Default
  13864. value is "25".
  13865. @item size, s
  13866. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  13867. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  13868. @item start_scale
  13869. Set the initial scale value. Default value is 3.0.
  13870. @item start_x
  13871. Set the initial x position. Must be a floating point value between
  13872. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13873. @item start_y
  13874. Set the initial y position. Must be a floating point value between
  13875. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13876. @end table
  13877. @section mptestsrc
  13878. Generate various test patterns, as generated by the MPlayer test filter.
  13879. The size of the generated video is fixed, and is 256x256.
  13880. This source is useful in particular for testing encoding features.
  13881. This source accepts the following options:
  13882. @table @option
  13883. @item rate, r
  13884. Specify the frame rate of the sourced video, as the number of frames
  13885. generated per second. It has to be a string in the format
  13886. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13887. number or a valid video frame rate abbreviation. The default value is
  13888. "25".
  13889. @item duration, d
  13890. Set the duration of the sourced video. See
  13891. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13892. for the accepted syntax.
  13893. If not specified, or the expressed duration is negative, the video is
  13894. supposed to be generated forever.
  13895. @item test, t
  13896. Set the number or the name of the test to perform. Supported tests are:
  13897. @table @option
  13898. @item dc_luma
  13899. @item dc_chroma
  13900. @item freq_luma
  13901. @item freq_chroma
  13902. @item amp_luma
  13903. @item amp_chroma
  13904. @item cbp
  13905. @item mv
  13906. @item ring1
  13907. @item ring2
  13908. @item all
  13909. @end table
  13910. Default value is "all", which will cycle through the list of all tests.
  13911. @end table
  13912. Some examples:
  13913. @example
  13914. mptestsrc=t=dc_luma
  13915. @end example
  13916. will generate a "dc_luma" test pattern.
  13917. @section frei0r_src
  13918. Provide a frei0r source.
  13919. To enable compilation of this filter you need to install the frei0r
  13920. header and configure FFmpeg with @code{--enable-frei0r}.
  13921. This source accepts the following parameters:
  13922. @table @option
  13923. @item size
  13924. The size of the video to generate. For the syntax of this option, check the
  13925. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13926. @item framerate
  13927. The framerate of the generated video. It may be a string of the form
  13928. @var{num}/@var{den} or a frame rate abbreviation.
  13929. @item filter_name
  13930. The name to the frei0r source to load. For more information regarding frei0r and
  13931. how to set the parameters, read the @ref{frei0r} section in the video filters
  13932. documentation.
  13933. @item filter_params
  13934. A '|'-separated list of parameters to pass to the frei0r source.
  13935. @end table
  13936. For example, to generate a frei0r partik0l source with size 200x200
  13937. and frame rate 10 which is overlaid on the overlay filter main input:
  13938. @example
  13939. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13940. @end example
  13941. @section life
  13942. Generate a life pattern.
  13943. This source is based on a generalization of John Conway's life game.
  13944. The sourced input represents a life grid, each pixel represents a cell
  13945. which can be in one of two possible states, alive or dead. Every cell
  13946. interacts with its eight neighbours, which are the cells that are
  13947. horizontally, vertically, or diagonally adjacent.
  13948. At each interaction the grid evolves according to the adopted rule,
  13949. which specifies the number of neighbor alive cells which will make a
  13950. cell stay alive or born. The @option{rule} option allows one to specify
  13951. the rule to adopt.
  13952. This source accepts the following options:
  13953. @table @option
  13954. @item filename, f
  13955. Set the file from which to read the initial grid state. In the file,
  13956. each non-whitespace character is considered an alive cell, and newline
  13957. is used to delimit the end of each row.
  13958. If this option is not specified, the initial grid is generated
  13959. randomly.
  13960. @item rate, r
  13961. Set the video rate, that is the number of frames generated per second.
  13962. Default is 25.
  13963. @item random_fill_ratio, ratio
  13964. Set the random fill ratio for the initial random grid. It is a
  13965. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13966. It is ignored when a file is specified.
  13967. @item random_seed, seed
  13968. Set the seed for filling the initial random grid, must be an integer
  13969. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13970. set to -1, the filter will try to use a good random seed on a best
  13971. effort basis.
  13972. @item rule
  13973. Set the life rule.
  13974. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13975. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13976. @var{NS} specifies the number of alive neighbor cells which make a
  13977. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13978. which make a dead cell to become alive (i.e. to "born").
  13979. "s" and "b" can be used in place of "S" and "B", respectively.
  13980. Alternatively a rule can be specified by an 18-bits integer. The 9
  13981. high order bits are used to encode the next cell state if it is alive
  13982. for each number of neighbor alive cells, the low order bits specify
  13983. the rule for "borning" new cells. Higher order bits encode for an
  13984. higher number of neighbor cells.
  13985. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13986. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13987. Default value is "S23/B3", which is the original Conway's game of life
  13988. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13989. cells, and will born a new cell if there are three alive cells around
  13990. a dead cell.
  13991. @item size, s
  13992. Set the size of the output video. For the syntax of this option, check the
  13993. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13994. If @option{filename} is specified, the size is set by default to the
  13995. same size of the input file. If @option{size} is set, it must contain
  13996. the size specified in the input file, and the initial grid defined in
  13997. that file is centered in the larger resulting area.
  13998. If a filename is not specified, the size value defaults to "320x240"
  13999. (used for a randomly generated initial grid).
  14000. @item stitch
  14001. If set to 1, stitch the left and right grid edges together, and the
  14002. top and bottom edges also. Defaults to 1.
  14003. @item mold
  14004. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  14005. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  14006. value from 0 to 255.
  14007. @item life_color
  14008. Set the color of living (or new born) cells.
  14009. @item death_color
  14010. Set the color of dead cells. If @option{mold} is set, this is the first color
  14011. used to represent a dead cell.
  14012. @item mold_color
  14013. Set mold color, for definitely dead and moldy cells.
  14014. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  14015. ffmpeg-utils manual,ffmpeg-utils}.
  14016. @end table
  14017. @subsection Examples
  14018. @itemize
  14019. @item
  14020. Read a grid from @file{pattern}, and center it on a grid of size
  14021. 300x300 pixels:
  14022. @example
  14023. life=f=pattern:s=300x300
  14024. @end example
  14025. @item
  14026. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  14027. @example
  14028. life=ratio=2/3:s=200x200
  14029. @end example
  14030. @item
  14031. Specify a custom rule for evolving a randomly generated grid:
  14032. @example
  14033. life=rule=S14/B34
  14034. @end example
  14035. @item
  14036. Full example with slow death effect (mold) using @command{ffplay}:
  14037. @example
  14038. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  14039. @end example
  14040. @end itemize
  14041. @anchor{allrgb}
  14042. @anchor{allyuv}
  14043. @anchor{color}
  14044. @anchor{haldclutsrc}
  14045. @anchor{nullsrc}
  14046. @anchor{pal75bars}
  14047. @anchor{pal100bars}
  14048. @anchor{rgbtestsrc}
  14049. @anchor{smptebars}
  14050. @anchor{smptehdbars}
  14051. @anchor{testsrc}
  14052. @anchor{testsrc2}
  14053. @anchor{yuvtestsrc}
  14054. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  14055. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  14056. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  14057. The @code{color} source provides an uniformly colored input.
  14058. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  14059. @ref{haldclut} filter.
  14060. The @code{nullsrc} source returns unprocessed video frames. It is
  14061. mainly useful to be employed in analysis / debugging tools, or as the
  14062. source for filters which ignore the input data.
  14063. The @code{pal75bars} source generates a color bars pattern, based on
  14064. EBU PAL recommendations with 75% color levels.
  14065. The @code{pal100bars} source generates a color bars pattern, based on
  14066. EBU PAL recommendations with 100% color levels.
  14067. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  14068. detecting RGB vs BGR issues. You should see a red, green and blue
  14069. stripe from top to bottom.
  14070. The @code{smptebars} source generates a color bars pattern, based on
  14071. the SMPTE Engineering Guideline EG 1-1990.
  14072. The @code{smptehdbars} source generates a color bars pattern, based on
  14073. the SMPTE RP 219-2002.
  14074. The @code{testsrc} source generates a test video pattern, showing a
  14075. color pattern, a scrolling gradient and a timestamp. This is mainly
  14076. intended for testing purposes.
  14077. The @code{testsrc2} source is similar to testsrc, but supports more
  14078. pixel formats instead of just @code{rgb24}. This allows using it as an
  14079. input for other tests without requiring a format conversion.
  14080. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  14081. see a y, cb and cr stripe from top to bottom.
  14082. The sources accept the following parameters:
  14083. @table @option
  14084. @item level
  14085. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  14086. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  14087. pixels to be used as identity matrix for 3D lookup tables. Each component is
  14088. coded on a @code{1/(N*N)} scale.
  14089. @item color, c
  14090. Specify the color of the source, only available in the @code{color}
  14091. source. For the syntax of this option, check the
  14092. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14093. @item size, s
  14094. Specify the size of the sourced video. For the syntax of this option, check the
  14095. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14096. The default value is @code{320x240}.
  14097. This option is not available with the @code{allrgb}, @code{allyuv}, and
  14098. @code{haldclutsrc} filters.
  14099. @item rate, r
  14100. Specify the frame rate of the sourced video, as the number of frames
  14101. generated per second. It has to be a string in the format
  14102. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14103. number or a valid video frame rate abbreviation. The default value is
  14104. "25".
  14105. @item duration, d
  14106. Set the duration of the sourced video. See
  14107. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14108. for the accepted syntax.
  14109. If not specified, or the expressed duration is negative, the video is
  14110. supposed to be generated forever.
  14111. @item sar
  14112. Set the sample aspect ratio of the sourced video.
  14113. @item alpha
  14114. Specify the alpha (opacity) of the background, only available in the
  14115. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  14116. 255 (fully opaque, the default).
  14117. @item decimals, n
  14118. Set the number of decimals to show in the timestamp, only available in the
  14119. @code{testsrc} source.
  14120. The displayed timestamp value will correspond to the original
  14121. timestamp value multiplied by the power of 10 of the specified
  14122. value. Default value is 0.
  14123. @end table
  14124. @subsection Examples
  14125. @itemize
  14126. @item
  14127. Generate a video with a duration of 5.3 seconds, with size
  14128. 176x144 and a frame rate of 10 frames per second:
  14129. @example
  14130. testsrc=duration=5.3:size=qcif:rate=10
  14131. @end example
  14132. @item
  14133. The following graph description will generate a red source
  14134. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  14135. frames per second:
  14136. @example
  14137. color=c=red@@0.2:s=qcif:r=10
  14138. @end example
  14139. @item
  14140. If the input content is to be ignored, @code{nullsrc} can be used. The
  14141. following command generates noise in the luminance plane by employing
  14142. the @code{geq} filter:
  14143. @example
  14144. nullsrc=s=256x256, geq=random(1)*255:128:128
  14145. @end example
  14146. @end itemize
  14147. @subsection Commands
  14148. The @code{color} source supports the following commands:
  14149. @table @option
  14150. @item c, color
  14151. Set the color of the created image. Accepts the same syntax of the
  14152. corresponding @option{color} option.
  14153. @end table
  14154. @section openclsrc
  14155. Generate video using an OpenCL program.
  14156. @table @option
  14157. @item source
  14158. OpenCL program source file.
  14159. @item kernel
  14160. Kernel name in program.
  14161. @item size, s
  14162. Size of frames to generate. This must be set.
  14163. @item format
  14164. Pixel format to use for the generated frames. This must be set.
  14165. @item rate, r
  14166. Number of frames generated every second. Default value is '25'.
  14167. @end table
  14168. For details of how the program loading works, see the @ref{program_opencl}
  14169. filter.
  14170. Example programs:
  14171. @itemize
  14172. @item
  14173. Generate a colour ramp by setting pixel values from the position of the pixel
  14174. in the output image. (Note that this will work with all pixel formats, but
  14175. the generated output will not be the same.)
  14176. @verbatim
  14177. __kernel void ramp(__write_only image2d_t dst,
  14178. unsigned int index)
  14179. {
  14180. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  14181. float4 val;
  14182. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  14183. write_imagef(dst, loc, val);
  14184. }
  14185. @end verbatim
  14186. @item
  14187. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  14188. @verbatim
  14189. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  14190. unsigned int index)
  14191. {
  14192. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  14193. float4 value = 0.0f;
  14194. int x = loc.x + index;
  14195. int y = loc.y + index;
  14196. while (x > 0 || y > 0) {
  14197. if (x % 3 == 1 && y % 3 == 1) {
  14198. value = 1.0f;
  14199. break;
  14200. }
  14201. x /= 3;
  14202. y /= 3;
  14203. }
  14204. write_imagef(dst, loc, value);
  14205. }
  14206. @end verbatim
  14207. @end itemize
  14208. @c man end VIDEO SOURCES
  14209. @chapter Video Sinks
  14210. @c man begin VIDEO SINKS
  14211. Below is a description of the currently available video sinks.
  14212. @section buffersink
  14213. Buffer video frames, and make them available to the end of the filter
  14214. graph.
  14215. This sink is mainly intended for programmatic use, in particular
  14216. through the interface defined in @file{libavfilter/buffersink.h}
  14217. or the options system.
  14218. It accepts a pointer to an AVBufferSinkContext structure, which
  14219. defines the incoming buffers' formats, to be passed as the opaque
  14220. parameter to @code{avfilter_init_filter} for initialization.
  14221. @section nullsink
  14222. Null video sink: do absolutely nothing with the input video. It is
  14223. mainly useful as a template and for use in analysis / debugging
  14224. tools.
  14225. @c man end VIDEO SINKS
  14226. @chapter Multimedia Filters
  14227. @c man begin MULTIMEDIA FILTERS
  14228. Below is a description of the currently available multimedia filters.
  14229. @section abitscope
  14230. Convert input audio to a video output, displaying the audio bit scope.
  14231. The filter accepts the following options:
  14232. @table @option
  14233. @item rate, r
  14234. Set frame rate, expressed as number of frames per second. Default
  14235. value is "25".
  14236. @item size, s
  14237. Specify the video size for the output. For the syntax of this option, check the
  14238. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14239. Default value is @code{1024x256}.
  14240. @item colors
  14241. Specify list of colors separated by space or by '|' which will be used to
  14242. draw channels. Unrecognized or missing colors will be replaced
  14243. by white color.
  14244. @end table
  14245. @section ahistogram
  14246. Convert input audio to a video output, displaying the volume histogram.
  14247. The filter accepts the following options:
  14248. @table @option
  14249. @item dmode
  14250. Specify how histogram is calculated.
  14251. It accepts the following values:
  14252. @table @samp
  14253. @item single
  14254. Use single histogram for all channels.
  14255. @item separate
  14256. Use separate histogram for each channel.
  14257. @end table
  14258. Default is @code{single}.
  14259. @item rate, r
  14260. Set frame rate, expressed as number of frames per second. Default
  14261. value is "25".
  14262. @item size, s
  14263. Specify the video size for the output. For the syntax of this option, check the
  14264. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14265. Default value is @code{hd720}.
  14266. @item scale
  14267. Set display scale.
  14268. It accepts the following values:
  14269. @table @samp
  14270. @item log
  14271. logarithmic
  14272. @item sqrt
  14273. square root
  14274. @item cbrt
  14275. cubic root
  14276. @item lin
  14277. linear
  14278. @item rlog
  14279. reverse logarithmic
  14280. @end table
  14281. Default is @code{log}.
  14282. @item ascale
  14283. Set amplitude scale.
  14284. It accepts the following values:
  14285. @table @samp
  14286. @item log
  14287. logarithmic
  14288. @item lin
  14289. linear
  14290. @end table
  14291. Default is @code{log}.
  14292. @item acount
  14293. Set how much frames to accumulate in histogram.
  14294. Defauls is 1. Setting this to -1 accumulates all frames.
  14295. @item rheight
  14296. Set histogram ratio of window height.
  14297. @item slide
  14298. Set sonogram sliding.
  14299. It accepts the following values:
  14300. @table @samp
  14301. @item replace
  14302. replace old rows with new ones.
  14303. @item scroll
  14304. scroll from top to bottom.
  14305. @end table
  14306. Default is @code{replace}.
  14307. @end table
  14308. @section aphasemeter
  14309. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  14310. representing mean phase of current audio frame. A video output can also be produced and is
  14311. enabled by default. The audio is passed through as first output.
  14312. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  14313. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  14314. and @code{1} means channels are in phase.
  14315. The filter accepts the following options, all related to its video output:
  14316. @table @option
  14317. @item rate, r
  14318. Set the output frame rate. Default value is @code{25}.
  14319. @item size, s
  14320. Set the video size for the output. For the syntax of this option, check the
  14321. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14322. Default value is @code{800x400}.
  14323. @item rc
  14324. @item gc
  14325. @item bc
  14326. Specify the red, green, blue contrast. Default values are @code{2},
  14327. @code{7} and @code{1}.
  14328. Allowed range is @code{[0, 255]}.
  14329. @item mpc
  14330. Set color which will be used for drawing median phase. If color is
  14331. @code{none} which is default, no median phase value will be drawn.
  14332. @item video
  14333. Enable video output. Default is enabled.
  14334. @end table
  14335. @section avectorscope
  14336. Convert input audio to a video output, representing the audio vector
  14337. scope.
  14338. The filter is used to measure the difference between channels of stereo
  14339. audio stream. A monoaural signal, consisting of identical left and right
  14340. signal, results in straight vertical line. Any stereo separation is visible
  14341. as a deviation from this line, creating a Lissajous figure.
  14342. If the straight (or deviation from it) but horizontal line appears this
  14343. indicates that the left and right channels are out of phase.
  14344. The filter accepts the following options:
  14345. @table @option
  14346. @item mode, m
  14347. Set the vectorscope mode.
  14348. Available values are:
  14349. @table @samp
  14350. @item lissajous
  14351. Lissajous rotated by 45 degrees.
  14352. @item lissajous_xy
  14353. Same as above but not rotated.
  14354. @item polar
  14355. Shape resembling half of circle.
  14356. @end table
  14357. Default value is @samp{lissajous}.
  14358. @item size, s
  14359. Set the video size for the output. For the syntax of this option, check the
  14360. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14361. Default value is @code{400x400}.
  14362. @item rate, r
  14363. Set the output frame rate. Default value is @code{25}.
  14364. @item rc
  14365. @item gc
  14366. @item bc
  14367. @item ac
  14368. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  14369. @code{160}, @code{80} and @code{255}.
  14370. Allowed range is @code{[0, 255]}.
  14371. @item rf
  14372. @item gf
  14373. @item bf
  14374. @item af
  14375. Specify the red, green, blue and alpha fade. Default values are @code{15},
  14376. @code{10}, @code{5} and @code{5}.
  14377. Allowed range is @code{[0, 255]}.
  14378. @item zoom
  14379. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  14380. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  14381. @item draw
  14382. Set the vectorscope drawing mode.
  14383. Available values are:
  14384. @table @samp
  14385. @item dot
  14386. Draw dot for each sample.
  14387. @item line
  14388. Draw line between previous and current sample.
  14389. @end table
  14390. Default value is @samp{dot}.
  14391. @item scale
  14392. Specify amplitude scale of audio samples.
  14393. Available values are:
  14394. @table @samp
  14395. @item lin
  14396. Linear.
  14397. @item sqrt
  14398. Square root.
  14399. @item cbrt
  14400. Cubic root.
  14401. @item log
  14402. Logarithmic.
  14403. @end table
  14404. @item swap
  14405. Swap left channel axis with right channel axis.
  14406. @item mirror
  14407. Mirror axis.
  14408. @table @samp
  14409. @item none
  14410. No mirror.
  14411. @item x
  14412. Mirror only x axis.
  14413. @item y
  14414. Mirror only y axis.
  14415. @item xy
  14416. Mirror both axis.
  14417. @end table
  14418. @end table
  14419. @subsection Examples
  14420. @itemize
  14421. @item
  14422. Complete example using @command{ffplay}:
  14423. @example
  14424. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14425. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  14426. @end example
  14427. @end itemize
  14428. @section bench, abench
  14429. Benchmark part of a filtergraph.
  14430. The filter accepts the following options:
  14431. @table @option
  14432. @item action
  14433. Start or stop a timer.
  14434. Available values are:
  14435. @table @samp
  14436. @item start
  14437. Get the current time, set it as frame metadata (using the key
  14438. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  14439. @item stop
  14440. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  14441. the input frame metadata to get the time difference. Time difference, average,
  14442. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  14443. @code{min}) are then printed. The timestamps are expressed in seconds.
  14444. @end table
  14445. @end table
  14446. @subsection Examples
  14447. @itemize
  14448. @item
  14449. Benchmark @ref{selectivecolor} filter:
  14450. @example
  14451. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  14452. @end example
  14453. @end itemize
  14454. @section concat
  14455. Concatenate audio and video streams, joining them together one after the
  14456. other.
  14457. The filter works on segments of synchronized video and audio streams. All
  14458. segments must have the same number of streams of each type, and that will
  14459. also be the number of streams at output.
  14460. The filter accepts the following options:
  14461. @table @option
  14462. @item n
  14463. Set the number of segments. Default is 2.
  14464. @item v
  14465. Set the number of output video streams, that is also the number of video
  14466. streams in each segment. Default is 1.
  14467. @item a
  14468. Set the number of output audio streams, that is also the number of audio
  14469. streams in each segment. Default is 0.
  14470. @item unsafe
  14471. Activate unsafe mode: do not fail if segments have a different format.
  14472. @end table
  14473. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  14474. @var{a} audio outputs.
  14475. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  14476. segment, in the same order as the outputs, then the inputs for the second
  14477. segment, etc.
  14478. Related streams do not always have exactly the same duration, for various
  14479. reasons including codec frame size or sloppy authoring. For that reason,
  14480. related synchronized streams (e.g. a video and its audio track) should be
  14481. concatenated at once. The concat filter will use the duration of the longest
  14482. stream in each segment (except the last one), and if necessary pad shorter
  14483. audio streams with silence.
  14484. For this filter to work correctly, all segments must start at timestamp 0.
  14485. All corresponding streams must have the same parameters in all segments; the
  14486. filtering system will automatically select a common pixel format for video
  14487. streams, and a common sample format, sample rate and channel layout for
  14488. audio streams, but other settings, such as resolution, must be converted
  14489. explicitly by the user.
  14490. Different frame rates are acceptable but will result in variable frame rate
  14491. at output; be sure to configure the output file to handle it.
  14492. @subsection Examples
  14493. @itemize
  14494. @item
  14495. Concatenate an opening, an episode and an ending, all in bilingual version
  14496. (video in stream 0, audio in streams 1 and 2):
  14497. @example
  14498. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  14499. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  14500. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  14501. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  14502. @end example
  14503. @item
  14504. Concatenate two parts, handling audio and video separately, using the
  14505. (a)movie sources, and adjusting the resolution:
  14506. @example
  14507. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  14508. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  14509. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  14510. @end example
  14511. Note that a desync will happen at the stitch if the audio and video streams
  14512. do not have exactly the same duration in the first file.
  14513. @end itemize
  14514. @subsection Commands
  14515. This filter supports the following commands:
  14516. @table @option
  14517. @item next
  14518. Close the current segment and step to the next one
  14519. @end table
  14520. @section drawgraph, adrawgraph
  14521. Draw a graph using input video or audio metadata.
  14522. It accepts the following parameters:
  14523. @table @option
  14524. @item m1
  14525. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  14526. @item fg1
  14527. Set 1st foreground color expression.
  14528. @item m2
  14529. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  14530. @item fg2
  14531. Set 2nd foreground color expression.
  14532. @item m3
  14533. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  14534. @item fg3
  14535. Set 3rd foreground color expression.
  14536. @item m4
  14537. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  14538. @item fg4
  14539. Set 4th foreground color expression.
  14540. @item min
  14541. Set minimal value of metadata value.
  14542. @item max
  14543. Set maximal value of metadata value.
  14544. @item bg
  14545. Set graph background color. Default is white.
  14546. @item mode
  14547. Set graph mode.
  14548. Available values for mode is:
  14549. @table @samp
  14550. @item bar
  14551. @item dot
  14552. @item line
  14553. @end table
  14554. Default is @code{line}.
  14555. @item slide
  14556. Set slide mode.
  14557. Available values for slide is:
  14558. @table @samp
  14559. @item frame
  14560. Draw new frame when right border is reached.
  14561. @item replace
  14562. Replace old columns with new ones.
  14563. @item scroll
  14564. Scroll from right to left.
  14565. @item rscroll
  14566. Scroll from left to right.
  14567. @item picture
  14568. Draw single picture.
  14569. @end table
  14570. Default is @code{frame}.
  14571. @item size
  14572. Set size of graph video. For the syntax of this option, check the
  14573. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14574. The default value is @code{900x256}.
  14575. The foreground color expressions can use the following variables:
  14576. @table @option
  14577. @item MIN
  14578. Minimal value of metadata value.
  14579. @item MAX
  14580. Maximal value of metadata value.
  14581. @item VAL
  14582. Current metadata key value.
  14583. @end table
  14584. The color is defined as 0xAABBGGRR.
  14585. @end table
  14586. Example using metadata from @ref{signalstats} filter:
  14587. @example
  14588. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  14589. @end example
  14590. Example using metadata from @ref{ebur128} filter:
  14591. @example
  14592. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  14593. @end example
  14594. @anchor{ebur128}
  14595. @section ebur128
  14596. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  14597. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  14598. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  14599. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  14600. The filter also has a video output (see the @var{video} option) with a real
  14601. time graph to observe the loudness evolution. The graphic contains the logged
  14602. message mentioned above, so it is not printed anymore when this option is set,
  14603. unless the verbose logging is set. The main graphing area contains the
  14604. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  14605. the momentary loudness (400 milliseconds).
  14606. More information about the Loudness Recommendation EBU R128 on
  14607. @url{http://tech.ebu.ch/loudness}.
  14608. The filter accepts the following options:
  14609. @table @option
  14610. @item video
  14611. Activate the video output. The audio stream is passed unchanged whether this
  14612. option is set or no. The video stream will be the first output stream if
  14613. activated. Default is @code{0}.
  14614. @item size
  14615. Set the video size. This option is for video only. For the syntax of this
  14616. option, check the
  14617. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14618. Default and minimum resolution is @code{640x480}.
  14619. @item meter
  14620. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  14621. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  14622. other integer value between this range is allowed.
  14623. @item metadata
  14624. Set metadata injection. If set to @code{1}, the audio input will be segmented
  14625. into 100ms output frames, each of them containing various loudness information
  14626. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  14627. Default is @code{0}.
  14628. @item framelog
  14629. Force the frame logging level.
  14630. Available values are:
  14631. @table @samp
  14632. @item info
  14633. information logging level
  14634. @item verbose
  14635. verbose logging level
  14636. @end table
  14637. By default, the logging level is set to @var{info}. If the @option{video} or
  14638. the @option{metadata} options are set, it switches to @var{verbose}.
  14639. @item peak
  14640. Set peak mode(s).
  14641. Available modes can be cumulated (the option is a @code{flag} type). Possible
  14642. values are:
  14643. @table @samp
  14644. @item none
  14645. Disable any peak mode (default).
  14646. @item sample
  14647. Enable sample-peak mode.
  14648. Simple peak mode looking for the higher sample value. It logs a message
  14649. for sample-peak (identified by @code{SPK}).
  14650. @item true
  14651. Enable true-peak mode.
  14652. If enabled, the peak lookup is done on an over-sampled version of the input
  14653. stream for better peak accuracy. It logs a message for true-peak.
  14654. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  14655. This mode requires a build with @code{libswresample}.
  14656. @end table
  14657. @item dualmono
  14658. Treat mono input files as "dual mono". If a mono file is intended for playback
  14659. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  14660. If set to @code{true}, this option will compensate for this effect.
  14661. Multi-channel input files are not affected by this option.
  14662. @item panlaw
  14663. Set a specific pan law to be used for the measurement of dual mono files.
  14664. This parameter is optional, and has a default value of -3.01dB.
  14665. @end table
  14666. @subsection Examples
  14667. @itemize
  14668. @item
  14669. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  14670. @example
  14671. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  14672. @end example
  14673. @item
  14674. Run an analysis with @command{ffmpeg}:
  14675. @example
  14676. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  14677. @end example
  14678. @end itemize
  14679. @section interleave, ainterleave
  14680. Temporally interleave frames from several inputs.
  14681. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  14682. These filters read frames from several inputs and send the oldest
  14683. queued frame to the output.
  14684. Input streams must have well defined, monotonically increasing frame
  14685. timestamp values.
  14686. In order to submit one frame to output, these filters need to enqueue
  14687. at least one frame for each input, so they cannot work in case one
  14688. input is not yet terminated and will not receive incoming frames.
  14689. For example consider the case when one input is a @code{select} filter
  14690. which always drops input frames. The @code{interleave} filter will keep
  14691. reading from that input, but it will never be able to send new frames
  14692. to output until the input sends an end-of-stream signal.
  14693. Also, depending on inputs synchronization, the filters will drop
  14694. frames in case one input receives more frames than the other ones, and
  14695. the queue is already filled.
  14696. These filters accept the following options:
  14697. @table @option
  14698. @item nb_inputs, n
  14699. Set the number of different inputs, it is 2 by default.
  14700. @end table
  14701. @subsection Examples
  14702. @itemize
  14703. @item
  14704. Interleave frames belonging to different streams using @command{ffmpeg}:
  14705. @example
  14706. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  14707. @end example
  14708. @item
  14709. Add flickering blur effect:
  14710. @example
  14711. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  14712. @end example
  14713. @end itemize
  14714. @section metadata, ametadata
  14715. Manipulate frame metadata.
  14716. This filter accepts the following options:
  14717. @table @option
  14718. @item mode
  14719. Set mode of operation of the filter.
  14720. Can be one of the following:
  14721. @table @samp
  14722. @item select
  14723. If both @code{value} and @code{key} is set, select frames
  14724. which have such metadata. If only @code{key} is set, select
  14725. every frame that has such key in metadata.
  14726. @item add
  14727. Add new metadata @code{key} and @code{value}. If key is already available
  14728. do nothing.
  14729. @item modify
  14730. Modify value of already present key.
  14731. @item delete
  14732. If @code{value} is set, delete only keys that have such value.
  14733. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  14734. the frame.
  14735. @item print
  14736. Print key and its value if metadata was found. If @code{key} is not set print all
  14737. metadata values available in frame.
  14738. @end table
  14739. @item key
  14740. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  14741. @item value
  14742. Set metadata value which will be used. This option is mandatory for
  14743. @code{modify} and @code{add} mode.
  14744. @item function
  14745. Which function to use when comparing metadata value and @code{value}.
  14746. Can be one of following:
  14747. @table @samp
  14748. @item same_str
  14749. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  14750. @item starts_with
  14751. Values are interpreted as strings, returns true if metadata value starts with
  14752. the @code{value} option string.
  14753. @item less
  14754. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  14755. @item equal
  14756. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  14757. @item greater
  14758. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  14759. @item expr
  14760. Values are interpreted as floats, returns true if expression from option @code{expr}
  14761. evaluates to true.
  14762. @end table
  14763. @item expr
  14764. Set expression which is used when @code{function} is set to @code{expr}.
  14765. The expression is evaluated through the eval API and can contain the following
  14766. constants:
  14767. @table @option
  14768. @item VALUE1
  14769. Float representation of @code{value} from metadata key.
  14770. @item VALUE2
  14771. Float representation of @code{value} as supplied by user in @code{value} option.
  14772. @end table
  14773. @item file
  14774. If specified in @code{print} mode, output is written to the named file. Instead of
  14775. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  14776. for standard output. If @code{file} option is not set, output is written to the log
  14777. with AV_LOG_INFO loglevel.
  14778. @end table
  14779. @subsection Examples
  14780. @itemize
  14781. @item
  14782. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  14783. between 0 and 1.
  14784. @example
  14785. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  14786. @end example
  14787. @item
  14788. Print silencedetect output to file @file{metadata.txt}.
  14789. @example
  14790. silencedetect,ametadata=mode=print:file=metadata.txt
  14791. @end example
  14792. @item
  14793. Direct all metadata to a pipe with file descriptor 4.
  14794. @example
  14795. metadata=mode=print:file='pipe\:4'
  14796. @end example
  14797. @end itemize
  14798. @section perms, aperms
  14799. Set read/write permissions for the output frames.
  14800. These filters are mainly aimed at developers to test direct path in the
  14801. following filter in the filtergraph.
  14802. The filters accept the following options:
  14803. @table @option
  14804. @item mode
  14805. Select the permissions mode.
  14806. It accepts the following values:
  14807. @table @samp
  14808. @item none
  14809. Do nothing. This is the default.
  14810. @item ro
  14811. Set all the output frames read-only.
  14812. @item rw
  14813. Set all the output frames directly writable.
  14814. @item toggle
  14815. Make the frame read-only if writable, and writable if read-only.
  14816. @item random
  14817. Set each output frame read-only or writable randomly.
  14818. @end table
  14819. @item seed
  14820. Set the seed for the @var{random} mode, must be an integer included between
  14821. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14822. @code{-1}, the filter will try to use a good random seed on a best effort
  14823. basis.
  14824. @end table
  14825. Note: in case of auto-inserted filter between the permission filter and the
  14826. following one, the permission might not be received as expected in that
  14827. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  14828. perms/aperms filter can avoid this problem.
  14829. @section realtime, arealtime
  14830. Slow down filtering to match real time approximately.
  14831. These filters will pause the filtering for a variable amount of time to
  14832. match the output rate with the input timestamps.
  14833. They are similar to the @option{re} option to @code{ffmpeg}.
  14834. They accept the following options:
  14835. @table @option
  14836. @item limit
  14837. Time limit for the pauses. Any pause longer than that will be considered
  14838. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  14839. @end table
  14840. @anchor{select}
  14841. @section select, aselect
  14842. Select frames to pass in output.
  14843. This filter accepts the following options:
  14844. @table @option
  14845. @item expr, e
  14846. Set expression, which is evaluated for each input frame.
  14847. If the expression is evaluated to zero, the frame is discarded.
  14848. If the evaluation result is negative or NaN, the frame is sent to the
  14849. first output; otherwise it is sent to the output with index
  14850. @code{ceil(val)-1}, assuming that the input index starts from 0.
  14851. For example a value of @code{1.2} corresponds to the output with index
  14852. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  14853. @item outputs, n
  14854. Set the number of outputs. The output to which to send the selected
  14855. frame is based on the result of the evaluation. Default value is 1.
  14856. @end table
  14857. The expression can contain the following constants:
  14858. @table @option
  14859. @item n
  14860. The (sequential) number of the filtered frame, starting from 0.
  14861. @item selected_n
  14862. The (sequential) number of the selected frame, starting from 0.
  14863. @item prev_selected_n
  14864. The sequential number of the last selected frame. It's NAN if undefined.
  14865. @item TB
  14866. The timebase of the input timestamps.
  14867. @item pts
  14868. The PTS (Presentation TimeStamp) of the filtered video frame,
  14869. expressed in @var{TB} units. It's NAN if undefined.
  14870. @item t
  14871. The PTS of the filtered video frame,
  14872. expressed in seconds. It's NAN if undefined.
  14873. @item prev_pts
  14874. The PTS of the previously filtered video frame. It's NAN if undefined.
  14875. @item prev_selected_pts
  14876. The PTS of the last previously filtered video frame. It's NAN if undefined.
  14877. @item prev_selected_t
  14878. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  14879. @item start_pts
  14880. The PTS of the first video frame in the video. It's NAN if undefined.
  14881. @item start_t
  14882. The time of the first video frame in the video. It's NAN if undefined.
  14883. @item pict_type @emph{(video only)}
  14884. The type of the filtered frame. It can assume one of the following
  14885. values:
  14886. @table @option
  14887. @item I
  14888. @item P
  14889. @item B
  14890. @item S
  14891. @item SI
  14892. @item SP
  14893. @item BI
  14894. @end table
  14895. @item interlace_type @emph{(video only)}
  14896. The frame interlace type. It can assume one of the following values:
  14897. @table @option
  14898. @item PROGRESSIVE
  14899. The frame is progressive (not interlaced).
  14900. @item TOPFIRST
  14901. The frame is top-field-first.
  14902. @item BOTTOMFIRST
  14903. The frame is bottom-field-first.
  14904. @end table
  14905. @item consumed_sample_n @emph{(audio only)}
  14906. the number of selected samples before the current frame
  14907. @item samples_n @emph{(audio only)}
  14908. the number of samples in the current frame
  14909. @item sample_rate @emph{(audio only)}
  14910. the input sample rate
  14911. @item key
  14912. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  14913. @item pos
  14914. the position in the file of the filtered frame, -1 if the information
  14915. is not available (e.g. for synthetic video)
  14916. @item scene @emph{(video only)}
  14917. value between 0 and 1 to indicate a new scene; a low value reflects a low
  14918. probability for the current frame to introduce a new scene, while a higher
  14919. value means the current frame is more likely to be one (see the example below)
  14920. @item concatdec_select
  14921. The concat demuxer can select only part of a concat input file by setting an
  14922. inpoint and an outpoint, but the output packets may not be entirely contained
  14923. in the selected interval. By using this variable, it is possible to skip frames
  14924. generated by the concat demuxer which are not exactly contained in the selected
  14925. interval.
  14926. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  14927. and the @var{lavf.concat.duration} packet metadata values which are also
  14928. present in the decoded frames.
  14929. The @var{concatdec_select} variable is -1 if the frame pts is at least
  14930. start_time and either the duration metadata is missing or the frame pts is less
  14931. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  14932. missing.
  14933. That basically means that an input frame is selected if its pts is within the
  14934. interval set by the concat demuxer.
  14935. @end table
  14936. The default value of the select expression is "1".
  14937. @subsection Examples
  14938. @itemize
  14939. @item
  14940. Select all frames in input:
  14941. @example
  14942. select
  14943. @end example
  14944. The example above is the same as:
  14945. @example
  14946. select=1
  14947. @end example
  14948. @item
  14949. Skip all frames:
  14950. @example
  14951. select=0
  14952. @end example
  14953. @item
  14954. Select only I-frames:
  14955. @example
  14956. select='eq(pict_type\,I)'
  14957. @end example
  14958. @item
  14959. Select one frame every 100:
  14960. @example
  14961. select='not(mod(n\,100))'
  14962. @end example
  14963. @item
  14964. Select only frames contained in the 10-20 time interval:
  14965. @example
  14966. select=between(t\,10\,20)
  14967. @end example
  14968. @item
  14969. Select only I-frames contained in the 10-20 time interval:
  14970. @example
  14971. select=between(t\,10\,20)*eq(pict_type\,I)
  14972. @end example
  14973. @item
  14974. Select frames with a minimum distance of 10 seconds:
  14975. @example
  14976. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14977. @end example
  14978. @item
  14979. Use aselect to select only audio frames with samples number > 100:
  14980. @example
  14981. aselect='gt(samples_n\,100)'
  14982. @end example
  14983. @item
  14984. Create a mosaic of the first scenes:
  14985. @example
  14986. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14987. @end example
  14988. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14989. choice.
  14990. @item
  14991. Send even and odd frames to separate outputs, and compose them:
  14992. @example
  14993. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14994. @end example
  14995. @item
  14996. Select useful frames from an ffconcat file which is using inpoints and
  14997. outpoints but where the source files are not intra frame only.
  14998. @example
  14999. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  15000. @end example
  15001. @end itemize
  15002. @section sendcmd, asendcmd
  15003. Send commands to filters in the filtergraph.
  15004. These filters read commands to be sent to other filters in the
  15005. filtergraph.
  15006. @code{sendcmd} must be inserted between two video filters,
  15007. @code{asendcmd} must be inserted between two audio filters, but apart
  15008. from that they act the same way.
  15009. The specification of commands can be provided in the filter arguments
  15010. with the @var{commands} option, or in a file specified by the
  15011. @var{filename} option.
  15012. These filters accept the following options:
  15013. @table @option
  15014. @item commands, c
  15015. Set the commands to be read and sent to the other filters.
  15016. @item filename, f
  15017. Set the filename of the commands to be read and sent to the other
  15018. filters.
  15019. @end table
  15020. @subsection Commands syntax
  15021. A commands description consists of a sequence of interval
  15022. specifications, comprising a list of commands to be executed when a
  15023. particular event related to that interval occurs. The occurring event
  15024. is typically the current frame time entering or leaving a given time
  15025. interval.
  15026. An interval is specified by the following syntax:
  15027. @example
  15028. @var{START}[-@var{END}] @var{COMMANDS};
  15029. @end example
  15030. The time interval is specified by the @var{START} and @var{END} times.
  15031. @var{END} is optional and defaults to the maximum time.
  15032. The current frame time is considered within the specified interval if
  15033. it is included in the interval [@var{START}, @var{END}), that is when
  15034. the time is greater or equal to @var{START} and is lesser than
  15035. @var{END}.
  15036. @var{COMMANDS} consists of a sequence of one or more command
  15037. specifications, separated by ",", relating to that interval. The
  15038. syntax of a command specification is given by:
  15039. @example
  15040. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  15041. @end example
  15042. @var{FLAGS} is optional and specifies the type of events relating to
  15043. the time interval which enable sending the specified command, and must
  15044. be a non-null sequence of identifier flags separated by "+" or "|" and
  15045. enclosed between "[" and "]".
  15046. The following flags are recognized:
  15047. @table @option
  15048. @item enter
  15049. The command is sent when the current frame timestamp enters the
  15050. specified interval. In other words, the command is sent when the
  15051. previous frame timestamp was not in the given interval, and the
  15052. current is.
  15053. @item leave
  15054. The command is sent when the current frame timestamp leaves the
  15055. specified interval. In other words, the command is sent when the
  15056. previous frame timestamp was in the given interval, and the
  15057. current is not.
  15058. @end table
  15059. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  15060. assumed.
  15061. @var{TARGET} specifies the target of the command, usually the name of
  15062. the filter class or a specific filter instance name.
  15063. @var{COMMAND} specifies the name of the command for the target filter.
  15064. @var{ARG} is optional and specifies the optional list of argument for
  15065. the given @var{COMMAND}.
  15066. Between one interval specification and another, whitespaces, or
  15067. sequences of characters starting with @code{#} until the end of line,
  15068. are ignored and can be used to annotate comments.
  15069. A simplified BNF description of the commands specification syntax
  15070. follows:
  15071. @example
  15072. @var{COMMAND_FLAG} ::= "enter" | "leave"
  15073. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  15074. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  15075. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  15076. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  15077. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  15078. @end example
  15079. @subsection Examples
  15080. @itemize
  15081. @item
  15082. Specify audio tempo change at second 4:
  15083. @example
  15084. asendcmd=c='4.0 atempo tempo 1.5',atempo
  15085. @end example
  15086. @item
  15087. Target a specific filter instance:
  15088. @example
  15089. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  15090. @end example
  15091. @item
  15092. Specify a list of drawtext and hue commands in a file.
  15093. @example
  15094. # show text in the interval 5-10
  15095. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  15096. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  15097. # desaturate the image in the interval 15-20
  15098. 15.0-20.0 [enter] hue s 0,
  15099. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  15100. [leave] hue s 1,
  15101. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  15102. # apply an exponential saturation fade-out effect, starting from time 25
  15103. 25 [enter] hue s exp(25-t)
  15104. @end example
  15105. A filtergraph allowing to read and process the above command list
  15106. stored in a file @file{test.cmd}, can be specified with:
  15107. @example
  15108. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  15109. @end example
  15110. @end itemize
  15111. @anchor{setpts}
  15112. @section setpts, asetpts
  15113. Change the PTS (presentation timestamp) of the input frames.
  15114. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  15115. This filter accepts the following options:
  15116. @table @option
  15117. @item expr
  15118. The expression which is evaluated for each frame to construct its timestamp.
  15119. @end table
  15120. The expression is evaluated through the eval API and can contain the following
  15121. constants:
  15122. @table @option
  15123. @item FRAME_RATE, FR
  15124. frame rate, only defined for constant frame-rate video
  15125. @item PTS
  15126. The presentation timestamp in input
  15127. @item N
  15128. The count of the input frame for video or the number of consumed samples,
  15129. not including the current frame for audio, starting from 0.
  15130. @item NB_CONSUMED_SAMPLES
  15131. The number of consumed samples, not including the current frame (only
  15132. audio)
  15133. @item NB_SAMPLES, S
  15134. The number of samples in the current frame (only audio)
  15135. @item SAMPLE_RATE, SR
  15136. The audio sample rate.
  15137. @item STARTPTS
  15138. The PTS of the first frame.
  15139. @item STARTT
  15140. the time in seconds of the first frame
  15141. @item INTERLACED
  15142. State whether the current frame is interlaced.
  15143. @item T
  15144. the time in seconds of the current frame
  15145. @item POS
  15146. original position in the file of the frame, or undefined if undefined
  15147. for the current frame
  15148. @item PREV_INPTS
  15149. The previous input PTS.
  15150. @item PREV_INT
  15151. previous input time in seconds
  15152. @item PREV_OUTPTS
  15153. The previous output PTS.
  15154. @item PREV_OUTT
  15155. previous output time in seconds
  15156. @item RTCTIME
  15157. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  15158. instead.
  15159. @item RTCSTART
  15160. The wallclock (RTC) time at the start of the movie in microseconds.
  15161. @item TB
  15162. The timebase of the input timestamps.
  15163. @end table
  15164. @subsection Examples
  15165. @itemize
  15166. @item
  15167. Start counting PTS from zero
  15168. @example
  15169. setpts=PTS-STARTPTS
  15170. @end example
  15171. @item
  15172. Apply fast motion effect:
  15173. @example
  15174. setpts=0.5*PTS
  15175. @end example
  15176. @item
  15177. Apply slow motion effect:
  15178. @example
  15179. setpts=2.0*PTS
  15180. @end example
  15181. @item
  15182. Set fixed rate of 25 frames per second:
  15183. @example
  15184. setpts=N/(25*TB)
  15185. @end example
  15186. @item
  15187. Set fixed rate 25 fps with some jitter:
  15188. @example
  15189. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  15190. @end example
  15191. @item
  15192. Apply an offset of 10 seconds to the input PTS:
  15193. @example
  15194. setpts=PTS+10/TB
  15195. @end example
  15196. @item
  15197. Generate timestamps from a "live source" and rebase onto the current timebase:
  15198. @example
  15199. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  15200. @end example
  15201. @item
  15202. Generate timestamps by counting samples:
  15203. @example
  15204. asetpts=N/SR/TB
  15205. @end example
  15206. @end itemize
  15207. @section setrange
  15208. Force color range for the output video frame.
  15209. The @code{setrange} filter marks the color range property for the
  15210. output frames. It does not change the input frame, but only sets the
  15211. corresponding property, which affects how the frame is treated by
  15212. following filters.
  15213. The filter accepts the following options:
  15214. @table @option
  15215. @item range
  15216. Available values are:
  15217. @table @samp
  15218. @item auto
  15219. Keep the same color range property.
  15220. @item unspecified, unknown
  15221. Set the color range as unspecified.
  15222. @item limited, tv, mpeg
  15223. Set the color range as limited.
  15224. @item full, pc, jpeg
  15225. Set the color range as full.
  15226. @end table
  15227. @end table
  15228. @section settb, asettb
  15229. Set the timebase to use for the output frames timestamps.
  15230. It is mainly useful for testing timebase configuration.
  15231. It accepts the following parameters:
  15232. @table @option
  15233. @item expr, tb
  15234. The expression which is evaluated into the output timebase.
  15235. @end table
  15236. The value for @option{tb} is an arithmetic expression representing a
  15237. rational. The expression can contain the constants "AVTB" (the default
  15238. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  15239. audio only). Default value is "intb".
  15240. @subsection Examples
  15241. @itemize
  15242. @item
  15243. Set the timebase to 1/25:
  15244. @example
  15245. settb=expr=1/25
  15246. @end example
  15247. @item
  15248. Set the timebase to 1/10:
  15249. @example
  15250. settb=expr=0.1
  15251. @end example
  15252. @item
  15253. Set the timebase to 1001/1000:
  15254. @example
  15255. settb=1+0.001
  15256. @end example
  15257. @item
  15258. Set the timebase to 2*intb:
  15259. @example
  15260. settb=2*intb
  15261. @end example
  15262. @item
  15263. Set the default timebase value:
  15264. @example
  15265. settb=AVTB
  15266. @end example
  15267. @end itemize
  15268. @section showcqt
  15269. Convert input audio to a video output representing frequency spectrum
  15270. logarithmically using Brown-Puckette constant Q transform algorithm with
  15271. direct frequency domain coefficient calculation (but the transform itself
  15272. is not really constant Q, instead the Q factor is actually variable/clamped),
  15273. with musical tone scale, from E0 to D#10.
  15274. The filter accepts the following options:
  15275. @table @option
  15276. @item size, s
  15277. Specify the video size for the output. It must be even. For the syntax of this option,
  15278. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15279. Default value is @code{1920x1080}.
  15280. @item fps, rate, r
  15281. Set the output frame rate. Default value is @code{25}.
  15282. @item bar_h
  15283. Set the bargraph height. It must be even. Default value is @code{-1} which
  15284. computes the bargraph height automatically.
  15285. @item axis_h
  15286. Set the axis height. It must be even. Default value is @code{-1} which computes
  15287. the axis height automatically.
  15288. @item sono_h
  15289. Set the sonogram height. It must be even. Default value is @code{-1} which
  15290. computes the sonogram height automatically.
  15291. @item fullhd
  15292. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  15293. instead. Default value is @code{1}.
  15294. @item sono_v, volume
  15295. Specify the sonogram volume expression. It can contain variables:
  15296. @table @option
  15297. @item bar_v
  15298. the @var{bar_v} evaluated expression
  15299. @item frequency, freq, f
  15300. the frequency where it is evaluated
  15301. @item timeclamp, tc
  15302. the value of @var{timeclamp} option
  15303. @end table
  15304. and functions:
  15305. @table @option
  15306. @item a_weighting(f)
  15307. A-weighting of equal loudness
  15308. @item b_weighting(f)
  15309. B-weighting of equal loudness
  15310. @item c_weighting(f)
  15311. C-weighting of equal loudness.
  15312. @end table
  15313. Default value is @code{16}.
  15314. @item bar_v, volume2
  15315. Specify the bargraph volume expression. It can contain variables:
  15316. @table @option
  15317. @item sono_v
  15318. the @var{sono_v} evaluated expression
  15319. @item frequency, freq, f
  15320. the frequency where it is evaluated
  15321. @item timeclamp, tc
  15322. the value of @var{timeclamp} option
  15323. @end table
  15324. and functions:
  15325. @table @option
  15326. @item a_weighting(f)
  15327. A-weighting of equal loudness
  15328. @item b_weighting(f)
  15329. B-weighting of equal loudness
  15330. @item c_weighting(f)
  15331. C-weighting of equal loudness.
  15332. @end table
  15333. Default value is @code{sono_v}.
  15334. @item sono_g, gamma
  15335. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  15336. higher gamma makes the spectrum having more range. Default value is @code{3}.
  15337. Acceptable range is @code{[1, 7]}.
  15338. @item bar_g, gamma2
  15339. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  15340. @code{[1, 7]}.
  15341. @item bar_t
  15342. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  15343. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  15344. @item timeclamp, tc
  15345. Specify the transform timeclamp. At low frequency, there is trade-off between
  15346. accuracy in time domain and frequency domain. If timeclamp is lower,
  15347. event in time domain is represented more accurately (such as fast bass drum),
  15348. otherwise event in frequency domain is represented more accurately
  15349. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  15350. @item attack
  15351. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  15352. limits future samples by applying asymmetric windowing in time domain, useful
  15353. when low latency is required. Accepted range is @code{[0, 1]}.
  15354. @item basefreq
  15355. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  15356. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  15357. @item endfreq
  15358. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  15359. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  15360. @item coeffclamp
  15361. This option is deprecated and ignored.
  15362. @item tlength
  15363. Specify the transform length in time domain. Use this option to control accuracy
  15364. trade-off between time domain and frequency domain at every frequency sample.
  15365. It can contain variables:
  15366. @table @option
  15367. @item frequency, freq, f
  15368. the frequency where it is evaluated
  15369. @item timeclamp, tc
  15370. the value of @var{timeclamp} option.
  15371. @end table
  15372. Default value is @code{384*tc/(384+tc*f)}.
  15373. @item count
  15374. Specify the transform count for every video frame. Default value is @code{6}.
  15375. Acceptable range is @code{[1, 30]}.
  15376. @item fcount
  15377. Specify the transform count for every single pixel. Default value is @code{0},
  15378. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  15379. @item fontfile
  15380. Specify font file for use with freetype to draw the axis. If not specified,
  15381. use embedded font. Note that drawing with font file or embedded font is not
  15382. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  15383. option instead.
  15384. @item font
  15385. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  15386. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  15387. @item fontcolor
  15388. Specify font color expression. This is arithmetic expression that should return
  15389. integer value 0xRRGGBB. It can contain variables:
  15390. @table @option
  15391. @item frequency, freq, f
  15392. the frequency where it is evaluated
  15393. @item timeclamp, tc
  15394. the value of @var{timeclamp} option
  15395. @end table
  15396. and functions:
  15397. @table @option
  15398. @item midi(f)
  15399. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  15400. @item r(x), g(x), b(x)
  15401. red, green, and blue value of intensity x.
  15402. @end table
  15403. Default value is @code{st(0, (midi(f)-59.5)/12);
  15404. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  15405. r(1-ld(1)) + b(ld(1))}.
  15406. @item axisfile
  15407. Specify image file to draw the axis. This option override @var{fontfile} and
  15408. @var{fontcolor} option.
  15409. @item axis, text
  15410. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  15411. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  15412. Default value is @code{1}.
  15413. @item csp
  15414. Set colorspace. The accepted values are:
  15415. @table @samp
  15416. @item unspecified
  15417. Unspecified (default)
  15418. @item bt709
  15419. BT.709
  15420. @item fcc
  15421. FCC
  15422. @item bt470bg
  15423. BT.470BG or BT.601-6 625
  15424. @item smpte170m
  15425. SMPTE-170M or BT.601-6 525
  15426. @item smpte240m
  15427. SMPTE-240M
  15428. @item bt2020ncl
  15429. BT.2020 with non-constant luminance
  15430. @end table
  15431. @item cscheme
  15432. Set spectrogram color scheme. This is list of floating point values with format
  15433. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  15434. The default is @code{1|0.5|0|0|0.5|1}.
  15435. @end table
  15436. @subsection Examples
  15437. @itemize
  15438. @item
  15439. Playing audio while showing the spectrum:
  15440. @example
  15441. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  15442. @end example
  15443. @item
  15444. Same as above, but with frame rate 30 fps:
  15445. @example
  15446. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  15447. @end example
  15448. @item
  15449. Playing at 1280x720:
  15450. @example
  15451. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  15452. @end example
  15453. @item
  15454. Disable sonogram display:
  15455. @example
  15456. sono_h=0
  15457. @end example
  15458. @item
  15459. A1 and its harmonics: A1, A2, (near)E3, A3:
  15460. @example
  15461. 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),
  15462. asplit[a][out1]; [a] showcqt [out0]'
  15463. @end example
  15464. @item
  15465. Same as above, but with more accuracy in frequency domain:
  15466. @example
  15467. 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),
  15468. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  15469. @end example
  15470. @item
  15471. Custom volume:
  15472. @example
  15473. bar_v=10:sono_v=bar_v*a_weighting(f)
  15474. @end example
  15475. @item
  15476. Custom gamma, now spectrum is linear to the amplitude.
  15477. @example
  15478. bar_g=2:sono_g=2
  15479. @end example
  15480. @item
  15481. Custom tlength equation:
  15482. @example
  15483. 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)))'
  15484. @end example
  15485. @item
  15486. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  15487. @example
  15488. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  15489. @end example
  15490. @item
  15491. Custom font using fontconfig:
  15492. @example
  15493. font='Courier New,Monospace,mono|bold'
  15494. @end example
  15495. @item
  15496. Custom frequency range with custom axis using image file:
  15497. @example
  15498. axisfile=myaxis.png:basefreq=40:endfreq=10000
  15499. @end example
  15500. @end itemize
  15501. @section showfreqs
  15502. Convert input audio to video output representing the audio power spectrum.
  15503. Audio amplitude is on Y-axis while frequency is on X-axis.
  15504. The filter accepts the following options:
  15505. @table @option
  15506. @item size, s
  15507. Specify size of video. For the syntax of this option, check the
  15508. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15509. Default is @code{1024x512}.
  15510. @item mode
  15511. Set display mode.
  15512. This set how each frequency bin will be represented.
  15513. It accepts the following values:
  15514. @table @samp
  15515. @item line
  15516. @item bar
  15517. @item dot
  15518. @end table
  15519. Default is @code{bar}.
  15520. @item ascale
  15521. Set amplitude scale.
  15522. It accepts the following values:
  15523. @table @samp
  15524. @item lin
  15525. Linear scale.
  15526. @item sqrt
  15527. Square root scale.
  15528. @item cbrt
  15529. Cubic root scale.
  15530. @item log
  15531. Logarithmic scale.
  15532. @end table
  15533. Default is @code{log}.
  15534. @item fscale
  15535. Set frequency scale.
  15536. It accepts the following values:
  15537. @table @samp
  15538. @item lin
  15539. Linear scale.
  15540. @item log
  15541. Logarithmic scale.
  15542. @item rlog
  15543. Reverse logarithmic scale.
  15544. @end table
  15545. Default is @code{lin}.
  15546. @item win_size
  15547. Set window size.
  15548. It accepts the following values:
  15549. @table @samp
  15550. @item w16
  15551. @item w32
  15552. @item w64
  15553. @item w128
  15554. @item w256
  15555. @item w512
  15556. @item w1024
  15557. @item w2048
  15558. @item w4096
  15559. @item w8192
  15560. @item w16384
  15561. @item w32768
  15562. @item w65536
  15563. @end table
  15564. Default is @code{w2048}
  15565. @item win_func
  15566. Set windowing function.
  15567. It accepts the following values:
  15568. @table @samp
  15569. @item rect
  15570. @item bartlett
  15571. @item hanning
  15572. @item hamming
  15573. @item blackman
  15574. @item welch
  15575. @item flattop
  15576. @item bharris
  15577. @item bnuttall
  15578. @item bhann
  15579. @item sine
  15580. @item nuttall
  15581. @item lanczos
  15582. @item gauss
  15583. @item tukey
  15584. @item dolph
  15585. @item cauchy
  15586. @item parzen
  15587. @item poisson
  15588. @end table
  15589. Default is @code{hanning}.
  15590. @item overlap
  15591. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15592. which means optimal overlap for selected window function will be picked.
  15593. @item averaging
  15594. Set time averaging. Setting this to 0 will display current maximal peaks.
  15595. Default is @code{1}, which means time averaging is disabled.
  15596. @item colors
  15597. Specify list of colors separated by space or by '|' which will be used to
  15598. draw channel frequencies. Unrecognized or missing colors will be replaced
  15599. by white color.
  15600. @item cmode
  15601. Set channel display mode.
  15602. It accepts the following values:
  15603. @table @samp
  15604. @item combined
  15605. @item separate
  15606. @end table
  15607. Default is @code{combined}.
  15608. @item minamp
  15609. Set minimum amplitude used in @code{log} amplitude scaler.
  15610. @end table
  15611. @anchor{showspectrum}
  15612. @section showspectrum
  15613. Convert input audio to a video output, representing the audio frequency
  15614. spectrum.
  15615. The filter accepts the following options:
  15616. @table @option
  15617. @item size, s
  15618. Specify the video size for the output. For the syntax of this option, check the
  15619. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15620. Default value is @code{640x512}.
  15621. @item slide
  15622. Specify how the spectrum should slide along the window.
  15623. It accepts the following values:
  15624. @table @samp
  15625. @item replace
  15626. the samples start again on the left when they reach the right
  15627. @item scroll
  15628. the samples scroll from right to left
  15629. @item fullframe
  15630. frames are only produced when the samples reach the right
  15631. @item rscroll
  15632. the samples scroll from left to right
  15633. @end table
  15634. Default value is @code{replace}.
  15635. @item mode
  15636. Specify display mode.
  15637. It accepts the following values:
  15638. @table @samp
  15639. @item combined
  15640. all channels are displayed in the same row
  15641. @item separate
  15642. all channels are displayed in separate rows
  15643. @end table
  15644. Default value is @samp{combined}.
  15645. @item color
  15646. Specify display color mode.
  15647. It accepts the following values:
  15648. @table @samp
  15649. @item channel
  15650. each channel is displayed in a separate color
  15651. @item intensity
  15652. each channel is displayed using the same color scheme
  15653. @item rainbow
  15654. each channel is displayed using the rainbow color scheme
  15655. @item moreland
  15656. each channel is displayed using the moreland color scheme
  15657. @item nebulae
  15658. each channel is displayed using the nebulae color scheme
  15659. @item fire
  15660. each channel is displayed using the fire color scheme
  15661. @item fiery
  15662. each channel is displayed using the fiery color scheme
  15663. @item fruit
  15664. each channel is displayed using the fruit color scheme
  15665. @item cool
  15666. each channel is displayed using the cool color scheme
  15667. @item magma
  15668. each channel is displayed using the magma color scheme
  15669. @end table
  15670. Default value is @samp{channel}.
  15671. @item scale
  15672. Specify scale used for calculating intensity color values.
  15673. It accepts the following values:
  15674. @table @samp
  15675. @item lin
  15676. linear
  15677. @item sqrt
  15678. square root, default
  15679. @item cbrt
  15680. cubic root
  15681. @item log
  15682. logarithmic
  15683. @item 4thrt
  15684. 4th root
  15685. @item 5thrt
  15686. 5th root
  15687. @end table
  15688. Default value is @samp{sqrt}.
  15689. @item saturation
  15690. Set saturation modifier for displayed colors. Negative values provide
  15691. alternative color scheme. @code{0} is no saturation at all.
  15692. Saturation must be in [-10.0, 10.0] range.
  15693. Default value is @code{1}.
  15694. @item win_func
  15695. Set window function.
  15696. It accepts the following values:
  15697. @table @samp
  15698. @item rect
  15699. @item bartlett
  15700. @item hann
  15701. @item hanning
  15702. @item hamming
  15703. @item blackman
  15704. @item welch
  15705. @item flattop
  15706. @item bharris
  15707. @item bnuttall
  15708. @item bhann
  15709. @item sine
  15710. @item nuttall
  15711. @item lanczos
  15712. @item gauss
  15713. @item tukey
  15714. @item dolph
  15715. @item cauchy
  15716. @item parzen
  15717. @item poisson
  15718. @end table
  15719. Default value is @code{hann}.
  15720. @item orientation
  15721. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15722. @code{horizontal}. Default is @code{vertical}.
  15723. @item overlap
  15724. Set ratio of overlap window. Default value is @code{0}.
  15725. When value is @code{1} overlap is set to recommended size for specific
  15726. window function currently used.
  15727. @item gain
  15728. Set scale gain for calculating intensity color values.
  15729. Default value is @code{1}.
  15730. @item data
  15731. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  15732. @item rotation
  15733. Set color rotation, must be in [-1.0, 1.0] range.
  15734. Default value is @code{0}.
  15735. @end table
  15736. The usage is very similar to the showwaves filter; see the examples in that
  15737. section.
  15738. @subsection Examples
  15739. @itemize
  15740. @item
  15741. Large window with logarithmic color scaling:
  15742. @example
  15743. showspectrum=s=1280x480:scale=log
  15744. @end example
  15745. @item
  15746. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  15747. @example
  15748. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15749. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  15750. @end example
  15751. @end itemize
  15752. @section showspectrumpic
  15753. Convert input audio to a single video frame, representing the audio frequency
  15754. spectrum.
  15755. The filter accepts the following options:
  15756. @table @option
  15757. @item size, s
  15758. Specify the video size for the output. For the syntax of this option, check the
  15759. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15760. Default value is @code{4096x2048}.
  15761. @item mode
  15762. Specify display mode.
  15763. It accepts the following values:
  15764. @table @samp
  15765. @item combined
  15766. all channels are displayed in the same row
  15767. @item separate
  15768. all channels are displayed in separate rows
  15769. @end table
  15770. Default value is @samp{combined}.
  15771. @item color
  15772. Specify display color mode.
  15773. It accepts the following values:
  15774. @table @samp
  15775. @item channel
  15776. each channel is displayed in a separate color
  15777. @item intensity
  15778. each channel is displayed using the same color scheme
  15779. @item rainbow
  15780. each channel is displayed using the rainbow color scheme
  15781. @item moreland
  15782. each channel is displayed using the moreland color scheme
  15783. @item nebulae
  15784. each channel is displayed using the nebulae color scheme
  15785. @item fire
  15786. each channel is displayed using the fire color scheme
  15787. @item fiery
  15788. each channel is displayed using the fiery color scheme
  15789. @item fruit
  15790. each channel is displayed using the fruit color scheme
  15791. @item cool
  15792. each channel is displayed using the cool color scheme
  15793. @item magma
  15794. each channel is displayed using the magma color scheme
  15795. @end table
  15796. Default value is @samp{intensity}.
  15797. @item scale
  15798. Specify scale used for calculating intensity color values.
  15799. It accepts the following values:
  15800. @table @samp
  15801. @item lin
  15802. linear
  15803. @item sqrt
  15804. square root, default
  15805. @item cbrt
  15806. cubic root
  15807. @item log
  15808. logarithmic
  15809. @item 4thrt
  15810. 4th root
  15811. @item 5thrt
  15812. 5th root
  15813. @end table
  15814. Default value is @samp{log}.
  15815. @item saturation
  15816. Set saturation modifier for displayed colors. Negative values provide
  15817. alternative color scheme. @code{0} is no saturation at all.
  15818. Saturation must be in [-10.0, 10.0] range.
  15819. Default value is @code{1}.
  15820. @item win_func
  15821. Set window function.
  15822. It accepts the following values:
  15823. @table @samp
  15824. @item rect
  15825. @item bartlett
  15826. @item hann
  15827. @item hanning
  15828. @item hamming
  15829. @item blackman
  15830. @item welch
  15831. @item flattop
  15832. @item bharris
  15833. @item bnuttall
  15834. @item bhann
  15835. @item sine
  15836. @item nuttall
  15837. @item lanczos
  15838. @item gauss
  15839. @item tukey
  15840. @item dolph
  15841. @item cauchy
  15842. @item parzen
  15843. @item poisson
  15844. @end table
  15845. Default value is @code{hann}.
  15846. @item orientation
  15847. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15848. @code{horizontal}. Default is @code{vertical}.
  15849. @item gain
  15850. Set scale gain for calculating intensity color values.
  15851. Default value is @code{1}.
  15852. @item legend
  15853. Draw time and frequency axes and legends. Default is enabled.
  15854. @item rotation
  15855. Set color rotation, must be in [-1.0, 1.0] range.
  15856. Default value is @code{0}.
  15857. @end table
  15858. @subsection Examples
  15859. @itemize
  15860. @item
  15861. Extract an audio spectrogram of a whole audio track
  15862. in a 1024x1024 picture using @command{ffmpeg}:
  15863. @example
  15864. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  15865. @end example
  15866. @end itemize
  15867. @section showvolume
  15868. Convert input audio volume to a video output.
  15869. The filter accepts the following options:
  15870. @table @option
  15871. @item rate, r
  15872. Set video rate.
  15873. @item b
  15874. Set border width, allowed range is [0, 5]. Default is 1.
  15875. @item w
  15876. Set channel width, allowed range is [80, 8192]. Default is 400.
  15877. @item h
  15878. Set channel height, allowed range is [1, 900]. Default is 20.
  15879. @item f
  15880. Set fade, allowed range is [0, 1]. Default is 0.95.
  15881. @item c
  15882. Set volume color expression.
  15883. The expression can use the following variables:
  15884. @table @option
  15885. @item VOLUME
  15886. Current max volume of channel in dB.
  15887. @item PEAK
  15888. Current peak.
  15889. @item CHANNEL
  15890. Current channel number, starting from 0.
  15891. @end table
  15892. @item t
  15893. If set, displays channel names. Default is enabled.
  15894. @item v
  15895. If set, displays volume values. Default is enabled.
  15896. @item o
  15897. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  15898. default is @code{h}.
  15899. @item s
  15900. Set step size, allowed range is [0, 5]. Default is 0, which means
  15901. step is disabled.
  15902. @item p
  15903. Set background opacity, allowed range is [0, 1]. Default is 0.
  15904. @item m
  15905. Set metering mode, can be peak: @code{p} or rms: @code{r},
  15906. default is @code{p}.
  15907. @item ds
  15908. Set display scale, can be linear: @code{lin} or log: @code{log},
  15909. default is @code{lin}.
  15910. @item dm
  15911. In second.
  15912. If set to > 0., display a line for the max level
  15913. in the previous seconds.
  15914. default is disabled: @code{0.}
  15915. @item dmc
  15916. The color of the max line. Use when @code{dm} option is set to > 0.
  15917. default is: @code{orange}
  15918. @end table
  15919. @section showwaves
  15920. Convert input audio to a video output, representing the samples waves.
  15921. The filter accepts the following options:
  15922. @table @option
  15923. @item size, s
  15924. Specify the video size for the output. For the syntax of this option, check the
  15925. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15926. Default value is @code{600x240}.
  15927. @item mode
  15928. Set display mode.
  15929. Available values are:
  15930. @table @samp
  15931. @item point
  15932. Draw a point for each sample.
  15933. @item line
  15934. Draw a vertical line for each sample.
  15935. @item p2p
  15936. Draw a point for each sample and a line between them.
  15937. @item cline
  15938. Draw a centered vertical line for each sample.
  15939. @end table
  15940. Default value is @code{point}.
  15941. @item n
  15942. Set the number of samples which are printed on the same column. A
  15943. larger value will decrease the frame rate. Must be a positive
  15944. integer. This option can be set only if the value for @var{rate}
  15945. is not explicitly specified.
  15946. @item rate, r
  15947. Set the (approximate) output frame rate. This is done by setting the
  15948. option @var{n}. Default value is "25".
  15949. @item split_channels
  15950. Set if channels should be drawn separately or overlap. Default value is 0.
  15951. @item colors
  15952. Set colors separated by '|' which are going to be used for drawing of each channel.
  15953. @item scale
  15954. Set amplitude scale.
  15955. Available values are:
  15956. @table @samp
  15957. @item lin
  15958. Linear.
  15959. @item log
  15960. Logarithmic.
  15961. @item sqrt
  15962. Square root.
  15963. @item cbrt
  15964. Cubic root.
  15965. @end table
  15966. Default is linear.
  15967. @item draw
  15968. Set the draw mode. This is mostly useful to set for high @var{n}.
  15969. Available values are:
  15970. @table @samp
  15971. @item scale
  15972. Scale pixel values for each drawn sample.
  15973. @item full
  15974. Draw every sample directly.
  15975. @end table
  15976. Default value is @code{scale}.
  15977. @end table
  15978. @subsection Examples
  15979. @itemize
  15980. @item
  15981. Output the input file audio and the corresponding video representation
  15982. at the same time:
  15983. @example
  15984. amovie=a.mp3,asplit[out0],showwaves[out1]
  15985. @end example
  15986. @item
  15987. Create a synthetic signal and show it with showwaves, forcing a
  15988. frame rate of 30 frames per second:
  15989. @example
  15990. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15991. @end example
  15992. @end itemize
  15993. @section showwavespic
  15994. Convert input audio to a single video frame, representing the samples waves.
  15995. The filter accepts the following options:
  15996. @table @option
  15997. @item size, s
  15998. Specify the video size for the output. For the syntax of this option, check the
  15999. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16000. Default value is @code{600x240}.
  16001. @item split_channels
  16002. Set if channels should be drawn separately or overlap. Default value is 0.
  16003. @item colors
  16004. Set colors separated by '|' which are going to be used for drawing of each channel.
  16005. @item scale
  16006. Set amplitude scale.
  16007. Available values are:
  16008. @table @samp
  16009. @item lin
  16010. Linear.
  16011. @item log
  16012. Logarithmic.
  16013. @item sqrt
  16014. Square root.
  16015. @item cbrt
  16016. Cubic root.
  16017. @end table
  16018. Default is linear.
  16019. @end table
  16020. @subsection Examples
  16021. @itemize
  16022. @item
  16023. Extract a channel split representation of the wave form of a whole audio track
  16024. in a 1024x800 picture using @command{ffmpeg}:
  16025. @example
  16026. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  16027. @end example
  16028. @end itemize
  16029. @section sidedata, asidedata
  16030. Delete frame side data, or select frames based on it.
  16031. This filter accepts the following options:
  16032. @table @option
  16033. @item mode
  16034. Set mode of operation of the filter.
  16035. Can be one of the following:
  16036. @table @samp
  16037. @item select
  16038. Select every frame with side data of @code{type}.
  16039. @item delete
  16040. Delete side data of @code{type}. If @code{type} is not set, delete all side
  16041. data in the frame.
  16042. @end table
  16043. @item type
  16044. Set side data type used with all modes. Must be set for @code{select} mode. For
  16045. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  16046. in @file{libavutil/frame.h}. For example, to choose
  16047. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  16048. @end table
  16049. @section spectrumsynth
  16050. Sythesize audio from 2 input video spectrums, first input stream represents
  16051. magnitude across time and second represents phase across time.
  16052. The filter will transform from frequency domain as displayed in videos back
  16053. to time domain as presented in audio output.
  16054. This filter is primarily created for reversing processed @ref{showspectrum}
  16055. filter outputs, but can synthesize sound from other spectrograms too.
  16056. But in such case results are going to be poor if the phase data is not
  16057. available, because in such cases phase data need to be recreated, usually
  16058. its just recreated from random noise.
  16059. For best results use gray only output (@code{channel} color mode in
  16060. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  16061. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  16062. @code{data} option. Inputs videos should generally use @code{fullframe}
  16063. slide mode as that saves resources needed for decoding video.
  16064. The filter accepts the following options:
  16065. @table @option
  16066. @item sample_rate
  16067. Specify sample rate of output audio, the sample rate of audio from which
  16068. spectrum was generated may differ.
  16069. @item channels
  16070. Set number of channels represented in input video spectrums.
  16071. @item scale
  16072. Set scale which was used when generating magnitude input spectrum.
  16073. Can be @code{lin} or @code{log}. Default is @code{log}.
  16074. @item slide
  16075. Set slide which was used when generating inputs spectrums.
  16076. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  16077. Default is @code{fullframe}.
  16078. @item win_func
  16079. Set window function used for resynthesis.
  16080. @item overlap
  16081. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16082. which means optimal overlap for selected window function will be picked.
  16083. @item orientation
  16084. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  16085. Default is @code{vertical}.
  16086. @end table
  16087. @subsection Examples
  16088. @itemize
  16089. @item
  16090. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  16091. then resynthesize videos back to audio with spectrumsynth:
  16092. @example
  16093. 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
  16094. 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
  16095. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  16096. @end example
  16097. @end itemize
  16098. @section split, asplit
  16099. Split input into several identical outputs.
  16100. @code{asplit} works with audio input, @code{split} with video.
  16101. The filter accepts a single parameter which specifies the number of outputs. If
  16102. unspecified, it defaults to 2.
  16103. @subsection Examples
  16104. @itemize
  16105. @item
  16106. Create two separate outputs from the same input:
  16107. @example
  16108. [in] split [out0][out1]
  16109. @end example
  16110. @item
  16111. To create 3 or more outputs, you need to specify the number of
  16112. outputs, like in:
  16113. @example
  16114. [in] asplit=3 [out0][out1][out2]
  16115. @end example
  16116. @item
  16117. Create two separate outputs from the same input, one cropped and
  16118. one padded:
  16119. @example
  16120. [in] split [splitout1][splitout2];
  16121. [splitout1] crop=100:100:0:0 [cropout];
  16122. [splitout2] pad=200:200:100:100 [padout];
  16123. @end example
  16124. @item
  16125. Create 5 copies of the input audio with @command{ffmpeg}:
  16126. @example
  16127. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  16128. @end example
  16129. @end itemize
  16130. @section zmq, azmq
  16131. Receive commands sent through a libzmq client, and forward them to
  16132. filters in the filtergraph.
  16133. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  16134. must be inserted between two video filters, @code{azmq} between two
  16135. audio filters. Both are capable to send messages to any filter type.
  16136. To enable these filters you need to install the libzmq library and
  16137. headers and configure FFmpeg with @code{--enable-libzmq}.
  16138. For more information about libzmq see:
  16139. @url{http://www.zeromq.org/}
  16140. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  16141. receives messages sent through a network interface defined by the
  16142. @option{bind_address} (or the abbreviation "@option{b}") option.
  16143. Default value of this option is @file{tcp://localhost:5555}. You may
  16144. want to alter this value to your needs, but do not forget to escape any
  16145. ':' signs (see @ref{filtergraph escaping}).
  16146. The received message must be in the form:
  16147. @example
  16148. @var{TARGET} @var{COMMAND} [@var{ARG}]
  16149. @end example
  16150. @var{TARGET} specifies the target of the command, usually the name of
  16151. the filter class or a specific filter instance name. The default
  16152. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  16153. but you can override this by using the @samp{filter_name@@id} syntax
  16154. (see @ref{Filtergraph syntax}).
  16155. @var{COMMAND} specifies the name of the command for the target filter.
  16156. @var{ARG} is optional and specifies the optional argument list for the
  16157. given @var{COMMAND}.
  16158. Upon reception, the message is processed and the corresponding command
  16159. is injected into the filtergraph. Depending on the result, the filter
  16160. will send a reply to the client, adopting the format:
  16161. @example
  16162. @var{ERROR_CODE} @var{ERROR_REASON}
  16163. @var{MESSAGE}
  16164. @end example
  16165. @var{MESSAGE} is optional.
  16166. @subsection Examples
  16167. Look at @file{tools/zmqsend} for an example of a zmq client which can
  16168. be used to send commands processed by these filters.
  16169. Consider the following filtergraph generated by @command{ffplay}.
  16170. In this example the last overlay filter has an instance name. All other
  16171. filters will have default instance names.
  16172. @example
  16173. ffplay -dumpgraph 1 -f lavfi "
  16174. color=s=100x100:c=red [l];
  16175. color=s=100x100:c=blue [r];
  16176. nullsrc=s=200x100, zmq [bg];
  16177. [bg][l] overlay [bg+l];
  16178. [bg+l][r] overlay@@my=x=100 "
  16179. @end example
  16180. To change the color of the left side of the video, the following
  16181. command can be used:
  16182. @example
  16183. echo Parsed_color_0 c yellow | tools/zmqsend
  16184. @end example
  16185. To change the right side:
  16186. @example
  16187. echo Parsed_color_1 c pink | tools/zmqsend
  16188. @end example
  16189. To change the position of the right side:
  16190. @example
  16191. echo overlay@@my x 150 | tools/zmqsend
  16192. @end example
  16193. @c man end MULTIMEDIA FILTERS
  16194. @chapter Multimedia Sources
  16195. @c man begin MULTIMEDIA SOURCES
  16196. Below is a description of the currently available multimedia sources.
  16197. @section amovie
  16198. This is the same as @ref{movie} source, except it selects an audio
  16199. stream by default.
  16200. @anchor{movie}
  16201. @section movie
  16202. Read audio and/or video stream(s) from a movie container.
  16203. It accepts the following parameters:
  16204. @table @option
  16205. @item filename
  16206. The name of the resource to read (not necessarily a file; it can also be a
  16207. device or a stream accessed through some protocol).
  16208. @item format_name, f
  16209. Specifies the format assumed for the movie to read, and can be either
  16210. the name of a container or an input device. If not specified, the
  16211. format is guessed from @var{movie_name} or by probing.
  16212. @item seek_point, sp
  16213. Specifies the seek point in seconds. The frames will be output
  16214. starting from this seek point. The parameter is evaluated with
  16215. @code{av_strtod}, so the numerical value may be suffixed by an IS
  16216. postfix. The default value is "0".
  16217. @item streams, s
  16218. Specifies the streams to read. Several streams can be specified,
  16219. separated by "+". The source will then have as many outputs, in the
  16220. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  16221. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  16222. respectively the default (best suited) video and audio stream. Default
  16223. is "dv", or "da" if the filter is called as "amovie".
  16224. @item stream_index, si
  16225. Specifies the index of the video stream to read. If the value is -1,
  16226. the most suitable video stream will be automatically selected. The default
  16227. value is "-1". Deprecated. If the filter is called "amovie", it will select
  16228. audio instead of video.
  16229. @item loop
  16230. Specifies how many times to read the stream in sequence.
  16231. If the value is 0, the stream will be looped infinitely.
  16232. Default value is "1".
  16233. Note that when the movie is looped the source timestamps are not
  16234. changed, so it will generate non monotonically increasing timestamps.
  16235. @item discontinuity
  16236. Specifies the time difference between frames above which the point is
  16237. considered a timestamp discontinuity which is removed by adjusting the later
  16238. timestamps.
  16239. @end table
  16240. It allows overlaying a second video on top of the main input of
  16241. a filtergraph, as shown in this graph:
  16242. @example
  16243. input -----------> deltapts0 --> overlay --> output
  16244. ^
  16245. |
  16246. movie --> scale--> deltapts1 -------+
  16247. @end example
  16248. @subsection Examples
  16249. @itemize
  16250. @item
  16251. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  16252. on top of the input labelled "in":
  16253. @example
  16254. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  16255. [in] setpts=PTS-STARTPTS [main];
  16256. [main][over] overlay=16:16 [out]
  16257. @end example
  16258. @item
  16259. Read from a video4linux2 device, and overlay it on top of the input
  16260. labelled "in":
  16261. @example
  16262. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  16263. [in] setpts=PTS-STARTPTS [main];
  16264. [main][over] overlay=16:16 [out]
  16265. @end example
  16266. @item
  16267. Read the first video stream and the audio stream with id 0x81 from
  16268. dvd.vob; the video is connected to the pad named "video" and the audio is
  16269. connected to the pad named "audio":
  16270. @example
  16271. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  16272. @end example
  16273. @end itemize
  16274. @subsection Commands
  16275. Both movie and amovie support the following commands:
  16276. @table @option
  16277. @item seek
  16278. Perform seek using "av_seek_frame".
  16279. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  16280. @itemize
  16281. @item
  16282. @var{stream_index}: If stream_index is -1, a default
  16283. stream is selected, and @var{timestamp} is automatically converted
  16284. from AV_TIME_BASE units to the stream specific time_base.
  16285. @item
  16286. @var{timestamp}: Timestamp in AVStream.time_base units
  16287. or, if no stream is specified, in AV_TIME_BASE units.
  16288. @item
  16289. @var{flags}: Flags which select direction and seeking mode.
  16290. @end itemize
  16291. @item get_duration
  16292. Get movie duration in AV_TIME_BASE units.
  16293. @end table
  16294. @c man end MULTIMEDIA SOURCES