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.

24146 lines
641KB

  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{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @end table
  283. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  284. @chapter Audio Filters
  285. @c man begin AUDIO FILTERS
  286. When you configure your FFmpeg build, you can disable any of the
  287. existing filters using @code{--disable-filters}.
  288. The configure output will show the audio filters included in your
  289. build.
  290. Below is a description of the currently available audio filters.
  291. @section acompressor
  292. A compressor is mainly used to reduce the dynamic range of a signal.
  293. Especially modern music is mostly compressed at a high ratio to
  294. improve the overall loudness. It's done to get the highest attention
  295. of a listener, "fatten" the sound and bring more "power" to the track.
  296. If a signal is compressed too much it may sound dull or "dead"
  297. afterwards or it may start to "pump" (which could be a powerful effect
  298. but can also destroy a track completely).
  299. The right compression is the key to reach a professional sound and is
  300. the high art of mixing and mastering. Because of its complex settings
  301. it may take a long time to get the right feeling for this kind of effect.
  302. Compression is done by detecting the volume above a chosen level
  303. @code{threshold} and dividing it by the factor set with @code{ratio}.
  304. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  305. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  306. the signal would cause distortion of the waveform the reduction can be
  307. levelled over the time. This is done by setting "Attack" and "Release".
  308. @code{attack} determines how long the signal has to rise above the threshold
  309. before any reduction will occur and @code{release} sets the time the signal
  310. has to fall below the threshold to reduce the reduction again. Shorter signals
  311. than the chosen attack time will be left untouched.
  312. The overall reduction of the signal can be made up afterwards with the
  313. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  314. raising the makeup to this level results in a signal twice as loud than the
  315. source. To gain a softer entry in the compression the @code{knee} flattens the
  316. hard edge at the threshold in the range of the chosen decibels.
  317. The filter accepts the following options:
  318. @table @option
  319. @item level_in
  320. Set input gain. Default is 1. Range is between 0.015625 and 64.
  321. @item mode
  322. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  323. Default is @code{downward}.
  324. @item threshold
  325. If a signal of stream rises above this level it will affect the gain
  326. reduction.
  327. By default it is 0.125. Range is between 0.00097563 and 1.
  328. @item ratio
  329. Set a ratio by which the signal is reduced. 1:2 means that if the level
  330. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  331. Default is 2. Range is between 1 and 20.
  332. @item attack
  333. Amount of milliseconds the signal has to rise above the threshold before gain
  334. reduction starts. Default is 20. Range is between 0.01 and 2000.
  335. @item release
  336. Amount of milliseconds the signal has to fall below the threshold before
  337. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  338. @item makeup
  339. Set the amount by how much signal will be amplified after processing.
  340. Default is 1. Range is from 1 to 64.
  341. @item knee
  342. Curve the sharp knee around the threshold to enter gain reduction more softly.
  343. Default is 2.82843. Range is between 1 and 8.
  344. @item link
  345. Choose if the @code{average} level between all channels of input stream
  346. or the louder(@code{maximum}) channel of input stream affects the
  347. reduction. Default is @code{average}.
  348. @item detection
  349. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  350. of @code{rms}. Default is @code{rms} which is mostly smoother.
  351. @item mix
  352. How much to use compressed signal in output. Default is 1.
  353. Range is between 0 and 1.
  354. @end table
  355. @section acontrast
  356. Simple audio dynamic range compression/expansion filter.
  357. The filter accepts the following options:
  358. @table @option
  359. @item contrast
  360. Set contrast. Default is 33. Allowed range is between 0 and 100.
  361. @end table
  362. @section acopy
  363. Copy the input audio source unchanged to the output. This is mainly useful for
  364. testing purposes.
  365. @section acrossfade
  366. Apply cross fade from one input audio stream to another input audio stream.
  367. The cross fade is applied for specified duration near the end of first stream.
  368. The filter accepts the following options:
  369. @table @option
  370. @item nb_samples, ns
  371. Specify the number of samples for which the cross fade effect has to last.
  372. At the end of the cross fade effect the first input audio will be completely
  373. silent. Default is 44100.
  374. @item duration, d
  375. Specify the duration of the cross fade effect. See
  376. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  377. for the accepted syntax.
  378. By default the duration is determined by @var{nb_samples}.
  379. If set this option is used instead of @var{nb_samples}.
  380. @item overlap, o
  381. Should first stream end overlap with second stream start. Default is enabled.
  382. @item curve1
  383. Set curve for cross fade transition for first stream.
  384. @item curve2
  385. Set curve for cross fade transition for second stream.
  386. For description of available curve types see @ref{afade} filter description.
  387. @end table
  388. @subsection Examples
  389. @itemize
  390. @item
  391. Cross fade from one input to another:
  392. @example
  393. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  394. @end example
  395. @item
  396. Cross fade from one input to another but without overlapping:
  397. @example
  398. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  399. @end example
  400. @end itemize
  401. @section acrossover
  402. Split audio stream into several bands.
  403. This filter splits audio stream into two or more frequency ranges.
  404. Summing all streams back will give flat output.
  405. The filter accepts the following options:
  406. @table @option
  407. @item split
  408. Set split frequencies. Those must be positive and increasing.
  409. @item order
  410. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  411. Default is @var{4th}.
  412. @end table
  413. @section acrusher
  414. Reduce audio bit resolution.
  415. This filter is bit crusher with enhanced functionality. A bit crusher
  416. is used to audibly reduce number of bits an audio signal is sampled
  417. with. This doesn't change the bit depth at all, it just produces the
  418. effect. Material reduced in bit depth sounds more harsh and "digital".
  419. This filter is able to even round to continuous values instead of discrete
  420. bit depths.
  421. Additionally it has a D/C offset which results in different crushing of
  422. the lower and the upper half of the signal.
  423. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  424. Another feature of this filter is the logarithmic mode.
  425. This setting switches from linear distances between bits to logarithmic ones.
  426. The result is a much more "natural" sounding crusher which doesn't gate low
  427. signals for example. The human ear has a logarithmic perception,
  428. so this kind of crushing is much more pleasant.
  429. Logarithmic crushing is also able to get anti-aliased.
  430. The filter accepts the following options:
  431. @table @option
  432. @item level_in
  433. Set level in.
  434. @item level_out
  435. Set level out.
  436. @item bits
  437. Set bit reduction.
  438. @item mix
  439. Set mixing amount.
  440. @item mode
  441. Can be linear: @code{lin} or logarithmic: @code{log}.
  442. @item dc
  443. Set DC.
  444. @item aa
  445. Set anti-aliasing.
  446. @item samples
  447. Set sample reduction.
  448. @item lfo
  449. Enable LFO. By default disabled.
  450. @item lforange
  451. Set LFO range.
  452. @item lforate
  453. Set LFO rate.
  454. @end table
  455. @section acue
  456. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  457. filter.
  458. @section adeclick
  459. Remove impulsive noise from input audio.
  460. Samples detected as impulsive noise are replaced by interpolated samples using
  461. autoregressive modelling.
  462. @table @option
  463. @item w
  464. Set window size, in milliseconds. Allowed range is from @code{10} to
  465. @code{100}. Default value is @code{55} milliseconds.
  466. This sets size of window which will be processed at once.
  467. @item o
  468. Set window overlap, in percentage of window size. Allowed range is from
  469. @code{50} to @code{95}. Default value is @code{75} percent.
  470. Setting this to a very high value increases impulsive noise removal but makes
  471. whole process much slower.
  472. @item a
  473. Set autoregression order, in percentage of window size. Allowed range is from
  474. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  475. controls quality of interpolated samples using neighbour good samples.
  476. @item t
  477. Set threshold value. Allowed range is from @code{1} to @code{100}.
  478. Default value is @code{2}.
  479. This controls the strength of impulsive noise which is going to be removed.
  480. The lower value, the more samples will be detected as impulsive noise.
  481. @item b
  482. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  483. @code{10}. Default value is @code{2}.
  484. If any two samples detected as noise are spaced less than this value then any
  485. sample between those two samples will be also detected as noise.
  486. @item m
  487. Set overlap method.
  488. It accepts the following values:
  489. @table @option
  490. @item a
  491. Select overlap-add method. Even not interpolated samples are slightly
  492. changed with this method.
  493. @item s
  494. Select overlap-save method. Not interpolated samples remain unchanged.
  495. @end table
  496. Default value is @code{a}.
  497. @end table
  498. @section adeclip
  499. Remove clipped samples from input audio.
  500. Samples detected as clipped are replaced by interpolated samples using
  501. autoregressive modelling.
  502. @table @option
  503. @item w
  504. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  505. Default value is @code{55} milliseconds.
  506. This sets size of window which will be processed at once.
  507. @item o
  508. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  509. to @code{95}. Default value is @code{75} percent.
  510. @item a
  511. Set autoregression order, in percentage of window size. Allowed range is from
  512. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  513. quality of interpolated samples using neighbour good samples.
  514. @item t
  515. Set threshold value. Allowed range is from @code{1} to @code{100}.
  516. Default value is @code{10}. Higher values make clip detection less aggressive.
  517. @item n
  518. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  519. Default value is @code{1000}. Higher values make clip detection less aggressive.
  520. @item m
  521. Set overlap method.
  522. It accepts the following values:
  523. @table @option
  524. @item a
  525. Select overlap-add method. Even not interpolated samples are slightly changed
  526. with this method.
  527. @item s
  528. Select overlap-save method. Not interpolated samples remain unchanged.
  529. @end table
  530. Default value is @code{a}.
  531. @end table
  532. @section adelay
  533. Delay one or more audio channels.
  534. Samples in delayed channel are filled with silence.
  535. The filter accepts the following option:
  536. @table @option
  537. @item delays
  538. Set list of delays in milliseconds for each channel separated by '|'.
  539. Unused delays will be silently ignored. If number of given delays is
  540. smaller than number of channels all remaining channels will not be delayed.
  541. If you want to delay exact number of samples, append 'S' to number.
  542. If you want instead to delay in seconds, append 's' to number.
  543. @item all
  544. Use last set delay for all remaining channels. By default is disabled.
  545. This option if enabled changes how option @code{delays} is interpreted.
  546. @end table
  547. @subsection Examples
  548. @itemize
  549. @item
  550. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  551. the second channel (and any other channels that may be present) unchanged.
  552. @example
  553. adelay=1500|0|500
  554. @end example
  555. @item
  556. Delay second channel by 500 samples, the third channel by 700 samples and leave
  557. the first channel (and any other channels that may be present) unchanged.
  558. @example
  559. adelay=0|500S|700S
  560. @end example
  561. @item
  562. Delay all channels by same number of samples:
  563. @example
  564. adelay=delays=64S:all=1
  565. @end example
  566. @end itemize
  567. @section aderivative, aintegral
  568. Compute derivative/integral of audio stream.
  569. Applying both filters one after another produces original audio.
  570. @section aecho
  571. Apply echoing to the input audio.
  572. Echoes are reflected sound and can occur naturally amongst mountains
  573. (and sometimes large buildings) when talking or shouting; digital echo
  574. effects emulate this behaviour and are often used to help fill out the
  575. sound of a single instrument or vocal. The time difference between the
  576. original signal and the reflection is the @code{delay}, and the
  577. loudness of the reflected signal is the @code{decay}.
  578. Multiple echoes can have different delays and decays.
  579. A description of the accepted parameters follows.
  580. @table @option
  581. @item in_gain
  582. Set input gain of reflected signal. Default is @code{0.6}.
  583. @item out_gain
  584. Set output gain of reflected signal. Default is @code{0.3}.
  585. @item delays
  586. Set list of time intervals in milliseconds between original signal and reflections
  587. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  588. Default is @code{1000}.
  589. @item decays
  590. Set list of loudness of reflected signals separated by '|'.
  591. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  592. Default is @code{0.5}.
  593. @end table
  594. @subsection Examples
  595. @itemize
  596. @item
  597. Make it sound as if there are twice as many instruments as are actually playing:
  598. @example
  599. aecho=0.8:0.88:60:0.4
  600. @end example
  601. @item
  602. If delay is very short, then it sounds like a (metallic) robot playing music:
  603. @example
  604. aecho=0.8:0.88:6:0.4
  605. @end example
  606. @item
  607. A longer delay will sound like an open air concert in the mountains:
  608. @example
  609. aecho=0.8:0.9:1000:0.3
  610. @end example
  611. @item
  612. Same as above but with one more mountain:
  613. @example
  614. aecho=0.8:0.9:1000|1800:0.3|0.25
  615. @end example
  616. @end itemize
  617. @section aemphasis
  618. Audio emphasis filter creates or restores material directly taken from LPs or
  619. emphased CDs with different filter curves. E.g. to store music on vinyl the
  620. signal has to be altered by a filter first to even out the disadvantages of
  621. this recording medium.
  622. Once the material is played back the inverse filter has to be applied to
  623. restore the distortion of the frequency response.
  624. The filter accepts the following options:
  625. @table @option
  626. @item level_in
  627. Set input gain.
  628. @item level_out
  629. Set output gain.
  630. @item mode
  631. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  632. use @code{production} mode. Default is @code{reproduction} mode.
  633. @item type
  634. Set filter type. Selects medium. Can be one of the following:
  635. @table @option
  636. @item col
  637. select Columbia.
  638. @item emi
  639. select EMI.
  640. @item bsi
  641. select BSI (78RPM).
  642. @item riaa
  643. select RIAA.
  644. @item cd
  645. select Compact Disc (CD).
  646. @item 50fm
  647. select 50µs (FM).
  648. @item 75fm
  649. select 75µs (FM).
  650. @item 50kf
  651. select 50µs (FM-KF).
  652. @item 75kf
  653. select 75µs (FM-KF).
  654. @end table
  655. @end table
  656. @section aeval
  657. Modify an audio signal according to the specified expressions.
  658. This filter accepts one or more expressions (one for each channel),
  659. which are evaluated and used to modify a corresponding audio signal.
  660. It accepts the following parameters:
  661. @table @option
  662. @item exprs
  663. Set the '|'-separated expressions list for each separate channel. If
  664. the number of input channels is greater than the number of
  665. expressions, the last specified expression is used for the remaining
  666. output channels.
  667. @item channel_layout, c
  668. Set output channel layout. If not specified, the channel layout is
  669. specified by the number of expressions. If set to @samp{same}, it will
  670. use by default the same input channel layout.
  671. @end table
  672. Each expression in @var{exprs} can contain the following constants and functions:
  673. @table @option
  674. @item ch
  675. channel number of the current expression
  676. @item n
  677. number of the evaluated sample, starting from 0
  678. @item s
  679. sample rate
  680. @item t
  681. time of the evaluated sample expressed in seconds
  682. @item nb_in_channels
  683. @item nb_out_channels
  684. input and output number of channels
  685. @item val(CH)
  686. the value of input channel with number @var{CH}
  687. @end table
  688. Note: this filter is slow. For faster processing you should use a
  689. dedicated filter.
  690. @subsection Examples
  691. @itemize
  692. @item
  693. Half volume:
  694. @example
  695. aeval=val(ch)/2:c=same
  696. @end example
  697. @item
  698. Invert phase of the second channel:
  699. @example
  700. aeval=val(0)|-val(1)
  701. @end example
  702. @end itemize
  703. @anchor{afade}
  704. @section afade
  705. Apply fade-in/out effect to input audio.
  706. A description of the accepted parameters follows.
  707. @table @option
  708. @item type, t
  709. Specify the effect type, can be either @code{in} for fade-in, or
  710. @code{out} for a fade-out effect. Default is @code{in}.
  711. @item start_sample, ss
  712. Specify the number of the start sample for starting to apply the fade
  713. effect. Default is 0.
  714. @item nb_samples, ns
  715. Specify the number of samples for which the fade effect has to last. At
  716. the end of the fade-in effect the output audio will have the same
  717. volume as the input audio, at the end of the fade-out transition
  718. the output audio will be silence. Default is 44100.
  719. @item start_time, st
  720. Specify the start time of the fade effect. Default is 0.
  721. The value must be specified as a time duration; see
  722. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  723. for the accepted syntax.
  724. If set this option is used instead of @var{start_sample}.
  725. @item duration, d
  726. Specify the duration of the fade effect. See
  727. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  728. for the accepted syntax.
  729. At the end of the fade-in effect the output audio will have the same
  730. volume as the input audio, at the end of the fade-out transition
  731. the output audio will be silence.
  732. By default the duration is determined by @var{nb_samples}.
  733. If set this option is used instead of @var{nb_samples}.
  734. @item curve
  735. Set curve for fade transition.
  736. It accepts the following values:
  737. @table @option
  738. @item tri
  739. select triangular, linear slope (default)
  740. @item qsin
  741. select quarter of sine wave
  742. @item hsin
  743. select half of sine wave
  744. @item esin
  745. select exponential sine wave
  746. @item log
  747. select logarithmic
  748. @item ipar
  749. select inverted parabola
  750. @item qua
  751. select quadratic
  752. @item cub
  753. select cubic
  754. @item squ
  755. select square root
  756. @item cbr
  757. select cubic root
  758. @item par
  759. select parabola
  760. @item exp
  761. select exponential
  762. @item iqsin
  763. select inverted quarter of sine wave
  764. @item ihsin
  765. select inverted half of sine wave
  766. @item dese
  767. select double-exponential seat
  768. @item desi
  769. select double-exponential sigmoid
  770. @item losi
  771. select logistic sigmoid
  772. @item nofade
  773. no fade applied
  774. @end table
  775. @end table
  776. @subsection Examples
  777. @itemize
  778. @item
  779. Fade in first 15 seconds of audio:
  780. @example
  781. afade=t=in:ss=0:d=15
  782. @end example
  783. @item
  784. Fade out last 25 seconds of a 900 seconds audio:
  785. @example
  786. afade=t=out:st=875:d=25
  787. @end example
  788. @end itemize
  789. @section afftdn
  790. Denoise audio samples with FFT.
  791. A description of the accepted parameters follows.
  792. @table @option
  793. @item nr
  794. Set the noise reduction in dB, allowed range is 0.01 to 97.
  795. Default value is 12 dB.
  796. @item nf
  797. Set the noise floor in dB, allowed range is -80 to -20.
  798. Default value is -50 dB.
  799. @item nt
  800. Set the noise type.
  801. It accepts the following values:
  802. @table @option
  803. @item w
  804. Select white noise.
  805. @item v
  806. Select vinyl noise.
  807. @item s
  808. Select shellac noise.
  809. @item c
  810. Select custom noise, defined in @code{bn} option.
  811. Default value is white noise.
  812. @end table
  813. @item bn
  814. Set custom band noise for every one of 15 bands.
  815. Bands are separated by ' ' or '|'.
  816. @item rf
  817. Set the residual floor in dB, allowed range is -80 to -20.
  818. Default value is -38 dB.
  819. @item tn
  820. Enable noise tracking. By default is disabled.
  821. With this enabled, noise floor is automatically adjusted.
  822. @item tr
  823. Enable residual tracking. By default is disabled.
  824. @item om
  825. Set the output mode.
  826. It accepts the following values:
  827. @table @option
  828. @item i
  829. Pass input unchanged.
  830. @item o
  831. Pass noise filtered out.
  832. @item n
  833. Pass only noise.
  834. Default value is @var{o}.
  835. @end table
  836. @end table
  837. @subsection Commands
  838. This filter supports the following commands:
  839. @table @option
  840. @item sample_noise, sn
  841. Start or stop measuring noise profile.
  842. Syntax for the command is : "start" or "stop" string.
  843. After measuring noise profile is stopped it will be
  844. automatically applied in filtering.
  845. @item noise_reduction, nr
  846. Change noise reduction. Argument is single float number.
  847. Syntax for the command is : "@var{noise_reduction}"
  848. @item noise_floor, nf
  849. Change noise floor. Argument is single float number.
  850. Syntax for the command is : "@var{noise_floor}"
  851. @item output_mode, om
  852. Change output mode operation.
  853. Syntax for the command is : "i", "o" or "n" string.
  854. @end table
  855. @section afftfilt
  856. Apply arbitrary expressions to samples in frequency domain.
  857. @table @option
  858. @item real
  859. Set frequency domain real expression for each separate channel separated
  860. by '|'. Default is "re".
  861. If the number of input channels is greater than the number of
  862. expressions, the last specified expression is used for the remaining
  863. output channels.
  864. @item imag
  865. Set frequency domain imaginary expression for each separate channel
  866. separated by '|'. Default is "im".
  867. Each expression in @var{real} and @var{imag} can contain the following
  868. constants and functions:
  869. @table @option
  870. @item sr
  871. sample rate
  872. @item b
  873. current frequency bin number
  874. @item nb
  875. number of available bins
  876. @item ch
  877. channel number of the current expression
  878. @item chs
  879. number of channels
  880. @item pts
  881. current frame pts
  882. @item re
  883. current real part of frequency bin of current channel
  884. @item im
  885. current imaginary part of frequency bin of current channel
  886. @item real(b, ch)
  887. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  888. @item imag(b, ch)
  889. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  890. @end table
  891. @item win_size
  892. Set window size. Allowed range is from 16 to 131072.
  893. Default is @code{4096}
  894. @item win_func
  895. Set window function. Default is @code{hann}.
  896. @item overlap
  897. Set window overlap. If set to 1, the recommended overlap for selected
  898. window function will be picked. Default is @code{0.75}.
  899. @end table
  900. @subsection Examples
  901. @itemize
  902. @item
  903. Leave almost only low frequencies in audio:
  904. @example
  905. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  906. @end example
  907. @item
  908. Apply robotize effect:
  909. @example
  910. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  911. @end example
  912. @item
  913. Apply whisper effect:
  914. @example
  915. afftfilt="real='hypot(re,im)*cos((random(0)*2-1)*2*3.14)':imag='hypot(re,im)*sin((random(1)*2-1)*2*3.14)':win_size=128:overlap=0.8"
  916. @end example
  917. @end itemize
  918. @anchor{afir}
  919. @section afir
  920. Apply an arbitrary Frequency Impulse Response filter.
  921. This filter is designed for applying long FIR filters,
  922. up to 60 seconds long.
  923. It can be used as component for digital crossover filters,
  924. room equalization, cross talk cancellation, wavefield synthesis,
  925. auralization, ambiophonics, ambisonics and spatialization.
  926. This filter uses the second stream as FIR coefficients.
  927. If the second stream holds a single channel, it will be used
  928. for all input channels in the first stream, otherwise
  929. the number of channels in the second stream must be same as
  930. the number of channels in the first stream.
  931. It accepts the following parameters:
  932. @table @option
  933. @item dry
  934. Set dry gain. This sets input gain.
  935. @item wet
  936. Set wet gain. This sets final output gain.
  937. @item length
  938. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  939. @item gtype
  940. Enable applying gain measured from power of IR.
  941. Set which approach to use for auto gain measurement.
  942. @table @option
  943. @item none
  944. Do not apply any gain.
  945. @item peak
  946. select peak gain, very conservative approach. This is default value.
  947. @item dc
  948. select DC gain, limited application.
  949. @item gn
  950. select gain to noise approach, this is most popular one.
  951. @end table
  952. @item irgain
  953. Set gain to be applied to IR coefficients before filtering.
  954. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  955. @item irfmt
  956. Set format of IR stream. Can be @code{mono} or @code{input}.
  957. Default is @code{input}.
  958. @item maxir
  959. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  960. Allowed range is 0.1 to 60 seconds.
  961. @item response
  962. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  963. By default it is disabled.
  964. @item channel
  965. Set for which IR channel to display frequency response. By default is first channel
  966. displayed. This option is used only when @var{response} is enabled.
  967. @item size
  968. Set video stream size. This option is used only when @var{response} is enabled.
  969. @item rate
  970. Set video stream frame rate. This option is used only when @var{response} is enabled.
  971. @item minp
  972. Set minimal partition size used for convolution. Default is @var{8192}.
  973. Allowed range is from @var{8} to @var{32768}.
  974. Lower values decreases latency at cost of higher CPU usage.
  975. @item maxp
  976. Set maximal partition size used for convolution. Default is @var{8192}.
  977. Allowed range is from @var{8} to @var{32768}.
  978. Lower values may increase CPU usage.
  979. @end table
  980. @subsection Examples
  981. @itemize
  982. @item
  983. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  984. @example
  985. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  986. @end example
  987. @end itemize
  988. @anchor{aformat}
  989. @section aformat
  990. Set output format constraints for the input audio. The framework will
  991. negotiate the most appropriate format to minimize conversions.
  992. It accepts the following parameters:
  993. @table @option
  994. @item sample_fmts
  995. A '|'-separated list of requested sample formats.
  996. @item sample_rates
  997. A '|'-separated list of requested sample rates.
  998. @item channel_layouts
  999. A '|'-separated list of requested channel layouts.
  1000. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1001. for the required syntax.
  1002. @end table
  1003. If a parameter is omitted, all values are allowed.
  1004. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1005. @example
  1006. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1007. @end example
  1008. @section agate
  1009. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1010. processing reduces disturbing noise between useful signals.
  1011. Gating is done by detecting the volume below a chosen level @var{threshold}
  1012. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1013. floor is set via @var{range}. Because an exact manipulation of the signal
  1014. would cause distortion of the waveform the reduction can be levelled over
  1015. time. This is done by setting @var{attack} and @var{release}.
  1016. @var{attack} determines how long the signal has to fall below the threshold
  1017. before any reduction will occur and @var{release} sets the time the signal
  1018. has to rise above the threshold to reduce the reduction again.
  1019. Shorter signals than the chosen attack time will be left untouched.
  1020. @table @option
  1021. @item level_in
  1022. Set input level before filtering.
  1023. Default is 1. Allowed range is from 0.015625 to 64.
  1024. @item mode
  1025. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1026. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1027. will be amplified, expanding dynamic range in upward direction.
  1028. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1029. @item range
  1030. Set the level of gain reduction when the signal is below the threshold.
  1031. Default is 0.06125. Allowed range is from 0 to 1.
  1032. Setting this to 0 disables reduction and then filter behaves like expander.
  1033. @item threshold
  1034. If a signal rises above this level the gain reduction is released.
  1035. Default is 0.125. Allowed range is from 0 to 1.
  1036. @item ratio
  1037. Set a ratio by which the signal is reduced.
  1038. Default is 2. Allowed range is from 1 to 9000.
  1039. @item attack
  1040. Amount of milliseconds the signal has to rise above the threshold before gain
  1041. reduction stops.
  1042. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1043. @item release
  1044. Amount of milliseconds the signal has to fall below the threshold before the
  1045. reduction is increased again. Default is 250 milliseconds.
  1046. Allowed range is from 0.01 to 9000.
  1047. @item makeup
  1048. Set amount of amplification of signal after processing.
  1049. Default is 1. Allowed range is from 1 to 64.
  1050. @item knee
  1051. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1052. Default is 2.828427125. Allowed range is from 1 to 8.
  1053. @item detection
  1054. Choose if exact signal should be taken for detection or an RMS like one.
  1055. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1056. @item link
  1057. Choose if the average level between all channels or the louder channel affects
  1058. the reduction.
  1059. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1060. @end table
  1061. @section aiir
  1062. Apply an arbitrary Infinite Impulse Response filter.
  1063. It accepts the following parameters:
  1064. @table @option
  1065. @item z
  1066. Set numerator/zeros coefficients.
  1067. @item p
  1068. Set denominator/poles coefficients.
  1069. @item k
  1070. Set channels gains.
  1071. @item dry_gain
  1072. Set input gain.
  1073. @item wet_gain
  1074. Set output gain.
  1075. @item f
  1076. Set coefficients format.
  1077. @table @samp
  1078. @item tf
  1079. transfer function
  1080. @item zp
  1081. Z-plane zeros/poles, cartesian (default)
  1082. @item pr
  1083. Z-plane zeros/poles, polar radians
  1084. @item pd
  1085. Z-plane zeros/poles, polar degrees
  1086. @end table
  1087. @item r
  1088. Set kind of processing.
  1089. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1090. @item e
  1091. Set filtering precision.
  1092. @table @samp
  1093. @item dbl
  1094. double-precision floating-point (default)
  1095. @item flt
  1096. single-precision floating-point
  1097. @item i32
  1098. 32-bit integers
  1099. @item i16
  1100. 16-bit integers
  1101. @end table
  1102. @item mix
  1103. How much to use filtered signal in output. Default is 1.
  1104. Range is between 0 and 1.
  1105. @item response
  1106. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1107. By default it is disabled.
  1108. @item channel
  1109. Set for which IR channel to display frequency response. By default is first channel
  1110. displayed. This option is used only when @var{response} is enabled.
  1111. @item size
  1112. Set video stream size. This option is used only when @var{response} is enabled.
  1113. @end table
  1114. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1115. order.
  1116. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1117. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1118. imaginary unit.
  1119. Different coefficients and gains can be provided for every channel, in such case
  1120. use '|' to separate coefficients or gains. Last provided coefficients will be
  1121. used for all remaining channels.
  1122. @subsection Examples
  1123. @itemize
  1124. @item
  1125. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1126. @example
  1127. 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
  1128. @end example
  1129. @item
  1130. Same as above but in @code{zp} format:
  1131. @example
  1132. 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
  1133. @end example
  1134. @end itemize
  1135. @section alimiter
  1136. The limiter prevents an input signal from rising over a desired threshold.
  1137. This limiter uses lookahead technology to prevent your signal from distorting.
  1138. It means that there is a small delay after the signal is processed. Keep in mind
  1139. that the delay it produces is the attack time you set.
  1140. The filter accepts the following options:
  1141. @table @option
  1142. @item level_in
  1143. Set input gain. Default is 1.
  1144. @item level_out
  1145. Set output gain. Default is 1.
  1146. @item limit
  1147. Don't let signals above this level pass the limiter. Default is 1.
  1148. @item attack
  1149. The limiter will reach its attenuation level in this amount of time in
  1150. milliseconds. Default is 5 milliseconds.
  1151. @item release
  1152. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1153. Default is 50 milliseconds.
  1154. @item asc
  1155. When gain reduction is always needed ASC takes care of releasing to an
  1156. average reduction level rather than reaching a reduction of 0 in the release
  1157. time.
  1158. @item asc_level
  1159. Select how much the release time is affected by ASC, 0 means nearly no changes
  1160. in release time while 1 produces higher release times.
  1161. @item level
  1162. Auto level output signal. Default is enabled.
  1163. This normalizes audio back to 0dB if enabled.
  1164. @end table
  1165. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1166. with @ref{aresample} before applying this filter.
  1167. @section allpass
  1168. Apply a two-pole all-pass filter with central frequency (in Hz)
  1169. @var{frequency}, and filter-width @var{width}.
  1170. An all-pass filter changes the audio's frequency to phase relationship
  1171. without changing its frequency to amplitude relationship.
  1172. The filter accepts the following options:
  1173. @table @option
  1174. @item frequency, f
  1175. Set frequency in Hz.
  1176. @item width_type, t
  1177. Set method to specify band-width of filter.
  1178. @table @option
  1179. @item h
  1180. Hz
  1181. @item q
  1182. Q-Factor
  1183. @item o
  1184. octave
  1185. @item s
  1186. slope
  1187. @item k
  1188. kHz
  1189. @end table
  1190. @item width, w
  1191. Specify the band-width of a filter in width_type units.
  1192. @item mix, m
  1193. How much to use filtered signal in output. Default is 1.
  1194. Range is between 0 and 1.
  1195. @item channels, c
  1196. Specify which channels to filter, by default all available are filtered.
  1197. @end table
  1198. @subsection Commands
  1199. This filter supports the following commands:
  1200. @table @option
  1201. @item frequency, f
  1202. Change allpass frequency.
  1203. Syntax for the command is : "@var{frequency}"
  1204. @item width_type, t
  1205. Change allpass width_type.
  1206. Syntax for the command is : "@var{width_type}"
  1207. @item width, w
  1208. Change allpass width.
  1209. Syntax for the command is : "@var{width}"
  1210. @item mix, m
  1211. Change allpass mix.
  1212. Syntax for the command is : "@var{mix}"
  1213. @end table
  1214. @section aloop
  1215. Loop audio samples.
  1216. The filter accepts the following options:
  1217. @table @option
  1218. @item loop
  1219. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1220. Default is 0.
  1221. @item size
  1222. Set maximal number of samples. Default is 0.
  1223. @item start
  1224. Set first sample of loop. Default is 0.
  1225. @end table
  1226. @anchor{amerge}
  1227. @section amerge
  1228. Merge two or more audio streams into a single multi-channel stream.
  1229. The filter accepts the following options:
  1230. @table @option
  1231. @item inputs
  1232. Set the number of inputs. Default is 2.
  1233. @end table
  1234. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1235. the channel layout of the output will be set accordingly and the channels
  1236. will be reordered as necessary. If the channel layouts of the inputs are not
  1237. disjoint, the output will have all the channels of the first input then all
  1238. the channels of the second input, in that order, and the channel layout of
  1239. the output will be the default value corresponding to the total number of
  1240. channels.
  1241. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1242. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1243. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1244. first input, b1 is the first channel of the second input).
  1245. On the other hand, if both input are in stereo, the output channels will be
  1246. in the default order: a1, a2, b1, b2, and the channel layout will be
  1247. arbitrarily set to 4.0, which may or may not be the expected value.
  1248. All inputs must have the same sample rate, and format.
  1249. If inputs do not have the same duration, the output will stop with the
  1250. shortest.
  1251. @subsection Examples
  1252. @itemize
  1253. @item
  1254. Merge two mono files into a stereo stream:
  1255. @example
  1256. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1257. @end example
  1258. @item
  1259. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1260. @example
  1261. 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
  1262. @end example
  1263. @end itemize
  1264. @section amix
  1265. Mixes multiple audio inputs into a single output.
  1266. Note that this filter only supports float samples (the @var{amerge}
  1267. and @var{pan} audio filters support many formats). If the @var{amix}
  1268. input has integer samples then @ref{aresample} will be automatically
  1269. inserted to perform the conversion to float samples.
  1270. For example
  1271. @example
  1272. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1273. @end example
  1274. will mix 3 input audio streams to a single output with the same duration as the
  1275. first input and a dropout transition time of 3 seconds.
  1276. It accepts the following parameters:
  1277. @table @option
  1278. @item inputs
  1279. The number of inputs. If unspecified, it defaults to 2.
  1280. @item duration
  1281. How to determine the end-of-stream.
  1282. @table @option
  1283. @item longest
  1284. The duration of the longest input. (default)
  1285. @item shortest
  1286. The duration of the shortest input.
  1287. @item first
  1288. The duration of the first input.
  1289. @end table
  1290. @item dropout_transition
  1291. The transition time, in seconds, for volume renormalization when an input
  1292. stream ends. The default value is 2 seconds.
  1293. @item weights
  1294. Specify weight of each input audio stream as sequence.
  1295. Each weight is separated by space. By default all inputs have same weight.
  1296. @end table
  1297. @section amultiply
  1298. Multiply first audio stream with second audio stream and store result
  1299. in output audio stream. Multiplication is done by multiplying each
  1300. sample from first stream with sample at same position from second stream.
  1301. With this element-wise multiplication one can create amplitude fades and
  1302. amplitude modulations.
  1303. @section anequalizer
  1304. High-order parametric multiband equalizer for each channel.
  1305. It accepts the following parameters:
  1306. @table @option
  1307. @item params
  1308. This option string is in format:
  1309. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1310. Each equalizer band is separated by '|'.
  1311. @table @option
  1312. @item chn
  1313. Set channel number to which equalization will be applied.
  1314. If input doesn't have that channel the entry is ignored.
  1315. @item f
  1316. Set central frequency for band.
  1317. If input doesn't have that frequency the entry is ignored.
  1318. @item w
  1319. Set band width in hertz.
  1320. @item g
  1321. Set band gain in dB.
  1322. @item t
  1323. Set filter type for band, optional, can be:
  1324. @table @samp
  1325. @item 0
  1326. Butterworth, this is default.
  1327. @item 1
  1328. Chebyshev type 1.
  1329. @item 2
  1330. Chebyshev type 2.
  1331. @end table
  1332. @end table
  1333. @item curves
  1334. With this option activated frequency response of anequalizer is displayed
  1335. in video stream.
  1336. @item size
  1337. Set video stream size. Only useful if curves option is activated.
  1338. @item mgain
  1339. Set max gain that will be displayed. Only useful if curves option is activated.
  1340. Setting this to a reasonable value makes it possible to display gain which is derived from
  1341. neighbour bands which are too close to each other and thus produce higher gain
  1342. when both are activated.
  1343. @item fscale
  1344. Set frequency scale used to draw frequency response in video output.
  1345. Can be linear or logarithmic. Default is logarithmic.
  1346. @item colors
  1347. Set color for each channel curve which is going to be displayed in video stream.
  1348. This is list of color names separated by space or by '|'.
  1349. Unrecognised or missing colors will be replaced by white color.
  1350. @end table
  1351. @subsection Examples
  1352. @itemize
  1353. @item
  1354. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1355. for first 2 channels using Chebyshev type 1 filter:
  1356. @example
  1357. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1358. @end example
  1359. @end itemize
  1360. @subsection Commands
  1361. This filter supports the following commands:
  1362. @table @option
  1363. @item change
  1364. Alter existing filter parameters.
  1365. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1366. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1367. error is returned.
  1368. @var{freq} set new frequency parameter.
  1369. @var{width} set new width parameter in herz.
  1370. @var{gain} set new gain parameter in dB.
  1371. Full filter invocation with asendcmd may look like this:
  1372. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1373. @end table
  1374. @section anlmdn
  1375. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1376. Each sample is adjusted by looking for other samples with similar contexts. This
  1377. context similarity is defined by comparing their surrounding patches of size
  1378. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1379. The filter accepts the following options:
  1380. @table @option
  1381. @item s
  1382. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1383. @item p
  1384. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1385. Default value is 2 milliseconds.
  1386. @item r
  1387. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1388. Default value is 6 milliseconds.
  1389. @item o
  1390. Set the output mode.
  1391. It accepts the following values:
  1392. @table @option
  1393. @item i
  1394. Pass input unchanged.
  1395. @item o
  1396. Pass noise filtered out.
  1397. @item n
  1398. Pass only noise.
  1399. Default value is @var{o}.
  1400. @end table
  1401. @item m
  1402. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1403. @end table
  1404. @subsection Commands
  1405. This filter supports the following commands:
  1406. @table @option
  1407. @item s
  1408. Change denoise strength. Argument is single float number.
  1409. Syntax for the command is : "@var{s}"
  1410. @item o
  1411. Change output mode.
  1412. Syntax for the command is : "i", "o" or "n" string.
  1413. @end table
  1414. @section anlms
  1415. Apply Normalized Least-Mean-Squares algorithm to the first audio stream using the second audio stream.
  1416. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1417. relate to producing the least mean square of the error signal (difference between the desired,
  1418. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1419. A description of the accepted options follows.
  1420. @table @option
  1421. @item order
  1422. Set filter order.
  1423. @item mu
  1424. Set filter mu.
  1425. @item eps
  1426. Set the filter eps.
  1427. @item leakage
  1428. Set the filter leakage.
  1429. @item out_mode
  1430. It accepts the following values:
  1431. @table @option
  1432. @item i
  1433. Pass the 1st input.
  1434. @item d
  1435. Pass the 2nd input.
  1436. @item o
  1437. Pass filtered samples.
  1438. @item n
  1439. Pass difference between desired and filtered samples.
  1440. Default value is @var{o}.
  1441. @end table
  1442. @end table
  1443. @subsection Examples
  1444. @itemize
  1445. @item
  1446. One of many usages of this filter is noise reduction, input audio is filtered
  1447. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1448. @example
  1449. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1450. @end example
  1451. @end itemize
  1452. @subsection Commands
  1453. This filter supports the same commands as options, excluding option @code{order}.
  1454. @section anull
  1455. Pass the audio source unchanged to the output.
  1456. @section apad
  1457. Pad the end of an audio stream with silence.
  1458. This can be used together with @command{ffmpeg} @option{-shortest} to
  1459. extend audio streams to the same length as the video stream.
  1460. A description of the accepted options follows.
  1461. @table @option
  1462. @item packet_size
  1463. Set silence packet size. Default value is 4096.
  1464. @item pad_len
  1465. Set the number of samples of silence to add to the end. After the
  1466. value is reached, the stream is terminated. This option is mutually
  1467. exclusive with @option{whole_len}.
  1468. @item whole_len
  1469. Set the minimum total number of samples in the output audio stream. If
  1470. the value is longer than the input audio length, silence is added to
  1471. the end, until the value is reached. This option is mutually exclusive
  1472. with @option{pad_len}.
  1473. @item pad_dur
  1474. Specify the duration of samples of silence to add. See
  1475. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1476. for the accepted syntax. Used only if set to non-zero value.
  1477. @item whole_dur
  1478. Specify the minimum total duration in the output audio stream. See
  1479. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1480. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1481. the input audio length, silence is added to the end, until the value is reached.
  1482. This option is mutually exclusive with @option{pad_dur}
  1483. @end table
  1484. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1485. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1486. the input stream indefinitely.
  1487. @subsection Examples
  1488. @itemize
  1489. @item
  1490. Add 1024 samples of silence to the end of the input:
  1491. @example
  1492. apad=pad_len=1024
  1493. @end example
  1494. @item
  1495. Make sure the audio output will contain at least 10000 samples, pad
  1496. the input with silence if required:
  1497. @example
  1498. apad=whole_len=10000
  1499. @end example
  1500. @item
  1501. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1502. video stream will always result the shortest and will be converted
  1503. until the end in the output file when using the @option{shortest}
  1504. option:
  1505. @example
  1506. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1507. @end example
  1508. @end itemize
  1509. @section aphaser
  1510. Add a phasing effect to the input audio.
  1511. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1512. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1513. A description of the accepted parameters follows.
  1514. @table @option
  1515. @item in_gain
  1516. Set input gain. Default is 0.4.
  1517. @item out_gain
  1518. Set output gain. Default is 0.74
  1519. @item delay
  1520. Set delay in milliseconds. Default is 3.0.
  1521. @item decay
  1522. Set decay. Default is 0.4.
  1523. @item speed
  1524. Set modulation speed in Hz. Default is 0.5.
  1525. @item type
  1526. Set modulation type. Default is triangular.
  1527. It accepts the following values:
  1528. @table @samp
  1529. @item triangular, t
  1530. @item sinusoidal, s
  1531. @end table
  1532. @end table
  1533. @section apulsator
  1534. Audio pulsator is something between an autopanner and a tremolo.
  1535. But it can produce funny stereo effects as well. Pulsator changes the volume
  1536. of the left and right channel based on a LFO (low frequency oscillator) with
  1537. different waveforms and shifted phases.
  1538. This filter have the ability to define an offset between left and right
  1539. channel. An offset of 0 means that both LFO shapes match each other.
  1540. The left and right channel are altered equally - a conventional tremolo.
  1541. An offset of 50% means that the shape of the right channel is exactly shifted
  1542. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1543. an autopanner. At 1 both curves match again. Every setting in between moves the
  1544. phase shift gapless between all stages and produces some "bypassing" sounds with
  1545. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1546. the 0.5) the faster the signal passes from the left to the right speaker.
  1547. The filter accepts the following options:
  1548. @table @option
  1549. @item level_in
  1550. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1551. @item level_out
  1552. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1553. @item mode
  1554. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1555. sawup or sawdown. Default is sine.
  1556. @item amount
  1557. Set modulation. Define how much of original signal is affected by the LFO.
  1558. @item offset_l
  1559. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1560. @item offset_r
  1561. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1562. @item width
  1563. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1564. @item timing
  1565. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1566. @item bpm
  1567. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1568. is set to bpm.
  1569. @item ms
  1570. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1571. is set to ms.
  1572. @item hz
  1573. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1574. if timing is set to hz.
  1575. @end table
  1576. @anchor{aresample}
  1577. @section aresample
  1578. Resample the input audio to the specified parameters, using the
  1579. libswresample library. If none are specified then the filter will
  1580. automatically convert between its input and output.
  1581. This filter is also able to stretch/squeeze the audio data to make it match
  1582. the timestamps or to inject silence / cut out audio to make it match the
  1583. timestamps, do a combination of both or do neither.
  1584. The filter accepts the syntax
  1585. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1586. expresses a sample rate and @var{resampler_options} is a list of
  1587. @var{key}=@var{value} pairs, separated by ":". See the
  1588. @ref{Resampler Options,,"Resampler Options" section in the
  1589. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1590. for the complete list of supported options.
  1591. @subsection Examples
  1592. @itemize
  1593. @item
  1594. Resample the input audio to 44100Hz:
  1595. @example
  1596. aresample=44100
  1597. @end example
  1598. @item
  1599. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1600. samples per second compensation:
  1601. @example
  1602. aresample=async=1000
  1603. @end example
  1604. @end itemize
  1605. @section areverse
  1606. Reverse an audio clip.
  1607. Warning: This filter requires memory to buffer the entire clip, so trimming
  1608. is suggested.
  1609. @subsection Examples
  1610. @itemize
  1611. @item
  1612. Take the first 5 seconds of a clip, and reverse it.
  1613. @example
  1614. atrim=end=5,areverse
  1615. @end example
  1616. @end itemize
  1617. @section asetnsamples
  1618. Set the number of samples per each output audio frame.
  1619. The last output packet may contain a different number of samples, as
  1620. the filter will flush all the remaining samples when the input audio
  1621. signals its end.
  1622. The filter accepts the following options:
  1623. @table @option
  1624. @item nb_out_samples, n
  1625. Set the number of frames per each output audio frame. The number is
  1626. intended as the number of samples @emph{per each channel}.
  1627. Default value is 1024.
  1628. @item pad, p
  1629. If set to 1, the filter will pad the last audio frame with zeroes, so
  1630. that the last frame will contain the same number of samples as the
  1631. previous ones. Default value is 1.
  1632. @end table
  1633. For example, to set the number of per-frame samples to 1234 and
  1634. disable padding for the last frame, use:
  1635. @example
  1636. asetnsamples=n=1234:p=0
  1637. @end example
  1638. @section asetrate
  1639. Set the sample rate without altering the PCM data.
  1640. This will result in a change of speed and pitch.
  1641. The filter accepts the following options:
  1642. @table @option
  1643. @item sample_rate, r
  1644. Set the output sample rate. Default is 44100 Hz.
  1645. @end table
  1646. @section ashowinfo
  1647. Show a line containing various information for each input audio frame.
  1648. The input audio is not modified.
  1649. The shown line contains a sequence of key/value pairs of the form
  1650. @var{key}:@var{value}.
  1651. The following values are shown in the output:
  1652. @table @option
  1653. @item n
  1654. The (sequential) number of the input frame, starting from 0.
  1655. @item pts
  1656. The presentation timestamp of the input frame, in time base units; the time base
  1657. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1658. @item pts_time
  1659. The presentation timestamp of the input frame in seconds.
  1660. @item pos
  1661. position of the frame in the input stream, -1 if this information in
  1662. unavailable and/or meaningless (for example in case of synthetic audio)
  1663. @item fmt
  1664. The sample format.
  1665. @item chlayout
  1666. The channel layout.
  1667. @item rate
  1668. The sample rate for the audio frame.
  1669. @item nb_samples
  1670. The number of samples (per channel) in the frame.
  1671. @item checksum
  1672. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1673. audio, the data is treated as if all the planes were concatenated.
  1674. @item plane_checksums
  1675. A list of Adler-32 checksums for each data plane.
  1676. @end table
  1677. @section asoftclip
  1678. Apply audio soft clipping.
  1679. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1680. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1681. This filter accepts the following options:
  1682. @table @option
  1683. @item type
  1684. Set type of soft-clipping.
  1685. It accepts the following values:
  1686. @table @option
  1687. @item tanh
  1688. @item atan
  1689. @item cubic
  1690. @item exp
  1691. @item alg
  1692. @item quintic
  1693. @item sin
  1694. @end table
  1695. @item param
  1696. Set additional parameter which controls sigmoid function.
  1697. @end table
  1698. @section asr
  1699. Automatic Speech Recognition
  1700. This filter uses PocketSphinx for speech recognition. To enable
  1701. compilation of this filter, you need to configure FFmpeg with
  1702. @code{--enable-pocketsphinx}.
  1703. It accepts the following options:
  1704. @table @option
  1705. @item rate
  1706. Set sampling rate of input audio. Defaults is @code{16000}.
  1707. This need to match speech models, otherwise one will get poor results.
  1708. @item hmm
  1709. Set dictionary containing acoustic model files.
  1710. @item dict
  1711. Set pronunciation dictionary.
  1712. @item lm
  1713. Set language model file.
  1714. @item lmctl
  1715. Set language model set.
  1716. @item lmname
  1717. Set which language model to use.
  1718. @item logfn
  1719. Set output for log messages.
  1720. @end table
  1721. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1722. @anchor{astats}
  1723. @section astats
  1724. Display time domain statistical information about the audio channels.
  1725. Statistics are calculated and displayed for each audio channel and,
  1726. where applicable, an overall figure is also given.
  1727. It accepts the following option:
  1728. @table @option
  1729. @item length
  1730. Short window length in seconds, used for peak and trough RMS measurement.
  1731. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1732. @item metadata
  1733. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1734. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1735. disabled.
  1736. Available keys for each channel are:
  1737. DC_offset
  1738. Min_level
  1739. Max_level
  1740. Min_difference
  1741. Max_difference
  1742. Mean_difference
  1743. RMS_difference
  1744. Peak_level
  1745. RMS_peak
  1746. RMS_trough
  1747. Crest_factor
  1748. Flat_factor
  1749. Peak_count
  1750. Bit_depth
  1751. Dynamic_range
  1752. Zero_crossings
  1753. Zero_crossings_rate
  1754. Number_of_NaNs
  1755. Number_of_Infs
  1756. Number_of_denormals
  1757. and for Overall:
  1758. DC_offset
  1759. Min_level
  1760. Max_level
  1761. Min_difference
  1762. Max_difference
  1763. Mean_difference
  1764. RMS_difference
  1765. Peak_level
  1766. RMS_level
  1767. RMS_peak
  1768. RMS_trough
  1769. Flat_factor
  1770. Peak_count
  1771. Bit_depth
  1772. Number_of_samples
  1773. Number_of_NaNs
  1774. Number_of_Infs
  1775. Number_of_denormals
  1776. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1777. this @code{lavfi.astats.Overall.Peak_count}.
  1778. For description what each key means read below.
  1779. @item reset
  1780. Set number of frame after which stats are going to be recalculated.
  1781. Default is disabled.
  1782. @item measure_perchannel
  1783. Select the entries which need to be measured per channel. The metadata keys can
  1784. be used as flags, default is @option{all} which measures everything.
  1785. @option{none} disables all per channel measurement.
  1786. @item measure_overall
  1787. Select the entries which need to be measured overall. The metadata keys can
  1788. be used as flags, default is @option{all} which measures everything.
  1789. @option{none} disables all overall measurement.
  1790. @end table
  1791. A description of each shown parameter follows:
  1792. @table @option
  1793. @item DC offset
  1794. Mean amplitude displacement from zero.
  1795. @item Min level
  1796. Minimal sample level.
  1797. @item Max level
  1798. Maximal sample level.
  1799. @item Min difference
  1800. Minimal difference between two consecutive samples.
  1801. @item Max difference
  1802. Maximal difference between two consecutive samples.
  1803. @item Mean difference
  1804. Mean difference between two consecutive samples.
  1805. The average of each difference between two consecutive samples.
  1806. @item RMS difference
  1807. Root Mean Square difference between two consecutive samples.
  1808. @item Peak level dB
  1809. @item RMS level dB
  1810. Standard peak and RMS level measured in dBFS.
  1811. @item RMS peak dB
  1812. @item RMS trough dB
  1813. Peak and trough values for RMS level measured over a short window.
  1814. @item Crest factor
  1815. Standard ratio of peak to RMS level (note: not in dB).
  1816. @item Flat factor
  1817. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1818. (i.e. either @var{Min level} or @var{Max level}).
  1819. @item Peak count
  1820. Number of occasions (not the number of samples) that the signal attained either
  1821. @var{Min level} or @var{Max level}.
  1822. @item Bit depth
  1823. Overall bit depth of audio. Number of bits used for each sample.
  1824. @item Dynamic range
  1825. Measured dynamic range of audio in dB.
  1826. @item Zero crossings
  1827. Number of points where the waveform crosses the zero level axis.
  1828. @item Zero crossings rate
  1829. Rate of Zero crossings and number of audio samples.
  1830. @end table
  1831. @section atempo
  1832. Adjust audio tempo.
  1833. The filter accepts exactly one parameter, the audio tempo. If not
  1834. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1835. be in the [0.5, 100.0] range.
  1836. Note that tempo greater than 2 will skip some samples rather than
  1837. blend them in. If for any reason this is a concern it is always
  1838. possible to daisy-chain several instances of atempo to achieve the
  1839. desired product tempo.
  1840. @subsection Examples
  1841. @itemize
  1842. @item
  1843. Slow down audio to 80% tempo:
  1844. @example
  1845. atempo=0.8
  1846. @end example
  1847. @item
  1848. To speed up audio to 300% tempo:
  1849. @example
  1850. atempo=3
  1851. @end example
  1852. @item
  1853. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1854. @example
  1855. atempo=sqrt(3),atempo=sqrt(3)
  1856. @end example
  1857. @end itemize
  1858. @subsection Commands
  1859. This filter supports the following commands:
  1860. @table @option
  1861. @item tempo
  1862. Change filter tempo scale factor.
  1863. Syntax for the command is : "@var{tempo}"
  1864. @end table
  1865. @section atrim
  1866. Trim the input so that the output contains one continuous subpart of the input.
  1867. It accepts the following parameters:
  1868. @table @option
  1869. @item start
  1870. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1871. sample with the timestamp @var{start} will be the first sample in the output.
  1872. @item end
  1873. Specify time of the first audio sample that will be dropped, i.e. the
  1874. audio sample immediately preceding the one with the timestamp @var{end} will be
  1875. the last sample in the output.
  1876. @item start_pts
  1877. Same as @var{start}, except this option sets the start timestamp in samples
  1878. instead of seconds.
  1879. @item end_pts
  1880. Same as @var{end}, except this option sets the end timestamp in samples instead
  1881. of seconds.
  1882. @item duration
  1883. The maximum duration of the output in seconds.
  1884. @item start_sample
  1885. The number of the first sample that should be output.
  1886. @item end_sample
  1887. The number of the first sample that should be dropped.
  1888. @end table
  1889. @option{start}, @option{end}, and @option{duration} are expressed as time
  1890. duration specifications; see
  1891. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1892. Note that the first two sets of the start/end options and the @option{duration}
  1893. option look at the frame timestamp, while the _sample options simply count the
  1894. samples that pass through the filter. So start/end_pts and start/end_sample will
  1895. give different results when the timestamps are wrong, inexact or do not start at
  1896. zero. Also note that this filter does not modify the timestamps. If you wish
  1897. to have the output timestamps start at zero, insert the asetpts filter after the
  1898. atrim filter.
  1899. If multiple start or end options are set, this filter tries to be greedy and
  1900. keep all samples that match at least one of the specified constraints. To keep
  1901. only the part that matches all the constraints at once, chain multiple atrim
  1902. filters.
  1903. The defaults are such that all the input is kept. So it is possible to set e.g.
  1904. just the end values to keep everything before the specified time.
  1905. Examples:
  1906. @itemize
  1907. @item
  1908. Drop everything except the second minute of input:
  1909. @example
  1910. ffmpeg -i INPUT -af atrim=60:120
  1911. @end example
  1912. @item
  1913. Keep only the first 1000 samples:
  1914. @example
  1915. ffmpeg -i INPUT -af atrim=end_sample=1000
  1916. @end example
  1917. @end itemize
  1918. @section bandpass
  1919. Apply a two-pole Butterworth band-pass filter with central
  1920. frequency @var{frequency}, and (3dB-point) band-width width.
  1921. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1922. instead of the default: constant 0dB peak gain.
  1923. The filter roll off at 6dB per octave (20dB per decade).
  1924. The filter accepts the following options:
  1925. @table @option
  1926. @item frequency, f
  1927. Set the filter's central frequency. Default is @code{3000}.
  1928. @item csg
  1929. Constant skirt gain if set to 1. Defaults to 0.
  1930. @item width_type, t
  1931. Set method to specify band-width of filter.
  1932. @table @option
  1933. @item h
  1934. Hz
  1935. @item q
  1936. Q-Factor
  1937. @item o
  1938. octave
  1939. @item s
  1940. slope
  1941. @item k
  1942. kHz
  1943. @end table
  1944. @item width, w
  1945. Specify the band-width of a filter in width_type units.
  1946. @item mix, m
  1947. How much to use filtered signal in output. Default is 1.
  1948. Range is between 0 and 1.
  1949. @item channels, c
  1950. Specify which channels to filter, by default all available are filtered.
  1951. @end table
  1952. @subsection Commands
  1953. This filter supports the following commands:
  1954. @table @option
  1955. @item frequency, f
  1956. Change bandpass frequency.
  1957. Syntax for the command is : "@var{frequency}"
  1958. @item width_type, t
  1959. Change bandpass width_type.
  1960. Syntax for the command is : "@var{width_type}"
  1961. @item width, w
  1962. Change bandpass width.
  1963. Syntax for the command is : "@var{width}"
  1964. @item mix, m
  1965. Change bandpass mix.
  1966. Syntax for the command is : "@var{mix}"
  1967. @end table
  1968. @section bandreject
  1969. Apply a two-pole Butterworth band-reject filter with central
  1970. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1971. The filter roll off at 6dB per octave (20dB per decade).
  1972. The filter accepts the following options:
  1973. @table @option
  1974. @item frequency, f
  1975. Set the filter's central frequency. Default is @code{3000}.
  1976. @item width_type, t
  1977. Set method to specify band-width of filter.
  1978. @table @option
  1979. @item h
  1980. Hz
  1981. @item q
  1982. Q-Factor
  1983. @item o
  1984. octave
  1985. @item s
  1986. slope
  1987. @item k
  1988. kHz
  1989. @end table
  1990. @item width, w
  1991. Specify the band-width of a filter in width_type units.
  1992. @item mix, m
  1993. How much to use filtered signal in output. Default is 1.
  1994. Range is between 0 and 1.
  1995. @item channels, c
  1996. Specify which channels to filter, by default all available are filtered.
  1997. @end table
  1998. @subsection Commands
  1999. This filter supports the following commands:
  2000. @table @option
  2001. @item frequency, f
  2002. Change bandreject frequency.
  2003. Syntax for the command is : "@var{frequency}"
  2004. @item width_type, t
  2005. Change bandreject width_type.
  2006. Syntax for the command is : "@var{width_type}"
  2007. @item width, w
  2008. Change bandreject width.
  2009. Syntax for the command is : "@var{width}"
  2010. @item mix, m
  2011. Change bandreject mix.
  2012. Syntax for the command is : "@var{mix}"
  2013. @end table
  2014. @section bass, lowshelf
  2015. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2016. shelving filter with a response similar to that of a standard
  2017. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2018. The filter accepts the following options:
  2019. @table @option
  2020. @item gain, g
  2021. Give the gain at 0 Hz. Its useful range is about -20
  2022. (for a large cut) to +20 (for a large boost).
  2023. Beware of clipping when using a positive gain.
  2024. @item frequency, f
  2025. Set the filter's central frequency and so can be used
  2026. to extend or reduce the frequency range to be boosted or cut.
  2027. The default value is @code{100} Hz.
  2028. @item width_type, t
  2029. Set method to specify band-width of filter.
  2030. @table @option
  2031. @item h
  2032. Hz
  2033. @item q
  2034. Q-Factor
  2035. @item o
  2036. octave
  2037. @item s
  2038. slope
  2039. @item k
  2040. kHz
  2041. @end table
  2042. @item width, w
  2043. Determine how steep is the filter's shelf transition.
  2044. @item mix, m
  2045. How much to use filtered signal in output. Default is 1.
  2046. Range is between 0 and 1.
  2047. @item channels, c
  2048. Specify which channels to filter, by default all available are filtered.
  2049. @end table
  2050. @subsection Commands
  2051. This filter supports the following commands:
  2052. @table @option
  2053. @item frequency, f
  2054. Change bass frequency.
  2055. Syntax for the command is : "@var{frequency}"
  2056. @item width_type, t
  2057. Change bass width_type.
  2058. Syntax for the command is : "@var{width_type}"
  2059. @item width, w
  2060. Change bass width.
  2061. Syntax for the command is : "@var{width}"
  2062. @item gain, g
  2063. Change bass gain.
  2064. Syntax for the command is : "@var{gain}"
  2065. @item mix, m
  2066. Change bass mix.
  2067. Syntax for the command is : "@var{mix}"
  2068. @end table
  2069. @section biquad
  2070. Apply a biquad IIR filter with the given coefficients.
  2071. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2072. are the numerator and denominator coefficients respectively.
  2073. and @var{channels}, @var{c} specify which channels to filter, by default all
  2074. available are filtered.
  2075. @subsection Commands
  2076. This filter supports the following commands:
  2077. @table @option
  2078. @item a0
  2079. @item a1
  2080. @item a2
  2081. @item b0
  2082. @item b1
  2083. @item b2
  2084. Change biquad parameter.
  2085. Syntax for the command is : "@var{value}"
  2086. @item mix, m
  2087. How much to use filtered signal in output. Default is 1.
  2088. Range is between 0 and 1.
  2089. @end table
  2090. @section bs2b
  2091. Bauer stereo to binaural transformation, which improves headphone listening of
  2092. stereo audio records.
  2093. To enable compilation of this filter you need to configure FFmpeg with
  2094. @code{--enable-libbs2b}.
  2095. It accepts the following parameters:
  2096. @table @option
  2097. @item profile
  2098. Pre-defined crossfeed level.
  2099. @table @option
  2100. @item default
  2101. Default level (fcut=700, feed=50).
  2102. @item cmoy
  2103. Chu Moy circuit (fcut=700, feed=60).
  2104. @item jmeier
  2105. Jan Meier circuit (fcut=650, feed=95).
  2106. @end table
  2107. @item fcut
  2108. Cut frequency (in Hz).
  2109. @item feed
  2110. Feed level (in Hz).
  2111. @end table
  2112. @section channelmap
  2113. Remap input channels to new locations.
  2114. It accepts the following parameters:
  2115. @table @option
  2116. @item map
  2117. Map channels from input to output. The argument is a '|'-separated list of
  2118. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2119. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2120. channel (e.g. FL for front left) or its index in the input channel layout.
  2121. @var{out_channel} is the name of the output channel or its index in the output
  2122. channel layout. If @var{out_channel} is not given then it is implicitly an
  2123. index, starting with zero and increasing by one for each mapping.
  2124. @item channel_layout
  2125. The channel layout of the output stream.
  2126. @end table
  2127. If no mapping is present, the filter will implicitly map input channels to
  2128. output channels, preserving indices.
  2129. @subsection Examples
  2130. @itemize
  2131. @item
  2132. For example, assuming a 5.1+downmix input MOV file,
  2133. @example
  2134. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2135. @end example
  2136. will create an output WAV file tagged as stereo from the downmix channels of
  2137. the input.
  2138. @item
  2139. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2140. @example
  2141. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2142. @end example
  2143. @end itemize
  2144. @section channelsplit
  2145. Split each channel from an input audio stream into a separate output stream.
  2146. It accepts the following parameters:
  2147. @table @option
  2148. @item channel_layout
  2149. The channel layout of the input stream. The default is "stereo".
  2150. @item channels
  2151. A channel layout describing the channels to be extracted as separate output streams
  2152. or "all" to extract each input channel as a separate stream. The default is "all".
  2153. Choosing channels not present in channel layout in the input will result in an error.
  2154. @end table
  2155. @subsection Examples
  2156. @itemize
  2157. @item
  2158. For example, assuming a stereo input MP3 file,
  2159. @example
  2160. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2161. @end example
  2162. will create an output Matroska file with two audio streams, one containing only
  2163. the left channel and the other the right channel.
  2164. @item
  2165. Split a 5.1 WAV file into per-channel files:
  2166. @example
  2167. ffmpeg -i in.wav -filter_complex
  2168. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2169. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2170. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2171. side_right.wav
  2172. @end example
  2173. @item
  2174. Extract only LFE from a 5.1 WAV file:
  2175. @example
  2176. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2177. -map '[LFE]' lfe.wav
  2178. @end example
  2179. @end itemize
  2180. @section chorus
  2181. Add a chorus effect to the audio.
  2182. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2183. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2184. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2185. The modulation depth defines the range the modulated delay is played before or after
  2186. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2187. sound tuned around the original one, like in a chorus where some vocals are slightly
  2188. off key.
  2189. It accepts the following parameters:
  2190. @table @option
  2191. @item in_gain
  2192. Set input gain. Default is 0.4.
  2193. @item out_gain
  2194. Set output gain. Default is 0.4.
  2195. @item delays
  2196. Set delays. A typical delay is around 40ms to 60ms.
  2197. @item decays
  2198. Set decays.
  2199. @item speeds
  2200. Set speeds.
  2201. @item depths
  2202. Set depths.
  2203. @end table
  2204. @subsection Examples
  2205. @itemize
  2206. @item
  2207. A single delay:
  2208. @example
  2209. chorus=0.7:0.9:55:0.4:0.25:2
  2210. @end example
  2211. @item
  2212. Two delays:
  2213. @example
  2214. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2215. @end example
  2216. @item
  2217. Fuller sounding chorus with three delays:
  2218. @example
  2219. 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
  2220. @end example
  2221. @end itemize
  2222. @section compand
  2223. Compress or expand the audio's dynamic range.
  2224. It accepts the following parameters:
  2225. @table @option
  2226. @item attacks
  2227. @item decays
  2228. A list of times in seconds for each channel over which the instantaneous level
  2229. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2230. increase of volume and @var{decays} refers to decrease of volume. For most
  2231. situations, the attack time (response to the audio getting louder) should be
  2232. shorter than the decay time, because the human ear is more sensitive to sudden
  2233. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2234. a typical value for decay is 0.8 seconds.
  2235. If specified number of attacks & decays is lower than number of channels, the last
  2236. set attack/decay will be used for all remaining channels.
  2237. @item points
  2238. A list of points for the transfer function, specified in dB relative to the
  2239. maximum possible signal amplitude. Each key points list must be defined using
  2240. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2241. @code{x0/y0 x1/y1 x2/y2 ....}
  2242. The input values must be in strictly increasing order but the transfer function
  2243. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2244. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2245. function are @code{-70/-70|-60/-20|1/0}.
  2246. @item soft-knee
  2247. Set the curve radius in dB for all joints. It defaults to 0.01.
  2248. @item gain
  2249. Set the additional gain in dB to be applied at all points on the transfer
  2250. function. This allows for easy adjustment of the overall gain.
  2251. It defaults to 0.
  2252. @item volume
  2253. Set an initial volume, in dB, to be assumed for each channel when filtering
  2254. starts. This permits the user to supply a nominal level initially, so that, for
  2255. example, a very large gain is not applied to initial signal levels before the
  2256. companding has begun to operate. A typical value for audio which is initially
  2257. quiet is -90 dB. It defaults to 0.
  2258. @item delay
  2259. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2260. delayed before being fed to the volume adjuster. Specifying a delay
  2261. approximately equal to the attack/decay times allows the filter to effectively
  2262. operate in predictive rather than reactive mode. It defaults to 0.
  2263. @end table
  2264. @subsection Examples
  2265. @itemize
  2266. @item
  2267. Make music with both quiet and loud passages suitable for listening to in a
  2268. noisy environment:
  2269. @example
  2270. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2271. @end example
  2272. Another example for audio with whisper and explosion parts:
  2273. @example
  2274. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2275. @end example
  2276. @item
  2277. A noise gate for when the noise is at a lower level than the signal:
  2278. @example
  2279. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2280. @end example
  2281. @item
  2282. Here is another noise gate, this time for when the noise is at a higher level
  2283. than the signal (making it, in some ways, similar to squelch):
  2284. @example
  2285. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2286. @end example
  2287. @item
  2288. 2:1 compression starting at -6dB:
  2289. @example
  2290. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2291. @end example
  2292. @item
  2293. 2:1 compression starting at -9dB:
  2294. @example
  2295. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2296. @end example
  2297. @item
  2298. 2:1 compression starting at -12dB:
  2299. @example
  2300. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2301. @end example
  2302. @item
  2303. 2:1 compression starting at -18dB:
  2304. @example
  2305. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2306. @end example
  2307. @item
  2308. 3:1 compression starting at -15dB:
  2309. @example
  2310. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2311. @end example
  2312. @item
  2313. Compressor/Gate:
  2314. @example
  2315. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2316. @end example
  2317. @item
  2318. Expander:
  2319. @example
  2320. 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
  2321. @end example
  2322. @item
  2323. Hard limiter at -6dB:
  2324. @example
  2325. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2326. @end example
  2327. @item
  2328. Hard limiter at -12dB:
  2329. @example
  2330. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2331. @end example
  2332. @item
  2333. Hard noise gate at -35 dB:
  2334. @example
  2335. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2336. @end example
  2337. @item
  2338. Soft limiter:
  2339. @example
  2340. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2341. @end example
  2342. @end itemize
  2343. @section compensationdelay
  2344. Compensation Delay Line is a metric based delay to compensate differing
  2345. positions of microphones or speakers.
  2346. For example, you have recorded guitar with two microphones placed in
  2347. different locations. Because the front of sound wave has fixed speed in
  2348. normal conditions, the phasing of microphones can vary and depends on
  2349. their location and interposition. The best sound mix can be achieved when
  2350. these microphones are in phase (synchronized). Note that a distance of
  2351. ~30 cm between microphones makes one microphone capture the signal in
  2352. antiphase to the other microphone. That makes the final mix sound moody.
  2353. This filter helps to solve phasing problems by adding different delays
  2354. to each microphone track and make them synchronized.
  2355. The best result can be reached when you take one track as base and
  2356. synchronize other tracks one by one with it.
  2357. Remember that synchronization/delay tolerance depends on sample rate, too.
  2358. Higher sample rates will give more tolerance.
  2359. The filter accepts the following parameters:
  2360. @table @option
  2361. @item mm
  2362. Set millimeters distance. This is compensation distance for fine tuning.
  2363. Default is 0.
  2364. @item cm
  2365. Set cm distance. This is compensation distance for tightening distance setup.
  2366. Default is 0.
  2367. @item m
  2368. Set meters distance. This is compensation distance for hard distance setup.
  2369. Default is 0.
  2370. @item dry
  2371. Set dry amount. Amount of unprocessed (dry) signal.
  2372. Default is 0.
  2373. @item wet
  2374. Set wet amount. Amount of processed (wet) signal.
  2375. Default is 1.
  2376. @item temp
  2377. Set temperature in degrees Celsius. This is the temperature of the environment.
  2378. Default is 20.
  2379. @end table
  2380. @section crossfeed
  2381. Apply headphone crossfeed filter.
  2382. Crossfeed is the process of blending the left and right channels of stereo
  2383. audio recording.
  2384. It is mainly used to reduce extreme stereo separation of low frequencies.
  2385. The intent is to produce more speaker like sound to the listener.
  2386. The filter accepts the following options:
  2387. @table @option
  2388. @item strength
  2389. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2390. This sets gain of low shelf filter for side part of stereo image.
  2391. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2392. @item range
  2393. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2394. This sets cut off frequency of low shelf filter. Default is cut off near
  2395. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2396. @item level_in
  2397. Set input gain. Default is 0.9.
  2398. @item level_out
  2399. Set output gain. Default is 1.
  2400. @end table
  2401. @section crystalizer
  2402. Simple algorithm to expand audio dynamic range.
  2403. The filter accepts the following options:
  2404. @table @option
  2405. @item i
  2406. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2407. (unchanged sound) to 10.0 (maximum effect).
  2408. @item c
  2409. Enable clipping. By default is enabled.
  2410. @end table
  2411. @section dcshift
  2412. Apply a DC shift to the audio.
  2413. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2414. in the recording chain) from the audio. The effect of a DC offset is reduced
  2415. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2416. a signal has a DC offset.
  2417. @table @option
  2418. @item shift
  2419. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2420. the audio.
  2421. @item limitergain
  2422. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2423. used to prevent clipping.
  2424. @end table
  2425. @section deesser
  2426. Apply de-essing to the audio samples.
  2427. @table @option
  2428. @item i
  2429. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2430. Default is 0.
  2431. @item m
  2432. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2433. Default is 0.5.
  2434. @item f
  2435. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2436. Default is 0.5.
  2437. @item s
  2438. Set the output mode.
  2439. It accepts the following values:
  2440. @table @option
  2441. @item i
  2442. Pass input unchanged.
  2443. @item o
  2444. Pass ess filtered out.
  2445. @item e
  2446. Pass only ess.
  2447. Default value is @var{o}.
  2448. @end table
  2449. @end table
  2450. @section drmeter
  2451. Measure audio dynamic range.
  2452. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2453. is found in transition material. And anything less that 8 have very poor dynamics
  2454. and is very compressed.
  2455. The filter accepts the following options:
  2456. @table @option
  2457. @item length
  2458. Set window length in seconds used to split audio into segments of equal length.
  2459. Default is 3 seconds.
  2460. @end table
  2461. @section dynaudnorm
  2462. Dynamic Audio Normalizer.
  2463. This filter applies a certain amount of gain to the input audio in order
  2464. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2465. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2466. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2467. This allows for applying extra gain to the "quiet" sections of the audio
  2468. while avoiding distortions or clipping the "loud" sections. In other words:
  2469. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2470. sections, in the sense that the volume of each section is brought to the
  2471. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2472. this goal *without* applying "dynamic range compressing". It will retain 100%
  2473. of the dynamic range *within* each section of the audio file.
  2474. @table @option
  2475. @item framelen, f
  2476. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2477. Default is 500 milliseconds.
  2478. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2479. referred to as frames. This is required, because a peak magnitude has no
  2480. meaning for just a single sample value. Instead, we need to determine the
  2481. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2482. normalizer would simply use the peak magnitude of the complete file, the
  2483. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2484. frame. The length of a frame is specified in milliseconds. By default, the
  2485. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2486. been found to give good results with most files.
  2487. Note that the exact frame length, in number of samples, will be determined
  2488. automatically, based on the sampling rate of the individual input audio file.
  2489. @item gausssize, g
  2490. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2491. number. Default is 31.
  2492. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2493. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2494. is specified in frames, centered around the current frame. For the sake of
  2495. simplicity, this must be an odd number. Consequently, the default value of 31
  2496. takes into account the current frame, as well as the 15 preceding frames and
  2497. the 15 subsequent frames. Using a larger window results in a stronger
  2498. smoothing effect and thus in less gain variation, i.e. slower gain
  2499. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2500. effect and thus in more gain variation, i.e. faster gain adaptation.
  2501. In other words, the more you increase this value, the more the Dynamic Audio
  2502. Normalizer will behave like a "traditional" normalization filter. On the
  2503. contrary, the more you decrease this value, the more the Dynamic Audio
  2504. Normalizer will behave like a dynamic range compressor.
  2505. @item peak, p
  2506. Set the target peak value. This specifies the highest permissible magnitude
  2507. level for the normalized audio input. This filter will try to approach the
  2508. target peak magnitude as closely as possible, but at the same time it also
  2509. makes sure that the normalized signal will never exceed the peak magnitude.
  2510. A frame's maximum local gain factor is imposed directly by the target peak
  2511. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2512. It is not recommended to go above this value.
  2513. @item maxgain, m
  2514. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2515. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2516. factor for each input frame, i.e. the maximum gain factor that does not
  2517. result in clipping or distortion. The maximum gain factor is determined by
  2518. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2519. additionally bounds the frame's maximum gain factor by a predetermined
  2520. (global) maximum gain factor. This is done in order to avoid excessive gain
  2521. factors in "silent" or almost silent frames. By default, the maximum gain
  2522. factor is 10.0, For most inputs the default value should be sufficient and
  2523. it usually is not recommended to increase this value. Though, for input
  2524. with an extremely low overall volume level, it may be necessary to allow even
  2525. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2526. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2527. Instead, a "sigmoid" threshold function will be applied. This way, the
  2528. gain factors will smoothly approach the threshold value, but never exceed that
  2529. value.
  2530. @item targetrms, r
  2531. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2532. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2533. This means that the maximum local gain factor for each frame is defined
  2534. (only) by the frame's highest magnitude sample. This way, the samples can
  2535. be amplified as much as possible without exceeding the maximum signal
  2536. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2537. Normalizer can also take into account the frame's root mean square,
  2538. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2539. determine the power of a time-varying signal. It is therefore considered
  2540. that the RMS is a better approximation of the "perceived loudness" than
  2541. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2542. frames to a constant RMS value, a uniform "perceived loudness" can be
  2543. established. If a target RMS value has been specified, a frame's local gain
  2544. factor is defined as the factor that would result in exactly that RMS value.
  2545. Note, however, that the maximum local gain factor is still restricted by the
  2546. frame's highest magnitude sample, in order to prevent clipping.
  2547. @item coupling, n
  2548. Enable channels coupling. By default is enabled.
  2549. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2550. amount. This means the same gain factor will be applied to all channels, i.e.
  2551. the maximum possible gain factor is determined by the "loudest" channel.
  2552. However, in some recordings, it may happen that the volume of the different
  2553. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2554. In this case, this option can be used to disable the channel coupling. This way,
  2555. the gain factor will be determined independently for each channel, depending
  2556. only on the individual channel's highest magnitude sample. This allows for
  2557. harmonizing the volume of the different channels.
  2558. @item correctdc, c
  2559. Enable DC bias correction. By default is disabled.
  2560. An audio signal (in the time domain) is a sequence of sample values.
  2561. In the Dynamic Audio Normalizer these sample values are represented in the
  2562. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2563. audio signal, or "waveform", should be centered around the zero point.
  2564. That means if we calculate the mean value of all samples in a file, or in a
  2565. single frame, then the result should be 0.0 or at least very close to that
  2566. value. If, however, there is a significant deviation of the mean value from
  2567. 0.0, in either positive or negative direction, this is referred to as a
  2568. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2569. Audio Normalizer provides optional DC bias correction.
  2570. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2571. the mean value, or "DC correction" offset, of each input frame and subtract
  2572. that value from all of the frame's sample values which ensures those samples
  2573. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2574. boundaries, the DC correction offset values will be interpolated smoothly
  2575. between neighbouring frames.
  2576. @item altboundary, b
  2577. Enable alternative boundary mode. By default is disabled.
  2578. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2579. around each frame. This includes the preceding frames as well as the
  2580. subsequent frames. However, for the "boundary" frames, located at the very
  2581. beginning and at the very end of the audio file, not all neighbouring
  2582. frames are available. In particular, for the first few frames in the audio
  2583. file, the preceding frames are not known. And, similarly, for the last few
  2584. frames in the audio file, the subsequent frames are not known. Thus, the
  2585. question arises which gain factors should be assumed for the missing frames
  2586. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2587. to deal with this situation. The default boundary mode assumes a gain factor
  2588. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2589. "fade out" at the beginning and at the end of the input, respectively.
  2590. @item compress, s
  2591. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2592. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2593. compression. This means that signal peaks will not be pruned and thus the
  2594. full dynamic range will be retained within each local neighbourhood. However,
  2595. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2596. normalization algorithm with a more "traditional" compression.
  2597. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2598. (thresholding) function. If (and only if) the compression feature is enabled,
  2599. all input frames will be processed by a soft knee thresholding function prior
  2600. to the actual normalization process. Put simply, the thresholding function is
  2601. going to prune all samples whose magnitude exceeds a certain threshold value.
  2602. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2603. value. Instead, the threshold value will be adjusted for each individual
  2604. frame.
  2605. In general, smaller parameters result in stronger compression, and vice versa.
  2606. Values below 3.0 are not recommended, because audible distortion may appear.
  2607. @end table
  2608. @section earwax
  2609. Make audio easier to listen to on headphones.
  2610. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2611. so that when listened to on headphones the stereo image is moved from
  2612. inside your head (standard for headphones) to outside and in front of
  2613. the listener (standard for speakers).
  2614. Ported from SoX.
  2615. @section equalizer
  2616. Apply a two-pole peaking equalisation (EQ) filter. With this
  2617. filter, the signal-level at and around a selected frequency can
  2618. be increased or decreased, whilst (unlike bandpass and bandreject
  2619. filters) that at all other frequencies is unchanged.
  2620. In order to produce complex equalisation curves, this filter can
  2621. be given several times, each with a different central frequency.
  2622. The filter accepts the following options:
  2623. @table @option
  2624. @item frequency, f
  2625. Set the filter's central frequency in Hz.
  2626. @item width_type, t
  2627. Set method to specify band-width of filter.
  2628. @table @option
  2629. @item h
  2630. Hz
  2631. @item q
  2632. Q-Factor
  2633. @item o
  2634. octave
  2635. @item s
  2636. slope
  2637. @item k
  2638. kHz
  2639. @end table
  2640. @item width, w
  2641. Specify the band-width of a filter in width_type units.
  2642. @item gain, g
  2643. Set the required gain or attenuation in dB.
  2644. Beware of clipping when using a positive gain.
  2645. @item mix, m
  2646. How much to use filtered signal in output. Default is 1.
  2647. Range is between 0 and 1.
  2648. @item channels, c
  2649. Specify which channels to filter, by default all available are filtered.
  2650. @end table
  2651. @subsection Examples
  2652. @itemize
  2653. @item
  2654. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2655. @example
  2656. equalizer=f=1000:t=h:width=200:g=-10
  2657. @end example
  2658. @item
  2659. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2660. @example
  2661. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2662. @end example
  2663. @end itemize
  2664. @subsection Commands
  2665. This filter supports the following commands:
  2666. @table @option
  2667. @item frequency, f
  2668. Change equalizer frequency.
  2669. Syntax for the command is : "@var{frequency}"
  2670. @item width_type, t
  2671. Change equalizer width_type.
  2672. Syntax for the command is : "@var{width_type}"
  2673. @item width, w
  2674. Change equalizer width.
  2675. Syntax for the command is : "@var{width}"
  2676. @item gain, g
  2677. Change equalizer gain.
  2678. Syntax for the command is : "@var{gain}"
  2679. @item mix, m
  2680. Change equalizer mix.
  2681. Syntax for the command is : "@var{mix}"
  2682. @end table
  2683. @section extrastereo
  2684. Linearly increases the difference between left and right channels which
  2685. adds some sort of "live" effect to playback.
  2686. The filter accepts the following options:
  2687. @table @option
  2688. @item m
  2689. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2690. (average of both channels), with 1.0 sound will be unchanged, with
  2691. -1.0 left and right channels will be swapped.
  2692. @item c
  2693. Enable clipping. By default is enabled.
  2694. @end table
  2695. @section firequalizer
  2696. Apply FIR Equalization using arbitrary frequency response.
  2697. The filter accepts the following option:
  2698. @table @option
  2699. @item gain
  2700. Set gain curve equation (in dB). The expression can contain variables:
  2701. @table @option
  2702. @item f
  2703. the evaluated frequency
  2704. @item sr
  2705. sample rate
  2706. @item ch
  2707. channel number, set to 0 when multichannels evaluation is disabled
  2708. @item chid
  2709. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2710. multichannels evaluation is disabled
  2711. @item chs
  2712. number of channels
  2713. @item chlayout
  2714. channel_layout, see libavutil/channel_layout.h
  2715. @end table
  2716. and functions:
  2717. @table @option
  2718. @item gain_interpolate(f)
  2719. interpolate gain on frequency f based on gain_entry
  2720. @item cubic_interpolate(f)
  2721. same as gain_interpolate, but smoother
  2722. @end table
  2723. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2724. @item gain_entry
  2725. Set gain entry for gain_interpolate function. The expression can
  2726. contain functions:
  2727. @table @option
  2728. @item entry(f, g)
  2729. store gain entry at frequency f with value g
  2730. @end table
  2731. This option is also available as command.
  2732. @item delay
  2733. Set filter delay in seconds. Higher value means more accurate.
  2734. Default is @code{0.01}.
  2735. @item accuracy
  2736. Set filter accuracy in Hz. Lower value means more accurate.
  2737. Default is @code{5}.
  2738. @item wfunc
  2739. Set window function. Acceptable values are:
  2740. @table @option
  2741. @item rectangular
  2742. rectangular window, useful when gain curve is already smooth
  2743. @item hann
  2744. hann window (default)
  2745. @item hamming
  2746. hamming window
  2747. @item blackman
  2748. blackman window
  2749. @item nuttall3
  2750. 3-terms continuous 1st derivative nuttall window
  2751. @item mnuttall3
  2752. minimum 3-terms discontinuous nuttall window
  2753. @item nuttall
  2754. 4-terms continuous 1st derivative nuttall window
  2755. @item bnuttall
  2756. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2757. @item bharris
  2758. blackman-harris window
  2759. @item tukey
  2760. tukey window
  2761. @end table
  2762. @item fixed
  2763. If enabled, use fixed number of audio samples. This improves speed when
  2764. filtering with large delay. Default is disabled.
  2765. @item multi
  2766. Enable multichannels evaluation on gain. Default is disabled.
  2767. @item zero_phase
  2768. Enable zero phase mode by subtracting timestamp to compensate delay.
  2769. Default is disabled.
  2770. @item scale
  2771. Set scale used by gain. Acceptable values are:
  2772. @table @option
  2773. @item linlin
  2774. linear frequency, linear gain
  2775. @item linlog
  2776. linear frequency, logarithmic (in dB) gain (default)
  2777. @item loglin
  2778. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2779. @item loglog
  2780. logarithmic frequency, logarithmic gain
  2781. @end table
  2782. @item dumpfile
  2783. Set file for dumping, suitable for gnuplot.
  2784. @item dumpscale
  2785. Set scale for dumpfile. Acceptable values are same with scale option.
  2786. Default is linlog.
  2787. @item fft2
  2788. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2789. Default is disabled.
  2790. @item min_phase
  2791. Enable minimum phase impulse response. Default is disabled.
  2792. @end table
  2793. @subsection Examples
  2794. @itemize
  2795. @item
  2796. lowpass at 1000 Hz:
  2797. @example
  2798. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2799. @end example
  2800. @item
  2801. lowpass at 1000 Hz with gain_entry:
  2802. @example
  2803. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2804. @end example
  2805. @item
  2806. custom equalization:
  2807. @example
  2808. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2809. @end example
  2810. @item
  2811. higher delay with zero phase to compensate delay:
  2812. @example
  2813. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2814. @end example
  2815. @item
  2816. lowpass on left channel, highpass on right channel:
  2817. @example
  2818. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2819. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2820. @end example
  2821. @end itemize
  2822. @section flanger
  2823. Apply a flanging effect to the audio.
  2824. The filter accepts the following options:
  2825. @table @option
  2826. @item delay
  2827. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2828. @item depth
  2829. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2830. @item regen
  2831. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2832. Default value is 0.
  2833. @item width
  2834. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2835. Default value is 71.
  2836. @item speed
  2837. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2838. @item shape
  2839. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2840. Default value is @var{sinusoidal}.
  2841. @item phase
  2842. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2843. Default value is 25.
  2844. @item interp
  2845. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2846. Default is @var{linear}.
  2847. @end table
  2848. @section haas
  2849. Apply Haas effect to audio.
  2850. Note that this makes most sense to apply on mono signals.
  2851. With this filter applied to mono signals it give some directionality and
  2852. stretches its stereo image.
  2853. The filter accepts the following options:
  2854. @table @option
  2855. @item level_in
  2856. Set input level. By default is @var{1}, or 0dB
  2857. @item level_out
  2858. Set output level. By default is @var{1}, or 0dB.
  2859. @item side_gain
  2860. Set gain applied to side part of signal. By default is @var{1}.
  2861. @item middle_source
  2862. Set kind of middle source. Can be one of the following:
  2863. @table @samp
  2864. @item left
  2865. Pick left channel.
  2866. @item right
  2867. Pick right channel.
  2868. @item mid
  2869. Pick middle part signal of stereo image.
  2870. @item side
  2871. Pick side part signal of stereo image.
  2872. @end table
  2873. @item middle_phase
  2874. Change middle phase. By default is disabled.
  2875. @item left_delay
  2876. Set left channel delay. By default is @var{2.05} milliseconds.
  2877. @item left_balance
  2878. Set left channel balance. By default is @var{-1}.
  2879. @item left_gain
  2880. Set left channel gain. By default is @var{1}.
  2881. @item left_phase
  2882. Change left phase. By default is disabled.
  2883. @item right_delay
  2884. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2885. @item right_balance
  2886. Set right channel balance. By default is @var{1}.
  2887. @item right_gain
  2888. Set right channel gain. By default is @var{1}.
  2889. @item right_phase
  2890. Change right phase. By default is enabled.
  2891. @end table
  2892. @section hdcd
  2893. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2894. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2895. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2896. of HDCD, and detects the Transient Filter flag.
  2897. @example
  2898. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2899. @end example
  2900. When using the filter with wav, note the default encoding for wav is 16-bit,
  2901. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2902. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2903. @example
  2904. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2905. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2906. @end example
  2907. The filter accepts the following options:
  2908. @table @option
  2909. @item disable_autoconvert
  2910. Disable any automatic format conversion or resampling in the filter graph.
  2911. @item process_stereo
  2912. Process the stereo channels together. If target_gain does not match between
  2913. channels, consider it invalid and use the last valid target_gain.
  2914. @item cdt_ms
  2915. Set the code detect timer period in ms.
  2916. @item force_pe
  2917. Always extend peaks above -3dBFS even if PE isn't signaled.
  2918. @item analyze_mode
  2919. Replace audio with a solid tone and adjust the amplitude to signal some
  2920. specific aspect of the decoding process. The output file can be loaded in
  2921. an audio editor alongside the original to aid analysis.
  2922. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2923. Modes are:
  2924. @table @samp
  2925. @item 0, off
  2926. Disabled
  2927. @item 1, lle
  2928. Gain adjustment level at each sample
  2929. @item 2, pe
  2930. Samples where peak extend occurs
  2931. @item 3, cdt
  2932. Samples where the code detect timer is active
  2933. @item 4, tgm
  2934. Samples where the target gain does not match between channels
  2935. @end table
  2936. @end table
  2937. @section headphone
  2938. Apply head-related transfer functions (HRTFs) to create virtual
  2939. loudspeakers around the user for binaural listening via headphones.
  2940. The HRIRs are provided via additional streams, for each channel
  2941. one stereo input stream is needed.
  2942. The filter accepts the following options:
  2943. @table @option
  2944. @item map
  2945. Set mapping of input streams for convolution.
  2946. The argument is a '|'-separated list of channel names in order as they
  2947. are given as additional stream inputs for filter.
  2948. This also specify number of input streams. Number of input streams
  2949. must be not less than number of channels in first stream plus one.
  2950. @item gain
  2951. Set gain applied to audio. Value is in dB. Default is 0.
  2952. @item type
  2953. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2954. processing audio in time domain which is slow.
  2955. @var{freq} is processing audio in frequency domain which is fast.
  2956. Default is @var{freq}.
  2957. @item lfe
  2958. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2959. @item size
  2960. Set size of frame in number of samples which will be processed at once.
  2961. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2962. @item hrir
  2963. Set format of hrir stream.
  2964. Default value is @var{stereo}. Alternative value is @var{multich}.
  2965. If value is set to @var{stereo}, number of additional streams should
  2966. be greater or equal to number of input channels in first input stream.
  2967. Also each additional stream should have stereo number of channels.
  2968. If value is set to @var{multich}, number of additional streams should
  2969. be exactly one. Also number of input channels of additional stream
  2970. should be equal or greater than twice number of channels of first input
  2971. stream.
  2972. @end table
  2973. @subsection Examples
  2974. @itemize
  2975. @item
  2976. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2977. each amovie filter use stereo file with IR coefficients as input.
  2978. The files give coefficients for each position of virtual loudspeaker:
  2979. @example
  2980. ffmpeg -i input.wav
  2981. -filter_complex "amovie=azi_270_ele_0_DFC.wav[sr];amovie=azi_90_ele_0_DFC.wav[sl];amovie=azi_225_ele_0_DFC.wav[br];amovie=azi_135_ele_0_DFC.wav[bl];amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe];amovie=azi_35_ele_0_DFC.wav[fl];amovie=azi_325_ele_0_DFC.wav[fr];[0:a][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2982. output.wav
  2983. @end example
  2984. @item
  2985. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2986. but now in @var{multich} @var{hrir} format.
  2987. @example
  2988. ffmpeg -i input.wav -filter_complex "amovie=minp.wav[hrirs];[0:a][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  2989. output.wav
  2990. @end example
  2991. @end itemize
  2992. @section highpass
  2993. Apply a high-pass filter with 3dB point frequency.
  2994. The filter can be either single-pole, or double-pole (the default).
  2995. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2996. The filter accepts the following options:
  2997. @table @option
  2998. @item frequency, f
  2999. Set frequency in Hz. Default is 3000.
  3000. @item poles, p
  3001. Set number of poles. Default is 2.
  3002. @item width_type, t
  3003. Set method to specify band-width of filter.
  3004. @table @option
  3005. @item h
  3006. Hz
  3007. @item q
  3008. Q-Factor
  3009. @item o
  3010. octave
  3011. @item s
  3012. slope
  3013. @item k
  3014. kHz
  3015. @end table
  3016. @item width, w
  3017. Specify the band-width of a filter in width_type units.
  3018. Applies only to double-pole filter.
  3019. The default is 0.707q and gives a Butterworth response.
  3020. @item mix, m
  3021. How much to use filtered signal in output. Default is 1.
  3022. Range is between 0 and 1.
  3023. @item channels, c
  3024. Specify which channels to filter, by default all available are filtered.
  3025. @end table
  3026. @subsection Commands
  3027. This filter supports the following commands:
  3028. @table @option
  3029. @item frequency, f
  3030. Change highpass frequency.
  3031. Syntax for the command is : "@var{frequency}"
  3032. @item width_type, t
  3033. Change highpass width_type.
  3034. Syntax for the command is : "@var{width_type}"
  3035. @item width, w
  3036. Change highpass width.
  3037. Syntax for the command is : "@var{width}"
  3038. @item mix, m
  3039. Change highpass mix.
  3040. Syntax for the command is : "@var{mix}"
  3041. @end table
  3042. @section join
  3043. Join multiple input streams into one multi-channel stream.
  3044. It accepts the following parameters:
  3045. @table @option
  3046. @item inputs
  3047. The number of input streams. It defaults to 2.
  3048. @item channel_layout
  3049. The desired output channel layout. It defaults to stereo.
  3050. @item map
  3051. Map channels from inputs to output. The argument is a '|'-separated list of
  3052. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3053. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3054. can be either the name of the input channel (e.g. FL for front left) or its
  3055. index in the specified input stream. @var{out_channel} is the name of the output
  3056. channel.
  3057. @end table
  3058. The filter will attempt to guess the mappings when they are not specified
  3059. explicitly. It does so by first trying to find an unused matching input channel
  3060. and if that fails it picks the first unused input channel.
  3061. Join 3 inputs (with properly set channel layouts):
  3062. @example
  3063. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3064. @end example
  3065. Build a 5.1 output from 6 single-channel streams:
  3066. @example
  3067. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3068. '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'
  3069. out
  3070. @end example
  3071. @section ladspa
  3072. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3073. To enable compilation of this filter you need to configure FFmpeg with
  3074. @code{--enable-ladspa}.
  3075. @table @option
  3076. @item file, f
  3077. Specifies the name of LADSPA plugin library to load. If the environment
  3078. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3079. each one of the directories specified by the colon separated list in
  3080. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3081. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3082. @file{/usr/lib/ladspa/}.
  3083. @item plugin, p
  3084. Specifies the plugin within the library. Some libraries contain only
  3085. one plugin, but others contain many of them. If this is not set filter
  3086. will list all available plugins within the specified library.
  3087. @item controls, c
  3088. Set the '|' separated list of controls which are zero or more floating point
  3089. values that determine the behavior of the loaded plugin (for example delay,
  3090. threshold or gain).
  3091. Controls need to be defined using the following syntax:
  3092. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3093. @var{valuei} is the value set on the @var{i}-th control.
  3094. Alternatively they can be also defined using the following syntax:
  3095. @var{value0}|@var{value1}|@var{value2}|..., where
  3096. @var{valuei} is the value set on the @var{i}-th control.
  3097. If @option{controls} is set to @code{help}, all available controls and
  3098. their valid ranges are printed.
  3099. @item sample_rate, s
  3100. Specify the sample rate, default to 44100. Only used if plugin have
  3101. zero inputs.
  3102. @item nb_samples, n
  3103. Set the number of samples per channel per each output frame, default
  3104. is 1024. Only used if plugin have zero inputs.
  3105. @item duration, d
  3106. Set the minimum duration of the sourced audio. See
  3107. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3108. for the accepted syntax.
  3109. Note that the resulting duration may be greater than the specified duration,
  3110. as the generated audio is always cut at the end of a complete frame.
  3111. If not specified, or the expressed duration is negative, the audio is
  3112. supposed to be generated forever.
  3113. Only used if plugin have zero inputs.
  3114. @end table
  3115. @subsection Examples
  3116. @itemize
  3117. @item
  3118. List all available plugins within amp (LADSPA example plugin) library:
  3119. @example
  3120. ladspa=file=amp
  3121. @end example
  3122. @item
  3123. List all available controls and their valid ranges for @code{vcf_notch}
  3124. plugin from @code{VCF} library:
  3125. @example
  3126. ladspa=f=vcf:p=vcf_notch:c=help
  3127. @end example
  3128. @item
  3129. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3130. plugin library:
  3131. @example
  3132. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3133. @end example
  3134. @item
  3135. Add reverberation to the audio using TAP-plugins
  3136. (Tom's Audio Processing plugins):
  3137. @example
  3138. ladspa=file=tap_reverb:tap_reverb
  3139. @end example
  3140. @item
  3141. Generate white noise, with 0.2 amplitude:
  3142. @example
  3143. ladspa=file=cmt:noise_source_white:c=c0=.2
  3144. @end example
  3145. @item
  3146. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3147. @code{C* Audio Plugin Suite} (CAPS) library:
  3148. @example
  3149. ladspa=file=caps:Click:c=c1=20'
  3150. @end example
  3151. @item
  3152. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3153. @example
  3154. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3155. @end example
  3156. @item
  3157. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3158. @code{SWH Plugins} collection:
  3159. @example
  3160. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3161. @end example
  3162. @item
  3163. Attenuate low frequencies using Multiband EQ from Steve Harris
  3164. @code{SWH Plugins} collection:
  3165. @example
  3166. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3167. @end example
  3168. @item
  3169. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3170. (CAPS) library:
  3171. @example
  3172. ladspa=caps:Narrower
  3173. @end example
  3174. @item
  3175. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3176. @example
  3177. ladspa=caps:White:.2
  3178. @end example
  3179. @item
  3180. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3181. @example
  3182. ladspa=caps:Fractal:c=c1=1
  3183. @end example
  3184. @item
  3185. Dynamic volume normalization using @code{VLevel} plugin:
  3186. @example
  3187. ladspa=vlevel-ladspa:vlevel_mono
  3188. @end example
  3189. @end itemize
  3190. @subsection Commands
  3191. This filter supports the following commands:
  3192. @table @option
  3193. @item cN
  3194. Modify the @var{N}-th control value.
  3195. If the specified value is not valid, it is ignored and prior one is kept.
  3196. @end table
  3197. @section loudnorm
  3198. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3199. Support for both single pass (livestreams, files) and double pass (files) modes.
  3200. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3201. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3202. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3203. The filter accepts the following options:
  3204. @table @option
  3205. @item I, i
  3206. Set integrated loudness target.
  3207. Range is -70.0 - -5.0. Default value is -24.0.
  3208. @item LRA, lra
  3209. Set loudness range target.
  3210. Range is 1.0 - 20.0. Default value is 7.0.
  3211. @item TP, tp
  3212. Set maximum true peak.
  3213. Range is -9.0 - +0.0. Default value is -2.0.
  3214. @item measured_I, measured_i
  3215. Measured IL of input file.
  3216. Range is -99.0 - +0.0.
  3217. @item measured_LRA, measured_lra
  3218. Measured LRA of input file.
  3219. Range is 0.0 - 99.0.
  3220. @item measured_TP, measured_tp
  3221. Measured true peak of input file.
  3222. Range is -99.0 - +99.0.
  3223. @item measured_thresh
  3224. Measured threshold of input file.
  3225. Range is -99.0 - +0.0.
  3226. @item offset
  3227. Set offset gain. Gain is applied before the true-peak limiter.
  3228. Range is -99.0 - +99.0. Default is +0.0.
  3229. @item linear
  3230. Normalize linearly if possible.
  3231. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3232. to be specified in order to use this mode.
  3233. Options are true or false. Default is true.
  3234. @item dual_mono
  3235. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3236. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3237. If set to @code{true}, this option will compensate for this effect.
  3238. Multi-channel input files are not affected by this option.
  3239. Options are true or false. Default is false.
  3240. @item print_format
  3241. Set print format for stats. Options are summary, json, or none.
  3242. Default value is none.
  3243. @end table
  3244. @section lowpass
  3245. Apply a low-pass filter with 3dB point frequency.
  3246. The filter can be either single-pole or double-pole (the default).
  3247. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3248. The filter accepts the following options:
  3249. @table @option
  3250. @item frequency, f
  3251. Set frequency in Hz. Default is 500.
  3252. @item poles, p
  3253. Set number of poles. Default is 2.
  3254. @item width_type, t
  3255. Set method to specify band-width of filter.
  3256. @table @option
  3257. @item h
  3258. Hz
  3259. @item q
  3260. Q-Factor
  3261. @item o
  3262. octave
  3263. @item s
  3264. slope
  3265. @item k
  3266. kHz
  3267. @end table
  3268. @item width, w
  3269. Specify the band-width of a filter in width_type units.
  3270. Applies only to double-pole filter.
  3271. The default is 0.707q and gives a Butterworth response.
  3272. @item mix, m
  3273. How much to use filtered signal in output. Default is 1.
  3274. Range is between 0 and 1.
  3275. @item channels, c
  3276. Specify which channels to filter, by default all available are filtered.
  3277. @end table
  3278. @subsection Examples
  3279. @itemize
  3280. @item
  3281. Lowpass only LFE channel, it LFE is not present it does nothing:
  3282. @example
  3283. lowpass=c=LFE
  3284. @end example
  3285. @end itemize
  3286. @subsection Commands
  3287. This filter supports the following commands:
  3288. @table @option
  3289. @item frequency, f
  3290. Change lowpass frequency.
  3291. Syntax for the command is : "@var{frequency}"
  3292. @item width_type, t
  3293. Change lowpass width_type.
  3294. Syntax for the command is : "@var{width_type}"
  3295. @item width, w
  3296. Change lowpass width.
  3297. Syntax for the command is : "@var{width}"
  3298. @item mix, m
  3299. Change lowpass mix.
  3300. Syntax for the command is : "@var{mix}"
  3301. @end table
  3302. @section lv2
  3303. Load a LV2 (LADSPA Version 2) plugin.
  3304. To enable compilation of this filter you need to configure FFmpeg with
  3305. @code{--enable-lv2}.
  3306. @table @option
  3307. @item plugin, p
  3308. Specifies the plugin URI. You may need to escape ':'.
  3309. @item controls, c
  3310. Set the '|' separated list of controls which are zero or more floating point
  3311. values that determine the behavior of the loaded plugin (for example delay,
  3312. threshold or gain).
  3313. If @option{controls} is set to @code{help}, all available controls and
  3314. their valid ranges are printed.
  3315. @item sample_rate, s
  3316. Specify the sample rate, default to 44100. Only used if plugin have
  3317. zero inputs.
  3318. @item nb_samples, n
  3319. Set the number of samples per channel per each output frame, default
  3320. is 1024. Only used if plugin have zero inputs.
  3321. @item duration, d
  3322. Set the minimum duration of the sourced audio. See
  3323. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3324. for the accepted syntax.
  3325. Note that the resulting duration may be greater than the specified duration,
  3326. as the generated audio is always cut at the end of a complete frame.
  3327. If not specified, or the expressed duration is negative, the audio is
  3328. supposed to be generated forever.
  3329. Only used if plugin have zero inputs.
  3330. @end table
  3331. @subsection Examples
  3332. @itemize
  3333. @item
  3334. Apply bass enhancer plugin from Calf:
  3335. @example
  3336. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3337. @end example
  3338. @item
  3339. Apply vinyl plugin from Calf:
  3340. @example
  3341. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3342. @end example
  3343. @item
  3344. Apply bit crusher plugin from ArtyFX:
  3345. @example
  3346. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3347. @end example
  3348. @end itemize
  3349. @section mcompand
  3350. Multiband Compress or expand the audio's dynamic range.
  3351. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3352. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3353. response when absent compander action.
  3354. It accepts the following parameters:
  3355. @table @option
  3356. @item args
  3357. This option syntax is:
  3358. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3359. For explanation of each item refer to compand filter documentation.
  3360. @end table
  3361. @anchor{pan}
  3362. @section pan
  3363. Mix channels with specific gain levels. The filter accepts the output
  3364. channel layout followed by a set of channels definitions.
  3365. This filter is also designed to efficiently remap the channels of an audio
  3366. stream.
  3367. The filter accepts parameters of the form:
  3368. "@var{l}|@var{outdef}|@var{outdef}|..."
  3369. @table @option
  3370. @item l
  3371. output channel layout or number of channels
  3372. @item outdef
  3373. output channel specification, of the form:
  3374. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3375. @item out_name
  3376. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3377. number (c0, c1, etc.)
  3378. @item gain
  3379. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3380. @item in_name
  3381. input channel to use, see out_name for details; it is not possible to mix
  3382. named and numbered input channels
  3383. @end table
  3384. If the `=' in a channel specification is replaced by `<', then the gains for
  3385. that specification will be renormalized so that the total is 1, thus
  3386. avoiding clipping noise.
  3387. @subsection Mixing examples
  3388. For example, if you want to down-mix from stereo to mono, but with a bigger
  3389. factor for the left channel:
  3390. @example
  3391. pan=1c|c0=0.9*c0+0.1*c1
  3392. @end example
  3393. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3394. 7-channels surround:
  3395. @example
  3396. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3397. @end example
  3398. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3399. that should be preferred (see "-ac" option) unless you have very specific
  3400. needs.
  3401. @subsection Remapping examples
  3402. The channel remapping will be effective if, and only if:
  3403. @itemize
  3404. @item gain coefficients are zeroes or ones,
  3405. @item only one input per channel output,
  3406. @end itemize
  3407. If all these conditions are satisfied, the filter will notify the user ("Pure
  3408. channel mapping detected"), and use an optimized and lossless method to do the
  3409. remapping.
  3410. For example, if you have a 5.1 source and want a stereo audio stream by
  3411. dropping the extra channels:
  3412. @example
  3413. pan="stereo| c0=FL | c1=FR"
  3414. @end example
  3415. Given the same source, you can also switch front left and front right channels
  3416. and keep the input channel layout:
  3417. @example
  3418. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3419. @end example
  3420. If the input is a stereo audio stream, you can mute the front left channel (and
  3421. still keep the stereo channel layout) with:
  3422. @example
  3423. pan="stereo|c1=c1"
  3424. @end example
  3425. Still with a stereo audio stream input, you can copy the right channel in both
  3426. front left and right:
  3427. @example
  3428. pan="stereo| c0=FR | c1=FR"
  3429. @end example
  3430. @section replaygain
  3431. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3432. outputs it unchanged.
  3433. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3434. @section resample
  3435. Convert the audio sample format, sample rate and channel layout. It is
  3436. not meant to be used directly.
  3437. @section rubberband
  3438. Apply time-stretching and pitch-shifting with librubberband.
  3439. To enable compilation of this filter, you need to configure FFmpeg with
  3440. @code{--enable-librubberband}.
  3441. The filter accepts the following options:
  3442. @table @option
  3443. @item tempo
  3444. Set tempo scale factor.
  3445. @item pitch
  3446. Set pitch scale factor.
  3447. @item transients
  3448. Set transients detector.
  3449. Possible values are:
  3450. @table @var
  3451. @item crisp
  3452. @item mixed
  3453. @item smooth
  3454. @end table
  3455. @item detector
  3456. Set detector.
  3457. Possible values are:
  3458. @table @var
  3459. @item compound
  3460. @item percussive
  3461. @item soft
  3462. @end table
  3463. @item phase
  3464. Set phase.
  3465. Possible values are:
  3466. @table @var
  3467. @item laminar
  3468. @item independent
  3469. @end table
  3470. @item window
  3471. Set processing window size.
  3472. Possible values are:
  3473. @table @var
  3474. @item standard
  3475. @item short
  3476. @item long
  3477. @end table
  3478. @item smoothing
  3479. Set smoothing.
  3480. Possible values are:
  3481. @table @var
  3482. @item off
  3483. @item on
  3484. @end table
  3485. @item formant
  3486. Enable formant preservation when shift pitching.
  3487. Possible values are:
  3488. @table @var
  3489. @item shifted
  3490. @item preserved
  3491. @end table
  3492. @item pitchq
  3493. Set pitch quality.
  3494. Possible values are:
  3495. @table @var
  3496. @item quality
  3497. @item speed
  3498. @item consistency
  3499. @end table
  3500. @item channels
  3501. Set channels.
  3502. Possible values are:
  3503. @table @var
  3504. @item apart
  3505. @item together
  3506. @end table
  3507. @end table
  3508. @subsection Commands
  3509. This filter supports the following commands:
  3510. @table @option
  3511. @item tempo
  3512. Change filter tempo scale factor.
  3513. Syntax for the command is : "@var{tempo}"
  3514. @item pitch
  3515. Change filter pitch scale factor.
  3516. Syntax for the command is : "@var{pitch}"
  3517. @end table
  3518. @section sidechaincompress
  3519. This filter acts like normal compressor but has the ability to compress
  3520. detected signal using second input signal.
  3521. It needs two input streams and returns one output stream.
  3522. First input stream will be processed depending on second stream signal.
  3523. The filtered signal then can be filtered with other filters in later stages of
  3524. processing. See @ref{pan} and @ref{amerge} filter.
  3525. The filter accepts the following options:
  3526. @table @option
  3527. @item level_in
  3528. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3529. @item mode
  3530. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3531. Default is @code{downward}.
  3532. @item threshold
  3533. If a signal of second stream raises above this level it will affect the gain
  3534. reduction of first stream.
  3535. By default is 0.125. Range is between 0.00097563 and 1.
  3536. @item ratio
  3537. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3538. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3539. Default is 2. Range is between 1 and 20.
  3540. @item attack
  3541. Amount of milliseconds the signal has to rise above the threshold before gain
  3542. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3543. @item release
  3544. Amount of milliseconds the signal has to fall below the threshold before
  3545. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3546. @item makeup
  3547. Set the amount by how much signal will be amplified after processing.
  3548. Default is 1. Range is from 1 to 64.
  3549. @item knee
  3550. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3551. Default is 2.82843. Range is between 1 and 8.
  3552. @item link
  3553. Choose if the @code{average} level between all channels of side-chain stream
  3554. or the louder(@code{maximum}) channel of side-chain stream affects the
  3555. reduction. Default is @code{average}.
  3556. @item detection
  3557. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3558. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3559. @item level_sc
  3560. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3561. @item mix
  3562. How much to use compressed signal in output. Default is 1.
  3563. Range is between 0 and 1.
  3564. @end table
  3565. @subsection Examples
  3566. @itemize
  3567. @item
  3568. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3569. depending on the signal of 2nd input and later compressed signal to be
  3570. merged with 2nd input:
  3571. @example
  3572. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3573. @end example
  3574. @end itemize
  3575. @section sidechaingate
  3576. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3577. filter the detected signal before sending it to the gain reduction stage.
  3578. Normally a gate uses the full range signal to detect a level above the
  3579. threshold.
  3580. For example: If you cut all lower frequencies from your sidechain signal
  3581. the gate will decrease the volume of your track only if not enough highs
  3582. appear. With this technique you are able to reduce the resonation of a
  3583. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3584. guitar.
  3585. It needs two input streams and returns one output stream.
  3586. First input stream will be processed depending on second stream signal.
  3587. The filter accepts the following options:
  3588. @table @option
  3589. @item level_in
  3590. Set input level before filtering.
  3591. Default is 1. Allowed range is from 0.015625 to 64.
  3592. @item mode
  3593. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3594. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3595. will be amplified, expanding dynamic range in upward direction.
  3596. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3597. @item range
  3598. Set the level of gain reduction when the signal is below the threshold.
  3599. Default is 0.06125. Allowed range is from 0 to 1.
  3600. Setting this to 0 disables reduction and then filter behaves like expander.
  3601. @item threshold
  3602. If a signal rises above this level the gain reduction is released.
  3603. Default is 0.125. Allowed range is from 0 to 1.
  3604. @item ratio
  3605. Set a ratio about which the signal is reduced.
  3606. Default is 2. Allowed range is from 1 to 9000.
  3607. @item attack
  3608. Amount of milliseconds the signal has to rise above the threshold before gain
  3609. reduction stops.
  3610. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3611. @item release
  3612. Amount of milliseconds the signal has to fall below the threshold before the
  3613. reduction is increased again. Default is 250 milliseconds.
  3614. Allowed range is from 0.01 to 9000.
  3615. @item makeup
  3616. Set amount of amplification of signal after processing.
  3617. Default is 1. Allowed range is from 1 to 64.
  3618. @item knee
  3619. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3620. Default is 2.828427125. Allowed range is from 1 to 8.
  3621. @item detection
  3622. Choose if exact signal should be taken for detection or an RMS like one.
  3623. Default is rms. Can be peak or rms.
  3624. @item link
  3625. Choose if the average level between all channels or the louder channel affects
  3626. the reduction.
  3627. Default is average. Can be average or maximum.
  3628. @item level_sc
  3629. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3630. @end table
  3631. @section silencedetect
  3632. Detect silence in an audio stream.
  3633. This filter logs a message when it detects that the input audio volume is less
  3634. or equal to a noise tolerance value for a duration greater or equal to the
  3635. minimum detected noise duration.
  3636. The printed times and duration are expressed in seconds.
  3637. The filter accepts the following options:
  3638. @table @option
  3639. @item noise, n
  3640. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3641. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3642. @item duration, d
  3643. Set silence duration until notification (default is 2 seconds).
  3644. @item mono, m
  3645. Process each channel separately, instead of combined. By default is disabled.
  3646. @end table
  3647. @subsection Examples
  3648. @itemize
  3649. @item
  3650. Detect 5 seconds of silence with -50dB noise tolerance:
  3651. @example
  3652. silencedetect=n=-50dB:d=5
  3653. @end example
  3654. @item
  3655. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3656. tolerance in @file{silence.mp3}:
  3657. @example
  3658. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3659. @end example
  3660. @end itemize
  3661. @section silenceremove
  3662. Remove silence from the beginning, middle or end of the audio.
  3663. The filter accepts the following options:
  3664. @table @option
  3665. @item start_periods
  3666. This value is used to indicate if audio should be trimmed at beginning of
  3667. the audio. A value of zero indicates no silence should be trimmed from the
  3668. beginning. When specifying a non-zero value, it trims audio up until it
  3669. finds non-silence. Normally, when trimming silence from beginning of audio
  3670. the @var{start_periods} will be @code{1} but it can be increased to higher
  3671. values to trim all audio up to specific count of non-silence periods.
  3672. Default value is @code{0}.
  3673. @item start_duration
  3674. Specify the amount of time that non-silence must be detected before it stops
  3675. trimming audio. By increasing the duration, bursts of noises can be treated
  3676. as silence and trimmed off. Default value is @code{0}.
  3677. @item start_threshold
  3678. This indicates what sample value should be treated as silence. For digital
  3679. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3680. you may wish to increase the value to account for background noise.
  3681. Can be specified in dB (in case "dB" is appended to the specified value)
  3682. or amplitude ratio. Default value is @code{0}.
  3683. @item start_silence
  3684. Specify max duration of silence at beginning that will be kept after
  3685. trimming. Default is 0, which is equal to trimming all samples detected
  3686. as silence.
  3687. @item start_mode
  3688. Specify mode of detection of silence end in start of multi-channel audio.
  3689. Can be @var{any} or @var{all}. Default is @var{any}.
  3690. With @var{any}, any sample that is detected as non-silence will cause
  3691. stopped trimming of silence.
  3692. With @var{all}, only if all channels are detected as non-silence will cause
  3693. stopped trimming of silence.
  3694. @item stop_periods
  3695. Set the count for trimming silence from the end of audio.
  3696. To remove silence from the middle of a file, specify a @var{stop_periods}
  3697. that is negative. This value is then treated as a positive value and is
  3698. used to indicate the effect should restart processing as specified by
  3699. @var{start_periods}, making it suitable for removing periods of silence
  3700. in the middle of the audio.
  3701. Default value is @code{0}.
  3702. @item stop_duration
  3703. Specify a duration of silence that must exist before audio is not copied any
  3704. more. By specifying a higher duration, silence that is wanted can be left in
  3705. the audio.
  3706. Default value is @code{0}.
  3707. @item stop_threshold
  3708. This is the same as @option{start_threshold} but for trimming silence from
  3709. the end of audio.
  3710. Can be specified in dB (in case "dB" is appended to the specified value)
  3711. or amplitude ratio. Default value is @code{0}.
  3712. @item stop_silence
  3713. Specify max duration of silence at end that will be kept after
  3714. trimming. Default is 0, which is equal to trimming all samples detected
  3715. as silence.
  3716. @item stop_mode
  3717. Specify mode of detection of silence start in end of multi-channel audio.
  3718. Can be @var{any} or @var{all}. Default is @var{any}.
  3719. With @var{any}, any sample that is detected as non-silence will cause
  3720. stopped trimming of silence.
  3721. With @var{all}, only if all channels are detected as non-silence will cause
  3722. stopped trimming of silence.
  3723. @item detection
  3724. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3725. and works better with digital silence which is exactly 0.
  3726. Default value is @code{rms}.
  3727. @item window
  3728. Set duration in number of seconds used to calculate size of window in number
  3729. of samples for detecting silence.
  3730. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3731. @end table
  3732. @subsection Examples
  3733. @itemize
  3734. @item
  3735. The following example shows how this filter can be used to start a recording
  3736. that does not contain the delay at the start which usually occurs between
  3737. pressing the record button and the start of the performance:
  3738. @example
  3739. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3740. @end example
  3741. @item
  3742. Trim all silence encountered from beginning to end where there is more than 1
  3743. second of silence in audio:
  3744. @example
  3745. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3746. @end example
  3747. @item
  3748. Trim all digital silence samples, using peak detection, from beginning to end
  3749. where there is more than 0 samples of digital silence in audio and digital
  3750. silence is detected in all channels at same positions in stream:
  3751. @example
  3752. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3753. @end example
  3754. @end itemize
  3755. @section sofalizer
  3756. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3757. loudspeakers around the user for binaural listening via headphones (audio
  3758. formats up to 9 channels supported).
  3759. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3760. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3761. Austrian Academy of Sciences.
  3762. To enable compilation of this filter you need to configure FFmpeg with
  3763. @code{--enable-libmysofa}.
  3764. The filter accepts the following options:
  3765. @table @option
  3766. @item sofa
  3767. Set the SOFA file used for rendering.
  3768. @item gain
  3769. Set gain applied to audio. Value is in dB. Default is 0.
  3770. @item rotation
  3771. Set rotation of virtual loudspeakers in deg. Default is 0.
  3772. @item elevation
  3773. Set elevation of virtual speakers in deg. Default is 0.
  3774. @item radius
  3775. Set distance in meters between loudspeakers and the listener with near-field
  3776. HRTFs. Default is 1.
  3777. @item type
  3778. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3779. processing audio in time domain which is slow.
  3780. @var{freq} is processing audio in frequency domain which is fast.
  3781. Default is @var{freq}.
  3782. @item speakers
  3783. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3784. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3785. Each virtual loudspeaker is described with short channel name following with
  3786. azimuth and elevation in degrees.
  3787. Each virtual loudspeaker description is separated by '|'.
  3788. For example to override front left and front right channel positions use:
  3789. 'speakers=FL 45 15|FR 345 15'.
  3790. Descriptions with unrecognised channel names are ignored.
  3791. @item lfegain
  3792. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3793. @item framesize
  3794. Set custom frame size in number of samples. Default is 1024.
  3795. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3796. is set to @var{freq}.
  3797. @item normalize
  3798. Should all IRs be normalized upon importing SOFA file.
  3799. By default is enabled.
  3800. @item interpolate
  3801. Should nearest IRs be interpolated with neighbor IRs if exact position
  3802. does not match. By default is disabled.
  3803. @item minphase
  3804. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3805. @item anglestep
  3806. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3807. @item radstep
  3808. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3809. @end table
  3810. @subsection Examples
  3811. @itemize
  3812. @item
  3813. Using ClubFritz6 sofa file:
  3814. @example
  3815. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3816. @end example
  3817. @item
  3818. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3819. @example
  3820. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3821. @end example
  3822. @item
  3823. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3824. and also with custom gain:
  3825. @example
  3826. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3827. @end example
  3828. @end itemize
  3829. @section stereotools
  3830. This filter has some handy utilities to manage stereo signals, for converting
  3831. M/S stereo recordings to L/R signal while having control over the parameters
  3832. or spreading the stereo image of master track.
  3833. The filter accepts the following options:
  3834. @table @option
  3835. @item level_in
  3836. Set input level before filtering for both channels. Defaults is 1.
  3837. Allowed range is from 0.015625 to 64.
  3838. @item level_out
  3839. Set output level after filtering for both channels. Defaults is 1.
  3840. Allowed range is from 0.015625 to 64.
  3841. @item balance_in
  3842. Set input balance between both channels. Default is 0.
  3843. Allowed range is from -1 to 1.
  3844. @item balance_out
  3845. Set output balance between both channels. Default is 0.
  3846. Allowed range is from -1 to 1.
  3847. @item softclip
  3848. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3849. clipping. Disabled by default.
  3850. @item mutel
  3851. Mute the left channel. Disabled by default.
  3852. @item muter
  3853. Mute the right channel. Disabled by default.
  3854. @item phasel
  3855. Change the phase of the left channel. Disabled by default.
  3856. @item phaser
  3857. Change the phase of the right channel. Disabled by default.
  3858. @item mode
  3859. Set stereo mode. Available values are:
  3860. @table @samp
  3861. @item lr>lr
  3862. Left/Right to Left/Right, this is default.
  3863. @item lr>ms
  3864. Left/Right to Mid/Side.
  3865. @item ms>lr
  3866. Mid/Side to Left/Right.
  3867. @item lr>ll
  3868. Left/Right to Left/Left.
  3869. @item lr>rr
  3870. Left/Right to Right/Right.
  3871. @item lr>l+r
  3872. Left/Right to Left + Right.
  3873. @item lr>rl
  3874. Left/Right to Right/Left.
  3875. @item ms>ll
  3876. Mid/Side to Left/Left.
  3877. @item ms>rr
  3878. Mid/Side to Right/Right.
  3879. @end table
  3880. @item slev
  3881. Set level of side signal. Default is 1.
  3882. Allowed range is from 0.015625 to 64.
  3883. @item sbal
  3884. Set balance of side signal. Default is 0.
  3885. Allowed range is from -1 to 1.
  3886. @item mlev
  3887. Set level of the middle signal. Default is 1.
  3888. Allowed range is from 0.015625 to 64.
  3889. @item mpan
  3890. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3891. @item base
  3892. Set stereo base between mono and inversed channels. Default is 0.
  3893. Allowed range is from -1 to 1.
  3894. @item delay
  3895. Set delay in milliseconds how much to delay left from right channel and
  3896. vice versa. Default is 0. Allowed range is from -20 to 20.
  3897. @item sclevel
  3898. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3899. @item phase
  3900. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3901. @item bmode_in, bmode_out
  3902. Set balance mode for balance_in/balance_out option.
  3903. Can be one of the following:
  3904. @table @samp
  3905. @item balance
  3906. Classic balance mode. Attenuate one channel at time.
  3907. Gain is raised up to 1.
  3908. @item amplitude
  3909. Similar as classic mode above but gain is raised up to 2.
  3910. @item power
  3911. Equal power distribution, from -6dB to +6dB range.
  3912. @end table
  3913. @end table
  3914. @subsection Examples
  3915. @itemize
  3916. @item
  3917. Apply karaoke like effect:
  3918. @example
  3919. stereotools=mlev=0.015625
  3920. @end example
  3921. @item
  3922. Convert M/S signal to L/R:
  3923. @example
  3924. "stereotools=mode=ms>lr"
  3925. @end example
  3926. @end itemize
  3927. @section stereowiden
  3928. This filter enhance the stereo effect by suppressing signal common to both
  3929. channels and by delaying the signal of left into right and vice versa,
  3930. thereby widening the stereo effect.
  3931. The filter accepts the following options:
  3932. @table @option
  3933. @item delay
  3934. Time in milliseconds of the delay of left signal into right and vice versa.
  3935. Default is 20 milliseconds.
  3936. @item feedback
  3937. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3938. effect of left signal in right output and vice versa which gives widening
  3939. effect. Default is 0.3.
  3940. @item crossfeed
  3941. Cross feed of left into right with inverted phase. This helps in suppressing
  3942. the mono. If the value is 1 it will cancel all the signal common to both
  3943. channels. Default is 0.3.
  3944. @item drymix
  3945. Set level of input signal of original channel. Default is 0.8.
  3946. @end table
  3947. @section superequalizer
  3948. Apply 18 band equalizer.
  3949. The filter accepts the following options:
  3950. @table @option
  3951. @item 1b
  3952. Set 65Hz band gain.
  3953. @item 2b
  3954. Set 92Hz band gain.
  3955. @item 3b
  3956. Set 131Hz band gain.
  3957. @item 4b
  3958. Set 185Hz band gain.
  3959. @item 5b
  3960. Set 262Hz band gain.
  3961. @item 6b
  3962. Set 370Hz band gain.
  3963. @item 7b
  3964. Set 523Hz band gain.
  3965. @item 8b
  3966. Set 740Hz band gain.
  3967. @item 9b
  3968. Set 1047Hz band gain.
  3969. @item 10b
  3970. Set 1480Hz band gain.
  3971. @item 11b
  3972. Set 2093Hz band gain.
  3973. @item 12b
  3974. Set 2960Hz band gain.
  3975. @item 13b
  3976. Set 4186Hz band gain.
  3977. @item 14b
  3978. Set 5920Hz band gain.
  3979. @item 15b
  3980. Set 8372Hz band gain.
  3981. @item 16b
  3982. Set 11840Hz band gain.
  3983. @item 17b
  3984. Set 16744Hz band gain.
  3985. @item 18b
  3986. Set 20000Hz band gain.
  3987. @end table
  3988. @section surround
  3989. Apply audio surround upmix filter.
  3990. This filter allows to produce multichannel output from audio stream.
  3991. The filter accepts the following options:
  3992. @table @option
  3993. @item chl_out
  3994. Set output channel layout. By default, this is @var{5.1}.
  3995. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3996. for the required syntax.
  3997. @item chl_in
  3998. Set input channel layout. By default, this is @var{stereo}.
  3999. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4000. for the required syntax.
  4001. @item level_in
  4002. Set input volume level. By default, this is @var{1}.
  4003. @item level_out
  4004. Set output volume level. By default, this is @var{1}.
  4005. @item lfe
  4006. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4007. @item lfe_low
  4008. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4009. @item lfe_high
  4010. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4011. @item lfe_mode
  4012. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4013. In @var{add} mode, LFE channel is created from input audio and added to output.
  4014. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4015. also all non-LFE output channels are subtracted with output LFE channel.
  4016. @item angle
  4017. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4018. Default is @var{90}.
  4019. @item fc_in
  4020. Set front center input volume. By default, this is @var{1}.
  4021. @item fc_out
  4022. Set front center output volume. By default, this is @var{1}.
  4023. @item fl_in
  4024. Set front left input volume. By default, this is @var{1}.
  4025. @item fl_out
  4026. Set front left output volume. By default, this is @var{1}.
  4027. @item fr_in
  4028. Set front right input volume. By default, this is @var{1}.
  4029. @item fr_out
  4030. Set front right output volume. By default, this is @var{1}.
  4031. @item sl_in
  4032. Set side left input volume. By default, this is @var{1}.
  4033. @item sl_out
  4034. Set side left output volume. By default, this is @var{1}.
  4035. @item sr_in
  4036. Set side right input volume. By default, this is @var{1}.
  4037. @item sr_out
  4038. Set side right output volume. By default, this is @var{1}.
  4039. @item bl_in
  4040. Set back left input volume. By default, this is @var{1}.
  4041. @item bl_out
  4042. Set back left output volume. By default, this is @var{1}.
  4043. @item br_in
  4044. Set back right input volume. By default, this is @var{1}.
  4045. @item br_out
  4046. Set back right output volume. By default, this is @var{1}.
  4047. @item bc_in
  4048. Set back center input volume. By default, this is @var{1}.
  4049. @item bc_out
  4050. Set back center output volume. By default, this is @var{1}.
  4051. @item lfe_in
  4052. Set LFE input volume. By default, this is @var{1}.
  4053. @item lfe_out
  4054. Set LFE output volume. By default, this is @var{1}.
  4055. @item allx
  4056. Set spread usage of stereo image across X axis for all channels.
  4057. @item ally
  4058. Set spread usage of stereo image across Y axis for all channels.
  4059. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4060. Set spread usage of stereo image across X axis for each channel.
  4061. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4062. Set spread usage of stereo image across Y axis for each channel.
  4063. @item win_size
  4064. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4065. @item win_func
  4066. Set window function.
  4067. It accepts the following values:
  4068. @table @samp
  4069. @item rect
  4070. @item bartlett
  4071. @item hann, hanning
  4072. @item hamming
  4073. @item blackman
  4074. @item welch
  4075. @item flattop
  4076. @item bharris
  4077. @item bnuttall
  4078. @item bhann
  4079. @item sine
  4080. @item nuttall
  4081. @item lanczos
  4082. @item gauss
  4083. @item tukey
  4084. @item dolph
  4085. @item cauchy
  4086. @item parzen
  4087. @item poisson
  4088. @item bohman
  4089. @end table
  4090. Default is @code{hann}.
  4091. @item overlap
  4092. Set window overlap. If set to 1, the recommended overlap for selected
  4093. window function will be picked. Default is @code{0.5}.
  4094. @end table
  4095. @section treble, highshelf
  4096. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4097. shelving filter with a response similar to that of a standard
  4098. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4099. The filter accepts the following options:
  4100. @table @option
  4101. @item gain, g
  4102. Give the gain at whichever is the lower of ~22 kHz and the
  4103. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4104. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4105. @item frequency, f
  4106. Set the filter's central frequency and so can be used
  4107. to extend or reduce the frequency range to be boosted or cut.
  4108. The default value is @code{3000} Hz.
  4109. @item width_type, t
  4110. Set method to specify band-width of filter.
  4111. @table @option
  4112. @item h
  4113. Hz
  4114. @item q
  4115. Q-Factor
  4116. @item o
  4117. octave
  4118. @item s
  4119. slope
  4120. @item k
  4121. kHz
  4122. @end table
  4123. @item width, w
  4124. Determine how steep is the filter's shelf transition.
  4125. @item mix, m
  4126. How much to use filtered signal in output. Default is 1.
  4127. Range is between 0 and 1.
  4128. @item channels, c
  4129. Specify which channels to filter, by default all available are filtered.
  4130. @end table
  4131. @subsection Commands
  4132. This filter supports the following commands:
  4133. @table @option
  4134. @item frequency, f
  4135. Change treble frequency.
  4136. Syntax for the command is : "@var{frequency}"
  4137. @item width_type, t
  4138. Change treble width_type.
  4139. Syntax for the command is : "@var{width_type}"
  4140. @item width, w
  4141. Change treble width.
  4142. Syntax for the command is : "@var{width}"
  4143. @item gain, g
  4144. Change treble gain.
  4145. Syntax for the command is : "@var{gain}"
  4146. @item mix, m
  4147. Change treble mix.
  4148. Syntax for the command is : "@var{mix}"
  4149. @end table
  4150. @section tremolo
  4151. Sinusoidal amplitude modulation.
  4152. The filter accepts the following options:
  4153. @table @option
  4154. @item f
  4155. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4156. (20 Hz or lower) will result in a tremolo effect.
  4157. This filter may also be used as a ring modulator by specifying
  4158. a modulation frequency higher than 20 Hz.
  4159. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4160. @item d
  4161. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4162. Default value is 0.5.
  4163. @end table
  4164. @section vibrato
  4165. Sinusoidal phase modulation.
  4166. The filter accepts the following options:
  4167. @table @option
  4168. @item f
  4169. Modulation frequency in Hertz.
  4170. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4171. @item d
  4172. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4173. Default value is 0.5.
  4174. @end table
  4175. @section volume
  4176. Adjust the input audio volume.
  4177. It accepts the following parameters:
  4178. @table @option
  4179. @item volume
  4180. Set audio volume expression.
  4181. Output values are clipped to the maximum value.
  4182. The output audio volume is given by the relation:
  4183. @example
  4184. @var{output_volume} = @var{volume} * @var{input_volume}
  4185. @end example
  4186. The default value for @var{volume} is "1.0".
  4187. @item precision
  4188. This parameter represents the mathematical precision.
  4189. It determines which input sample formats will be allowed, which affects the
  4190. precision of the volume scaling.
  4191. @table @option
  4192. @item fixed
  4193. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4194. @item float
  4195. 32-bit floating-point; this limits input sample format to FLT. (default)
  4196. @item double
  4197. 64-bit floating-point; this limits input sample format to DBL.
  4198. @end table
  4199. @item replaygain
  4200. Choose the behaviour on encountering ReplayGain side data in input frames.
  4201. @table @option
  4202. @item drop
  4203. Remove ReplayGain side data, ignoring its contents (the default).
  4204. @item ignore
  4205. Ignore ReplayGain side data, but leave it in the frame.
  4206. @item track
  4207. Prefer the track gain, if present.
  4208. @item album
  4209. Prefer the album gain, if present.
  4210. @end table
  4211. @item replaygain_preamp
  4212. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4213. Default value for @var{replaygain_preamp} is 0.0.
  4214. @item eval
  4215. Set when the volume expression is evaluated.
  4216. It accepts the following values:
  4217. @table @samp
  4218. @item once
  4219. only evaluate expression once during the filter initialization, or
  4220. when the @samp{volume} command is sent
  4221. @item frame
  4222. evaluate expression for each incoming frame
  4223. @end table
  4224. Default value is @samp{once}.
  4225. @end table
  4226. The volume expression can contain the following parameters.
  4227. @table @option
  4228. @item n
  4229. frame number (starting at zero)
  4230. @item nb_channels
  4231. number of channels
  4232. @item nb_consumed_samples
  4233. number of samples consumed by the filter
  4234. @item nb_samples
  4235. number of samples in the current frame
  4236. @item pos
  4237. original frame position in the file
  4238. @item pts
  4239. frame PTS
  4240. @item sample_rate
  4241. sample rate
  4242. @item startpts
  4243. PTS at start of stream
  4244. @item startt
  4245. time at start of stream
  4246. @item t
  4247. frame time
  4248. @item tb
  4249. timestamp timebase
  4250. @item volume
  4251. last set volume value
  4252. @end table
  4253. Note that when @option{eval} is set to @samp{once} only the
  4254. @var{sample_rate} and @var{tb} variables are available, all other
  4255. variables will evaluate to NAN.
  4256. @subsection Commands
  4257. This filter supports the following commands:
  4258. @table @option
  4259. @item volume
  4260. Modify the volume expression.
  4261. The command accepts the same syntax of the corresponding option.
  4262. If the specified expression is not valid, it is kept at its current
  4263. value.
  4264. @item replaygain_noclip
  4265. Prevent clipping by limiting the gain applied.
  4266. Default value for @var{replaygain_noclip} is 1.
  4267. @end table
  4268. @subsection Examples
  4269. @itemize
  4270. @item
  4271. Halve the input audio volume:
  4272. @example
  4273. volume=volume=0.5
  4274. volume=volume=1/2
  4275. volume=volume=-6.0206dB
  4276. @end example
  4277. In all the above example the named key for @option{volume} can be
  4278. omitted, for example like in:
  4279. @example
  4280. volume=0.5
  4281. @end example
  4282. @item
  4283. Increase input audio power by 6 decibels using fixed-point precision:
  4284. @example
  4285. volume=volume=6dB:precision=fixed
  4286. @end example
  4287. @item
  4288. Fade volume after time 10 with an annihilation period of 5 seconds:
  4289. @example
  4290. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4291. @end example
  4292. @end itemize
  4293. @section volumedetect
  4294. Detect the volume of the input video.
  4295. The filter has no parameters. The input is not modified. Statistics about
  4296. the volume will be printed in the log when the input stream end is reached.
  4297. In particular it will show the mean volume (root mean square), maximum
  4298. volume (on a per-sample basis), and the beginning of a histogram of the
  4299. registered volume values (from the maximum value to a cumulated 1/1000 of
  4300. the samples).
  4301. All volumes are in decibels relative to the maximum PCM value.
  4302. @subsection Examples
  4303. Here is an excerpt of the output:
  4304. @example
  4305. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4306. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4307. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4308. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4309. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4310. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4311. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4312. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4313. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4314. @end example
  4315. It means that:
  4316. @itemize
  4317. @item
  4318. The mean square energy is approximately -27 dB, or 10^-2.7.
  4319. @item
  4320. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4321. @item
  4322. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4323. @end itemize
  4324. In other words, raising the volume by +4 dB does not cause any clipping,
  4325. raising it by +5 dB causes clipping for 6 samples, etc.
  4326. @c man end AUDIO FILTERS
  4327. @chapter Audio Sources
  4328. @c man begin AUDIO SOURCES
  4329. Below is a description of the currently available audio sources.
  4330. @section abuffer
  4331. Buffer audio frames, and make them available to the filter chain.
  4332. This source is mainly intended for a programmatic use, in particular
  4333. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4334. It accepts the following parameters:
  4335. @table @option
  4336. @item time_base
  4337. The timebase which will be used for timestamps of submitted frames. It must be
  4338. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4339. @item sample_rate
  4340. The sample rate of the incoming audio buffers.
  4341. @item sample_fmt
  4342. The sample format of the incoming audio buffers.
  4343. Either a sample format name or its corresponding integer representation from
  4344. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4345. @item channel_layout
  4346. The channel layout of the incoming audio buffers.
  4347. Either a channel layout name from channel_layout_map in
  4348. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4349. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4350. @item channels
  4351. The number of channels of the incoming audio buffers.
  4352. If both @var{channels} and @var{channel_layout} are specified, then they
  4353. must be consistent.
  4354. @end table
  4355. @subsection Examples
  4356. @example
  4357. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4358. @end example
  4359. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4360. Since the sample format with name "s16p" corresponds to the number
  4361. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4362. equivalent to:
  4363. @example
  4364. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4365. @end example
  4366. @section aevalsrc
  4367. Generate an audio signal specified by an expression.
  4368. This source accepts in input one or more expressions (one for each
  4369. channel), which are evaluated and used to generate a corresponding
  4370. audio signal.
  4371. This source accepts the following options:
  4372. @table @option
  4373. @item exprs
  4374. Set the '|'-separated expressions list for each separate channel. In case the
  4375. @option{channel_layout} option is not specified, the selected channel layout
  4376. depends on the number of provided expressions. Otherwise the last
  4377. specified expression is applied to the remaining output channels.
  4378. @item channel_layout, c
  4379. Set the channel layout. The number of channels in the specified layout
  4380. must be equal to the number of specified expressions.
  4381. @item duration, d
  4382. Set the minimum duration of the sourced audio. See
  4383. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4384. for the accepted syntax.
  4385. Note that the resulting duration may be greater than the specified
  4386. duration, as the generated audio is always cut at the end of a
  4387. complete frame.
  4388. If not specified, or the expressed duration is negative, the audio is
  4389. supposed to be generated forever.
  4390. @item nb_samples, n
  4391. Set the number of samples per channel per each output frame,
  4392. default to 1024.
  4393. @item sample_rate, s
  4394. Specify the sample rate, default to 44100.
  4395. @end table
  4396. Each expression in @var{exprs} can contain the following constants:
  4397. @table @option
  4398. @item n
  4399. number of the evaluated sample, starting from 0
  4400. @item t
  4401. time of the evaluated sample expressed in seconds, starting from 0
  4402. @item s
  4403. sample rate
  4404. @end table
  4405. @subsection Examples
  4406. @itemize
  4407. @item
  4408. Generate silence:
  4409. @example
  4410. aevalsrc=0
  4411. @end example
  4412. @item
  4413. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4414. 8000 Hz:
  4415. @example
  4416. aevalsrc="sin(440*2*PI*t):s=8000"
  4417. @end example
  4418. @item
  4419. Generate a two channels signal, specify the channel layout (Front
  4420. Center + Back Center) explicitly:
  4421. @example
  4422. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4423. @end example
  4424. @item
  4425. Generate white noise:
  4426. @example
  4427. aevalsrc="-2+random(0)"
  4428. @end example
  4429. @item
  4430. Generate an amplitude modulated signal:
  4431. @example
  4432. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4433. @end example
  4434. @item
  4435. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4436. @example
  4437. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4438. @end example
  4439. @end itemize
  4440. @section anullsrc
  4441. The null audio source, return unprocessed audio frames. It is mainly useful
  4442. as a template and to be employed in analysis / debugging tools, or as
  4443. the source for filters which ignore the input data (for example the sox
  4444. synth filter).
  4445. This source accepts the following options:
  4446. @table @option
  4447. @item channel_layout, cl
  4448. Specifies the channel layout, and can be either an integer or a string
  4449. representing a channel layout. The default value of @var{channel_layout}
  4450. is "stereo".
  4451. Check the channel_layout_map definition in
  4452. @file{libavutil/channel_layout.c} for the mapping between strings and
  4453. channel layout values.
  4454. @item sample_rate, r
  4455. Specifies the sample rate, and defaults to 44100.
  4456. @item nb_samples, n
  4457. Set the number of samples per requested frames.
  4458. @end table
  4459. @subsection Examples
  4460. @itemize
  4461. @item
  4462. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4463. @example
  4464. anullsrc=r=48000:cl=4
  4465. @end example
  4466. @item
  4467. Do the same operation with a more obvious syntax:
  4468. @example
  4469. anullsrc=r=48000:cl=mono
  4470. @end example
  4471. @end itemize
  4472. All the parameters need to be explicitly defined.
  4473. @section flite
  4474. Synthesize a voice utterance using the libflite library.
  4475. To enable compilation of this filter you need to configure FFmpeg with
  4476. @code{--enable-libflite}.
  4477. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4478. The filter accepts the following options:
  4479. @table @option
  4480. @item list_voices
  4481. If set to 1, list the names of the available voices and exit
  4482. immediately. Default value is 0.
  4483. @item nb_samples, n
  4484. Set the maximum number of samples per frame. Default value is 512.
  4485. @item textfile
  4486. Set the filename containing the text to speak.
  4487. @item text
  4488. Set the text to speak.
  4489. @item voice, v
  4490. Set the voice to use for the speech synthesis. Default value is
  4491. @code{kal}. See also the @var{list_voices} option.
  4492. @end table
  4493. @subsection Examples
  4494. @itemize
  4495. @item
  4496. Read from file @file{speech.txt}, and synthesize the text using the
  4497. standard flite voice:
  4498. @example
  4499. flite=textfile=speech.txt
  4500. @end example
  4501. @item
  4502. Read the specified text selecting the @code{slt} voice:
  4503. @example
  4504. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4505. @end example
  4506. @item
  4507. Input text to ffmpeg:
  4508. @example
  4509. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4510. @end example
  4511. @item
  4512. Make @file{ffplay} speak the specified text, using @code{flite} and
  4513. the @code{lavfi} device:
  4514. @example
  4515. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4516. @end example
  4517. @end itemize
  4518. For more information about libflite, check:
  4519. @url{http://www.festvox.org/flite/}
  4520. @section anoisesrc
  4521. Generate a noise audio signal.
  4522. The filter accepts the following options:
  4523. @table @option
  4524. @item sample_rate, r
  4525. Specify the sample rate. Default value is 48000 Hz.
  4526. @item amplitude, a
  4527. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4528. is 1.0.
  4529. @item duration, d
  4530. Specify the duration of the generated audio stream. Not specifying this option
  4531. results in noise with an infinite length.
  4532. @item color, colour, c
  4533. Specify the color of noise. Available noise colors are white, pink, brown,
  4534. blue and violet. Default color is white.
  4535. @item seed, s
  4536. Specify a value used to seed the PRNG.
  4537. @item nb_samples, n
  4538. Set the number of samples per each output frame, default is 1024.
  4539. @end table
  4540. @subsection Examples
  4541. @itemize
  4542. @item
  4543. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4544. @example
  4545. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4546. @end example
  4547. @end itemize
  4548. @section hilbert
  4549. Generate odd-tap Hilbert transform FIR coefficients.
  4550. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4551. the signal by 90 degrees.
  4552. This is used in many matrix coding schemes and for analytic signal generation.
  4553. The process is often written as a multiplication by i (or j), the imaginary unit.
  4554. The filter accepts the following options:
  4555. @table @option
  4556. @item sample_rate, s
  4557. Set sample rate, default is 44100.
  4558. @item taps, t
  4559. Set length of FIR filter, default is 22051.
  4560. @item nb_samples, n
  4561. Set number of samples per each frame.
  4562. @item win_func, w
  4563. Set window function to be used when generating FIR coefficients.
  4564. @end table
  4565. @section sinc
  4566. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4567. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4568. The filter accepts the following options:
  4569. @table @option
  4570. @item sample_rate, r
  4571. Set sample rate, default is 44100.
  4572. @item nb_samples, n
  4573. Set number of samples per each frame. Default is 1024.
  4574. @item hp
  4575. Set high-pass frequency. Default is 0.
  4576. @item lp
  4577. Set low-pass frequency. Default is 0.
  4578. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4579. is higher than 0 then filter will create band-pass filter coefficients,
  4580. otherwise band-reject filter coefficients.
  4581. @item phase
  4582. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4583. @item beta
  4584. Set Kaiser window beta.
  4585. @item att
  4586. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4587. @item round
  4588. Enable rounding, by default is disabled.
  4589. @item hptaps
  4590. Set number of taps for high-pass filter.
  4591. @item lptaps
  4592. Set number of taps for low-pass filter.
  4593. @end table
  4594. @section sine
  4595. Generate an audio signal made of a sine wave with amplitude 1/8.
  4596. The audio signal is bit-exact.
  4597. The filter accepts the following options:
  4598. @table @option
  4599. @item frequency, f
  4600. Set the carrier frequency. Default is 440 Hz.
  4601. @item beep_factor, b
  4602. Enable a periodic beep every second with frequency @var{beep_factor} times
  4603. the carrier frequency. Default is 0, meaning the beep is disabled.
  4604. @item sample_rate, r
  4605. Specify the sample rate, default is 44100.
  4606. @item duration, d
  4607. Specify the duration of the generated audio stream.
  4608. @item samples_per_frame
  4609. Set the number of samples per output frame.
  4610. The expression can contain the following constants:
  4611. @table @option
  4612. @item n
  4613. The (sequential) number of the output audio frame, starting from 0.
  4614. @item pts
  4615. The PTS (Presentation TimeStamp) of the output audio frame,
  4616. expressed in @var{TB} units.
  4617. @item t
  4618. The PTS of the output audio frame, expressed in seconds.
  4619. @item TB
  4620. The timebase of the output audio frames.
  4621. @end table
  4622. Default is @code{1024}.
  4623. @end table
  4624. @subsection Examples
  4625. @itemize
  4626. @item
  4627. Generate a simple 440 Hz sine wave:
  4628. @example
  4629. sine
  4630. @end example
  4631. @item
  4632. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4633. @example
  4634. sine=220:4:d=5
  4635. sine=f=220:b=4:d=5
  4636. sine=frequency=220:beep_factor=4:duration=5
  4637. @end example
  4638. @item
  4639. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4640. pattern:
  4641. @example
  4642. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4643. @end example
  4644. @end itemize
  4645. @c man end AUDIO SOURCES
  4646. @chapter Audio Sinks
  4647. @c man begin AUDIO SINKS
  4648. Below is a description of the currently available audio sinks.
  4649. @section abuffersink
  4650. Buffer audio frames, and make them available to the end of filter chain.
  4651. This sink is mainly intended for programmatic use, in particular
  4652. through the interface defined in @file{libavfilter/buffersink.h}
  4653. or the options system.
  4654. It accepts a pointer to an AVABufferSinkContext structure, which
  4655. defines the incoming buffers' formats, to be passed as the opaque
  4656. parameter to @code{avfilter_init_filter} for initialization.
  4657. @section anullsink
  4658. Null audio sink; do absolutely nothing with the input audio. It is
  4659. mainly useful as a template and for use in analysis / debugging
  4660. tools.
  4661. @c man end AUDIO SINKS
  4662. @chapter Video Filters
  4663. @c man begin VIDEO FILTERS
  4664. When you configure your FFmpeg build, you can disable any of the
  4665. existing filters using @code{--disable-filters}.
  4666. The configure output will show the video filters included in your
  4667. build.
  4668. Below is a description of the currently available video filters.
  4669. @section addroi
  4670. Mark a region of interest in a video frame.
  4671. The frame data is passed through unchanged, but metadata is attached
  4672. to the frame indicating regions of interest which can affect the
  4673. behaviour of later encoding. Multiple regions can be marked by
  4674. applying the filter multiple times.
  4675. @table @option
  4676. @item x
  4677. Region distance in pixels from the left edge of the frame.
  4678. @item y
  4679. Region distance in pixels from the top edge of the frame.
  4680. @item w
  4681. Region width in pixels.
  4682. @item h
  4683. Region height in pixels.
  4684. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4685. and may contain the following variables:
  4686. @table @option
  4687. @item iw
  4688. Width of the input frame.
  4689. @item ih
  4690. Height of the input frame.
  4691. @end table
  4692. @item qoffset
  4693. Quantisation offset to apply within the region.
  4694. This must be a real value in the range -1 to +1. A value of zero
  4695. indicates no quality change. A negative value asks for better quality
  4696. (less quantisation), while a positive value asks for worse quality
  4697. (greater quantisation).
  4698. The range is calibrated so that the extreme values indicate the
  4699. largest possible offset - if the rest of the frame is encoded with the
  4700. worst possible quality, an offset of -1 indicates that this region
  4701. should be encoded with the best possible quality anyway. Intermediate
  4702. values are then interpolated in some codec-dependent way.
  4703. For example, in 10-bit H.264 the quantisation parameter varies between
  4704. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4705. this region should be encoded with a QP around one-tenth of the full
  4706. range better than the rest of the frame. So, if most of the frame
  4707. were to be encoded with a QP of around 30, this region would get a QP
  4708. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4709. An extreme value of -1 would indicate that this region should be
  4710. encoded with the best possible quality regardless of the treatment of
  4711. the rest of the frame - that is, should be encoded at a QP of -12.
  4712. @item clear
  4713. If set to true, remove any existing regions of interest marked on the
  4714. frame before adding the new one.
  4715. @end table
  4716. @subsection Examples
  4717. @itemize
  4718. @item
  4719. Mark the centre quarter of the frame as interesting.
  4720. @example
  4721. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4722. @end example
  4723. @item
  4724. Mark the 100-pixel-wide region on the left edge of the frame as very
  4725. uninteresting (to be encoded at much lower quality than the rest of
  4726. the frame).
  4727. @example
  4728. addroi=0:0:100:ih:+1/5
  4729. @end example
  4730. @end itemize
  4731. @section alphaextract
  4732. Extract the alpha component from the input as a grayscale video. This
  4733. is especially useful with the @var{alphamerge} filter.
  4734. @section alphamerge
  4735. Add or replace the alpha component of the primary input with the
  4736. grayscale value of a second input. This is intended for use with
  4737. @var{alphaextract} to allow the transmission or storage of frame
  4738. sequences that have alpha in a format that doesn't support an alpha
  4739. channel.
  4740. For example, to reconstruct full frames from a normal YUV-encoded video
  4741. and a separate video created with @var{alphaextract}, you might use:
  4742. @example
  4743. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4744. @end example
  4745. Since this filter is designed for reconstruction, it operates on frame
  4746. sequences without considering timestamps, and terminates when either
  4747. input reaches end of stream. This will cause problems if your encoding
  4748. pipeline drops frames. If you're trying to apply an image as an
  4749. overlay to a video stream, consider the @var{overlay} filter instead.
  4750. @section amplify
  4751. Amplify differences between current pixel and pixels of adjacent frames in
  4752. same pixel location.
  4753. This filter accepts the following options:
  4754. @table @option
  4755. @item radius
  4756. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4757. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4758. @item factor
  4759. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4760. @item threshold
  4761. Set threshold for difference amplification. Any difference greater or equal to
  4762. this value will not alter source pixel. Default is 10.
  4763. Allowed range is from 0 to 65535.
  4764. @item tolerance
  4765. Set tolerance for difference amplification. Any difference lower to
  4766. this value will not alter source pixel. Default is 0.
  4767. Allowed range is from 0 to 65535.
  4768. @item low
  4769. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4770. This option controls maximum possible value that will decrease source pixel value.
  4771. @item high
  4772. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4773. This option controls maximum possible value that will increase source pixel value.
  4774. @item planes
  4775. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4776. @end table
  4777. @section ass
  4778. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4779. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4780. Substation Alpha) subtitles files.
  4781. This filter accepts the following option in addition to the common options from
  4782. the @ref{subtitles} filter:
  4783. @table @option
  4784. @item shaping
  4785. Set the shaping engine
  4786. Available values are:
  4787. @table @samp
  4788. @item auto
  4789. The default libass shaping engine, which is the best available.
  4790. @item simple
  4791. Fast, font-agnostic shaper that can do only substitutions
  4792. @item complex
  4793. Slower shaper using OpenType for substitutions and positioning
  4794. @end table
  4795. The default is @code{auto}.
  4796. @end table
  4797. @section atadenoise
  4798. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4799. The filter accepts the following options:
  4800. @table @option
  4801. @item 0a
  4802. Set threshold A for 1st plane. Default is 0.02.
  4803. Valid range is 0 to 0.3.
  4804. @item 0b
  4805. Set threshold B for 1st plane. Default is 0.04.
  4806. Valid range is 0 to 5.
  4807. @item 1a
  4808. Set threshold A for 2nd plane. Default is 0.02.
  4809. Valid range is 0 to 0.3.
  4810. @item 1b
  4811. Set threshold B for 2nd plane. Default is 0.04.
  4812. Valid range is 0 to 5.
  4813. @item 2a
  4814. Set threshold A for 3rd plane. Default is 0.02.
  4815. Valid range is 0 to 0.3.
  4816. @item 2b
  4817. Set threshold B for 3rd plane. Default is 0.04.
  4818. Valid range is 0 to 5.
  4819. Threshold A is designed to react on abrupt changes in the input signal and
  4820. threshold B is designed to react on continuous changes in the input signal.
  4821. @item s
  4822. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4823. number in range [5, 129].
  4824. @item p
  4825. Set what planes of frame filter will use for averaging. Default is all.
  4826. @end table
  4827. @section avgblur
  4828. Apply average blur filter.
  4829. The filter accepts the following options:
  4830. @table @option
  4831. @item sizeX
  4832. Set horizontal radius size.
  4833. @item planes
  4834. Set which planes to filter. By default all planes are filtered.
  4835. @item sizeY
  4836. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4837. Default is @code{0}.
  4838. @end table
  4839. @subsection Commands
  4840. This filter supports same commands as options.
  4841. The command accepts the same syntax of the corresponding option.
  4842. If the specified expression is not valid, it is kept at its current
  4843. value.
  4844. @section bbox
  4845. Compute the bounding box for the non-black pixels in the input frame
  4846. luminance plane.
  4847. This filter computes the bounding box containing all the pixels with a
  4848. luminance value greater than the minimum allowed value.
  4849. The parameters describing the bounding box are printed on the filter
  4850. log.
  4851. The filter accepts the following option:
  4852. @table @option
  4853. @item min_val
  4854. Set the minimal luminance value. Default is @code{16}.
  4855. @end table
  4856. @section bitplanenoise
  4857. Show and measure bit plane noise.
  4858. The filter accepts the following options:
  4859. @table @option
  4860. @item bitplane
  4861. Set which plane to analyze. Default is @code{1}.
  4862. @item filter
  4863. Filter out noisy pixels from @code{bitplane} set above.
  4864. Default is disabled.
  4865. @end table
  4866. @section blackdetect
  4867. Detect video intervals that are (almost) completely black. Can be
  4868. useful to detect chapter transitions, commercials, or invalid
  4869. recordings. Output lines contains the time for the start, end and
  4870. duration of the detected black interval expressed in seconds.
  4871. In order to display the output lines, you need to set the loglevel at
  4872. least to the AV_LOG_INFO value.
  4873. The filter accepts the following options:
  4874. @table @option
  4875. @item black_min_duration, d
  4876. Set the minimum detected black duration expressed in seconds. It must
  4877. be a non-negative floating point number.
  4878. Default value is 2.0.
  4879. @item picture_black_ratio_th, pic_th
  4880. Set the threshold for considering a picture "black".
  4881. Express the minimum value for the ratio:
  4882. @example
  4883. @var{nb_black_pixels} / @var{nb_pixels}
  4884. @end example
  4885. for which a picture is considered black.
  4886. Default value is 0.98.
  4887. @item pixel_black_th, pix_th
  4888. Set the threshold for considering a pixel "black".
  4889. The threshold expresses the maximum pixel luminance value for which a
  4890. pixel is considered "black". The provided value is scaled according to
  4891. the following equation:
  4892. @example
  4893. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4894. @end example
  4895. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4896. the input video format, the range is [0-255] for YUV full-range
  4897. formats and [16-235] for YUV non full-range formats.
  4898. Default value is 0.10.
  4899. @end table
  4900. The following example sets the maximum pixel threshold to the minimum
  4901. value, and detects only black intervals of 2 or more seconds:
  4902. @example
  4903. blackdetect=d=2:pix_th=0.00
  4904. @end example
  4905. @section blackframe
  4906. Detect frames that are (almost) completely black. Can be useful to
  4907. detect chapter transitions or commercials. Output lines consist of
  4908. the frame number of the detected frame, the percentage of blackness,
  4909. the position in the file if known or -1 and the timestamp in seconds.
  4910. In order to display the output lines, you need to set the loglevel at
  4911. least to the AV_LOG_INFO value.
  4912. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4913. The value represents the percentage of pixels in the picture that
  4914. are below the threshold value.
  4915. It accepts the following parameters:
  4916. @table @option
  4917. @item amount
  4918. The percentage of the pixels that have to be below the threshold; it defaults to
  4919. @code{98}.
  4920. @item threshold, thresh
  4921. The threshold below which a pixel value is considered black; it defaults to
  4922. @code{32}.
  4923. @end table
  4924. @section blend, tblend
  4925. Blend two video frames into each other.
  4926. The @code{blend} filter takes two input streams and outputs one
  4927. stream, the first input is the "top" layer and second input is
  4928. "bottom" layer. By default, the output terminates when the longest input terminates.
  4929. The @code{tblend} (time blend) filter takes two consecutive frames
  4930. from one single stream, and outputs the result obtained by blending
  4931. the new frame on top of the old frame.
  4932. A description of the accepted options follows.
  4933. @table @option
  4934. @item c0_mode
  4935. @item c1_mode
  4936. @item c2_mode
  4937. @item c3_mode
  4938. @item all_mode
  4939. Set blend mode for specific pixel component or all pixel components in case
  4940. of @var{all_mode}. Default value is @code{normal}.
  4941. Available values for component modes are:
  4942. @table @samp
  4943. @item addition
  4944. @item grainmerge
  4945. @item and
  4946. @item average
  4947. @item burn
  4948. @item darken
  4949. @item difference
  4950. @item grainextract
  4951. @item divide
  4952. @item dodge
  4953. @item freeze
  4954. @item exclusion
  4955. @item extremity
  4956. @item glow
  4957. @item hardlight
  4958. @item hardmix
  4959. @item heat
  4960. @item lighten
  4961. @item linearlight
  4962. @item multiply
  4963. @item multiply128
  4964. @item negation
  4965. @item normal
  4966. @item or
  4967. @item overlay
  4968. @item phoenix
  4969. @item pinlight
  4970. @item reflect
  4971. @item screen
  4972. @item softlight
  4973. @item subtract
  4974. @item vividlight
  4975. @item xor
  4976. @end table
  4977. @item c0_opacity
  4978. @item c1_opacity
  4979. @item c2_opacity
  4980. @item c3_opacity
  4981. @item all_opacity
  4982. Set blend opacity for specific pixel component or all pixel components in case
  4983. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4984. @item c0_expr
  4985. @item c1_expr
  4986. @item c2_expr
  4987. @item c3_expr
  4988. @item all_expr
  4989. Set blend expression for specific pixel component or all pixel components in case
  4990. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4991. The expressions can use the following variables:
  4992. @table @option
  4993. @item N
  4994. The sequential number of the filtered frame, starting from @code{0}.
  4995. @item X
  4996. @item Y
  4997. the coordinates of the current sample
  4998. @item W
  4999. @item H
  5000. the width and height of currently filtered plane
  5001. @item SW
  5002. @item SH
  5003. Width and height scale for the plane being filtered. It is the
  5004. ratio between the dimensions of the current plane to the luma plane,
  5005. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  5006. the luma plane and @code{0.5,0.5} for the chroma planes.
  5007. @item T
  5008. Time of the current frame, expressed in seconds.
  5009. @item TOP, A
  5010. Value of pixel component at current location for first video frame (top layer).
  5011. @item BOTTOM, B
  5012. Value of pixel component at current location for second video frame (bottom layer).
  5013. @end table
  5014. @end table
  5015. The @code{blend} filter also supports the @ref{framesync} options.
  5016. @subsection Examples
  5017. @itemize
  5018. @item
  5019. Apply transition from bottom layer to top layer in first 10 seconds:
  5020. @example
  5021. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  5022. @end example
  5023. @item
  5024. Apply linear horizontal transition from top layer to bottom layer:
  5025. @example
  5026. blend=all_expr='A*(X/W)+B*(1-X/W)'
  5027. @end example
  5028. @item
  5029. Apply 1x1 checkerboard effect:
  5030. @example
  5031. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  5032. @end example
  5033. @item
  5034. Apply uncover left effect:
  5035. @example
  5036. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  5037. @end example
  5038. @item
  5039. Apply uncover down effect:
  5040. @example
  5041. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  5042. @end example
  5043. @item
  5044. Apply uncover up-left effect:
  5045. @example
  5046. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  5047. @end example
  5048. @item
  5049. Split diagonally video and shows top and bottom layer on each side:
  5050. @example
  5051. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  5052. @end example
  5053. @item
  5054. Display differences between the current and the previous frame:
  5055. @example
  5056. tblend=all_mode=grainextract
  5057. @end example
  5058. @end itemize
  5059. @section bm3d
  5060. Denoise frames using Block-Matching 3D algorithm.
  5061. The filter accepts the following options.
  5062. @table @option
  5063. @item sigma
  5064. Set denoising strength. Default value is 1.
  5065. Allowed range is from 0 to 999.9.
  5066. The denoising algorithm is very sensitive to sigma, so adjust it
  5067. according to the source.
  5068. @item block
  5069. Set local patch size. This sets dimensions in 2D.
  5070. @item bstep
  5071. Set sliding step for processing blocks. Default value is 4.
  5072. Allowed range is from 1 to 64.
  5073. Smaller values allows processing more reference blocks and is slower.
  5074. @item group
  5075. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  5076. When set to 1, no block matching is done. Larger values allows more blocks
  5077. in single group.
  5078. Allowed range is from 1 to 256.
  5079. @item range
  5080. Set radius for search block matching. Default is 9.
  5081. Allowed range is from 1 to INT32_MAX.
  5082. @item mstep
  5083. Set step between two search locations for block matching. Default is 1.
  5084. Allowed range is from 1 to 64. Smaller is slower.
  5085. @item thmse
  5086. Set threshold of mean square error for block matching. Valid range is 0 to
  5087. INT32_MAX.
  5088. @item hdthr
  5089. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5090. Larger values results in stronger hard-thresholding filtering in frequency
  5091. domain.
  5092. @item estim
  5093. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5094. Default is @code{basic}.
  5095. @item ref
  5096. If enabled, filter will use 2nd stream for block matching.
  5097. Default is disabled for @code{basic} value of @var{estim} option,
  5098. and always enabled if value of @var{estim} is @code{final}.
  5099. @item planes
  5100. Set planes to filter. Default is all available except alpha.
  5101. @end table
  5102. @subsection Examples
  5103. @itemize
  5104. @item
  5105. Basic filtering with bm3d:
  5106. @example
  5107. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5108. @end example
  5109. @item
  5110. Same as above, but filtering only luma:
  5111. @example
  5112. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5113. @end example
  5114. @item
  5115. Same as above, but with both estimation modes:
  5116. @example
  5117. 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
  5118. @end example
  5119. @item
  5120. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5121. @example
  5122. 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
  5123. @end example
  5124. @end itemize
  5125. @section boxblur
  5126. Apply a boxblur algorithm to the input video.
  5127. It accepts the following parameters:
  5128. @table @option
  5129. @item luma_radius, lr
  5130. @item luma_power, lp
  5131. @item chroma_radius, cr
  5132. @item chroma_power, cp
  5133. @item alpha_radius, ar
  5134. @item alpha_power, ap
  5135. @end table
  5136. A description of the accepted options follows.
  5137. @table @option
  5138. @item luma_radius, lr
  5139. @item chroma_radius, cr
  5140. @item alpha_radius, ar
  5141. Set an expression for the box radius in pixels used for blurring the
  5142. corresponding input plane.
  5143. The radius value must be a non-negative number, and must not be
  5144. greater than the value of the expression @code{min(w,h)/2} for the
  5145. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5146. planes.
  5147. Default value for @option{luma_radius} is "2". If not specified,
  5148. @option{chroma_radius} and @option{alpha_radius} default to the
  5149. corresponding value set for @option{luma_radius}.
  5150. The expressions can contain the following constants:
  5151. @table @option
  5152. @item w
  5153. @item h
  5154. The input width and height in pixels.
  5155. @item cw
  5156. @item ch
  5157. The input chroma image width and height in pixels.
  5158. @item hsub
  5159. @item vsub
  5160. The horizontal and vertical chroma subsample values. For example, for the
  5161. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5162. @end table
  5163. @item luma_power, lp
  5164. @item chroma_power, cp
  5165. @item alpha_power, ap
  5166. Specify how many times the boxblur filter is applied to the
  5167. corresponding plane.
  5168. Default value for @option{luma_power} is 2. If not specified,
  5169. @option{chroma_power} and @option{alpha_power} default to the
  5170. corresponding value set for @option{luma_power}.
  5171. A value of 0 will disable the effect.
  5172. @end table
  5173. @subsection Examples
  5174. @itemize
  5175. @item
  5176. Apply a boxblur filter with the luma, chroma, and alpha radii
  5177. set to 2:
  5178. @example
  5179. boxblur=luma_radius=2:luma_power=1
  5180. boxblur=2:1
  5181. @end example
  5182. @item
  5183. Set the luma radius to 2, and alpha and chroma radius to 0:
  5184. @example
  5185. boxblur=2:1:cr=0:ar=0
  5186. @end example
  5187. @item
  5188. Set the luma and chroma radii to a fraction of the video dimension:
  5189. @example
  5190. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5191. @end example
  5192. @end itemize
  5193. @section bwdif
  5194. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5195. Deinterlacing Filter").
  5196. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5197. interpolation algorithms.
  5198. It accepts the following parameters:
  5199. @table @option
  5200. @item mode
  5201. The interlacing mode to adopt. It accepts one of the following values:
  5202. @table @option
  5203. @item 0, send_frame
  5204. Output one frame for each frame.
  5205. @item 1, send_field
  5206. Output one frame for each field.
  5207. @end table
  5208. The default value is @code{send_field}.
  5209. @item parity
  5210. The picture field parity assumed for the input interlaced video. It accepts one
  5211. of the following values:
  5212. @table @option
  5213. @item 0, tff
  5214. Assume the top field is first.
  5215. @item 1, bff
  5216. Assume the bottom field is first.
  5217. @item -1, auto
  5218. Enable automatic detection of field parity.
  5219. @end table
  5220. The default value is @code{auto}.
  5221. If the interlacing is unknown or the decoder does not export this information,
  5222. top field first will be assumed.
  5223. @item deint
  5224. Specify which frames to deinterlace. Accepts one of the following
  5225. values:
  5226. @table @option
  5227. @item 0, all
  5228. Deinterlace all frames.
  5229. @item 1, interlaced
  5230. Only deinterlace frames marked as interlaced.
  5231. @end table
  5232. The default value is @code{all}.
  5233. @end table
  5234. @section chromahold
  5235. Remove all color information for all colors except for certain one.
  5236. The filter accepts the following options:
  5237. @table @option
  5238. @item color
  5239. The color which will not be replaced with neutral chroma.
  5240. @item similarity
  5241. Similarity percentage with the above color.
  5242. 0.01 matches only the exact key color, while 1.0 matches everything.
  5243. @item blend
  5244. Blend percentage.
  5245. 0.0 makes pixels either fully gray, or not gray at all.
  5246. Higher values result in more preserved color.
  5247. @item yuv
  5248. Signals that the color passed is already in YUV instead of RGB.
  5249. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5250. This can be used to pass exact YUV values as hexadecimal numbers.
  5251. @end table
  5252. @section chromakey
  5253. YUV colorspace color/chroma keying.
  5254. The filter accepts the following options:
  5255. @table @option
  5256. @item color
  5257. The color which will be replaced with transparency.
  5258. @item similarity
  5259. Similarity percentage with the key color.
  5260. 0.01 matches only the exact key color, while 1.0 matches everything.
  5261. @item blend
  5262. Blend percentage.
  5263. 0.0 makes pixels either fully transparent, or not transparent at all.
  5264. Higher values result in semi-transparent pixels, with a higher transparency
  5265. the more similar the pixels color is to the key color.
  5266. @item yuv
  5267. Signals that the color passed is already in YUV instead of RGB.
  5268. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5269. This can be used to pass exact YUV values as hexadecimal numbers.
  5270. @end table
  5271. @subsection Examples
  5272. @itemize
  5273. @item
  5274. Make every green pixel in the input image transparent:
  5275. @example
  5276. ffmpeg -i input.png -vf chromakey=green out.png
  5277. @end example
  5278. @item
  5279. Overlay a greenscreen-video on top of a static black background.
  5280. @example
  5281. 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
  5282. @end example
  5283. @end itemize
  5284. @section chromashift
  5285. Shift chroma pixels horizontally and/or vertically.
  5286. The filter accepts the following options:
  5287. @table @option
  5288. @item cbh
  5289. Set amount to shift chroma-blue horizontally.
  5290. @item cbv
  5291. Set amount to shift chroma-blue vertically.
  5292. @item crh
  5293. Set amount to shift chroma-red horizontally.
  5294. @item crv
  5295. Set amount to shift chroma-red vertically.
  5296. @item edge
  5297. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5298. @end table
  5299. @section ciescope
  5300. Display CIE color diagram with pixels overlaid onto it.
  5301. The filter accepts the following options:
  5302. @table @option
  5303. @item system
  5304. Set color system.
  5305. @table @samp
  5306. @item ntsc, 470m
  5307. @item ebu, 470bg
  5308. @item smpte
  5309. @item 240m
  5310. @item apple
  5311. @item widergb
  5312. @item cie1931
  5313. @item rec709, hdtv
  5314. @item uhdtv, rec2020
  5315. @item dcip3
  5316. @end table
  5317. @item cie
  5318. Set CIE system.
  5319. @table @samp
  5320. @item xyy
  5321. @item ucs
  5322. @item luv
  5323. @end table
  5324. @item gamuts
  5325. Set what gamuts to draw.
  5326. See @code{system} option for available values.
  5327. @item size, s
  5328. Set ciescope size, by default set to 512.
  5329. @item intensity, i
  5330. Set intensity used to map input pixel values to CIE diagram.
  5331. @item contrast
  5332. Set contrast used to draw tongue colors that are out of active color system gamut.
  5333. @item corrgamma
  5334. Correct gamma displayed on scope, by default enabled.
  5335. @item showwhite
  5336. Show white point on CIE diagram, by default disabled.
  5337. @item gamma
  5338. Set input gamma. Used only with XYZ input color space.
  5339. @end table
  5340. @section codecview
  5341. Visualize information exported by some codecs.
  5342. Some codecs can export information through frames using side-data or other
  5343. means. For example, some MPEG based codecs export motion vectors through the
  5344. @var{export_mvs} flag in the codec @option{flags2} option.
  5345. The filter accepts the following option:
  5346. @table @option
  5347. @item mv
  5348. Set motion vectors to visualize.
  5349. Available flags for @var{mv} are:
  5350. @table @samp
  5351. @item pf
  5352. forward predicted MVs of P-frames
  5353. @item bf
  5354. forward predicted MVs of B-frames
  5355. @item bb
  5356. backward predicted MVs of B-frames
  5357. @end table
  5358. @item qp
  5359. Display quantization parameters using the chroma planes.
  5360. @item mv_type, mvt
  5361. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5362. Available flags for @var{mv_type} are:
  5363. @table @samp
  5364. @item fp
  5365. forward predicted MVs
  5366. @item bp
  5367. backward predicted MVs
  5368. @end table
  5369. @item frame_type, ft
  5370. Set frame type to visualize motion vectors of.
  5371. Available flags for @var{frame_type} are:
  5372. @table @samp
  5373. @item if
  5374. intra-coded frames (I-frames)
  5375. @item pf
  5376. predicted frames (P-frames)
  5377. @item bf
  5378. bi-directionally predicted frames (B-frames)
  5379. @end table
  5380. @end table
  5381. @subsection Examples
  5382. @itemize
  5383. @item
  5384. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5385. @example
  5386. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5387. @end example
  5388. @item
  5389. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5390. @example
  5391. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5392. @end example
  5393. @end itemize
  5394. @section colorbalance
  5395. Modify intensity of primary colors (red, green and blue) of input frames.
  5396. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5397. regions for the red-cyan, green-magenta or blue-yellow balance.
  5398. A positive adjustment value shifts the balance towards the primary color, a negative
  5399. value towards the complementary color.
  5400. The filter accepts the following options:
  5401. @table @option
  5402. @item rs
  5403. @item gs
  5404. @item bs
  5405. Adjust red, green and blue shadows (darkest pixels).
  5406. @item rm
  5407. @item gm
  5408. @item bm
  5409. Adjust red, green and blue midtones (medium pixels).
  5410. @item rh
  5411. @item gh
  5412. @item bh
  5413. Adjust red, green and blue highlights (brightest pixels).
  5414. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5415. @end table
  5416. @subsection Examples
  5417. @itemize
  5418. @item
  5419. Add red color cast to shadows:
  5420. @example
  5421. colorbalance=rs=.3
  5422. @end example
  5423. @end itemize
  5424. @section colorchannelmixer
  5425. Adjust video input frames by re-mixing color channels.
  5426. This filter modifies a color channel by adding the values associated to
  5427. the other channels of the same pixels. For example if the value to
  5428. modify is red, the output value will be:
  5429. @example
  5430. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5431. @end example
  5432. The filter accepts the following options:
  5433. @table @option
  5434. @item rr
  5435. @item rg
  5436. @item rb
  5437. @item ra
  5438. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5439. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5440. @item gr
  5441. @item gg
  5442. @item gb
  5443. @item ga
  5444. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5445. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5446. @item br
  5447. @item bg
  5448. @item bb
  5449. @item ba
  5450. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5451. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5452. @item ar
  5453. @item ag
  5454. @item ab
  5455. @item aa
  5456. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5457. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5458. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5459. @end table
  5460. @subsection Examples
  5461. @itemize
  5462. @item
  5463. Convert source to grayscale:
  5464. @example
  5465. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5466. @end example
  5467. @item
  5468. Simulate sepia tones:
  5469. @example
  5470. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5471. @end example
  5472. @end itemize
  5473. @section colorkey
  5474. RGB colorspace color keying.
  5475. The filter accepts the following options:
  5476. @table @option
  5477. @item color
  5478. The color which will be replaced with transparency.
  5479. @item similarity
  5480. Similarity percentage with the key color.
  5481. 0.01 matches only the exact key color, while 1.0 matches everything.
  5482. @item blend
  5483. Blend percentage.
  5484. 0.0 makes pixels either fully transparent, or not transparent at all.
  5485. Higher values result in semi-transparent pixels, with a higher transparency
  5486. the more similar the pixels color is to the key color.
  5487. @end table
  5488. @subsection Examples
  5489. @itemize
  5490. @item
  5491. Make every green pixel in the input image transparent:
  5492. @example
  5493. ffmpeg -i input.png -vf colorkey=green out.png
  5494. @end example
  5495. @item
  5496. Overlay a greenscreen-video on top of a static background image.
  5497. @example
  5498. 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
  5499. @end example
  5500. @end itemize
  5501. @section colorhold
  5502. Remove all color information for all RGB colors except for certain one.
  5503. The filter accepts the following options:
  5504. @table @option
  5505. @item color
  5506. The color which will not be replaced with neutral gray.
  5507. @item similarity
  5508. Similarity percentage with the above color.
  5509. 0.01 matches only the exact key color, while 1.0 matches everything.
  5510. @item blend
  5511. Blend percentage. 0.0 makes pixels fully gray.
  5512. Higher values result in more preserved color.
  5513. @end table
  5514. @section colorlevels
  5515. Adjust video input frames using levels.
  5516. The filter accepts the following options:
  5517. @table @option
  5518. @item rimin
  5519. @item gimin
  5520. @item bimin
  5521. @item aimin
  5522. Adjust red, green, blue and alpha input black point.
  5523. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5524. @item rimax
  5525. @item gimax
  5526. @item bimax
  5527. @item aimax
  5528. Adjust red, green, blue and alpha input white point.
  5529. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5530. Input levels are used to lighten highlights (bright tones), darken shadows
  5531. (dark tones), change the balance of bright and dark tones.
  5532. @item romin
  5533. @item gomin
  5534. @item bomin
  5535. @item aomin
  5536. Adjust red, green, blue and alpha output black point.
  5537. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5538. @item romax
  5539. @item gomax
  5540. @item bomax
  5541. @item aomax
  5542. Adjust red, green, blue and alpha output white point.
  5543. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5544. Output levels allows manual selection of a constrained output level range.
  5545. @end table
  5546. @subsection Examples
  5547. @itemize
  5548. @item
  5549. Make video output darker:
  5550. @example
  5551. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5552. @end example
  5553. @item
  5554. Increase contrast:
  5555. @example
  5556. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5557. @end example
  5558. @item
  5559. Make video output lighter:
  5560. @example
  5561. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5562. @end example
  5563. @item
  5564. Increase brightness:
  5565. @example
  5566. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5567. @end example
  5568. @end itemize
  5569. @section colormatrix
  5570. Convert color matrix.
  5571. The filter accepts the following options:
  5572. @table @option
  5573. @item src
  5574. @item dst
  5575. Specify the source and destination color matrix. Both values must be
  5576. specified.
  5577. The accepted values are:
  5578. @table @samp
  5579. @item bt709
  5580. BT.709
  5581. @item fcc
  5582. FCC
  5583. @item bt601
  5584. BT.601
  5585. @item bt470
  5586. BT.470
  5587. @item bt470bg
  5588. BT.470BG
  5589. @item smpte170m
  5590. SMPTE-170M
  5591. @item smpte240m
  5592. SMPTE-240M
  5593. @item bt2020
  5594. BT.2020
  5595. @end table
  5596. @end table
  5597. For example to convert from BT.601 to SMPTE-240M, use the command:
  5598. @example
  5599. colormatrix=bt601:smpte240m
  5600. @end example
  5601. @section colorspace
  5602. Convert colorspace, transfer characteristics or color primaries.
  5603. Input video needs to have an even size.
  5604. The filter accepts the following options:
  5605. @table @option
  5606. @anchor{all}
  5607. @item all
  5608. Specify all color properties at once.
  5609. The accepted values are:
  5610. @table @samp
  5611. @item bt470m
  5612. BT.470M
  5613. @item bt470bg
  5614. BT.470BG
  5615. @item bt601-6-525
  5616. BT.601-6 525
  5617. @item bt601-6-625
  5618. BT.601-6 625
  5619. @item bt709
  5620. BT.709
  5621. @item smpte170m
  5622. SMPTE-170M
  5623. @item smpte240m
  5624. SMPTE-240M
  5625. @item bt2020
  5626. BT.2020
  5627. @end table
  5628. @anchor{space}
  5629. @item space
  5630. Specify output colorspace.
  5631. The accepted values are:
  5632. @table @samp
  5633. @item bt709
  5634. BT.709
  5635. @item fcc
  5636. FCC
  5637. @item bt470bg
  5638. BT.470BG or BT.601-6 625
  5639. @item smpte170m
  5640. SMPTE-170M or BT.601-6 525
  5641. @item smpte240m
  5642. SMPTE-240M
  5643. @item ycgco
  5644. YCgCo
  5645. @item bt2020ncl
  5646. BT.2020 with non-constant luminance
  5647. @end table
  5648. @anchor{trc}
  5649. @item trc
  5650. Specify output transfer characteristics.
  5651. The accepted values are:
  5652. @table @samp
  5653. @item bt709
  5654. BT.709
  5655. @item bt470m
  5656. BT.470M
  5657. @item bt470bg
  5658. BT.470BG
  5659. @item gamma22
  5660. Constant gamma of 2.2
  5661. @item gamma28
  5662. Constant gamma of 2.8
  5663. @item smpte170m
  5664. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5665. @item smpte240m
  5666. SMPTE-240M
  5667. @item srgb
  5668. SRGB
  5669. @item iec61966-2-1
  5670. iec61966-2-1
  5671. @item iec61966-2-4
  5672. iec61966-2-4
  5673. @item xvycc
  5674. xvycc
  5675. @item bt2020-10
  5676. BT.2020 for 10-bits content
  5677. @item bt2020-12
  5678. BT.2020 for 12-bits content
  5679. @end table
  5680. @anchor{primaries}
  5681. @item primaries
  5682. Specify output color primaries.
  5683. The accepted values are:
  5684. @table @samp
  5685. @item bt709
  5686. BT.709
  5687. @item bt470m
  5688. BT.470M
  5689. @item bt470bg
  5690. BT.470BG or BT.601-6 625
  5691. @item smpte170m
  5692. SMPTE-170M or BT.601-6 525
  5693. @item smpte240m
  5694. SMPTE-240M
  5695. @item film
  5696. film
  5697. @item smpte431
  5698. SMPTE-431
  5699. @item smpte432
  5700. SMPTE-432
  5701. @item bt2020
  5702. BT.2020
  5703. @item jedec-p22
  5704. JEDEC P22 phosphors
  5705. @end table
  5706. @anchor{range}
  5707. @item range
  5708. Specify output color range.
  5709. The accepted values are:
  5710. @table @samp
  5711. @item tv
  5712. TV (restricted) range
  5713. @item mpeg
  5714. MPEG (restricted) range
  5715. @item pc
  5716. PC (full) range
  5717. @item jpeg
  5718. JPEG (full) range
  5719. @end table
  5720. @item format
  5721. Specify output color format.
  5722. The accepted values are:
  5723. @table @samp
  5724. @item yuv420p
  5725. YUV 4:2:0 planar 8-bits
  5726. @item yuv420p10
  5727. YUV 4:2:0 planar 10-bits
  5728. @item yuv420p12
  5729. YUV 4:2:0 planar 12-bits
  5730. @item yuv422p
  5731. YUV 4:2:2 planar 8-bits
  5732. @item yuv422p10
  5733. YUV 4:2:2 planar 10-bits
  5734. @item yuv422p12
  5735. YUV 4:2:2 planar 12-bits
  5736. @item yuv444p
  5737. YUV 4:4:4 planar 8-bits
  5738. @item yuv444p10
  5739. YUV 4:4:4 planar 10-bits
  5740. @item yuv444p12
  5741. YUV 4:4:4 planar 12-bits
  5742. @end table
  5743. @item fast
  5744. Do a fast conversion, which skips gamma/primary correction. This will take
  5745. significantly less CPU, but will be mathematically incorrect. To get output
  5746. compatible with that produced by the colormatrix filter, use fast=1.
  5747. @item dither
  5748. Specify dithering mode.
  5749. The accepted values are:
  5750. @table @samp
  5751. @item none
  5752. No dithering
  5753. @item fsb
  5754. Floyd-Steinberg dithering
  5755. @end table
  5756. @item wpadapt
  5757. Whitepoint adaptation mode.
  5758. The accepted values are:
  5759. @table @samp
  5760. @item bradford
  5761. Bradford whitepoint adaptation
  5762. @item vonkries
  5763. von Kries whitepoint adaptation
  5764. @item identity
  5765. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5766. @end table
  5767. @item iall
  5768. Override all input properties at once. Same accepted values as @ref{all}.
  5769. @item ispace
  5770. Override input colorspace. Same accepted values as @ref{space}.
  5771. @item iprimaries
  5772. Override input color primaries. Same accepted values as @ref{primaries}.
  5773. @item itrc
  5774. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5775. @item irange
  5776. Override input color range. Same accepted values as @ref{range}.
  5777. @end table
  5778. The filter converts the transfer characteristics, color space and color
  5779. primaries to the specified user values. The output value, if not specified,
  5780. is set to a default value based on the "all" property. If that property is
  5781. also not specified, the filter will log an error. The output color range and
  5782. format default to the same value as the input color range and format. The
  5783. input transfer characteristics, color space, color primaries and color range
  5784. should be set on the input data. If any of these are missing, the filter will
  5785. log an error and no conversion will take place.
  5786. For example to convert the input to SMPTE-240M, use the command:
  5787. @example
  5788. colorspace=smpte240m
  5789. @end example
  5790. @section convolution
  5791. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5792. The filter accepts the following options:
  5793. @table @option
  5794. @item 0m
  5795. @item 1m
  5796. @item 2m
  5797. @item 3m
  5798. Set matrix for each plane.
  5799. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5800. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5801. @item 0rdiv
  5802. @item 1rdiv
  5803. @item 2rdiv
  5804. @item 3rdiv
  5805. Set multiplier for calculated value for each plane.
  5806. If unset or 0, it will be sum of all matrix elements.
  5807. @item 0bias
  5808. @item 1bias
  5809. @item 2bias
  5810. @item 3bias
  5811. Set bias for each plane. This value is added to the result of the multiplication.
  5812. Useful for making the overall image brighter or darker. Default is 0.0.
  5813. @item 0mode
  5814. @item 1mode
  5815. @item 2mode
  5816. @item 3mode
  5817. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5818. Default is @var{square}.
  5819. @end table
  5820. @subsection Examples
  5821. @itemize
  5822. @item
  5823. Apply sharpen:
  5824. @example
  5825. 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"
  5826. @end example
  5827. @item
  5828. Apply blur:
  5829. @example
  5830. 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"
  5831. @end example
  5832. @item
  5833. Apply edge enhance:
  5834. @example
  5835. 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"
  5836. @end example
  5837. @item
  5838. Apply edge detect:
  5839. @example
  5840. 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"
  5841. @end example
  5842. @item
  5843. Apply laplacian edge detector which includes diagonals:
  5844. @example
  5845. 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"
  5846. @end example
  5847. @item
  5848. Apply emboss:
  5849. @example
  5850. 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"
  5851. @end example
  5852. @end itemize
  5853. @section convolve
  5854. Apply 2D convolution of video stream in frequency domain using second stream
  5855. as impulse.
  5856. The filter accepts the following options:
  5857. @table @option
  5858. @item planes
  5859. Set which planes to process.
  5860. @item impulse
  5861. Set which impulse video frames will be processed, can be @var{first}
  5862. or @var{all}. Default is @var{all}.
  5863. @end table
  5864. The @code{convolve} filter also supports the @ref{framesync} options.
  5865. @section copy
  5866. Copy the input video source unchanged to the output. This is mainly useful for
  5867. testing purposes.
  5868. @anchor{coreimage}
  5869. @section coreimage
  5870. Video filtering on GPU using Apple's CoreImage API on OSX.
  5871. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5872. processed by video hardware. However, software-based OpenGL implementations
  5873. exist which means there is no guarantee for hardware processing. It depends on
  5874. the respective OSX.
  5875. There are many filters and image generators provided by Apple that come with a
  5876. large variety of options. The filter has to be referenced by its name along
  5877. with its options.
  5878. The coreimage filter accepts the following options:
  5879. @table @option
  5880. @item list_filters
  5881. List all available filters and generators along with all their respective
  5882. options as well as possible minimum and maximum values along with the default
  5883. values.
  5884. @example
  5885. list_filters=true
  5886. @end example
  5887. @item filter
  5888. Specify all filters by their respective name and options.
  5889. Use @var{list_filters} to determine all valid filter names and options.
  5890. Numerical options are specified by a float value and are automatically clamped
  5891. to their respective value range. Vector and color options have to be specified
  5892. by a list of space separated float values. Character escaping has to be done.
  5893. A special option name @code{default} is available to use default options for a
  5894. filter.
  5895. It is required to specify either @code{default} or at least one of the filter options.
  5896. All omitted options are used with their default values.
  5897. The syntax of the filter string is as follows:
  5898. @example
  5899. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5900. @end example
  5901. @item output_rect
  5902. Specify a rectangle where the output of the filter chain is copied into the
  5903. input image. It is given by a list of space separated float values:
  5904. @example
  5905. output_rect=x\ y\ width\ height
  5906. @end example
  5907. If not given, the output rectangle equals the dimensions of the input image.
  5908. The output rectangle is automatically cropped at the borders of the input
  5909. image. Negative values are valid for each component.
  5910. @example
  5911. output_rect=25\ 25\ 100\ 100
  5912. @end example
  5913. @end table
  5914. Several filters can be chained for successive processing without GPU-HOST
  5915. transfers allowing for fast processing of complex filter chains.
  5916. Currently, only filters with zero (generators) or exactly one (filters) input
  5917. image and one output image are supported. Also, transition filters are not yet
  5918. usable as intended.
  5919. Some filters generate output images with additional padding depending on the
  5920. respective filter kernel. The padding is automatically removed to ensure the
  5921. filter output has the same size as the input image.
  5922. For image generators, the size of the output image is determined by the
  5923. previous output image of the filter chain or the input image of the whole
  5924. filterchain, respectively. The generators do not use the pixel information of
  5925. this image to generate their output. However, the generated output is
  5926. blended onto this image, resulting in partial or complete coverage of the
  5927. output image.
  5928. The @ref{coreimagesrc} video source can be used for generating input images
  5929. which are directly fed into the filter chain. By using it, providing input
  5930. images by another video source or an input video is not required.
  5931. @subsection Examples
  5932. @itemize
  5933. @item
  5934. List all filters available:
  5935. @example
  5936. coreimage=list_filters=true
  5937. @end example
  5938. @item
  5939. Use the CIBoxBlur filter with default options to blur an image:
  5940. @example
  5941. coreimage=filter=CIBoxBlur@@default
  5942. @end example
  5943. @item
  5944. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5945. its center at 100x100 and a radius of 50 pixels:
  5946. @example
  5947. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5948. @end example
  5949. @item
  5950. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5951. given as complete and escaped command-line for Apple's standard bash shell:
  5952. @example
  5953. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5954. @end example
  5955. @end itemize
  5956. @section cover_rect
  5957. Cover a rectangular object
  5958. It accepts the following options:
  5959. @table @option
  5960. @item cover
  5961. Filepath of the optional cover image, needs to be in yuv420.
  5962. @item mode
  5963. Set covering mode.
  5964. It accepts the following values:
  5965. @table @samp
  5966. @item cover
  5967. cover it by the supplied image
  5968. @item blur
  5969. cover it by interpolating the surrounding pixels
  5970. @end table
  5971. Default value is @var{blur}.
  5972. @end table
  5973. @subsection Examples
  5974. @itemize
  5975. @item
  5976. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  5977. @example
  5978. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5979. @end example
  5980. @end itemize
  5981. @section crop
  5982. Crop the input video to given dimensions.
  5983. It accepts the following parameters:
  5984. @table @option
  5985. @item w, out_w
  5986. The width of the output video. It defaults to @code{iw}.
  5987. This expression is evaluated only once during the filter
  5988. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5989. @item h, out_h
  5990. The height of the output video. It defaults to @code{ih}.
  5991. This expression is evaluated only once during the filter
  5992. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5993. @item x
  5994. The horizontal position, in the input video, of the left edge of the output
  5995. video. It defaults to @code{(in_w-out_w)/2}.
  5996. This expression is evaluated per-frame.
  5997. @item y
  5998. The vertical position, in the input video, of the top edge of the output video.
  5999. It defaults to @code{(in_h-out_h)/2}.
  6000. This expression is evaluated per-frame.
  6001. @item keep_aspect
  6002. If set to 1 will force the output display aspect ratio
  6003. to be the same of the input, by changing the output sample aspect
  6004. ratio. It defaults to 0.
  6005. @item exact
  6006. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  6007. width/height/x/y as specified and will not be rounded to nearest smaller value.
  6008. It defaults to 0.
  6009. @end table
  6010. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  6011. expressions containing the following constants:
  6012. @table @option
  6013. @item x
  6014. @item y
  6015. The computed values for @var{x} and @var{y}. They are evaluated for
  6016. each new frame.
  6017. @item in_w
  6018. @item in_h
  6019. The input width and height.
  6020. @item iw
  6021. @item ih
  6022. These are the same as @var{in_w} and @var{in_h}.
  6023. @item out_w
  6024. @item out_h
  6025. The output (cropped) width and height.
  6026. @item ow
  6027. @item oh
  6028. These are the same as @var{out_w} and @var{out_h}.
  6029. @item a
  6030. same as @var{iw} / @var{ih}
  6031. @item sar
  6032. input sample aspect ratio
  6033. @item dar
  6034. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6035. @item hsub
  6036. @item vsub
  6037. horizontal and vertical chroma subsample values. For example for the
  6038. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6039. @item n
  6040. The number of the input frame, starting from 0.
  6041. @item pos
  6042. the position in the file of the input frame, NAN if unknown
  6043. @item t
  6044. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  6045. @end table
  6046. The expression for @var{out_w} may depend on the value of @var{out_h},
  6047. and the expression for @var{out_h} may depend on @var{out_w}, but they
  6048. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  6049. evaluated after @var{out_w} and @var{out_h}.
  6050. The @var{x} and @var{y} parameters specify the expressions for the
  6051. position of the top-left corner of the output (non-cropped) area. They
  6052. are evaluated for each frame. If the evaluated value is not valid, it
  6053. is approximated to the nearest valid value.
  6054. The expression for @var{x} may depend on @var{y}, and the expression
  6055. for @var{y} may depend on @var{x}.
  6056. @subsection Examples
  6057. @itemize
  6058. @item
  6059. Crop area with size 100x100 at position (12,34).
  6060. @example
  6061. crop=100:100:12:34
  6062. @end example
  6063. Using named options, the example above becomes:
  6064. @example
  6065. crop=w=100:h=100:x=12:y=34
  6066. @end example
  6067. @item
  6068. Crop the central input area with size 100x100:
  6069. @example
  6070. crop=100:100
  6071. @end example
  6072. @item
  6073. Crop the central input area with size 2/3 of the input video:
  6074. @example
  6075. crop=2/3*in_w:2/3*in_h
  6076. @end example
  6077. @item
  6078. Crop the input video central square:
  6079. @example
  6080. crop=out_w=in_h
  6081. crop=in_h
  6082. @end example
  6083. @item
  6084. Delimit the rectangle with the top-left corner placed at position
  6085. 100:100 and the right-bottom corner corresponding to the right-bottom
  6086. corner of the input image.
  6087. @example
  6088. crop=in_w-100:in_h-100:100:100
  6089. @end example
  6090. @item
  6091. Crop 10 pixels from the left and right borders, and 20 pixels from
  6092. the top and bottom borders
  6093. @example
  6094. crop=in_w-2*10:in_h-2*20
  6095. @end example
  6096. @item
  6097. Keep only the bottom right quarter of the input image:
  6098. @example
  6099. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6100. @end example
  6101. @item
  6102. Crop height for getting Greek harmony:
  6103. @example
  6104. crop=in_w:1/PHI*in_w
  6105. @end example
  6106. @item
  6107. Apply trembling effect:
  6108. @example
  6109. 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)
  6110. @end example
  6111. @item
  6112. Apply erratic camera effect depending on timestamp:
  6113. @example
  6114. 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)"
  6115. @end example
  6116. @item
  6117. Set x depending on the value of y:
  6118. @example
  6119. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6120. @end example
  6121. @end itemize
  6122. @subsection Commands
  6123. This filter supports the following commands:
  6124. @table @option
  6125. @item w, out_w
  6126. @item h, out_h
  6127. @item x
  6128. @item y
  6129. Set width/height of the output video and the horizontal/vertical position
  6130. in the input video.
  6131. The command accepts the same syntax of the corresponding option.
  6132. If the specified expression is not valid, it is kept at its current
  6133. value.
  6134. @end table
  6135. @section cropdetect
  6136. Auto-detect the crop size.
  6137. It calculates the necessary cropping parameters and prints the
  6138. recommended parameters via the logging system. The detected dimensions
  6139. correspond to the non-black area of the input video.
  6140. It accepts the following parameters:
  6141. @table @option
  6142. @item limit
  6143. Set higher black value threshold, which can be optionally specified
  6144. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6145. value greater to the set value is considered non-black. It defaults to 24.
  6146. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6147. on the bitdepth of the pixel format.
  6148. @item round
  6149. The value which the width/height should be divisible by. It defaults to
  6150. 16. The offset is automatically adjusted to center the video. Use 2 to
  6151. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6152. encoding to most video codecs.
  6153. @item reset_count, reset
  6154. Set the counter that determines after how many frames cropdetect will
  6155. reset the previously detected largest video area and start over to
  6156. detect the current optimal crop area. Default value is 0.
  6157. This can be useful when channel logos distort the video area. 0
  6158. indicates 'never reset', and returns the largest area encountered during
  6159. playback.
  6160. @end table
  6161. @anchor{cue}
  6162. @section cue
  6163. Delay video filtering until a given wallclock timestamp. The filter first
  6164. passes on @option{preroll} amount of frames, then it buffers at most
  6165. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6166. it forwards the buffered frames and also any subsequent frames coming in its
  6167. input.
  6168. The filter can be used synchronize the output of multiple ffmpeg processes for
  6169. realtime output devices like decklink. By putting the delay in the filtering
  6170. chain and pre-buffering frames the process can pass on data to output almost
  6171. immediately after the target wallclock timestamp is reached.
  6172. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6173. some use cases.
  6174. @table @option
  6175. @item cue
  6176. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6177. @item preroll
  6178. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6179. @item buffer
  6180. The maximum duration of content to buffer before waiting for the cue expressed
  6181. in seconds. Default is 0.
  6182. @end table
  6183. @anchor{curves}
  6184. @section curves
  6185. Apply color adjustments using curves.
  6186. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6187. component (red, green and blue) has its values defined by @var{N} key points
  6188. tied from each other using a smooth curve. The x-axis represents the pixel
  6189. values from the input frame, and the y-axis the new pixel values to be set for
  6190. the output frame.
  6191. By default, a component curve is defined by the two points @var{(0;0)} and
  6192. @var{(1;1)}. This creates a straight line where each original pixel value is
  6193. "adjusted" to its own value, which means no change to the image.
  6194. The filter allows you to redefine these two points and add some more. A new
  6195. curve (using a natural cubic spline interpolation) will be define to pass
  6196. smoothly through all these new coordinates. The new defined points needs to be
  6197. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6198. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6199. the vector spaces, the values will be clipped accordingly.
  6200. The filter accepts the following options:
  6201. @table @option
  6202. @item preset
  6203. Select one of the available color presets. This option can be used in addition
  6204. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6205. options takes priority on the preset values.
  6206. Available presets are:
  6207. @table @samp
  6208. @item none
  6209. @item color_negative
  6210. @item cross_process
  6211. @item darker
  6212. @item increase_contrast
  6213. @item lighter
  6214. @item linear_contrast
  6215. @item medium_contrast
  6216. @item negative
  6217. @item strong_contrast
  6218. @item vintage
  6219. @end table
  6220. Default is @code{none}.
  6221. @item master, m
  6222. Set the master key points. These points will define a second pass mapping. It
  6223. is sometimes called a "luminance" or "value" mapping. It can be used with
  6224. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6225. post-processing LUT.
  6226. @item red, r
  6227. Set the key points for the red component.
  6228. @item green, g
  6229. Set the key points for the green component.
  6230. @item blue, b
  6231. Set the key points for the blue component.
  6232. @item all
  6233. Set the key points for all components (not including master).
  6234. Can be used in addition to the other key points component
  6235. options. In this case, the unset component(s) will fallback on this
  6236. @option{all} setting.
  6237. @item psfile
  6238. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6239. @item plot
  6240. Save Gnuplot script of the curves in specified file.
  6241. @end table
  6242. To avoid some filtergraph syntax conflicts, each key points list need to be
  6243. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6244. @subsection Examples
  6245. @itemize
  6246. @item
  6247. Increase slightly the middle level of blue:
  6248. @example
  6249. curves=blue='0/0 0.5/0.58 1/1'
  6250. @end example
  6251. @item
  6252. Vintage effect:
  6253. @example
  6254. 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'
  6255. @end example
  6256. Here we obtain the following coordinates for each components:
  6257. @table @var
  6258. @item red
  6259. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6260. @item green
  6261. @code{(0;0) (0.50;0.48) (1;1)}
  6262. @item blue
  6263. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6264. @end table
  6265. @item
  6266. The previous example can also be achieved with the associated built-in preset:
  6267. @example
  6268. curves=preset=vintage
  6269. @end example
  6270. @item
  6271. Or simply:
  6272. @example
  6273. curves=vintage
  6274. @end example
  6275. @item
  6276. Use a Photoshop preset and redefine the points of the green component:
  6277. @example
  6278. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6279. @end example
  6280. @item
  6281. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6282. and @command{gnuplot}:
  6283. @example
  6284. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6285. gnuplot -p /tmp/curves.plt
  6286. @end example
  6287. @end itemize
  6288. @section datascope
  6289. Video data analysis filter.
  6290. This filter shows hexadecimal pixel values of part of video.
  6291. The filter accepts the following options:
  6292. @table @option
  6293. @item size, s
  6294. Set output video size.
  6295. @item x
  6296. Set x offset from where to pick pixels.
  6297. @item y
  6298. Set y offset from where to pick pixels.
  6299. @item mode
  6300. Set scope mode, can be one of the following:
  6301. @table @samp
  6302. @item mono
  6303. Draw hexadecimal pixel values with white color on black background.
  6304. @item color
  6305. Draw hexadecimal pixel values with input video pixel color on black
  6306. background.
  6307. @item color2
  6308. Draw hexadecimal pixel values on color background picked from input video,
  6309. the text color is picked in such way so its always visible.
  6310. @end table
  6311. @item axis
  6312. Draw rows and columns numbers on left and top of video.
  6313. @item opacity
  6314. Set background opacity.
  6315. @end table
  6316. @section dctdnoiz
  6317. Denoise frames using 2D DCT (frequency domain filtering).
  6318. This filter is not designed for real time.
  6319. The filter accepts the following options:
  6320. @table @option
  6321. @item sigma, s
  6322. Set the noise sigma constant.
  6323. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6324. coefficient (absolute value) below this threshold with be dropped.
  6325. If you need a more advanced filtering, see @option{expr}.
  6326. Default is @code{0}.
  6327. @item overlap
  6328. Set number overlapping pixels for each block. Since the filter can be slow, you
  6329. may want to reduce this value, at the cost of a less effective filter and the
  6330. risk of various artefacts.
  6331. If the overlapping value doesn't permit processing the whole input width or
  6332. height, a warning will be displayed and according borders won't be denoised.
  6333. Default value is @var{blocksize}-1, which is the best possible setting.
  6334. @item expr, e
  6335. Set the coefficient factor expression.
  6336. For each coefficient of a DCT block, this expression will be evaluated as a
  6337. multiplier value for the coefficient.
  6338. If this is option is set, the @option{sigma} option will be ignored.
  6339. The absolute value of the coefficient can be accessed through the @var{c}
  6340. variable.
  6341. @item n
  6342. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6343. @var{blocksize}, which is the width and height of the processed blocks.
  6344. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6345. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6346. on the speed processing. Also, a larger block size does not necessarily means a
  6347. better de-noising.
  6348. @end table
  6349. @subsection Examples
  6350. Apply a denoise with a @option{sigma} of @code{4.5}:
  6351. @example
  6352. dctdnoiz=4.5
  6353. @end example
  6354. The same operation can be achieved using the expression system:
  6355. @example
  6356. dctdnoiz=e='gte(c, 4.5*3)'
  6357. @end example
  6358. Violent denoise using a block size of @code{16x16}:
  6359. @example
  6360. dctdnoiz=15:n=4
  6361. @end example
  6362. @section deband
  6363. Remove banding artifacts from input video.
  6364. It works by replacing banded pixels with average value of referenced pixels.
  6365. The filter accepts the following options:
  6366. @table @option
  6367. @item 1thr
  6368. @item 2thr
  6369. @item 3thr
  6370. @item 4thr
  6371. Set banding detection threshold for each plane. Default is 0.02.
  6372. Valid range is 0.00003 to 0.5.
  6373. If difference between current pixel and reference pixel is less than threshold,
  6374. it will be considered as banded.
  6375. @item range, r
  6376. Banding detection range in pixels. Default is 16. If positive, random number
  6377. in range 0 to set value will be used. If negative, exact absolute value
  6378. will be used.
  6379. The range defines square of four pixels around current pixel.
  6380. @item direction, d
  6381. Set direction in radians from which four pixel will be compared. If positive,
  6382. random direction from 0 to set direction will be picked. If negative, exact of
  6383. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6384. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6385. column.
  6386. @item blur, b
  6387. If enabled, current pixel is compared with average value of all four
  6388. surrounding pixels. The default is enabled. If disabled current pixel is
  6389. compared with all four surrounding pixels. The pixel is considered banded
  6390. if only all four differences with surrounding pixels are less than threshold.
  6391. @item coupling, c
  6392. If enabled, current pixel is changed if and only if all pixel components are banded,
  6393. e.g. banding detection threshold is triggered for all color components.
  6394. The default is disabled.
  6395. @end table
  6396. @section deblock
  6397. Remove blocking artifacts from input video.
  6398. The filter accepts the following options:
  6399. @table @option
  6400. @item filter
  6401. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6402. This controls what kind of deblocking is applied.
  6403. @item block
  6404. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6405. @item alpha
  6406. @item beta
  6407. @item gamma
  6408. @item delta
  6409. Set blocking detection thresholds. Allowed range is 0 to 1.
  6410. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6411. Using higher threshold gives more deblocking strength.
  6412. Setting @var{alpha} controls threshold detection at exact edge of block.
  6413. Remaining options controls threshold detection near the edge. Each one for
  6414. below/above or left/right. Setting any of those to @var{0} disables
  6415. deblocking.
  6416. @item planes
  6417. Set planes to filter. Default is to filter all available planes.
  6418. @end table
  6419. @subsection Examples
  6420. @itemize
  6421. @item
  6422. Deblock using weak filter and block size of 4 pixels.
  6423. @example
  6424. deblock=filter=weak:block=4
  6425. @end example
  6426. @item
  6427. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6428. deblocking more edges.
  6429. @example
  6430. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6431. @end example
  6432. @item
  6433. Similar as above, but filter only first plane.
  6434. @example
  6435. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6436. @end example
  6437. @item
  6438. Similar as above, but filter only second and third plane.
  6439. @example
  6440. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6441. @end example
  6442. @end itemize
  6443. @anchor{decimate}
  6444. @section decimate
  6445. Drop duplicated frames at regular intervals.
  6446. The filter accepts the following options:
  6447. @table @option
  6448. @item cycle
  6449. Set the number of frames from which one will be dropped. Setting this to
  6450. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6451. Default is @code{5}.
  6452. @item dupthresh
  6453. Set the threshold for duplicate detection. If the difference metric for a frame
  6454. is less than or equal to this value, then it is declared as duplicate. Default
  6455. is @code{1.1}
  6456. @item scthresh
  6457. Set scene change threshold. Default is @code{15}.
  6458. @item blockx
  6459. @item blocky
  6460. Set the size of the x and y-axis blocks used during metric calculations.
  6461. Larger blocks give better noise suppression, but also give worse detection of
  6462. small movements. Must be a power of two. Default is @code{32}.
  6463. @item ppsrc
  6464. Mark main input as a pre-processed input and activate clean source input
  6465. stream. This allows the input to be pre-processed with various filters to help
  6466. the metrics calculation while keeping the frame selection lossless. When set to
  6467. @code{1}, the first stream is for the pre-processed input, and the second
  6468. stream is the clean source from where the kept frames are chosen. Default is
  6469. @code{0}.
  6470. @item chroma
  6471. Set whether or not chroma is considered in the metric calculations. Default is
  6472. @code{1}.
  6473. @end table
  6474. @section deconvolve
  6475. Apply 2D deconvolution of video stream in frequency domain using second stream
  6476. as impulse.
  6477. The filter accepts the following options:
  6478. @table @option
  6479. @item planes
  6480. Set which planes to process.
  6481. @item impulse
  6482. Set which impulse video frames will be processed, can be @var{first}
  6483. or @var{all}. Default is @var{all}.
  6484. @item noise
  6485. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6486. and height are not same and not power of 2 or if stream prior to convolving
  6487. had noise.
  6488. @end table
  6489. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6490. @section dedot
  6491. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6492. It accepts the following options:
  6493. @table @option
  6494. @item m
  6495. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6496. @var{rainbows} for cross-color reduction.
  6497. @item lt
  6498. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6499. @item tl
  6500. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6501. @item tc
  6502. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6503. @item ct
  6504. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6505. @end table
  6506. @section deflate
  6507. Apply deflate effect to the video.
  6508. This filter replaces the pixel by the local(3x3) average by taking into account
  6509. only values lower than the pixel.
  6510. It accepts the following options:
  6511. @table @option
  6512. @item threshold0
  6513. @item threshold1
  6514. @item threshold2
  6515. @item threshold3
  6516. Limit the maximum change for each plane, default is 65535.
  6517. If 0, plane will remain unchanged.
  6518. @end table
  6519. @section deflicker
  6520. Remove temporal frame luminance variations.
  6521. It accepts the following options:
  6522. @table @option
  6523. @item size, s
  6524. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6525. @item mode, m
  6526. Set averaging mode to smooth temporal luminance variations.
  6527. Available values are:
  6528. @table @samp
  6529. @item am
  6530. Arithmetic mean
  6531. @item gm
  6532. Geometric mean
  6533. @item hm
  6534. Harmonic mean
  6535. @item qm
  6536. Quadratic mean
  6537. @item cm
  6538. Cubic mean
  6539. @item pm
  6540. Power mean
  6541. @item median
  6542. Median
  6543. @end table
  6544. @item bypass
  6545. Do not actually modify frame. Useful when one only wants metadata.
  6546. @end table
  6547. @section dejudder
  6548. Remove judder produced by partially interlaced telecined content.
  6549. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6550. source was partially telecined content then the output of @code{pullup,dejudder}
  6551. will have a variable frame rate. May change the recorded frame rate of the
  6552. container. Aside from that change, this filter will not affect constant frame
  6553. rate video.
  6554. The option available in this filter is:
  6555. @table @option
  6556. @item cycle
  6557. Specify the length of the window over which the judder repeats.
  6558. Accepts any integer greater than 1. Useful values are:
  6559. @table @samp
  6560. @item 4
  6561. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6562. @item 5
  6563. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6564. @item 20
  6565. If a mixture of the two.
  6566. @end table
  6567. The default is @samp{4}.
  6568. @end table
  6569. @section delogo
  6570. Suppress a TV station logo by a simple interpolation of the surrounding
  6571. pixels. Just set a rectangle covering the logo and watch it disappear
  6572. (and sometimes something even uglier appear - your mileage may vary).
  6573. It accepts the following parameters:
  6574. @table @option
  6575. @item x
  6576. @item y
  6577. Specify the top left corner coordinates of the logo. They must be
  6578. specified.
  6579. @item w
  6580. @item h
  6581. Specify the width and height of the logo to clear. They must be
  6582. specified.
  6583. @item band, t
  6584. Specify the thickness of the fuzzy edge of the rectangle (added to
  6585. @var{w} and @var{h}). The default value is 1. This option is
  6586. deprecated, setting higher values should no longer be necessary and
  6587. is not recommended.
  6588. @item show
  6589. When set to 1, a green rectangle is drawn on the screen to simplify
  6590. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6591. The default value is 0.
  6592. The rectangle is drawn on the outermost pixels which will be (partly)
  6593. replaced with interpolated values. The values of the next pixels
  6594. immediately outside this rectangle in each direction will be used to
  6595. compute the interpolated pixel values inside the rectangle.
  6596. @end table
  6597. @subsection Examples
  6598. @itemize
  6599. @item
  6600. Set a rectangle covering the area with top left corner coordinates 0,0
  6601. and size 100x77, and a band of size 10:
  6602. @example
  6603. delogo=x=0:y=0:w=100:h=77:band=10
  6604. @end example
  6605. @end itemize
  6606. @section derain
  6607. Remove the rain in the input image/video by applying the derain methods based on
  6608. convolutional neural networks. Supported models:
  6609. @itemize
  6610. @item
  6611. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6612. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6613. @end itemize
  6614. Training as well as model generation scripts are provided in
  6615. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6616. Native model files (.model) can be generated from TensorFlow model
  6617. files (.pb) by using tools/python/convert.py
  6618. The filter accepts the following options:
  6619. @table @option
  6620. @item filter_type
  6621. Specify which filter to use. This option accepts the following values:
  6622. @table @samp
  6623. @item derain
  6624. Derain filter. To conduct derain filter, you need to use a derain model.
  6625. @item dehaze
  6626. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  6627. @end table
  6628. Default value is @samp{derain}.
  6629. @item dnn_backend
  6630. Specify which DNN backend to use for model loading and execution. This option accepts
  6631. the following values:
  6632. @table @samp
  6633. @item native
  6634. Native implementation of DNN loading and execution.
  6635. @item tensorflow
  6636. TensorFlow backend. To enable this backend you
  6637. need to install the TensorFlow for C library (see
  6638. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6639. @code{--enable-libtensorflow}
  6640. @end table
  6641. Default value is @samp{native}.
  6642. @item model
  6643. Set path to model file specifying network architecture and its parameters.
  6644. Note that different backends use different file formats. TensorFlow and native
  6645. backend can load files for only its format.
  6646. @end table
  6647. @section deshake
  6648. Attempt to fix small changes in horizontal and/or vertical shift. This
  6649. filter helps remove camera shake from hand-holding a camera, bumping a
  6650. tripod, moving on a vehicle, etc.
  6651. The filter accepts the following options:
  6652. @table @option
  6653. @item x
  6654. @item y
  6655. @item w
  6656. @item h
  6657. Specify a rectangular area where to limit the search for motion
  6658. vectors.
  6659. If desired the search for motion vectors can be limited to a
  6660. rectangular area of the frame defined by its top left corner, width
  6661. and height. These parameters have the same meaning as the drawbox
  6662. filter which can be used to visualise the position of the bounding
  6663. box.
  6664. This is useful when simultaneous movement of subjects within the frame
  6665. might be confused for camera motion by the motion vector search.
  6666. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6667. then the full frame is used. This allows later options to be set
  6668. without specifying the bounding box for the motion vector search.
  6669. Default - search the whole frame.
  6670. @item rx
  6671. @item ry
  6672. Specify the maximum extent of movement in x and y directions in the
  6673. range 0-64 pixels. Default 16.
  6674. @item edge
  6675. Specify how to generate pixels to fill blanks at the edge of the
  6676. frame. Available values are:
  6677. @table @samp
  6678. @item blank, 0
  6679. Fill zeroes at blank locations
  6680. @item original, 1
  6681. Original image at blank locations
  6682. @item clamp, 2
  6683. Extruded edge value at blank locations
  6684. @item mirror, 3
  6685. Mirrored edge at blank locations
  6686. @end table
  6687. Default value is @samp{mirror}.
  6688. @item blocksize
  6689. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6690. default 8.
  6691. @item contrast
  6692. Specify the contrast threshold for blocks. Only blocks with more than
  6693. the specified contrast (difference between darkest and lightest
  6694. pixels) will be considered. Range 1-255, default 125.
  6695. @item search
  6696. Specify the search strategy. Available values are:
  6697. @table @samp
  6698. @item exhaustive, 0
  6699. Set exhaustive search
  6700. @item less, 1
  6701. Set less exhaustive search.
  6702. @end table
  6703. Default value is @samp{exhaustive}.
  6704. @item filename
  6705. If set then a detailed log of the motion search is written to the
  6706. specified file.
  6707. @end table
  6708. @section despill
  6709. Remove unwanted contamination of foreground colors, caused by reflected color of
  6710. greenscreen or bluescreen.
  6711. This filter accepts the following options:
  6712. @table @option
  6713. @item type
  6714. Set what type of despill to use.
  6715. @item mix
  6716. Set how spillmap will be generated.
  6717. @item expand
  6718. Set how much to get rid of still remaining spill.
  6719. @item red
  6720. Controls amount of red in spill area.
  6721. @item green
  6722. Controls amount of green in spill area.
  6723. Should be -1 for greenscreen.
  6724. @item blue
  6725. Controls amount of blue in spill area.
  6726. Should be -1 for bluescreen.
  6727. @item brightness
  6728. Controls brightness of spill area, preserving colors.
  6729. @item alpha
  6730. Modify alpha from generated spillmap.
  6731. @end table
  6732. @section detelecine
  6733. Apply an exact inverse of the telecine operation. It requires a predefined
  6734. pattern specified using the pattern option which must be the same as that passed
  6735. to the telecine filter.
  6736. This filter accepts the following options:
  6737. @table @option
  6738. @item first_field
  6739. @table @samp
  6740. @item top, t
  6741. top field first
  6742. @item bottom, b
  6743. bottom field first
  6744. The default value is @code{top}.
  6745. @end table
  6746. @item pattern
  6747. A string of numbers representing the pulldown pattern you wish to apply.
  6748. The default value is @code{23}.
  6749. @item start_frame
  6750. A number representing position of the first frame with respect to the telecine
  6751. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6752. @end table
  6753. @section dilation
  6754. Apply dilation effect to the video.
  6755. This filter replaces the pixel by the local(3x3) maximum.
  6756. It accepts the following options:
  6757. @table @option
  6758. @item threshold0
  6759. @item threshold1
  6760. @item threshold2
  6761. @item threshold3
  6762. Limit the maximum change for each plane, default is 65535.
  6763. If 0, plane will remain unchanged.
  6764. @item coordinates
  6765. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6766. pixels are used.
  6767. Flags to local 3x3 coordinates maps like this:
  6768. 1 2 3
  6769. 4 5
  6770. 6 7 8
  6771. @end table
  6772. @section displace
  6773. Displace pixels as indicated by second and third input stream.
  6774. It takes three input streams and outputs one stream, the first input is the
  6775. source, and second and third input are displacement maps.
  6776. The second input specifies how much to displace pixels along the
  6777. x-axis, while the third input specifies how much to displace pixels
  6778. along the y-axis.
  6779. If one of displacement map streams terminates, last frame from that
  6780. displacement map will be used.
  6781. Note that once generated, displacements maps can be reused over and over again.
  6782. A description of the accepted options follows.
  6783. @table @option
  6784. @item edge
  6785. Set displace behavior for pixels that are out of range.
  6786. Available values are:
  6787. @table @samp
  6788. @item blank
  6789. Missing pixels are replaced by black pixels.
  6790. @item smear
  6791. Adjacent pixels will spread out to replace missing pixels.
  6792. @item wrap
  6793. Out of range pixels are wrapped so they point to pixels of other side.
  6794. @item mirror
  6795. Out of range pixels will be replaced with mirrored pixels.
  6796. @end table
  6797. Default is @samp{smear}.
  6798. @end table
  6799. @subsection Examples
  6800. @itemize
  6801. @item
  6802. Add ripple effect to rgb input of video size hd720:
  6803. @example
  6804. 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
  6805. @end example
  6806. @item
  6807. Add wave effect to rgb input of video size hd720:
  6808. @example
  6809. 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
  6810. @end example
  6811. @end itemize
  6812. @section drawbox
  6813. Draw a colored box on the input image.
  6814. It accepts the following parameters:
  6815. @table @option
  6816. @item x
  6817. @item y
  6818. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6819. @item width, w
  6820. @item height, h
  6821. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6822. the input width and height. It defaults to 0.
  6823. @item color, c
  6824. Specify the color of the box to write. For the general syntax of this option,
  6825. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6826. value @code{invert} is used, the box edge color is the same as the
  6827. video with inverted luma.
  6828. @item thickness, t
  6829. The expression which sets the thickness of the box edge.
  6830. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6831. See below for the list of accepted constants.
  6832. @item replace
  6833. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6834. will overwrite the video's color and alpha pixels.
  6835. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6836. @end table
  6837. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6838. following constants:
  6839. @table @option
  6840. @item dar
  6841. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6842. @item hsub
  6843. @item vsub
  6844. horizontal and vertical chroma subsample values. For example for the
  6845. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6846. @item in_h, ih
  6847. @item in_w, iw
  6848. The input width and height.
  6849. @item sar
  6850. The input sample aspect ratio.
  6851. @item x
  6852. @item y
  6853. The x and y offset coordinates where the box is drawn.
  6854. @item w
  6855. @item h
  6856. The width and height of the drawn box.
  6857. @item t
  6858. The thickness of the drawn box.
  6859. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6860. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6861. @end table
  6862. @subsection Examples
  6863. @itemize
  6864. @item
  6865. Draw a black box around the edge of the input image:
  6866. @example
  6867. drawbox
  6868. @end example
  6869. @item
  6870. Draw a box with color red and an opacity of 50%:
  6871. @example
  6872. drawbox=10:20:200:60:red@@0.5
  6873. @end example
  6874. The previous example can be specified as:
  6875. @example
  6876. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6877. @end example
  6878. @item
  6879. Fill the box with pink color:
  6880. @example
  6881. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6882. @end example
  6883. @item
  6884. Draw a 2-pixel red 2.40:1 mask:
  6885. @example
  6886. 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
  6887. @end example
  6888. @end itemize
  6889. @subsection Commands
  6890. This filter supports same commands as options.
  6891. The command accepts the same syntax of the corresponding option.
  6892. If the specified expression is not valid, it is kept at its current
  6893. value.
  6894. @section drawgrid
  6895. Draw a grid on the input image.
  6896. It accepts the following parameters:
  6897. @table @option
  6898. @item x
  6899. @item y
  6900. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6901. @item width, w
  6902. @item height, h
  6903. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6904. input width and height, respectively, minus @code{thickness}, so image gets
  6905. framed. Default to 0.
  6906. @item color, c
  6907. Specify the color of the grid. For the general syntax of this option,
  6908. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6909. value @code{invert} is used, the grid color is the same as the
  6910. video with inverted luma.
  6911. @item thickness, t
  6912. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6913. See below for the list of accepted constants.
  6914. @item replace
  6915. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6916. will overwrite the video's color and alpha pixels.
  6917. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6918. @end table
  6919. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6920. following constants:
  6921. @table @option
  6922. @item dar
  6923. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6924. @item hsub
  6925. @item vsub
  6926. horizontal and vertical chroma subsample values. For example for the
  6927. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6928. @item in_h, ih
  6929. @item in_w, iw
  6930. The input grid cell width and height.
  6931. @item sar
  6932. The input sample aspect ratio.
  6933. @item x
  6934. @item y
  6935. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6936. @item w
  6937. @item h
  6938. The width and height of the drawn cell.
  6939. @item t
  6940. The thickness of the drawn cell.
  6941. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6942. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6943. @end table
  6944. @subsection Examples
  6945. @itemize
  6946. @item
  6947. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6948. @example
  6949. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6950. @end example
  6951. @item
  6952. Draw a white 3x3 grid with an opacity of 50%:
  6953. @example
  6954. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6955. @end example
  6956. @end itemize
  6957. @subsection Commands
  6958. This filter supports same commands as options.
  6959. The command accepts the same syntax of the corresponding option.
  6960. If the specified expression is not valid, it is kept at its current
  6961. value.
  6962. @anchor{drawtext}
  6963. @section drawtext
  6964. Draw a text string or text from a specified file on top of a video, using the
  6965. libfreetype library.
  6966. To enable compilation of this filter, you need to configure FFmpeg with
  6967. @code{--enable-libfreetype}.
  6968. To enable default font fallback and the @var{font} option you need to
  6969. configure FFmpeg with @code{--enable-libfontconfig}.
  6970. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6971. @code{--enable-libfribidi}.
  6972. @subsection Syntax
  6973. It accepts the following parameters:
  6974. @table @option
  6975. @item box
  6976. Used to draw a box around text using the background color.
  6977. The value must be either 1 (enable) or 0 (disable).
  6978. The default value of @var{box} is 0.
  6979. @item boxborderw
  6980. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6981. The default value of @var{boxborderw} is 0.
  6982. @item boxcolor
  6983. The color to be used for drawing box around text. For the syntax of this
  6984. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6985. The default value of @var{boxcolor} is "white".
  6986. @item line_spacing
  6987. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6988. The default value of @var{line_spacing} is 0.
  6989. @item borderw
  6990. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6991. The default value of @var{borderw} is 0.
  6992. @item bordercolor
  6993. Set the color to be used for drawing border around text. For the syntax of this
  6994. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6995. The default value of @var{bordercolor} is "black".
  6996. @item expansion
  6997. Select how the @var{text} is expanded. Can be either @code{none},
  6998. @code{strftime} (deprecated) or
  6999. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  7000. below for details.
  7001. @item basetime
  7002. Set a start time for the count. Value is in microseconds. Only applied
  7003. in the deprecated strftime expansion mode. To emulate in normal expansion
  7004. mode use the @code{pts} function, supplying the start time (in seconds)
  7005. as the second argument.
  7006. @item fix_bounds
  7007. If true, check and fix text coords to avoid clipping.
  7008. @item fontcolor
  7009. The color to be used for drawing fonts. For the syntax of this option, check
  7010. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7011. The default value of @var{fontcolor} is "black".
  7012. @item fontcolor_expr
  7013. String which is expanded the same way as @var{text} to obtain dynamic
  7014. @var{fontcolor} value. By default this option has empty value and is not
  7015. processed. When this option is set, it overrides @var{fontcolor} option.
  7016. @item font
  7017. The font family to be used for drawing text. By default Sans.
  7018. @item fontfile
  7019. The font file to be used for drawing text. The path must be included.
  7020. This parameter is mandatory if the fontconfig support is disabled.
  7021. @item alpha
  7022. Draw the text applying alpha blending. The value can
  7023. be a number between 0.0 and 1.0.
  7024. The expression accepts the same variables @var{x, y} as well.
  7025. The default value is 1.
  7026. Please see @var{fontcolor_expr}.
  7027. @item fontsize
  7028. The font size to be used for drawing text.
  7029. The default value of @var{fontsize} is 16.
  7030. @item text_shaping
  7031. If set to 1, attempt to shape the text (for example, reverse the order of
  7032. right-to-left text and join Arabic characters) before drawing it.
  7033. Otherwise, just draw the text exactly as given.
  7034. By default 1 (if supported).
  7035. @item ft_load_flags
  7036. The flags to be used for loading the fonts.
  7037. The flags map the corresponding flags supported by libfreetype, and are
  7038. a combination of the following values:
  7039. @table @var
  7040. @item default
  7041. @item no_scale
  7042. @item no_hinting
  7043. @item render
  7044. @item no_bitmap
  7045. @item vertical_layout
  7046. @item force_autohint
  7047. @item crop_bitmap
  7048. @item pedantic
  7049. @item ignore_global_advance_width
  7050. @item no_recurse
  7051. @item ignore_transform
  7052. @item monochrome
  7053. @item linear_design
  7054. @item no_autohint
  7055. @end table
  7056. Default value is "default".
  7057. For more information consult the documentation for the FT_LOAD_*
  7058. libfreetype flags.
  7059. @item shadowcolor
  7060. The color to be used for drawing a shadow behind the drawn text. For the
  7061. syntax of this option, check the @ref{color syntax,,"Color" section in the
  7062. ffmpeg-utils manual,ffmpeg-utils}.
  7063. The default value of @var{shadowcolor} is "black".
  7064. @item shadowx
  7065. @item shadowy
  7066. The x and y offsets for the text shadow position with respect to the
  7067. position of the text. They can be either positive or negative
  7068. values. The default value for both is "0".
  7069. @item start_number
  7070. The starting frame number for the n/frame_num variable. The default value
  7071. is "0".
  7072. @item tabsize
  7073. The size in number of spaces to use for rendering the tab.
  7074. Default value is 4.
  7075. @item timecode
  7076. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  7077. format. It can be used with or without text parameter. @var{timecode_rate}
  7078. option must be specified.
  7079. @item timecode_rate, rate, r
  7080. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  7081. integer. Minimum value is "1".
  7082. Drop-frame timecode is supported for frame rates 30 & 60.
  7083. @item tc24hmax
  7084. If set to 1, the output of the timecode option will wrap around at 24 hours.
  7085. Default is 0 (disabled).
  7086. @item text
  7087. The text string to be drawn. The text must be a sequence of UTF-8
  7088. encoded characters.
  7089. This parameter is mandatory if no file is specified with the parameter
  7090. @var{textfile}.
  7091. @item textfile
  7092. A text file containing text to be drawn. The text must be a sequence
  7093. of UTF-8 encoded characters.
  7094. This parameter is mandatory if no text string is specified with the
  7095. parameter @var{text}.
  7096. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7097. @item reload
  7098. If set to 1, the @var{textfile} will be reloaded before each frame.
  7099. Be sure to update it atomically, or it may be read partially, or even fail.
  7100. @item x
  7101. @item y
  7102. The expressions which specify the offsets where text will be drawn
  7103. within the video frame. They are relative to the top/left border of the
  7104. output image.
  7105. The default value of @var{x} and @var{y} is "0".
  7106. See below for the list of accepted constants and functions.
  7107. @end table
  7108. The parameters for @var{x} and @var{y} are expressions containing the
  7109. following constants and functions:
  7110. @table @option
  7111. @item dar
  7112. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7113. @item hsub
  7114. @item vsub
  7115. horizontal and vertical chroma subsample values. For example for the
  7116. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7117. @item line_h, lh
  7118. the height of each text line
  7119. @item main_h, h, H
  7120. the input height
  7121. @item main_w, w, W
  7122. the input width
  7123. @item max_glyph_a, ascent
  7124. the maximum distance from the baseline to the highest/upper grid
  7125. coordinate used to place a glyph outline point, for all the rendered
  7126. glyphs.
  7127. It is a positive value, due to the grid's orientation with the Y axis
  7128. upwards.
  7129. @item max_glyph_d, descent
  7130. the maximum distance from the baseline to the lowest grid coordinate
  7131. used to place a glyph outline point, for all the rendered glyphs.
  7132. This is a negative value, due to the grid's orientation, with the Y axis
  7133. upwards.
  7134. @item max_glyph_h
  7135. maximum glyph height, that is the maximum height for all the glyphs
  7136. contained in the rendered text, it is equivalent to @var{ascent} -
  7137. @var{descent}.
  7138. @item max_glyph_w
  7139. maximum glyph width, that is the maximum width for all the glyphs
  7140. contained in the rendered text
  7141. @item n
  7142. the number of input frame, starting from 0
  7143. @item rand(min, max)
  7144. return a random number included between @var{min} and @var{max}
  7145. @item sar
  7146. The input sample aspect ratio.
  7147. @item t
  7148. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7149. @item text_h, th
  7150. the height of the rendered text
  7151. @item text_w, tw
  7152. the width of the rendered text
  7153. @item x
  7154. @item y
  7155. the x and y offset coordinates where the text is drawn.
  7156. These parameters allow the @var{x} and @var{y} expressions to refer
  7157. to each other, so you can for example specify @code{y=x/dar}.
  7158. @item pict_type
  7159. A one character description of the current frame's picture type.
  7160. @item pkt_pos
  7161. The current packet's position in the input file or stream
  7162. (in bytes, from the start of the input). A value of -1 indicates
  7163. this info is not available.
  7164. @item pkt_duration
  7165. The current packet's duration, in seconds.
  7166. @item pkt_size
  7167. The current packet's size (in bytes).
  7168. @end table
  7169. @anchor{drawtext_expansion}
  7170. @subsection Text expansion
  7171. If @option{expansion} is set to @code{strftime},
  7172. the filter recognizes strftime() sequences in the provided text and
  7173. expands them accordingly. Check the documentation of strftime(). This
  7174. feature is deprecated.
  7175. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7176. If @option{expansion} is set to @code{normal} (which is the default),
  7177. the following expansion mechanism is used.
  7178. The backslash character @samp{\}, followed by any character, always expands to
  7179. the second character.
  7180. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7181. braces is a function name, possibly followed by arguments separated by ':'.
  7182. If the arguments contain special characters or delimiters (':' or '@}'),
  7183. they should be escaped.
  7184. Note that they probably must also be escaped as the value for the
  7185. @option{text} option in the filter argument string and as the filter
  7186. argument in the filtergraph description, and possibly also for the shell,
  7187. that makes up to four levels of escaping; using a text file avoids these
  7188. problems.
  7189. The following functions are available:
  7190. @table @command
  7191. @item expr, e
  7192. The expression evaluation result.
  7193. It must take one argument specifying the expression to be evaluated,
  7194. which accepts the same constants and functions as the @var{x} and
  7195. @var{y} values. Note that not all constants should be used, for
  7196. example the text size is not known when evaluating the expression, so
  7197. the constants @var{text_w} and @var{text_h} will have an undefined
  7198. value.
  7199. @item expr_int_format, eif
  7200. Evaluate the expression's value and output as formatted integer.
  7201. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7202. The second argument specifies the output format. Allowed values are @samp{x},
  7203. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7204. @code{printf} function.
  7205. The third parameter is optional and sets the number of positions taken by the output.
  7206. It can be used to add padding with zeros from the left.
  7207. @item gmtime
  7208. The time at which the filter is running, expressed in UTC.
  7209. It can accept an argument: a strftime() format string.
  7210. @item localtime
  7211. The time at which the filter is running, expressed in the local time zone.
  7212. It can accept an argument: a strftime() format string.
  7213. @item metadata
  7214. Frame metadata. Takes one or two arguments.
  7215. The first argument is mandatory and specifies the metadata key.
  7216. The second argument is optional and specifies a default value, used when the
  7217. metadata key is not found or empty.
  7218. Available metadata can be identified by inspecting entries
  7219. starting with TAG included within each frame section
  7220. printed by running @code{ffprobe -show_frames}.
  7221. String metadata generated in filters leading to
  7222. the drawtext filter are also available.
  7223. @item n, frame_num
  7224. The frame number, starting from 0.
  7225. @item pict_type
  7226. A one character description of the current picture type.
  7227. @item pts
  7228. The timestamp of the current frame.
  7229. It can take up to three arguments.
  7230. The first argument is the format of the timestamp; it defaults to @code{flt}
  7231. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7232. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7233. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7234. @code{localtime} stands for the timestamp of the frame formatted as
  7235. local time zone time.
  7236. The second argument is an offset added to the timestamp.
  7237. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7238. supplied to present the hour part of the formatted timestamp in 24h format
  7239. (00-23).
  7240. If the format is set to @code{localtime} or @code{gmtime},
  7241. a third argument may be supplied: a strftime() format string.
  7242. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7243. @end table
  7244. @subsection Commands
  7245. This filter supports altering parameters via commands:
  7246. @table @option
  7247. @item reinit
  7248. Alter existing filter parameters.
  7249. Syntax for the argument is the same as for filter invocation, e.g.
  7250. @example
  7251. fontsize=56:fontcolor=green:text='Hello World'
  7252. @end example
  7253. Full filter invocation with sendcmd would look like this:
  7254. @example
  7255. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7256. @end example
  7257. @end table
  7258. If the entire argument can't be parsed or applied as valid values then the filter will
  7259. continue with its existing parameters.
  7260. @subsection Examples
  7261. @itemize
  7262. @item
  7263. Draw "Test Text" with font FreeSerif, using the default values for the
  7264. optional parameters.
  7265. @example
  7266. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7267. @end example
  7268. @item
  7269. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7270. and y=50 (counting from the top-left corner of the screen), text is
  7271. yellow with a red box around it. Both the text and the box have an
  7272. opacity of 20%.
  7273. @example
  7274. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7275. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7276. @end example
  7277. Note that the double quotes are not necessary if spaces are not used
  7278. within the parameter list.
  7279. @item
  7280. Show the text at the center of the video frame:
  7281. @example
  7282. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7283. @end example
  7284. @item
  7285. Show the text at a random position, switching to a new position every 30 seconds:
  7286. @example
  7287. 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)"
  7288. @end example
  7289. @item
  7290. Show a text line sliding from right to left in the last row of the video
  7291. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7292. with no newlines.
  7293. @example
  7294. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7295. @end example
  7296. @item
  7297. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7298. @example
  7299. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7300. @end example
  7301. @item
  7302. Draw a single green letter "g", at the center of the input video.
  7303. The glyph baseline is placed at half screen height.
  7304. @example
  7305. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7306. @end example
  7307. @item
  7308. Show text for 1 second every 3 seconds:
  7309. @example
  7310. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7311. @end example
  7312. @item
  7313. Use fontconfig to set the font. Note that the colons need to be escaped.
  7314. @example
  7315. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7316. @end example
  7317. @item
  7318. Print the date of a real-time encoding (see strftime(3)):
  7319. @example
  7320. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7321. @end example
  7322. @item
  7323. Show text fading in and out (appearing/disappearing):
  7324. @example
  7325. #!/bin/sh
  7326. DS=1.0 # display start
  7327. DE=10.0 # display end
  7328. FID=1.5 # fade in duration
  7329. FOD=5 # fade out duration
  7330. 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 @}"
  7331. @end example
  7332. @item
  7333. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7334. and the @option{fontsize} value are included in the @option{y} offset.
  7335. @example
  7336. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7337. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7338. @end example
  7339. @end itemize
  7340. For more information about libfreetype, check:
  7341. @url{http://www.freetype.org/}.
  7342. For more information about fontconfig, check:
  7343. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7344. For more information about libfribidi, check:
  7345. @url{http://fribidi.org/}.
  7346. @section edgedetect
  7347. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7348. The filter accepts the following options:
  7349. @table @option
  7350. @item low
  7351. @item high
  7352. Set low and high threshold values used by the Canny thresholding
  7353. algorithm.
  7354. The high threshold selects the "strong" edge pixels, which are then
  7355. connected through 8-connectivity with the "weak" edge pixels selected
  7356. by the low threshold.
  7357. @var{low} and @var{high} threshold values must be chosen in the range
  7358. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7359. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7360. is @code{50/255}.
  7361. @item mode
  7362. Define the drawing mode.
  7363. @table @samp
  7364. @item wires
  7365. Draw white/gray wires on black background.
  7366. @item colormix
  7367. Mix the colors to create a paint/cartoon effect.
  7368. @item canny
  7369. Apply Canny edge detector on all selected planes.
  7370. @end table
  7371. Default value is @var{wires}.
  7372. @item planes
  7373. Select planes for filtering. By default all available planes are filtered.
  7374. @end table
  7375. @subsection Examples
  7376. @itemize
  7377. @item
  7378. Standard edge detection with custom values for the hysteresis thresholding:
  7379. @example
  7380. edgedetect=low=0.1:high=0.4
  7381. @end example
  7382. @item
  7383. Painting effect without thresholding:
  7384. @example
  7385. edgedetect=mode=colormix:high=0
  7386. @end example
  7387. @end itemize
  7388. @section elbg
  7389. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7390. For each input image, the filter will compute the optimal mapping from
  7391. the input to the output given the codebook length, that is the number
  7392. of distinct output colors.
  7393. This filter accepts the following options.
  7394. @table @option
  7395. @item codebook_length, l
  7396. Set codebook length. The value must be a positive integer, and
  7397. represents the number of distinct output colors. Default value is 256.
  7398. @item nb_steps, n
  7399. Set the maximum number of iterations to apply for computing the optimal
  7400. mapping. The higher the value the better the result and the higher the
  7401. computation time. Default value is 1.
  7402. @item seed, s
  7403. Set a random seed, must be an integer included between 0 and
  7404. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7405. will try to use a good random seed on a best effort basis.
  7406. @item pal8
  7407. Set pal8 output pixel format. This option does not work with codebook
  7408. length greater than 256.
  7409. @end table
  7410. @section entropy
  7411. Measure graylevel entropy in histogram of color channels of video frames.
  7412. It accepts the following parameters:
  7413. @table @option
  7414. @item mode
  7415. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7416. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7417. between neighbour histogram values.
  7418. @end table
  7419. @section eq
  7420. Set brightness, contrast, saturation and approximate gamma adjustment.
  7421. The filter accepts the following options:
  7422. @table @option
  7423. @item contrast
  7424. Set the contrast expression. The value must be a float value in range
  7425. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7426. @item brightness
  7427. Set the brightness expression. The value must be a float value in
  7428. range @code{-1.0} to @code{1.0}. The default value is "0".
  7429. @item saturation
  7430. Set the saturation expression. The value must be a float in
  7431. range @code{0.0} to @code{3.0}. The default value is "1".
  7432. @item gamma
  7433. Set the gamma expression. The value must be a float in range
  7434. @code{0.1} to @code{10.0}. The default value is "1".
  7435. @item gamma_r
  7436. Set the gamma expression for red. The value must be a float in
  7437. range @code{0.1} to @code{10.0}. The default value is "1".
  7438. @item gamma_g
  7439. Set the gamma expression for green. The value must be a float in range
  7440. @code{0.1} to @code{10.0}. The default value is "1".
  7441. @item gamma_b
  7442. Set the gamma expression for blue. The value must be a float in range
  7443. @code{0.1} to @code{10.0}. The default value is "1".
  7444. @item gamma_weight
  7445. Set the gamma weight expression. It can be used to reduce the effect
  7446. of a high gamma value on bright image areas, e.g. keep them from
  7447. getting overamplified and just plain white. The value must be a float
  7448. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7449. gamma correction all the way down while @code{1.0} leaves it at its
  7450. full strength. Default is "1".
  7451. @item eval
  7452. Set when the expressions for brightness, contrast, saturation and
  7453. gamma expressions are evaluated.
  7454. It accepts the following values:
  7455. @table @samp
  7456. @item init
  7457. only evaluate expressions once during the filter initialization or
  7458. when a command is processed
  7459. @item frame
  7460. evaluate expressions for each incoming frame
  7461. @end table
  7462. Default value is @samp{init}.
  7463. @end table
  7464. The expressions accept the following parameters:
  7465. @table @option
  7466. @item n
  7467. frame count of the input frame starting from 0
  7468. @item pos
  7469. byte position of the corresponding packet in the input file, NAN if
  7470. unspecified
  7471. @item r
  7472. frame rate of the input video, NAN if the input frame rate is unknown
  7473. @item t
  7474. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7475. @end table
  7476. @subsection Commands
  7477. The filter supports the following commands:
  7478. @table @option
  7479. @item contrast
  7480. Set the contrast expression.
  7481. @item brightness
  7482. Set the brightness expression.
  7483. @item saturation
  7484. Set the saturation expression.
  7485. @item gamma
  7486. Set the gamma expression.
  7487. @item gamma_r
  7488. Set the gamma_r expression.
  7489. @item gamma_g
  7490. Set gamma_g expression.
  7491. @item gamma_b
  7492. Set gamma_b expression.
  7493. @item gamma_weight
  7494. Set gamma_weight expression.
  7495. The command accepts the same syntax of the corresponding option.
  7496. If the specified expression is not valid, it is kept at its current
  7497. value.
  7498. @end table
  7499. @section erosion
  7500. Apply erosion effect to the video.
  7501. This filter replaces the pixel by the local(3x3) minimum.
  7502. It accepts the following options:
  7503. @table @option
  7504. @item threshold0
  7505. @item threshold1
  7506. @item threshold2
  7507. @item threshold3
  7508. Limit the maximum change for each plane, default is 65535.
  7509. If 0, plane will remain unchanged.
  7510. @item coordinates
  7511. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7512. pixels are used.
  7513. Flags to local 3x3 coordinates maps like this:
  7514. 1 2 3
  7515. 4 5
  7516. 6 7 8
  7517. @end table
  7518. @section extractplanes
  7519. Extract color channel components from input video stream into
  7520. separate grayscale video streams.
  7521. The filter accepts the following option:
  7522. @table @option
  7523. @item planes
  7524. Set plane(s) to extract.
  7525. Available values for planes are:
  7526. @table @samp
  7527. @item y
  7528. @item u
  7529. @item v
  7530. @item a
  7531. @item r
  7532. @item g
  7533. @item b
  7534. @end table
  7535. Choosing planes not available in the input will result in an error.
  7536. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7537. with @code{y}, @code{u}, @code{v} planes at same time.
  7538. @end table
  7539. @subsection Examples
  7540. @itemize
  7541. @item
  7542. Extract luma, u and v color channel component from input video frame
  7543. into 3 grayscale outputs:
  7544. @example
  7545. 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
  7546. @end example
  7547. @end itemize
  7548. @section fade
  7549. Apply a fade-in/out effect to the input video.
  7550. It accepts the following parameters:
  7551. @table @option
  7552. @item type, t
  7553. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7554. effect.
  7555. Default is @code{in}.
  7556. @item start_frame, s
  7557. Specify the number of the frame to start applying the fade
  7558. effect at. Default is 0.
  7559. @item nb_frames, n
  7560. The number of frames that the fade effect lasts. At the end of the
  7561. fade-in effect, the output video will have the same intensity as the input video.
  7562. At the end of the fade-out transition, the output video will be filled with the
  7563. selected @option{color}.
  7564. Default is 25.
  7565. @item alpha
  7566. If set to 1, fade only alpha channel, if one exists on the input.
  7567. Default value is 0.
  7568. @item start_time, st
  7569. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7570. effect. If both start_frame and start_time are specified, the fade will start at
  7571. whichever comes last. Default is 0.
  7572. @item duration, d
  7573. The number of seconds for which the fade effect has to last. At the end of the
  7574. fade-in effect the output video will have the same intensity as the input video,
  7575. at the end of the fade-out transition the output video will be filled with the
  7576. selected @option{color}.
  7577. If both duration and nb_frames are specified, duration is used. Default is 0
  7578. (nb_frames is used by default).
  7579. @item color, c
  7580. Specify the color of the fade. Default is "black".
  7581. @end table
  7582. @subsection Examples
  7583. @itemize
  7584. @item
  7585. Fade in the first 30 frames of video:
  7586. @example
  7587. fade=in:0:30
  7588. @end example
  7589. The command above is equivalent to:
  7590. @example
  7591. fade=t=in:s=0:n=30
  7592. @end example
  7593. @item
  7594. Fade out the last 45 frames of a 200-frame video:
  7595. @example
  7596. fade=out:155:45
  7597. fade=type=out:start_frame=155:nb_frames=45
  7598. @end example
  7599. @item
  7600. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7601. @example
  7602. fade=in:0:25, fade=out:975:25
  7603. @end example
  7604. @item
  7605. Make the first 5 frames yellow, then fade in from frame 5-24:
  7606. @example
  7607. fade=in:5:20:color=yellow
  7608. @end example
  7609. @item
  7610. Fade in alpha over first 25 frames of video:
  7611. @example
  7612. fade=in:0:25:alpha=1
  7613. @end example
  7614. @item
  7615. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7616. @example
  7617. fade=t=in:st=5.5:d=0.5
  7618. @end example
  7619. @end itemize
  7620. @section fftdnoiz
  7621. Denoise frames using 3D FFT (frequency domain filtering).
  7622. The filter accepts the following options:
  7623. @table @option
  7624. @item sigma
  7625. Set the noise sigma constant. This sets denoising strength.
  7626. Default value is 1. Allowed range is from 0 to 30.
  7627. Using very high sigma with low overlap may give blocking artifacts.
  7628. @item amount
  7629. Set amount of denoising. By default all detected noise is reduced.
  7630. Default value is 1. Allowed range is from 0 to 1.
  7631. @item block
  7632. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7633. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7634. block size in pixels is 2^4 which is 16.
  7635. @item overlap
  7636. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7637. @item prev
  7638. Set number of previous frames to use for denoising. By default is set to 0.
  7639. @item next
  7640. Set number of next frames to to use for denoising. By default is set to 0.
  7641. @item planes
  7642. Set planes which will be filtered, by default are all available filtered
  7643. except alpha.
  7644. @end table
  7645. @section fftfilt
  7646. Apply arbitrary expressions to samples in frequency domain
  7647. @table @option
  7648. @item dc_Y
  7649. Adjust the dc value (gain) of the luma plane of the image. The filter
  7650. accepts an integer value in range @code{0} to @code{1000}. The default
  7651. value is set to @code{0}.
  7652. @item dc_U
  7653. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7654. filter accepts an integer value in range @code{0} to @code{1000}. The
  7655. default value is set to @code{0}.
  7656. @item dc_V
  7657. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7658. filter accepts an integer value in range @code{0} to @code{1000}. The
  7659. default value is set to @code{0}.
  7660. @item weight_Y
  7661. Set the frequency domain weight expression for the luma plane.
  7662. @item weight_U
  7663. Set the frequency domain weight expression for the 1st chroma plane.
  7664. @item weight_V
  7665. Set the frequency domain weight expression for the 2nd chroma plane.
  7666. @item eval
  7667. Set when the expressions are evaluated.
  7668. It accepts the following values:
  7669. @table @samp
  7670. @item init
  7671. Only evaluate expressions once during the filter initialization.
  7672. @item frame
  7673. Evaluate expressions for each incoming frame.
  7674. @end table
  7675. Default value is @samp{init}.
  7676. The filter accepts the following variables:
  7677. @item X
  7678. @item Y
  7679. The coordinates of the current sample.
  7680. @item W
  7681. @item H
  7682. The width and height of the image.
  7683. @item N
  7684. The number of input frame, starting from 0.
  7685. @end table
  7686. @subsection Examples
  7687. @itemize
  7688. @item
  7689. High-pass:
  7690. @example
  7691. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7692. @end example
  7693. @item
  7694. Low-pass:
  7695. @example
  7696. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7697. @end example
  7698. @item
  7699. Sharpen:
  7700. @example
  7701. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7702. @end example
  7703. @item
  7704. Blur:
  7705. @example
  7706. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7707. @end example
  7708. @end itemize
  7709. @section field
  7710. Extract a single field from an interlaced image using stride
  7711. arithmetic to avoid wasting CPU time. The output frames are marked as
  7712. non-interlaced.
  7713. The filter accepts the following options:
  7714. @table @option
  7715. @item type
  7716. Specify whether to extract the top (if the value is @code{0} or
  7717. @code{top}) or the bottom field (if the value is @code{1} or
  7718. @code{bottom}).
  7719. @end table
  7720. @section fieldhint
  7721. Create new frames by copying the top and bottom fields from surrounding frames
  7722. supplied as numbers by the hint file.
  7723. @table @option
  7724. @item hint
  7725. Set file containing hints: absolute/relative frame numbers.
  7726. There must be one line for each frame in a clip. Each line must contain two
  7727. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7728. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7729. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7730. for @code{relative} mode. First number tells from which frame to pick up top
  7731. field and second number tells from which frame to pick up bottom field.
  7732. If optionally followed by @code{+} output frame will be marked as interlaced,
  7733. else if followed by @code{-} output frame will be marked as progressive, else
  7734. it will be marked same as input frame.
  7735. If line starts with @code{#} or @code{;} that line is skipped.
  7736. @item mode
  7737. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7738. @end table
  7739. Example of first several lines of @code{hint} file for @code{relative} mode:
  7740. @example
  7741. 0,0 - # first frame
  7742. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7743. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7744. 1,0 -
  7745. 0,0 -
  7746. 0,0 -
  7747. 1,0 -
  7748. 1,0 -
  7749. 1,0 -
  7750. 0,0 -
  7751. 0,0 -
  7752. 1,0 -
  7753. 1,0 -
  7754. 1,0 -
  7755. 0,0 -
  7756. @end example
  7757. @section fieldmatch
  7758. Field matching filter for inverse telecine. It is meant to reconstruct the
  7759. progressive frames from a telecined stream. The filter does not drop duplicated
  7760. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7761. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7762. The separation of the field matching and the decimation is notably motivated by
  7763. the possibility of inserting a de-interlacing filter fallback between the two.
  7764. If the source has mixed telecined and real interlaced content,
  7765. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7766. But these remaining combed frames will be marked as interlaced, and thus can be
  7767. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7768. In addition to the various configuration options, @code{fieldmatch} can take an
  7769. optional second stream, activated through the @option{ppsrc} option. If
  7770. enabled, the frames reconstruction will be based on the fields and frames from
  7771. this second stream. This allows the first input to be pre-processed in order to
  7772. help the various algorithms of the filter, while keeping the output lossless
  7773. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7774. or brightness/contrast adjustments can help.
  7775. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7776. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7777. which @code{fieldmatch} is based on. While the semantic and usage are very
  7778. close, some behaviour and options names can differ.
  7779. The @ref{decimate} filter currently only works for constant frame rate input.
  7780. If your input has mixed telecined (30fps) and progressive content with a lower
  7781. framerate like 24fps use the following filterchain to produce the necessary cfr
  7782. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7783. The filter accepts the following options:
  7784. @table @option
  7785. @item order
  7786. Specify the assumed field order of the input stream. Available values are:
  7787. @table @samp
  7788. @item auto
  7789. Auto detect parity (use FFmpeg's internal parity value).
  7790. @item bff
  7791. Assume bottom field first.
  7792. @item tff
  7793. Assume top field first.
  7794. @end table
  7795. Note that it is sometimes recommended not to trust the parity announced by the
  7796. stream.
  7797. Default value is @var{auto}.
  7798. @item mode
  7799. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7800. sense that it won't risk creating jerkiness due to duplicate frames when
  7801. possible, but if there are bad edits or blended fields it will end up
  7802. outputting combed frames when a good match might actually exist. On the other
  7803. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7804. but will almost always find a good frame if there is one. The other values are
  7805. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7806. jerkiness and creating duplicate frames versus finding good matches in sections
  7807. with bad edits, orphaned fields, blended fields, etc.
  7808. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7809. Available values are:
  7810. @table @samp
  7811. @item pc
  7812. 2-way matching (p/c)
  7813. @item pc_n
  7814. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7815. @item pc_u
  7816. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7817. @item pc_n_ub
  7818. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7819. still combed (p/c + n + u/b)
  7820. @item pcn
  7821. 3-way matching (p/c/n)
  7822. @item pcn_ub
  7823. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7824. detected as combed (p/c/n + u/b)
  7825. @end table
  7826. The parenthesis at the end indicate the matches that would be used for that
  7827. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7828. @var{top}).
  7829. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7830. the slowest.
  7831. Default value is @var{pc_n}.
  7832. @item ppsrc
  7833. Mark the main input stream as a pre-processed input, and enable the secondary
  7834. input stream as the clean source to pick the fields from. See the filter
  7835. introduction for more details. It is similar to the @option{clip2} feature from
  7836. VFM/TFM.
  7837. Default value is @code{0} (disabled).
  7838. @item field
  7839. Set the field to match from. It is recommended to set this to the same value as
  7840. @option{order} unless you experience matching failures with that setting. In
  7841. certain circumstances changing the field that is used to match from can have a
  7842. large impact on matching performance. Available values are:
  7843. @table @samp
  7844. @item auto
  7845. Automatic (same value as @option{order}).
  7846. @item bottom
  7847. Match from the bottom field.
  7848. @item top
  7849. Match from the top field.
  7850. @end table
  7851. Default value is @var{auto}.
  7852. @item mchroma
  7853. Set whether or not chroma is included during the match comparisons. In most
  7854. cases it is recommended to leave this enabled. You should set this to @code{0}
  7855. only if your clip has bad chroma problems such as heavy rainbowing or other
  7856. artifacts. Setting this to @code{0} could also be used to speed things up at
  7857. the cost of some accuracy.
  7858. Default value is @code{1}.
  7859. @item y0
  7860. @item y1
  7861. These define an exclusion band which excludes the lines between @option{y0} and
  7862. @option{y1} from being included in the field matching decision. An exclusion
  7863. band can be used to ignore subtitles, a logo, or other things that may
  7864. interfere with the matching. @option{y0} sets the starting scan line and
  7865. @option{y1} sets the ending line; all lines in between @option{y0} and
  7866. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7867. @option{y0} and @option{y1} to the same value will disable the feature.
  7868. @option{y0} and @option{y1} defaults to @code{0}.
  7869. @item scthresh
  7870. Set the scene change detection threshold as a percentage of maximum change on
  7871. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7872. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7873. @option{scthresh} is @code{[0.0, 100.0]}.
  7874. Default value is @code{12.0}.
  7875. @item combmatch
  7876. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7877. account the combed scores of matches when deciding what match to use as the
  7878. final match. Available values are:
  7879. @table @samp
  7880. @item none
  7881. No final matching based on combed scores.
  7882. @item sc
  7883. Combed scores are only used when a scene change is detected.
  7884. @item full
  7885. Use combed scores all the time.
  7886. @end table
  7887. Default is @var{sc}.
  7888. @item combdbg
  7889. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7890. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7891. Available values are:
  7892. @table @samp
  7893. @item none
  7894. No forced calculation.
  7895. @item pcn
  7896. Force p/c/n calculations.
  7897. @item pcnub
  7898. Force p/c/n/u/b calculations.
  7899. @end table
  7900. Default value is @var{none}.
  7901. @item cthresh
  7902. This is the area combing threshold used for combed frame detection. This
  7903. essentially controls how "strong" or "visible" combing must be to be detected.
  7904. Larger values mean combing must be more visible and smaller values mean combing
  7905. can be less visible or strong and still be detected. Valid settings are from
  7906. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7907. be detected as combed). This is basically a pixel difference value. A good
  7908. range is @code{[8, 12]}.
  7909. Default value is @code{9}.
  7910. @item chroma
  7911. Sets whether or not chroma is considered in the combed frame decision. Only
  7912. disable this if your source has chroma problems (rainbowing, etc.) that are
  7913. causing problems for the combed frame detection with chroma enabled. Actually,
  7914. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7915. where there is chroma only combing in the source.
  7916. Default value is @code{0}.
  7917. @item blockx
  7918. @item blocky
  7919. Respectively set the x-axis and y-axis size of the window used during combed
  7920. frame detection. This has to do with the size of the area in which
  7921. @option{combpel} pixels are required to be detected as combed for a frame to be
  7922. declared combed. See the @option{combpel} parameter description for more info.
  7923. Possible values are any number that is a power of 2 starting at 4 and going up
  7924. to 512.
  7925. Default value is @code{16}.
  7926. @item combpel
  7927. The number of combed pixels inside any of the @option{blocky} by
  7928. @option{blockx} size blocks on the frame for the frame to be detected as
  7929. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7930. setting controls "how much" combing there must be in any localized area (a
  7931. window defined by the @option{blockx} and @option{blocky} settings) on the
  7932. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7933. which point no frames will ever be detected as combed). This setting is known
  7934. as @option{MI} in TFM/VFM vocabulary.
  7935. Default value is @code{80}.
  7936. @end table
  7937. @anchor{p/c/n/u/b meaning}
  7938. @subsection p/c/n/u/b meaning
  7939. @subsubsection p/c/n
  7940. We assume the following telecined stream:
  7941. @example
  7942. Top fields: 1 2 2 3 4
  7943. Bottom fields: 1 2 3 4 4
  7944. @end example
  7945. The numbers correspond to the progressive frame the fields relate to. Here, the
  7946. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7947. When @code{fieldmatch} is configured to run a matching from bottom
  7948. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7949. @example
  7950. Input stream:
  7951. T 1 2 2 3 4
  7952. B 1 2 3 4 4 <-- matching reference
  7953. Matches: c c n n c
  7954. Output stream:
  7955. T 1 2 3 4 4
  7956. B 1 2 3 4 4
  7957. @end example
  7958. As a result of the field matching, we can see that some frames get duplicated.
  7959. To perform a complete inverse telecine, you need to rely on a decimation filter
  7960. after this operation. See for instance the @ref{decimate} filter.
  7961. The same operation now matching from top fields (@option{field}=@var{top})
  7962. looks like this:
  7963. @example
  7964. Input stream:
  7965. T 1 2 2 3 4 <-- matching reference
  7966. B 1 2 3 4 4
  7967. Matches: c c p p c
  7968. Output stream:
  7969. T 1 2 2 3 4
  7970. B 1 2 2 3 4
  7971. @end example
  7972. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7973. basically, they refer to the frame and field of the opposite parity:
  7974. @itemize
  7975. @item @var{p} matches the field of the opposite parity in the previous frame
  7976. @item @var{c} matches the field of the opposite parity in the current frame
  7977. @item @var{n} matches the field of the opposite parity in the next frame
  7978. @end itemize
  7979. @subsubsection u/b
  7980. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7981. from the opposite parity flag. In the following examples, we assume that we are
  7982. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7983. 'x' is placed above and below each matched fields.
  7984. With bottom matching (@option{field}=@var{bottom}):
  7985. @example
  7986. Match: c p n b u
  7987. x x x x x
  7988. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7989. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7990. x x x x x
  7991. Output frames:
  7992. 2 1 2 2 2
  7993. 2 2 2 1 3
  7994. @end example
  7995. With top matching (@option{field}=@var{top}):
  7996. @example
  7997. Match: c p n b u
  7998. x x x x x
  7999. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  8000. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  8001. x x x x x
  8002. Output frames:
  8003. 2 2 2 1 2
  8004. 2 1 3 2 2
  8005. @end example
  8006. @subsection Examples
  8007. Simple IVTC of a top field first telecined stream:
  8008. @example
  8009. fieldmatch=order=tff:combmatch=none, decimate
  8010. @end example
  8011. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  8012. @example
  8013. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  8014. @end example
  8015. @section fieldorder
  8016. Transform the field order of the input video.
  8017. It accepts the following parameters:
  8018. @table @option
  8019. @item order
  8020. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  8021. for bottom field first.
  8022. @end table
  8023. The default value is @samp{tff}.
  8024. The transformation is done by shifting the picture content up or down
  8025. by one line, and filling the remaining line with appropriate picture content.
  8026. This method is consistent with most broadcast field order converters.
  8027. If the input video is not flagged as being interlaced, or it is already
  8028. flagged as being of the required output field order, then this filter does
  8029. not alter the incoming video.
  8030. It is very useful when converting to or from PAL DV material,
  8031. which is bottom field first.
  8032. For example:
  8033. @example
  8034. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  8035. @end example
  8036. @section fifo, afifo
  8037. Buffer input images and send them when they are requested.
  8038. It is mainly useful when auto-inserted by the libavfilter
  8039. framework.
  8040. It does not take parameters.
  8041. @section fillborders
  8042. Fill borders of the input video, without changing video stream dimensions.
  8043. Sometimes video can have garbage at the four edges and you may not want to
  8044. crop video input to keep size multiple of some number.
  8045. This filter accepts the following options:
  8046. @table @option
  8047. @item left
  8048. Number of pixels to fill from left border.
  8049. @item right
  8050. Number of pixels to fill from right border.
  8051. @item top
  8052. Number of pixels to fill from top border.
  8053. @item bottom
  8054. Number of pixels to fill from bottom border.
  8055. @item mode
  8056. Set fill mode.
  8057. It accepts the following values:
  8058. @table @samp
  8059. @item smear
  8060. fill pixels using outermost pixels
  8061. @item mirror
  8062. fill pixels using mirroring
  8063. @item fixed
  8064. fill pixels with constant value
  8065. @end table
  8066. Default is @var{smear}.
  8067. @item color
  8068. Set color for pixels in fixed mode. Default is @var{black}.
  8069. @end table
  8070. @section find_rect
  8071. Find a rectangular object
  8072. It accepts the following options:
  8073. @table @option
  8074. @item object
  8075. Filepath of the object image, needs to be in gray8.
  8076. @item threshold
  8077. Detection threshold, default is 0.5.
  8078. @item mipmaps
  8079. Number of mipmaps, default is 3.
  8080. @item xmin, ymin, xmax, ymax
  8081. Specifies the rectangle in which to search.
  8082. @end table
  8083. @subsection Examples
  8084. @itemize
  8085. @item
  8086. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8087. @example
  8088. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8089. @end example
  8090. @end itemize
  8091. @section floodfill
  8092. Flood area with values of same pixel components with another values.
  8093. It accepts the following options:
  8094. @table @option
  8095. @item x
  8096. Set pixel x coordinate.
  8097. @item y
  8098. Set pixel y coordinate.
  8099. @item s0
  8100. Set source #0 component value.
  8101. @item s1
  8102. Set source #1 component value.
  8103. @item s2
  8104. Set source #2 component value.
  8105. @item s3
  8106. Set source #3 component value.
  8107. @item d0
  8108. Set destination #0 component value.
  8109. @item d1
  8110. Set destination #1 component value.
  8111. @item d2
  8112. Set destination #2 component value.
  8113. @item d3
  8114. Set destination #3 component value.
  8115. @end table
  8116. @anchor{format}
  8117. @section format
  8118. Convert the input video to one of the specified pixel formats.
  8119. Libavfilter will try to pick one that is suitable as input to
  8120. the next filter.
  8121. It accepts the following parameters:
  8122. @table @option
  8123. @item pix_fmts
  8124. A '|'-separated list of pixel format names, such as
  8125. "pix_fmts=yuv420p|monow|rgb24".
  8126. @end table
  8127. @subsection Examples
  8128. @itemize
  8129. @item
  8130. Convert the input video to the @var{yuv420p} format
  8131. @example
  8132. format=pix_fmts=yuv420p
  8133. @end example
  8134. Convert the input video to any of the formats in the list
  8135. @example
  8136. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8137. @end example
  8138. @end itemize
  8139. @anchor{fps}
  8140. @section fps
  8141. Convert the video to specified constant frame rate by duplicating or dropping
  8142. frames as necessary.
  8143. It accepts the following parameters:
  8144. @table @option
  8145. @item fps
  8146. The desired output frame rate. The default is @code{25}.
  8147. @item start_time
  8148. Assume the first PTS should be the given value, in seconds. This allows for
  8149. padding/trimming at the start of stream. By default, no assumption is made
  8150. about the first frame's expected PTS, so no padding or trimming is done.
  8151. For example, this could be set to 0 to pad the beginning with duplicates of
  8152. the first frame if a video stream starts after the audio stream or to trim any
  8153. frames with a negative PTS.
  8154. @item round
  8155. Timestamp (PTS) rounding method.
  8156. Possible values are:
  8157. @table @option
  8158. @item zero
  8159. round towards 0
  8160. @item inf
  8161. round away from 0
  8162. @item down
  8163. round towards -infinity
  8164. @item up
  8165. round towards +infinity
  8166. @item near
  8167. round to nearest
  8168. @end table
  8169. The default is @code{near}.
  8170. @item eof_action
  8171. Action performed when reading the last frame.
  8172. Possible values are:
  8173. @table @option
  8174. @item round
  8175. Use same timestamp rounding method as used for other frames.
  8176. @item pass
  8177. Pass through last frame if input duration has not been reached yet.
  8178. @end table
  8179. The default is @code{round}.
  8180. @end table
  8181. Alternatively, the options can be specified as a flat string:
  8182. @var{fps}[:@var{start_time}[:@var{round}]].
  8183. See also the @ref{setpts} filter.
  8184. @subsection Examples
  8185. @itemize
  8186. @item
  8187. A typical usage in order to set the fps to 25:
  8188. @example
  8189. fps=fps=25
  8190. @end example
  8191. @item
  8192. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8193. @example
  8194. fps=fps=film:round=near
  8195. @end example
  8196. @end itemize
  8197. @section framepack
  8198. Pack two different video streams into a stereoscopic video, setting proper
  8199. metadata on supported codecs. The two views should have the same size and
  8200. framerate and processing will stop when the shorter video ends. Please note
  8201. that you may conveniently adjust view properties with the @ref{scale} and
  8202. @ref{fps} filters.
  8203. It accepts the following parameters:
  8204. @table @option
  8205. @item format
  8206. The desired packing format. Supported values are:
  8207. @table @option
  8208. @item sbs
  8209. The views are next to each other (default).
  8210. @item tab
  8211. The views are on top of each other.
  8212. @item lines
  8213. The views are packed by line.
  8214. @item columns
  8215. The views are packed by column.
  8216. @item frameseq
  8217. The views are temporally interleaved.
  8218. @end table
  8219. @end table
  8220. Some examples:
  8221. @example
  8222. # Convert left and right views into a frame-sequential video
  8223. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8224. # Convert views into a side-by-side video with the same output resolution as the input
  8225. 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
  8226. @end example
  8227. @section framerate
  8228. Change the frame rate by interpolating new video output frames from the source
  8229. frames.
  8230. This filter is not designed to function correctly with interlaced media. If
  8231. you wish to change the frame rate of interlaced media then you are required
  8232. to deinterlace before this filter and re-interlace after this filter.
  8233. A description of the accepted options follows.
  8234. @table @option
  8235. @item fps
  8236. Specify the output frames per second. This option can also be specified
  8237. as a value alone. The default is @code{50}.
  8238. @item interp_start
  8239. Specify the start of a range where the output frame will be created as a
  8240. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8241. the default is @code{15}.
  8242. @item interp_end
  8243. Specify the end of a range where the output frame will be created as a
  8244. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8245. the default is @code{240}.
  8246. @item scene
  8247. Specify the level at which a scene change is detected as a value between
  8248. 0 and 100 to indicate a new scene; a low value reflects a low
  8249. probability for the current frame to introduce a new scene, while a higher
  8250. value means the current frame is more likely to be one.
  8251. The default is @code{8.2}.
  8252. @item flags
  8253. Specify flags influencing the filter process.
  8254. Available value for @var{flags} is:
  8255. @table @option
  8256. @item scene_change_detect, scd
  8257. Enable scene change detection using the value of the option @var{scene}.
  8258. This flag is enabled by default.
  8259. @end table
  8260. @end table
  8261. @section framestep
  8262. Select one frame every N-th frame.
  8263. This filter accepts the following option:
  8264. @table @option
  8265. @item step
  8266. Select frame after every @code{step} frames.
  8267. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8268. @end table
  8269. @section freezedetect
  8270. Detect frozen video.
  8271. This filter logs a message and sets frame metadata when it detects that the
  8272. input video has no significant change in content during a specified duration.
  8273. Video freeze detection calculates the mean average absolute difference of all
  8274. the components of video frames and compares it to a noise floor.
  8275. The printed times and duration are expressed in seconds. The
  8276. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8277. whose timestamp equals or exceeds the detection duration and it contains the
  8278. timestamp of the first frame of the freeze. The
  8279. @code{lavfi.freezedetect.freeze_duration} and
  8280. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8281. after the freeze.
  8282. The filter accepts the following options:
  8283. @table @option
  8284. @item noise, n
  8285. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8286. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8287. 0.001.
  8288. @item duration, d
  8289. Set freeze duration until notification (default is 2 seconds).
  8290. @end table
  8291. @anchor{frei0r}
  8292. @section frei0r
  8293. Apply a frei0r effect to the input video.
  8294. To enable the compilation of this filter, you need to install the frei0r
  8295. header and configure FFmpeg with @code{--enable-frei0r}.
  8296. It accepts the following parameters:
  8297. @table @option
  8298. @item filter_name
  8299. The name of the frei0r effect to load. If the environment variable
  8300. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8301. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8302. Otherwise, the standard frei0r paths are searched, in this order:
  8303. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8304. @file{/usr/lib/frei0r-1/}.
  8305. @item filter_params
  8306. A '|'-separated list of parameters to pass to the frei0r effect.
  8307. @end table
  8308. A frei0r effect parameter can be a boolean (its value is either
  8309. "y" or "n"), a double, a color (specified as
  8310. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8311. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8312. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8313. a position (specified as @var{X}/@var{Y}, where
  8314. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8315. The number and types of parameters depend on the loaded effect. If an
  8316. effect parameter is not specified, the default value is set.
  8317. @subsection Examples
  8318. @itemize
  8319. @item
  8320. Apply the distort0r effect, setting the first two double parameters:
  8321. @example
  8322. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8323. @end example
  8324. @item
  8325. Apply the colordistance effect, taking a color as the first parameter:
  8326. @example
  8327. frei0r=colordistance:0.2/0.3/0.4
  8328. frei0r=colordistance:violet
  8329. frei0r=colordistance:0x112233
  8330. @end example
  8331. @item
  8332. Apply the perspective effect, specifying the top left and top right image
  8333. positions:
  8334. @example
  8335. frei0r=perspective:0.2/0.2|0.8/0.2
  8336. @end example
  8337. @end itemize
  8338. For more information, see
  8339. @url{http://frei0r.dyne.org}
  8340. @section fspp
  8341. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8342. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8343. processing filter, one of them is performed once per block, not per pixel.
  8344. This allows for much higher speed.
  8345. The filter accepts the following options:
  8346. @table @option
  8347. @item quality
  8348. Set quality. This option defines the number of levels for averaging. It accepts
  8349. an integer in the range 4-5. Default value is @code{4}.
  8350. @item qp
  8351. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8352. If not set, the filter will use the QP from the video stream (if available).
  8353. @item strength
  8354. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8355. more details but also more artifacts, while higher values make the image smoother
  8356. but also blurrier. Default value is @code{0} − PSNR optimal.
  8357. @item use_bframe_qp
  8358. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8359. option may cause flicker since the B-Frames have often larger QP. Default is
  8360. @code{0} (not enabled).
  8361. @end table
  8362. @section gblur
  8363. Apply Gaussian blur filter.
  8364. The filter accepts the following options:
  8365. @table @option
  8366. @item sigma
  8367. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8368. @item steps
  8369. Set number of steps for Gaussian approximation. Default is @code{1}.
  8370. @item planes
  8371. Set which planes to filter. By default all planes are filtered.
  8372. @item sigmaV
  8373. Set vertical sigma, if negative it will be same as @code{sigma}.
  8374. Default is @code{-1}.
  8375. @end table
  8376. @subsection Commands
  8377. This filter supports same commands as options.
  8378. The command accepts the same syntax of the corresponding option.
  8379. If the specified expression is not valid, it is kept at its current
  8380. value.
  8381. @section geq
  8382. Apply generic equation to each pixel.
  8383. The filter accepts the following options:
  8384. @table @option
  8385. @item lum_expr, lum
  8386. Set the luminance expression.
  8387. @item cb_expr, cb
  8388. Set the chrominance blue expression.
  8389. @item cr_expr, cr
  8390. Set the chrominance red expression.
  8391. @item alpha_expr, a
  8392. Set the alpha expression.
  8393. @item red_expr, r
  8394. Set the red expression.
  8395. @item green_expr, g
  8396. Set the green expression.
  8397. @item blue_expr, b
  8398. Set the blue expression.
  8399. @end table
  8400. The colorspace is selected according to the specified options. If one
  8401. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8402. options is specified, the filter will automatically select a YCbCr
  8403. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8404. @option{blue_expr} options is specified, it will select an RGB
  8405. colorspace.
  8406. If one of the chrominance expression is not defined, it falls back on the other
  8407. one. If no alpha expression is specified it will evaluate to opaque value.
  8408. If none of chrominance expressions are specified, they will evaluate
  8409. to the luminance expression.
  8410. The expressions can use the following variables and functions:
  8411. @table @option
  8412. @item N
  8413. The sequential number of the filtered frame, starting from @code{0}.
  8414. @item X
  8415. @item Y
  8416. The coordinates of the current sample.
  8417. @item W
  8418. @item H
  8419. The width and height of the image.
  8420. @item SW
  8421. @item SH
  8422. Width and height scale depending on the currently filtered plane. It is the
  8423. ratio between the corresponding luma plane number of pixels and the current
  8424. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8425. @code{0.5,0.5} for chroma planes.
  8426. @item T
  8427. Time of the current frame, expressed in seconds.
  8428. @item p(x, y)
  8429. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8430. plane.
  8431. @item lum(x, y)
  8432. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8433. plane.
  8434. @item cb(x, y)
  8435. Return the value of the pixel at location (@var{x},@var{y}) of the
  8436. blue-difference chroma plane. Return 0 if there is no such plane.
  8437. @item cr(x, y)
  8438. Return the value of the pixel at location (@var{x},@var{y}) of the
  8439. red-difference chroma plane. Return 0 if there is no such plane.
  8440. @item r(x, y)
  8441. @item g(x, y)
  8442. @item b(x, y)
  8443. Return the value of the pixel at location (@var{x},@var{y}) of the
  8444. red/green/blue component. Return 0 if there is no such component.
  8445. @item alpha(x, y)
  8446. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8447. plane. Return 0 if there is no such plane.
  8448. @item interpolation
  8449. Set one of interpolation methods:
  8450. @table @option
  8451. @item nearest, n
  8452. @item bilinear, b
  8453. @end table
  8454. Default is bilinear.
  8455. @end table
  8456. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8457. automatically clipped to the closer edge.
  8458. @subsection Examples
  8459. @itemize
  8460. @item
  8461. Flip the image horizontally:
  8462. @example
  8463. geq=p(W-X\,Y)
  8464. @end example
  8465. @item
  8466. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8467. wavelength of 100 pixels:
  8468. @example
  8469. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8470. @end example
  8471. @item
  8472. Generate a fancy enigmatic moving light:
  8473. @example
  8474. 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
  8475. @end example
  8476. @item
  8477. Generate a quick emboss effect:
  8478. @example
  8479. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8480. @end example
  8481. @item
  8482. Modify RGB components depending on pixel position:
  8483. @example
  8484. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8485. @end example
  8486. @item
  8487. Create a radial gradient that is the same size as the input (also see
  8488. the @ref{vignette} filter):
  8489. @example
  8490. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8491. @end example
  8492. @end itemize
  8493. @section gradfun
  8494. Fix the banding artifacts that are sometimes introduced into nearly flat
  8495. regions by truncation to 8-bit color depth.
  8496. Interpolate the gradients that should go where the bands are, and
  8497. dither them.
  8498. It is designed for playback only. Do not use it prior to
  8499. lossy compression, because compression tends to lose the dither and
  8500. bring back the bands.
  8501. It accepts the following parameters:
  8502. @table @option
  8503. @item strength
  8504. The maximum amount by which the filter will change any one pixel. This is also
  8505. the threshold for detecting nearly flat regions. Acceptable values range from
  8506. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8507. valid range.
  8508. @item radius
  8509. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8510. gradients, but also prevents the filter from modifying the pixels near detailed
  8511. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8512. values will be clipped to the valid range.
  8513. @end table
  8514. Alternatively, the options can be specified as a flat string:
  8515. @var{strength}[:@var{radius}]
  8516. @subsection Examples
  8517. @itemize
  8518. @item
  8519. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8520. @example
  8521. gradfun=3.5:8
  8522. @end example
  8523. @item
  8524. Specify radius, omitting the strength (which will fall-back to the default
  8525. value):
  8526. @example
  8527. gradfun=radius=8
  8528. @end example
  8529. @end itemize
  8530. @section graphmonitor, agraphmonitor
  8531. Show various filtergraph stats.
  8532. With this filter one can debug complete filtergraph.
  8533. Especially issues with links filling with queued frames.
  8534. The filter accepts the following options:
  8535. @table @option
  8536. @item size, s
  8537. Set video output size. Default is @var{hd720}.
  8538. @item opacity, o
  8539. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8540. @item mode, m
  8541. Set output mode, can be @var{fulll} or @var{compact}.
  8542. In @var{compact} mode only filters with some queued frames have displayed stats.
  8543. @item flags, f
  8544. Set flags which enable which stats are shown in video.
  8545. Available values for flags are:
  8546. @table @samp
  8547. @item queue
  8548. Display number of queued frames in each link.
  8549. @item frame_count_in
  8550. Display number of frames taken from filter.
  8551. @item frame_count_out
  8552. Display number of frames given out from filter.
  8553. @item pts
  8554. Display current filtered frame pts.
  8555. @item time
  8556. Display current filtered frame time.
  8557. @item timebase
  8558. Display time base for filter link.
  8559. @item format
  8560. Display used format for filter link.
  8561. @item size
  8562. Display video size or number of audio channels in case of audio used by filter link.
  8563. @item rate
  8564. Display video frame rate or sample rate in case of audio used by filter link.
  8565. @end table
  8566. @item rate, r
  8567. Set upper limit for video rate of output stream, Default value is @var{25}.
  8568. This guarantee that output video frame rate will not be higher than this value.
  8569. @end table
  8570. @section greyedge
  8571. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8572. and corrects the scene colors accordingly.
  8573. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8574. The filter accepts the following options:
  8575. @table @option
  8576. @item difford
  8577. The order of differentiation to be applied on the scene. Must be chosen in the range
  8578. [0,2] and default value is 1.
  8579. @item minknorm
  8580. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8581. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8582. max value instead of calculating Minkowski distance.
  8583. @item sigma
  8584. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8585. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8586. can't be equal to 0 if @var{difford} is greater than 0.
  8587. @end table
  8588. @subsection Examples
  8589. @itemize
  8590. @item
  8591. Grey Edge:
  8592. @example
  8593. greyedge=difford=1:minknorm=5:sigma=2
  8594. @end example
  8595. @item
  8596. Max Edge:
  8597. @example
  8598. greyedge=difford=1:minknorm=0:sigma=2
  8599. @end example
  8600. @end itemize
  8601. @anchor{haldclut}
  8602. @section haldclut
  8603. Apply a Hald CLUT to a video stream.
  8604. First input is the video stream to process, and second one is the Hald CLUT.
  8605. The Hald CLUT input can be a simple picture or a complete video stream.
  8606. The filter accepts the following options:
  8607. @table @option
  8608. @item shortest
  8609. Force termination when the shortest input terminates. Default is @code{0}.
  8610. @item repeatlast
  8611. Continue applying the last CLUT after the end of the stream. A value of
  8612. @code{0} disable the filter after the last frame of the CLUT is reached.
  8613. Default is @code{1}.
  8614. @end table
  8615. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8616. filters share the same internals).
  8617. This filter also supports the @ref{framesync} options.
  8618. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8619. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8620. @subsection Workflow examples
  8621. @subsubsection Hald CLUT video stream
  8622. Generate an identity Hald CLUT stream altered with various effects:
  8623. @example
  8624. 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
  8625. @end example
  8626. Note: make sure you use a lossless codec.
  8627. Then use it with @code{haldclut} to apply it on some random stream:
  8628. @example
  8629. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8630. @end example
  8631. The Hald CLUT will be applied to the 10 first seconds (duration of
  8632. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8633. to the remaining frames of the @code{mandelbrot} stream.
  8634. @subsubsection Hald CLUT with preview
  8635. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8636. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8637. biggest possible square starting at the top left of the picture. The remaining
  8638. padding pixels (bottom or right) will be ignored. This area can be used to add
  8639. a preview of the Hald CLUT.
  8640. Typically, the following generated Hald CLUT will be supported by the
  8641. @code{haldclut} filter:
  8642. @example
  8643. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8644. pad=iw+320 [padded_clut];
  8645. smptebars=s=320x256, split [a][b];
  8646. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8647. [main][b] overlay=W-320" -frames:v 1 clut.png
  8648. @end example
  8649. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8650. bars are displayed on the right-top, and below the same color bars processed by
  8651. the color changes.
  8652. Then, the effect of this Hald CLUT can be visualized with:
  8653. @example
  8654. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8655. @end example
  8656. @section hflip
  8657. Flip the input video horizontally.
  8658. For example, to horizontally flip the input video with @command{ffmpeg}:
  8659. @example
  8660. ffmpeg -i in.avi -vf "hflip" out.avi
  8661. @end example
  8662. @section histeq
  8663. This filter applies a global color histogram equalization on a
  8664. per-frame basis.
  8665. It can be used to correct video that has a compressed range of pixel
  8666. intensities. The filter redistributes the pixel intensities to
  8667. equalize their distribution across the intensity range. It may be
  8668. viewed as an "automatically adjusting contrast filter". This filter is
  8669. useful only for correcting degraded or poorly captured source
  8670. video.
  8671. The filter accepts the following options:
  8672. @table @option
  8673. @item strength
  8674. Determine the amount of equalization to be applied. As the strength
  8675. is reduced, the distribution of pixel intensities more-and-more
  8676. approaches that of the input frame. The value must be a float number
  8677. in the range [0,1] and defaults to 0.200.
  8678. @item intensity
  8679. Set the maximum intensity that can generated and scale the output
  8680. values appropriately. The strength should be set as desired and then
  8681. the intensity can be limited if needed to avoid washing-out. The value
  8682. must be a float number in the range [0,1] and defaults to 0.210.
  8683. @item antibanding
  8684. Set the antibanding level. If enabled the filter will randomly vary
  8685. the luminance of output pixels by a small amount to avoid banding of
  8686. the histogram. Possible values are @code{none}, @code{weak} or
  8687. @code{strong}. It defaults to @code{none}.
  8688. @end table
  8689. @section histogram
  8690. Compute and draw a color distribution histogram for the input video.
  8691. The computed histogram is a representation of the color component
  8692. distribution in an image.
  8693. Standard histogram displays the color components distribution in an image.
  8694. Displays color graph for each color component. Shows distribution of
  8695. the Y, U, V, A or R, G, B components, depending on input format, in the
  8696. current frame. Below each graph a color component scale meter is shown.
  8697. The filter accepts the following options:
  8698. @table @option
  8699. @item level_height
  8700. Set height of level. Default value is @code{200}.
  8701. Allowed range is [50, 2048].
  8702. @item scale_height
  8703. Set height of color scale. Default value is @code{12}.
  8704. Allowed range is [0, 40].
  8705. @item display_mode
  8706. Set display mode.
  8707. It accepts the following values:
  8708. @table @samp
  8709. @item stack
  8710. Per color component graphs are placed below each other.
  8711. @item parade
  8712. Per color component graphs are placed side by side.
  8713. @item overlay
  8714. Presents information identical to that in the @code{parade}, except
  8715. that the graphs representing color components are superimposed directly
  8716. over one another.
  8717. @end table
  8718. Default is @code{stack}.
  8719. @item levels_mode
  8720. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8721. Default is @code{linear}.
  8722. @item components
  8723. Set what color components to display.
  8724. Default is @code{7}.
  8725. @item fgopacity
  8726. Set foreground opacity. Default is @code{0.7}.
  8727. @item bgopacity
  8728. Set background opacity. Default is @code{0.5}.
  8729. @end table
  8730. @subsection Examples
  8731. @itemize
  8732. @item
  8733. Calculate and draw histogram:
  8734. @example
  8735. ffplay -i input -vf histogram
  8736. @end example
  8737. @end itemize
  8738. @anchor{hqdn3d}
  8739. @section hqdn3d
  8740. This is a high precision/quality 3d denoise filter. It aims to reduce
  8741. image noise, producing smooth images and making still images really
  8742. still. It should enhance compressibility.
  8743. It accepts the following optional parameters:
  8744. @table @option
  8745. @item luma_spatial
  8746. A non-negative floating point number which specifies spatial luma strength.
  8747. It defaults to 4.0.
  8748. @item chroma_spatial
  8749. A non-negative floating point number which specifies spatial chroma strength.
  8750. It defaults to 3.0*@var{luma_spatial}/4.0.
  8751. @item luma_tmp
  8752. A floating point number which specifies luma temporal strength. It defaults to
  8753. 6.0*@var{luma_spatial}/4.0.
  8754. @item chroma_tmp
  8755. A floating point number which specifies chroma temporal strength. It defaults to
  8756. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8757. @end table
  8758. @anchor{hwdownload}
  8759. @section hwdownload
  8760. Download hardware frames to system memory.
  8761. The input must be in hardware frames, and the output a non-hardware format.
  8762. Not all formats will be supported on the output - it may be necessary to insert
  8763. an additional @option{format} filter immediately following in the graph to get
  8764. the output in a supported format.
  8765. @section hwmap
  8766. Map hardware frames to system memory or to another device.
  8767. This filter has several different modes of operation; which one is used depends
  8768. on the input and output formats:
  8769. @itemize
  8770. @item
  8771. Hardware frame input, normal frame output
  8772. Map the input frames to system memory and pass them to the output. If the
  8773. original hardware frame is later required (for example, after overlaying
  8774. something else on part of it), the @option{hwmap} filter can be used again
  8775. in the next mode to retrieve it.
  8776. @item
  8777. Normal frame input, hardware frame output
  8778. If the input is actually a software-mapped hardware frame, then unmap it -
  8779. that is, return the original hardware frame.
  8780. Otherwise, a device must be provided. Create new hardware surfaces on that
  8781. device for the output, then map them back to the software format at the input
  8782. and give those frames to the preceding filter. This will then act like the
  8783. @option{hwupload} filter, but may be able to avoid an additional copy when
  8784. the input is already in a compatible format.
  8785. @item
  8786. Hardware frame input and output
  8787. A device must be supplied for the output, either directly or with the
  8788. @option{derive_device} option. The input and output devices must be of
  8789. different types and compatible - the exact meaning of this is
  8790. system-dependent, but typically it means that they must refer to the same
  8791. underlying hardware context (for example, refer to the same graphics card).
  8792. If the input frames were originally created on the output device, then unmap
  8793. to retrieve the original frames.
  8794. Otherwise, map the frames to the output device - create new hardware frames
  8795. on the output corresponding to the frames on the input.
  8796. @end itemize
  8797. The following additional parameters are accepted:
  8798. @table @option
  8799. @item mode
  8800. Set the frame mapping mode. Some combination of:
  8801. @table @var
  8802. @item read
  8803. The mapped frame should be readable.
  8804. @item write
  8805. The mapped frame should be writeable.
  8806. @item overwrite
  8807. The mapping will always overwrite the entire frame.
  8808. This may improve performance in some cases, as the original contents of the
  8809. frame need not be loaded.
  8810. @item direct
  8811. The mapping must not involve any copying.
  8812. Indirect mappings to copies of frames are created in some cases where either
  8813. direct mapping is not possible or it would have unexpected properties.
  8814. Setting this flag ensures that the mapping is direct and will fail if that is
  8815. not possible.
  8816. @end table
  8817. Defaults to @var{read+write} if not specified.
  8818. @item derive_device @var{type}
  8819. Rather than using the device supplied at initialisation, instead derive a new
  8820. device of type @var{type} from the device the input frames exist on.
  8821. @item reverse
  8822. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8823. and map them back to the source. This may be necessary in some cases where
  8824. a mapping in one direction is required but only the opposite direction is
  8825. supported by the devices being used.
  8826. This option is dangerous - it may break the preceding filter in undefined
  8827. ways if there are any additional constraints on that filter's output.
  8828. Do not use it without fully understanding the implications of its use.
  8829. @end table
  8830. @anchor{hwupload}
  8831. @section hwupload
  8832. Upload system memory frames to hardware surfaces.
  8833. The device to upload to must be supplied when the filter is initialised. If
  8834. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8835. option.
  8836. @anchor{hwupload_cuda}
  8837. @section hwupload_cuda
  8838. Upload system memory frames to a CUDA device.
  8839. It accepts the following optional parameters:
  8840. @table @option
  8841. @item device
  8842. The number of the CUDA device to use
  8843. @end table
  8844. @section hqx
  8845. Apply a high-quality magnification filter designed for pixel art. This filter
  8846. was originally created by Maxim Stepin.
  8847. It accepts the following option:
  8848. @table @option
  8849. @item n
  8850. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8851. @code{hq3x} and @code{4} for @code{hq4x}.
  8852. Default is @code{3}.
  8853. @end table
  8854. @section hstack
  8855. Stack input videos horizontally.
  8856. All streams must be of same pixel format and of same height.
  8857. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8858. to create same output.
  8859. The filter accepts the following option:
  8860. @table @option
  8861. @item inputs
  8862. Set number of input streams. Default is 2.
  8863. @item shortest
  8864. If set to 1, force the output to terminate when the shortest input
  8865. terminates. Default value is 0.
  8866. @end table
  8867. @section hue
  8868. Modify the hue and/or the saturation of the input.
  8869. It accepts the following parameters:
  8870. @table @option
  8871. @item h
  8872. Specify the hue angle as a number of degrees. It accepts an expression,
  8873. and defaults to "0".
  8874. @item s
  8875. Specify the saturation in the [-10,10] range. It accepts an expression and
  8876. defaults to "1".
  8877. @item H
  8878. Specify the hue angle as a number of radians. It accepts an
  8879. expression, and defaults to "0".
  8880. @item b
  8881. Specify the brightness in the [-10,10] range. It accepts an expression and
  8882. defaults to "0".
  8883. @end table
  8884. @option{h} and @option{H} are mutually exclusive, and can't be
  8885. specified at the same time.
  8886. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8887. expressions containing the following constants:
  8888. @table @option
  8889. @item n
  8890. frame count of the input frame starting from 0
  8891. @item pts
  8892. presentation timestamp of the input frame expressed in time base units
  8893. @item r
  8894. frame rate of the input video, NAN if the input frame rate is unknown
  8895. @item t
  8896. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8897. @item tb
  8898. time base of the input video
  8899. @end table
  8900. @subsection Examples
  8901. @itemize
  8902. @item
  8903. Set the hue to 90 degrees and the saturation to 1.0:
  8904. @example
  8905. hue=h=90:s=1
  8906. @end example
  8907. @item
  8908. Same command but expressing the hue in radians:
  8909. @example
  8910. hue=H=PI/2:s=1
  8911. @end example
  8912. @item
  8913. Rotate hue and make the saturation swing between 0
  8914. and 2 over a period of 1 second:
  8915. @example
  8916. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8917. @end example
  8918. @item
  8919. Apply a 3 seconds saturation fade-in effect starting at 0:
  8920. @example
  8921. hue="s=min(t/3\,1)"
  8922. @end example
  8923. The general fade-in expression can be written as:
  8924. @example
  8925. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8926. @end example
  8927. @item
  8928. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8929. @example
  8930. hue="s=max(0\, min(1\, (8-t)/3))"
  8931. @end example
  8932. The general fade-out expression can be written as:
  8933. @example
  8934. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8935. @end example
  8936. @end itemize
  8937. @subsection Commands
  8938. This filter supports the following commands:
  8939. @table @option
  8940. @item b
  8941. @item s
  8942. @item h
  8943. @item H
  8944. Modify the hue and/or the saturation and/or brightness of the input video.
  8945. The command accepts the same syntax of the corresponding option.
  8946. If the specified expression is not valid, it is kept at its current
  8947. value.
  8948. @end table
  8949. @section hysteresis
  8950. Grow first stream into second stream by connecting components.
  8951. This makes it possible to build more robust edge masks.
  8952. This filter accepts the following options:
  8953. @table @option
  8954. @item planes
  8955. Set which planes will be processed as bitmap, unprocessed planes will be
  8956. copied from first stream.
  8957. By default value 0xf, all planes will be processed.
  8958. @item threshold
  8959. Set threshold which is used in filtering. If pixel component value is higher than
  8960. this value filter algorithm for connecting components is activated.
  8961. By default value is 0.
  8962. @end table
  8963. @section idet
  8964. Detect video interlacing type.
  8965. This filter tries to detect if the input frames are interlaced, progressive,
  8966. top or bottom field first. It will also try to detect fields that are
  8967. repeated between adjacent frames (a sign of telecine).
  8968. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8969. Multiple frame detection incorporates the classification history of previous frames.
  8970. The filter will log these metadata values:
  8971. @table @option
  8972. @item single.current_frame
  8973. Detected type of current frame using single-frame detection. One of:
  8974. ``tff'' (top field first), ``bff'' (bottom field first),
  8975. ``progressive'', or ``undetermined''
  8976. @item single.tff
  8977. Cumulative number of frames detected as top field first using single-frame detection.
  8978. @item multiple.tff
  8979. Cumulative number of frames detected as top field first using multiple-frame detection.
  8980. @item single.bff
  8981. Cumulative number of frames detected as bottom field first using single-frame detection.
  8982. @item multiple.current_frame
  8983. Detected type of current frame using multiple-frame detection. One of:
  8984. ``tff'' (top field first), ``bff'' (bottom field first),
  8985. ``progressive'', or ``undetermined''
  8986. @item multiple.bff
  8987. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8988. @item single.progressive
  8989. Cumulative number of frames detected as progressive using single-frame detection.
  8990. @item multiple.progressive
  8991. Cumulative number of frames detected as progressive using multiple-frame detection.
  8992. @item single.undetermined
  8993. Cumulative number of frames that could not be classified using single-frame detection.
  8994. @item multiple.undetermined
  8995. Cumulative number of frames that could not be classified using multiple-frame detection.
  8996. @item repeated.current_frame
  8997. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8998. @item repeated.neither
  8999. Cumulative number of frames with no repeated field.
  9000. @item repeated.top
  9001. Cumulative number of frames with the top field repeated from the previous frame's top field.
  9002. @item repeated.bottom
  9003. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  9004. @end table
  9005. The filter accepts the following options:
  9006. @table @option
  9007. @item intl_thres
  9008. Set interlacing threshold.
  9009. @item prog_thres
  9010. Set progressive threshold.
  9011. @item rep_thres
  9012. Threshold for repeated field detection.
  9013. @item half_life
  9014. Number of frames after which a given frame's contribution to the
  9015. statistics is halved (i.e., it contributes only 0.5 to its
  9016. classification). The default of 0 means that all frames seen are given
  9017. full weight of 1.0 forever.
  9018. @item analyze_interlaced_flag
  9019. When this is not 0 then idet will use the specified number of frames to determine
  9020. if the interlaced flag is accurate, it will not count undetermined frames.
  9021. If the flag is found to be accurate it will be used without any further
  9022. computations, if it is found to be inaccurate it will be cleared without any
  9023. further computations. This allows inserting the idet filter as a low computational
  9024. method to clean up the interlaced flag
  9025. @end table
  9026. @section il
  9027. Deinterleave or interleave fields.
  9028. This filter allows one to process interlaced images fields without
  9029. deinterlacing them. Deinterleaving splits the input frame into 2
  9030. fields (so called half pictures). Odd lines are moved to the top
  9031. half of the output image, even lines to the bottom half.
  9032. You can process (filter) them independently and then re-interleave them.
  9033. The filter accepts the following options:
  9034. @table @option
  9035. @item luma_mode, l
  9036. @item chroma_mode, c
  9037. @item alpha_mode, a
  9038. Available values for @var{luma_mode}, @var{chroma_mode} and
  9039. @var{alpha_mode} are:
  9040. @table @samp
  9041. @item none
  9042. Do nothing.
  9043. @item deinterleave, d
  9044. Deinterleave fields, placing one above the other.
  9045. @item interleave, i
  9046. Interleave fields. Reverse the effect of deinterleaving.
  9047. @end table
  9048. Default value is @code{none}.
  9049. @item luma_swap, ls
  9050. @item chroma_swap, cs
  9051. @item alpha_swap, as
  9052. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  9053. @end table
  9054. @section inflate
  9055. Apply inflate effect to the video.
  9056. This filter replaces the pixel by the local(3x3) average by taking into account
  9057. only values higher than the pixel.
  9058. It accepts the following options:
  9059. @table @option
  9060. @item threshold0
  9061. @item threshold1
  9062. @item threshold2
  9063. @item threshold3
  9064. Limit the maximum change for each plane, default is 65535.
  9065. If 0, plane will remain unchanged.
  9066. @end table
  9067. @section interlace
  9068. Simple interlacing filter from progressive contents. This interleaves upper (or
  9069. lower) lines from odd frames with lower (or upper) lines from even frames,
  9070. halving the frame rate and preserving image height.
  9071. @example
  9072. Original Original New Frame
  9073. Frame 'j' Frame 'j+1' (tff)
  9074. ========== =========== ==================
  9075. Line 0 --------------------> Frame 'j' Line 0
  9076. Line 1 Line 1 ----> Frame 'j+1' Line 1
  9077. Line 2 ---------------------> Frame 'j' Line 2
  9078. Line 3 Line 3 ----> Frame 'j+1' Line 3
  9079. ... ... ...
  9080. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  9081. @end example
  9082. It accepts the following optional parameters:
  9083. @table @option
  9084. @item scan
  9085. This determines whether the interlaced frame is taken from the even
  9086. (tff - default) or odd (bff) lines of the progressive frame.
  9087. @item lowpass
  9088. Vertical lowpass filter to avoid twitter interlacing and
  9089. reduce moire patterns.
  9090. @table @samp
  9091. @item 0, off
  9092. Disable vertical lowpass filter
  9093. @item 1, linear
  9094. Enable linear filter (default)
  9095. @item 2, complex
  9096. Enable complex filter. This will slightly less reduce twitter and moire
  9097. but better retain detail and subjective sharpness impression.
  9098. @end table
  9099. @end table
  9100. @section kerndeint
  9101. Deinterlace input video by applying Donald Graft's adaptive kernel
  9102. deinterling. Work on interlaced parts of a video to produce
  9103. progressive frames.
  9104. The description of the accepted parameters follows.
  9105. @table @option
  9106. @item thresh
  9107. Set the threshold which affects the filter's tolerance when
  9108. determining if a pixel line must be processed. It must be an integer
  9109. in the range [0,255] and defaults to 10. A value of 0 will result in
  9110. applying the process on every pixels.
  9111. @item map
  9112. Paint pixels exceeding the threshold value to white if set to 1.
  9113. Default is 0.
  9114. @item order
  9115. Set the fields order. Swap fields if set to 1, leave fields alone if
  9116. 0. Default is 0.
  9117. @item sharp
  9118. Enable additional sharpening if set to 1. Default is 0.
  9119. @item twoway
  9120. Enable twoway sharpening if set to 1. Default is 0.
  9121. @end table
  9122. @subsection Examples
  9123. @itemize
  9124. @item
  9125. Apply default values:
  9126. @example
  9127. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9128. @end example
  9129. @item
  9130. Enable additional sharpening:
  9131. @example
  9132. kerndeint=sharp=1
  9133. @end example
  9134. @item
  9135. Paint processed pixels in white:
  9136. @example
  9137. kerndeint=map=1
  9138. @end example
  9139. @end itemize
  9140. @section lagfun
  9141. Slowly update darker pixels.
  9142. This filter makes short flashes of light appear longer.
  9143. This filter accepts the following options:
  9144. @table @option
  9145. @item decay
  9146. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9147. @item planes
  9148. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9149. @end table
  9150. @section lenscorrection
  9151. Correct radial lens distortion
  9152. This filter can be used to correct for radial distortion as can result from the use
  9153. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9154. one can use tools available for example as part of opencv or simply trial-and-error.
  9155. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9156. and extract the k1 and k2 coefficients from the resulting matrix.
  9157. Note that effectively the same filter is available in the open-source tools Krita and
  9158. Digikam from the KDE project.
  9159. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9160. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9161. brightness distribution, so you may want to use both filters together in certain
  9162. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9163. be applied before or after lens correction.
  9164. @subsection Options
  9165. The filter accepts the following options:
  9166. @table @option
  9167. @item cx
  9168. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9169. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9170. width. Default is 0.5.
  9171. @item cy
  9172. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9173. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9174. height. Default is 0.5.
  9175. @item k1
  9176. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9177. no correction. Default is 0.
  9178. @item k2
  9179. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9180. 0 means no correction. Default is 0.
  9181. @end table
  9182. The formula that generates the correction is:
  9183. @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)
  9184. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9185. distances from the focal point in the source and target images, respectively.
  9186. @section lensfun
  9187. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9188. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9189. to apply the lens correction. The filter will load the lensfun database and
  9190. query it to find the corresponding camera and lens entries in the database. As
  9191. long as these entries can be found with the given options, the filter can
  9192. perform corrections on frames. Note that incomplete strings will result in the
  9193. filter choosing the best match with the given options, and the filter will
  9194. output the chosen camera and lens models (logged with level "info"). You must
  9195. provide the make, camera model, and lens model as they are required.
  9196. The filter accepts the following options:
  9197. @table @option
  9198. @item make
  9199. The make of the camera (for example, "Canon"). This option is required.
  9200. @item model
  9201. The model of the camera (for example, "Canon EOS 100D"). This option is
  9202. required.
  9203. @item lens_model
  9204. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9205. option is required.
  9206. @item mode
  9207. The type of correction to apply. The following values are valid options:
  9208. @table @samp
  9209. @item vignetting
  9210. Enables fixing lens vignetting.
  9211. @item geometry
  9212. Enables fixing lens geometry. This is the default.
  9213. @item subpixel
  9214. Enables fixing chromatic aberrations.
  9215. @item vig_geo
  9216. Enables fixing lens vignetting and lens geometry.
  9217. @item vig_subpixel
  9218. Enables fixing lens vignetting and chromatic aberrations.
  9219. @item distortion
  9220. Enables fixing both lens geometry and chromatic aberrations.
  9221. @item all
  9222. Enables all possible corrections.
  9223. @end table
  9224. @item focal_length
  9225. The focal length of the image/video (zoom; expected constant for video). For
  9226. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9227. range should be chosen when using that lens. Default 18.
  9228. @item aperture
  9229. The aperture of the image/video (expected constant for video). Note that
  9230. aperture is only used for vignetting correction. Default 3.5.
  9231. @item focus_distance
  9232. The focus distance of the image/video (expected constant for video). Note that
  9233. focus distance is only used for vignetting and only slightly affects the
  9234. vignetting correction process. If unknown, leave it at the default value (which
  9235. is 1000).
  9236. @item scale
  9237. The scale factor which is applied after transformation. After correction the
  9238. video is no longer necessarily rectangular. This parameter controls how much of
  9239. the resulting image is visible. The value 0 means that a value will be chosen
  9240. automatically such that there is little or no unmapped area in the output
  9241. image. 1.0 means that no additional scaling is done. Lower values may result
  9242. in more of the corrected image being visible, while higher values may avoid
  9243. unmapped areas in the output.
  9244. @item target_geometry
  9245. The target geometry of the output image/video. The following values are valid
  9246. options:
  9247. @table @samp
  9248. @item rectilinear (default)
  9249. @item fisheye
  9250. @item panoramic
  9251. @item equirectangular
  9252. @item fisheye_orthographic
  9253. @item fisheye_stereographic
  9254. @item fisheye_equisolid
  9255. @item fisheye_thoby
  9256. @end table
  9257. @item reverse
  9258. Apply the reverse of image correction (instead of correcting distortion, apply
  9259. it).
  9260. @item interpolation
  9261. The type of interpolation used when correcting distortion. The following values
  9262. are valid options:
  9263. @table @samp
  9264. @item nearest
  9265. @item linear (default)
  9266. @item lanczos
  9267. @end table
  9268. @end table
  9269. @subsection Examples
  9270. @itemize
  9271. @item
  9272. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9273. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9274. aperture of "8.0".
  9275. @example
  9276. 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
  9277. @end example
  9278. @item
  9279. Apply the same as before, but only for the first 5 seconds of video.
  9280. @example
  9281. 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
  9282. @end example
  9283. @end itemize
  9284. @section libvmaf
  9285. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9286. score between two input videos.
  9287. The obtained VMAF score is printed through the logging system.
  9288. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9289. After installing the library it can be enabled using:
  9290. @code{./configure --enable-libvmaf --enable-version3}.
  9291. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9292. The filter has following options:
  9293. @table @option
  9294. @item model_path
  9295. Set the model path which is to be used for SVM.
  9296. Default value: @code{"vmaf_v0.6.1.pkl"}
  9297. @item log_path
  9298. Set the file path to be used to store logs.
  9299. @item log_fmt
  9300. Set the format of the log file (xml or json).
  9301. @item enable_transform
  9302. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9303. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9304. Default value: @code{false}
  9305. @item phone_model
  9306. Invokes the phone model which will generate VMAF scores higher than in the
  9307. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9308. @item psnr
  9309. Enables computing psnr along with vmaf.
  9310. @item ssim
  9311. Enables computing ssim along with vmaf.
  9312. @item ms_ssim
  9313. Enables computing ms_ssim along with vmaf.
  9314. @item pool
  9315. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  9316. @item n_threads
  9317. Set number of threads to be used when computing vmaf.
  9318. @item n_subsample
  9319. Set interval for frame subsampling used when computing vmaf.
  9320. @item enable_conf_interval
  9321. Enables confidence interval.
  9322. @end table
  9323. This filter also supports the @ref{framesync} options.
  9324. On the below examples the input file @file{main.mpg} being processed is
  9325. compared with the reference file @file{ref.mpg}.
  9326. @example
  9327. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9328. @end example
  9329. Example with options:
  9330. @example
  9331. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9332. @end example
  9333. @section limiter
  9334. Limits the pixel components values to the specified range [min, max].
  9335. The filter accepts the following options:
  9336. @table @option
  9337. @item min
  9338. Lower bound. Defaults to the lowest allowed value for the input.
  9339. @item max
  9340. Upper bound. Defaults to the highest allowed value for the input.
  9341. @item planes
  9342. Specify which planes will be processed. Defaults to all available.
  9343. @end table
  9344. @section loop
  9345. Loop video frames.
  9346. The filter accepts the following options:
  9347. @table @option
  9348. @item loop
  9349. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9350. Default is 0.
  9351. @item size
  9352. Set maximal size in number of frames. Default is 0.
  9353. @item start
  9354. Set first frame of loop. Default is 0.
  9355. @end table
  9356. @subsection Examples
  9357. @itemize
  9358. @item
  9359. Loop single first frame infinitely:
  9360. @example
  9361. loop=loop=-1:size=1:start=0
  9362. @end example
  9363. @item
  9364. Loop single first frame 10 times:
  9365. @example
  9366. loop=loop=10:size=1:start=0
  9367. @end example
  9368. @item
  9369. Loop 10 first frames 5 times:
  9370. @example
  9371. loop=loop=5:size=10:start=0
  9372. @end example
  9373. @end itemize
  9374. @section lut1d
  9375. Apply a 1D LUT to an input video.
  9376. The filter accepts the following options:
  9377. @table @option
  9378. @item file
  9379. Set the 1D LUT file name.
  9380. Currently supported formats:
  9381. @table @samp
  9382. @item cube
  9383. Iridas
  9384. @item csp
  9385. cineSpace
  9386. @end table
  9387. @item interp
  9388. Select interpolation mode.
  9389. Available values are:
  9390. @table @samp
  9391. @item nearest
  9392. Use values from the nearest defined point.
  9393. @item linear
  9394. Interpolate values using the linear interpolation.
  9395. @item cosine
  9396. Interpolate values using the cosine interpolation.
  9397. @item cubic
  9398. Interpolate values using the cubic interpolation.
  9399. @item spline
  9400. Interpolate values using the spline interpolation.
  9401. @end table
  9402. @end table
  9403. @anchor{lut3d}
  9404. @section lut3d
  9405. Apply a 3D LUT to an input video.
  9406. The filter accepts the following options:
  9407. @table @option
  9408. @item file
  9409. Set the 3D LUT file name.
  9410. Currently supported formats:
  9411. @table @samp
  9412. @item 3dl
  9413. AfterEffects
  9414. @item cube
  9415. Iridas
  9416. @item dat
  9417. DaVinci
  9418. @item m3d
  9419. Pandora
  9420. @item csp
  9421. cineSpace
  9422. @end table
  9423. @item interp
  9424. Select interpolation mode.
  9425. Available values are:
  9426. @table @samp
  9427. @item nearest
  9428. Use values from the nearest defined point.
  9429. @item trilinear
  9430. Interpolate values using the 8 points defining a cube.
  9431. @item tetrahedral
  9432. Interpolate values using a tetrahedron.
  9433. @end table
  9434. @end table
  9435. @section lumakey
  9436. Turn certain luma values into transparency.
  9437. The filter accepts the following options:
  9438. @table @option
  9439. @item threshold
  9440. Set the luma which will be used as base for transparency.
  9441. Default value is @code{0}.
  9442. @item tolerance
  9443. Set the range of luma values to be keyed out.
  9444. Default value is @code{0}.
  9445. @item softness
  9446. Set the range of softness. Default value is @code{0}.
  9447. Use this to control gradual transition from zero to full transparency.
  9448. @end table
  9449. @section lut, lutrgb, lutyuv
  9450. Compute a look-up table for binding each pixel component input value
  9451. to an output value, and apply it to the input video.
  9452. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9453. to an RGB input video.
  9454. These filters accept the following parameters:
  9455. @table @option
  9456. @item c0
  9457. set first pixel component expression
  9458. @item c1
  9459. set second pixel component expression
  9460. @item c2
  9461. set third pixel component expression
  9462. @item c3
  9463. set fourth pixel component expression, corresponds to the alpha component
  9464. @item r
  9465. set red component expression
  9466. @item g
  9467. set green component expression
  9468. @item b
  9469. set blue component expression
  9470. @item a
  9471. alpha component expression
  9472. @item y
  9473. set Y/luminance component expression
  9474. @item u
  9475. set U/Cb component expression
  9476. @item v
  9477. set V/Cr component expression
  9478. @end table
  9479. Each of them specifies the expression to use for computing the lookup table for
  9480. the corresponding pixel component values.
  9481. The exact component associated to each of the @var{c*} options depends on the
  9482. format in input.
  9483. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9484. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9485. The expressions can contain the following constants and functions:
  9486. @table @option
  9487. @item w
  9488. @item h
  9489. The input width and height.
  9490. @item val
  9491. The input value for the pixel component.
  9492. @item clipval
  9493. The input value, clipped to the @var{minval}-@var{maxval} range.
  9494. @item maxval
  9495. The maximum value for the pixel component.
  9496. @item minval
  9497. The minimum value for the pixel component.
  9498. @item negval
  9499. The negated value for the pixel component value, clipped to the
  9500. @var{minval}-@var{maxval} range; it corresponds to the expression
  9501. "maxval-clipval+minval".
  9502. @item clip(val)
  9503. The computed value in @var{val}, clipped to the
  9504. @var{minval}-@var{maxval} range.
  9505. @item gammaval(gamma)
  9506. The computed gamma correction value of the pixel component value,
  9507. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9508. expression
  9509. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9510. @end table
  9511. All expressions default to "val".
  9512. @subsection Examples
  9513. @itemize
  9514. @item
  9515. Negate input video:
  9516. @example
  9517. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9518. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9519. @end example
  9520. The above is the same as:
  9521. @example
  9522. lutrgb="r=negval:g=negval:b=negval"
  9523. lutyuv="y=negval:u=negval:v=negval"
  9524. @end example
  9525. @item
  9526. Negate luminance:
  9527. @example
  9528. lutyuv=y=negval
  9529. @end example
  9530. @item
  9531. Remove chroma components, turning the video into a graytone image:
  9532. @example
  9533. lutyuv="u=128:v=128"
  9534. @end example
  9535. @item
  9536. Apply a luma burning effect:
  9537. @example
  9538. lutyuv="y=2*val"
  9539. @end example
  9540. @item
  9541. Remove green and blue components:
  9542. @example
  9543. lutrgb="g=0:b=0"
  9544. @end example
  9545. @item
  9546. Set a constant alpha channel value on input:
  9547. @example
  9548. format=rgba,lutrgb=a="maxval-minval/2"
  9549. @end example
  9550. @item
  9551. Correct luminance gamma by a factor of 0.5:
  9552. @example
  9553. lutyuv=y=gammaval(0.5)
  9554. @end example
  9555. @item
  9556. Discard least significant bits of luma:
  9557. @example
  9558. lutyuv=y='bitand(val, 128+64+32)'
  9559. @end example
  9560. @item
  9561. Technicolor like effect:
  9562. @example
  9563. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9564. @end example
  9565. @end itemize
  9566. @section lut2, tlut2
  9567. The @code{lut2} filter takes two input streams and outputs one
  9568. stream.
  9569. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9570. from one single stream.
  9571. This filter accepts the following parameters:
  9572. @table @option
  9573. @item c0
  9574. set first pixel component expression
  9575. @item c1
  9576. set second pixel component expression
  9577. @item c2
  9578. set third pixel component expression
  9579. @item c3
  9580. set fourth pixel component expression, corresponds to the alpha component
  9581. @item d
  9582. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9583. which means bit depth is automatically picked from first input format.
  9584. @end table
  9585. Each of them specifies the expression to use for computing the lookup table for
  9586. the corresponding pixel component values.
  9587. The exact component associated to each of the @var{c*} options depends on the
  9588. format in inputs.
  9589. The expressions can contain the following constants:
  9590. @table @option
  9591. @item w
  9592. @item h
  9593. The input width and height.
  9594. @item x
  9595. The first input value for the pixel component.
  9596. @item y
  9597. The second input value for the pixel component.
  9598. @item bdx
  9599. The first input video bit depth.
  9600. @item bdy
  9601. The second input video bit depth.
  9602. @end table
  9603. All expressions default to "x".
  9604. @subsection Examples
  9605. @itemize
  9606. @item
  9607. Highlight differences between two RGB video streams:
  9608. @example
  9609. 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)'
  9610. @end example
  9611. @item
  9612. Highlight differences between two YUV video streams:
  9613. @example
  9614. 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)'
  9615. @end example
  9616. @item
  9617. Show max difference between two video streams:
  9618. @example
  9619. 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)))'
  9620. @end example
  9621. @end itemize
  9622. @section maskedclamp
  9623. Clamp the first input stream with the second input and third input stream.
  9624. Returns the value of first stream to be between second input
  9625. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9626. This filter accepts the following options:
  9627. @table @option
  9628. @item undershoot
  9629. Default value is @code{0}.
  9630. @item overshoot
  9631. Default value is @code{0}.
  9632. @item planes
  9633. Set which planes will be processed as bitmap, unprocessed planes will be
  9634. copied from first stream.
  9635. By default value 0xf, all planes will be processed.
  9636. @end table
  9637. @section maskedmerge
  9638. Merge the first input stream with the second input stream using per pixel
  9639. weights in the third input stream.
  9640. A value of 0 in the third stream pixel component means that pixel component
  9641. from first stream is returned unchanged, while maximum value (eg. 255 for
  9642. 8-bit videos) means that pixel component from second stream is returned
  9643. unchanged. Intermediate values define the amount of merging between both
  9644. input stream's pixel components.
  9645. This filter accepts the following options:
  9646. @table @option
  9647. @item planes
  9648. Set which planes will be processed as bitmap, unprocessed planes will be
  9649. copied from first stream.
  9650. By default value 0xf, all planes will be processed.
  9651. @end table
  9652. @section maskfun
  9653. Create mask from input video.
  9654. For example it is useful to create motion masks after @code{tblend} filter.
  9655. This filter accepts the following options:
  9656. @table @option
  9657. @item low
  9658. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9659. @item high
  9660. Set high threshold. Any pixel component higher than this value will be set to max value
  9661. allowed for current pixel format.
  9662. @item planes
  9663. Set planes to filter, by default all available planes are filtered.
  9664. @item fill
  9665. Fill all frame pixels with this value.
  9666. @item sum
  9667. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9668. average, output frame will be completely filled with value set by @var{fill} option.
  9669. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9670. @end table
  9671. @section mcdeint
  9672. Apply motion-compensation deinterlacing.
  9673. It needs one field per frame as input and must thus be used together
  9674. with yadif=1/3 or equivalent.
  9675. This filter accepts the following options:
  9676. @table @option
  9677. @item mode
  9678. Set the deinterlacing mode.
  9679. It accepts one of the following values:
  9680. @table @samp
  9681. @item fast
  9682. @item medium
  9683. @item slow
  9684. use iterative motion estimation
  9685. @item extra_slow
  9686. like @samp{slow}, but use multiple reference frames.
  9687. @end table
  9688. Default value is @samp{fast}.
  9689. @item parity
  9690. Set the picture field parity assumed for the input video. It must be
  9691. one of the following values:
  9692. @table @samp
  9693. @item 0, tff
  9694. assume top field first
  9695. @item 1, bff
  9696. assume bottom field first
  9697. @end table
  9698. Default value is @samp{bff}.
  9699. @item qp
  9700. Set per-block quantization parameter (QP) used by the internal
  9701. encoder.
  9702. Higher values should result in a smoother motion vector field but less
  9703. optimal individual vectors. Default value is 1.
  9704. @end table
  9705. @section mergeplanes
  9706. Merge color channel components from several video streams.
  9707. The filter accepts up to 4 input streams, and merge selected input
  9708. planes to the output video.
  9709. This filter accepts the following options:
  9710. @table @option
  9711. @item mapping
  9712. Set input to output plane mapping. Default is @code{0}.
  9713. The mappings is specified as a bitmap. It should be specified as a
  9714. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9715. mapping for the first plane of the output stream. 'A' sets the number of
  9716. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9717. corresponding input to use (from 0 to 3). The rest of the mappings is
  9718. similar, 'Bb' describes the mapping for the output stream second
  9719. plane, 'Cc' describes the mapping for the output stream third plane and
  9720. 'Dd' describes the mapping for the output stream fourth plane.
  9721. @item format
  9722. Set output pixel format. Default is @code{yuva444p}.
  9723. @end table
  9724. @subsection Examples
  9725. @itemize
  9726. @item
  9727. Merge three gray video streams of same width and height into single video stream:
  9728. @example
  9729. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9730. @end example
  9731. @item
  9732. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9733. @example
  9734. [a0][a1]mergeplanes=0x00010210:yuva444p
  9735. @end example
  9736. @item
  9737. Swap Y and A plane in yuva444p stream:
  9738. @example
  9739. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9740. @end example
  9741. @item
  9742. Swap U and V plane in yuv420p stream:
  9743. @example
  9744. format=yuv420p,mergeplanes=0x000201:yuv420p
  9745. @end example
  9746. @item
  9747. Cast a rgb24 clip to yuv444p:
  9748. @example
  9749. format=rgb24,mergeplanes=0x000102:yuv444p
  9750. @end example
  9751. @end itemize
  9752. @section mestimate
  9753. Estimate and export motion vectors using block matching algorithms.
  9754. Motion vectors are stored in frame side data to be used by other filters.
  9755. This filter accepts the following options:
  9756. @table @option
  9757. @item method
  9758. Specify the motion estimation method. Accepts one of the following values:
  9759. @table @samp
  9760. @item esa
  9761. Exhaustive search algorithm.
  9762. @item tss
  9763. Three step search algorithm.
  9764. @item tdls
  9765. Two dimensional logarithmic search algorithm.
  9766. @item ntss
  9767. New three step search algorithm.
  9768. @item fss
  9769. Four step search algorithm.
  9770. @item ds
  9771. Diamond search algorithm.
  9772. @item hexbs
  9773. Hexagon-based search algorithm.
  9774. @item epzs
  9775. Enhanced predictive zonal search algorithm.
  9776. @item umh
  9777. Uneven multi-hexagon search algorithm.
  9778. @end table
  9779. Default value is @samp{esa}.
  9780. @item mb_size
  9781. Macroblock size. Default @code{16}.
  9782. @item search_param
  9783. Search parameter. Default @code{7}.
  9784. @end table
  9785. @section midequalizer
  9786. Apply Midway Image Equalization effect using two video streams.
  9787. Midway Image Equalization adjusts a pair of images to have the same
  9788. histogram, while maintaining their dynamics as much as possible. It's
  9789. useful for e.g. matching exposures from a pair of stereo cameras.
  9790. This filter has two inputs and one output, which must be of same pixel format, but
  9791. may be of different sizes. The output of filter is first input adjusted with
  9792. midway histogram of both inputs.
  9793. This filter accepts the following option:
  9794. @table @option
  9795. @item planes
  9796. Set which planes to process. Default is @code{15}, which is all available planes.
  9797. @end table
  9798. @section minterpolate
  9799. Convert the video to specified frame rate using motion interpolation.
  9800. This filter accepts the following options:
  9801. @table @option
  9802. @item fps
  9803. 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}.
  9804. @item mi_mode
  9805. Motion interpolation mode. Following values are accepted:
  9806. @table @samp
  9807. @item dup
  9808. Duplicate previous or next frame for interpolating new ones.
  9809. @item blend
  9810. Blend source frames. Interpolated frame is mean of previous and next frames.
  9811. @item mci
  9812. Motion compensated interpolation. Following options are effective when this mode is selected:
  9813. @table @samp
  9814. @item mc_mode
  9815. Motion compensation mode. Following values are accepted:
  9816. @table @samp
  9817. @item obmc
  9818. Overlapped block motion compensation.
  9819. @item aobmc
  9820. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9821. @end table
  9822. Default mode is @samp{obmc}.
  9823. @item me_mode
  9824. Motion estimation mode. Following values are accepted:
  9825. @table @samp
  9826. @item bidir
  9827. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9828. @item bilat
  9829. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9830. @end table
  9831. Default mode is @samp{bilat}.
  9832. @item me
  9833. The algorithm to be used for motion estimation. Following values are accepted:
  9834. @table @samp
  9835. @item esa
  9836. Exhaustive search algorithm.
  9837. @item tss
  9838. Three step search algorithm.
  9839. @item tdls
  9840. Two dimensional logarithmic search algorithm.
  9841. @item ntss
  9842. New three step search algorithm.
  9843. @item fss
  9844. Four step search algorithm.
  9845. @item ds
  9846. Diamond search algorithm.
  9847. @item hexbs
  9848. Hexagon-based search algorithm.
  9849. @item epzs
  9850. Enhanced predictive zonal search algorithm.
  9851. @item umh
  9852. Uneven multi-hexagon search algorithm.
  9853. @end table
  9854. Default algorithm is @samp{epzs}.
  9855. @item mb_size
  9856. Macroblock size. Default @code{16}.
  9857. @item search_param
  9858. Motion estimation search parameter. Default @code{32}.
  9859. @item vsbmc
  9860. 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).
  9861. @end table
  9862. @end table
  9863. @item scd
  9864. 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:
  9865. @table @samp
  9866. @item none
  9867. Disable scene change detection.
  9868. @item fdiff
  9869. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9870. @end table
  9871. Default method is @samp{fdiff}.
  9872. @item scd_threshold
  9873. Scene change detection threshold. Default is @code{5.0}.
  9874. @end table
  9875. @section mix
  9876. Mix several video input streams into one video stream.
  9877. A description of the accepted options follows.
  9878. @table @option
  9879. @item nb_inputs
  9880. The number of inputs. If unspecified, it defaults to 2.
  9881. @item weights
  9882. Specify weight of each input video stream as sequence.
  9883. Each weight is separated by space. If number of weights
  9884. is smaller than number of @var{frames} last specified
  9885. weight will be used for all remaining unset weights.
  9886. @item scale
  9887. Specify scale, if it is set it will be multiplied with sum
  9888. of each weight multiplied with pixel values to give final destination
  9889. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9890. @item duration
  9891. Specify how end of stream is determined.
  9892. @table @samp
  9893. @item longest
  9894. The duration of the longest input. (default)
  9895. @item shortest
  9896. The duration of the shortest input.
  9897. @item first
  9898. The duration of the first input.
  9899. @end table
  9900. @end table
  9901. @section mpdecimate
  9902. Drop frames that do not differ greatly from the previous frame in
  9903. order to reduce frame rate.
  9904. The main use of this filter is for very-low-bitrate encoding
  9905. (e.g. streaming over dialup modem), but it could in theory be used for
  9906. fixing movies that were inverse-telecined incorrectly.
  9907. A description of the accepted options follows.
  9908. @table @option
  9909. @item max
  9910. Set the maximum number of consecutive frames which can be dropped (if
  9911. positive), or the minimum interval between dropped frames (if
  9912. negative). If the value is 0, the frame is dropped disregarding the
  9913. number of previous sequentially dropped frames.
  9914. Default value is 0.
  9915. @item hi
  9916. @item lo
  9917. @item frac
  9918. Set the dropping threshold values.
  9919. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9920. represent actual pixel value differences, so a threshold of 64
  9921. corresponds to 1 unit of difference for each pixel, or the same spread
  9922. out differently over the block.
  9923. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9924. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9925. meaning the whole image) differ by more than a threshold of @option{lo}.
  9926. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9927. 64*5, and default value for @option{frac} is 0.33.
  9928. @end table
  9929. @section negate
  9930. Negate (invert) the input video.
  9931. It accepts the following option:
  9932. @table @option
  9933. @item negate_alpha
  9934. With value 1, it negates the alpha component, if present. Default value is 0.
  9935. @end table
  9936. @anchor{nlmeans}
  9937. @section nlmeans
  9938. Denoise frames using Non-Local Means algorithm.
  9939. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9940. context similarity is defined by comparing their surrounding patches of size
  9941. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9942. around the pixel.
  9943. Note that the research area defines centers for patches, which means some
  9944. patches will be made of pixels outside that research area.
  9945. The filter accepts the following options.
  9946. @table @option
  9947. @item s
  9948. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9949. @item p
  9950. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9951. @item pc
  9952. Same as @option{p} but for chroma planes.
  9953. The default value is @var{0} and means automatic.
  9954. @item r
  9955. Set research size. Default is 15. Must be odd number in range [0, 99].
  9956. @item rc
  9957. Same as @option{r} but for chroma planes.
  9958. The default value is @var{0} and means automatic.
  9959. @end table
  9960. @section nnedi
  9961. Deinterlace video using neural network edge directed interpolation.
  9962. This filter accepts the following options:
  9963. @table @option
  9964. @item weights
  9965. Mandatory option, without binary file filter can not work.
  9966. Currently file can be found here:
  9967. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9968. @item deint
  9969. Set which frames to deinterlace, by default it is @code{all}.
  9970. Can be @code{all} or @code{interlaced}.
  9971. @item field
  9972. Set mode of operation.
  9973. Can be one of the following:
  9974. @table @samp
  9975. @item af
  9976. Use frame flags, both fields.
  9977. @item a
  9978. Use frame flags, single field.
  9979. @item t
  9980. Use top field only.
  9981. @item b
  9982. Use bottom field only.
  9983. @item tf
  9984. Use both fields, top first.
  9985. @item bf
  9986. Use both fields, bottom first.
  9987. @end table
  9988. @item planes
  9989. Set which planes to process, by default filter process all frames.
  9990. @item nsize
  9991. Set size of local neighborhood around each pixel, used by the predictor neural
  9992. network.
  9993. Can be one of the following:
  9994. @table @samp
  9995. @item s8x6
  9996. @item s16x6
  9997. @item s32x6
  9998. @item s48x6
  9999. @item s8x4
  10000. @item s16x4
  10001. @item s32x4
  10002. @end table
  10003. @item nns
  10004. Set the number of neurons in predictor neural network.
  10005. Can be one of the following:
  10006. @table @samp
  10007. @item n16
  10008. @item n32
  10009. @item n64
  10010. @item n128
  10011. @item n256
  10012. @end table
  10013. @item qual
  10014. Controls the number of different neural network predictions that are blended
  10015. together to compute the final output value. Can be @code{fast}, default or
  10016. @code{slow}.
  10017. @item etype
  10018. Set which set of weights to use in the predictor.
  10019. Can be one of the following:
  10020. @table @samp
  10021. @item a
  10022. weights trained to minimize absolute error
  10023. @item s
  10024. weights trained to minimize squared error
  10025. @end table
  10026. @item pscrn
  10027. Controls whether or not the prescreener neural network is used to decide
  10028. which pixels should be processed by the predictor neural network and which
  10029. can be handled by simple cubic interpolation.
  10030. The prescreener is trained to know whether cubic interpolation will be
  10031. sufficient for a pixel or whether it should be predicted by the predictor nn.
  10032. The computational complexity of the prescreener nn is much less than that of
  10033. the predictor nn. Since most pixels can be handled by cubic interpolation,
  10034. using the prescreener generally results in much faster processing.
  10035. The prescreener is pretty accurate, so the difference between using it and not
  10036. using it is almost always unnoticeable.
  10037. Can be one of the following:
  10038. @table @samp
  10039. @item none
  10040. @item original
  10041. @item new
  10042. @end table
  10043. Default is @code{new}.
  10044. @item fapprox
  10045. Set various debugging flags.
  10046. @end table
  10047. @section noformat
  10048. Force libavfilter not to use any of the specified pixel formats for the
  10049. input to the next filter.
  10050. It accepts the following parameters:
  10051. @table @option
  10052. @item pix_fmts
  10053. A '|'-separated list of pixel format names, such as
  10054. pix_fmts=yuv420p|monow|rgb24".
  10055. @end table
  10056. @subsection Examples
  10057. @itemize
  10058. @item
  10059. Force libavfilter to use a format different from @var{yuv420p} for the
  10060. input to the vflip filter:
  10061. @example
  10062. noformat=pix_fmts=yuv420p,vflip
  10063. @end example
  10064. @item
  10065. Convert the input video to any of the formats not contained in the list:
  10066. @example
  10067. noformat=yuv420p|yuv444p|yuv410p
  10068. @end example
  10069. @end itemize
  10070. @section noise
  10071. Add noise on video input frame.
  10072. The filter accepts the following options:
  10073. @table @option
  10074. @item all_seed
  10075. @item c0_seed
  10076. @item c1_seed
  10077. @item c2_seed
  10078. @item c3_seed
  10079. Set noise seed for specific pixel component or all pixel components in case
  10080. of @var{all_seed}. Default value is @code{123457}.
  10081. @item all_strength, alls
  10082. @item c0_strength, c0s
  10083. @item c1_strength, c1s
  10084. @item c2_strength, c2s
  10085. @item c3_strength, c3s
  10086. Set noise strength for specific pixel component or all pixel components in case
  10087. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  10088. @item all_flags, allf
  10089. @item c0_flags, c0f
  10090. @item c1_flags, c1f
  10091. @item c2_flags, c2f
  10092. @item c3_flags, c3f
  10093. Set pixel component flags or set flags for all components if @var{all_flags}.
  10094. Available values for component flags are:
  10095. @table @samp
  10096. @item a
  10097. averaged temporal noise (smoother)
  10098. @item p
  10099. mix random noise with a (semi)regular pattern
  10100. @item t
  10101. temporal noise (noise pattern changes between frames)
  10102. @item u
  10103. uniform noise (gaussian otherwise)
  10104. @end table
  10105. @end table
  10106. @subsection Examples
  10107. Add temporal and uniform noise to input video:
  10108. @example
  10109. noise=alls=20:allf=t+u
  10110. @end example
  10111. @section normalize
  10112. Normalize RGB video (aka histogram stretching, contrast stretching).
  10113. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10114. For each channel of each frame, the filter computes the input range and maps
  10115. it linearly to the user-specified output range. The output range defaults
  10116. to the full dynamic range from pure black to pure white.
  10117. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10118. changes in brightness) caused when small dark or bright objects enter or leave
  10119. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10120. video camera, and, like a video camera, it may cause a period of over- or
  10121. under-exposure of the video.
  10122. The R,G,B channels can be normalized independently, which may cause some
  10123. color shifting, or linked together as a single channel, which prevents
  10124. color shifting. Linked normalization preserves hue. Independent normalization
  10125. does not, so it can be used to remove some color casts. Independent and linked
  10126. normalization can be combined in any ratio.
  10127. The normalize filter accepts the following options:
  10128. @table @option
  10129. @item blackpt
  10130. @item whitept
  10131. Colors which define the output range. The minimum input value is mapped to
  10132. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10133. The defaults are black and white respectively. Specifying white for
  10134. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10135. normalized video. Shades of grey can be used to reduce the dynamic range
  10136. (contrast). Specifying saturated colors here can create some interesting
  10137. effects.
  10138. @item smoothing
  10139. The number of previous frames to use for temporal smoothing. The input range
  10140. of each channel is smoothed using a rolling average over the current frame
  10141. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10142. smoothing).
  10143. @item independence
  10144. Controls the ratio of independent (color shifting) channel normalization to
  10145. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10146. independent. Defaults to 1.0 (fully independent).
  10147. @item strength
  10148. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10149. expensive no-op. Defaults to 1.0 (full strength).
  10150. @end table
  10151. @subsection Examples
  10152. Stretch video contrast to use the full dynamic range, with no temporal
  10153. smoothing; may flicker depending on the source content:
  10154. @example
  10155. normalize=blackpt=black:whitept=white:smoothing=0
  10156. @end example
  10157. As above, but with 50 frames of temporal smoothing; flicker should be
  10158. reduced, depending on the source content:
  10159. @example
  10160. normalize=blackpt=black:whitept=white:smoothing=50
  10161. @end example
  10162. As above, but with hue-preserving linked channel normalization:
  10163. @example
  10164. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10165. @end example
  10166. As above, but with half strength:
  10167. @example
  10168. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10169. @end example
  10170. Map the darkest input color to red, the brightest input color to cyan:
  10171. @example
  10172. normalize=blackpt=red:whitept=cyan
  10173. @end example
  10174. @section null
  10175. Pass the video source unchanged to the output.
  10176. @section ocr
  10177. Optical Character Recognition
  10178. This filter uses Tesseract for optical character recognition. To enable
  10179. compilation of this filter, you need to configure FFmpeg with
  10180. @code{--enable-libtesseract}.
  10181. It accepts the following options:
  10182. @table @option
  10183. @item datapath
  10184. Set datapath to tesseract data. Default is to use whatever was
  10185. set at installation.
  10186. @item language
  10187. Set language, default is "eng".
  10188. @item whitelist
  10189. Set character whitelist.
  10190. @item blacklist
  10191. Set character blacklist.
  10192. @end table
  10193. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10194. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10195. @section ocv
  10196. Apply a video transform using libopencv.
  10197. To enable this filter, install the libopencv library and headers and
  10198. configure FFmpeg with @code{--enable-libopencv}.
  10199. It accepts the following parameters:
  10200. @table @option
  10201. @item filter_name
  10202. The name of the libopencv filter to apply.
  10203. @item filter_params
  10204. The parameters to pass to the libopencv filter. If not specified, the default
  10205. values are assumed.
  10206. @end table
  10207. Refer to the official libopencv documentation for more precise
  10208. information:
  10209. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10210. Several libopencv filters are supported; see the following subsections.
  10211. @anchor{dilate}
  10212. @subsection dilate
  10213. Dilate an image by using a specific structuring element.
  10214. It corresponds to the libopencv function @code{cvDilate}.
  10215. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10216. @var{struct_el} represents a structuring element, and has the syntax:
  10217. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10218. @var{cols} and @var{rows} represent the number of columns and rows of
  10219. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10220. point, and @var{shape} the shape for the structuring element. @var{shape}
  10221. must be "rect", "cross", "ellipse", or "custom".
  10222. If the value for @var{shape} is "custom", it must be followed by a
  10223. string of the form "=@var{filename}". The file with name
  10224. @var{filename} is assumed to represent a binary image, with each
  10225. printable character corresponding to a bright pixel. When a custom
  10226. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10227. or columns and rows of the read file are assumed instead.
  10228. The default value for @var{struct_el} is "3x3+0x0/rect".
  10229. @var{nb_iterations} specifies the number of times the transform is
  10230. applied to the image, and defaults to 1.
  10231. Some examples:
  10232. @example
  10233. # Use the default values
  10234. ocv=dilate
  10235. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10236. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10237. # Read the shape from the file diamond.shape, iterating two times.
  10238. # The file diamond.shape may contain a pattern of characters like this
  10239. # *
  10240. # ***
  10241. # *****
  10242. # ***
  10243. # *
  10244. # The specified columns and rows are ignored
  10245. # but the anchor point coordinates are not
  10246. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10247. @end example
  10248. @subsection erode
  10249. Erode an image by using a specific structuring element.
  10250. It corresponds to the libopencv function @code{cvErode}.
  10251. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10252. with the same syntax and semantics as the @ref{dilate} filter.
  10253. @subsection smooth
  10254. Smooth the input video.
  10255. The filter takes the following parameters:
  10256. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10257. @var{type} is the type of smooth filter to apply, and must be one of
  10258. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10259. or "bilateral". The default value is "gaussian".
  10260. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10261. depends on the smooth type. @var{param1} and
  10262. @var{param2} accept integer positive values or 0. @var{param3} and
  10263. @var{param4} accept floating point values.
  10264. The default value for @var{param1} is 3. The default value for the
  10265. other parameters is 0.
  10266. These parameters correspond to the parameters assigned to the
  10267. libopencv function @code{cvSmooth}.
  10268. @section oscilloscope
  10269. 2D Video Oscilloscope.
  10270. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10271. It accepts the following parameters:
  10272. @table @option
  10273. @item x
  10274. Set scope center x position.
  10275. @item y
  10276. Set scope center y position.
  10277. @item s
  10278. Set scope size, relative to frame diagonal.
  10279. @item t
  10280. Set scope tilt/rotation.
  10281. @item o
  10282. Set trace opacity.
  10283. @item tx
  10284. Set trace center x position.
  10285. @item ty
  10286. Set trace center y position.
  10287. @item tw
  10288. Set trace width, relative to width of frame.
  10289. @item th
  10290. Set trace height, relative to height of frame.
  10291. @item c
  10292. Set which components to trace. By default it traces first three components.
  10293. @item g
  10294. Draw trace grid. By default is enabled.
  10295. @item st
  10296. Draw some statistics. By default is enabled.
  10297. @item sc
  10298. Draw scope. By default is enabled.
  10299. @end table
  10300. @subsection Examples
  10301. @itemize
  10302. @item
  10303. Inspect full first row of video frame.
  10304. @example
  10305. oscilloscope=x=0.5:y=0:s=1
  10306. @end example
  10307. @item
  10308. Inspect full last row of video frame.
  10309. @example
  10310. oscilloscope=x=0.5:y=1:s=1
  10311. @end example
  10312. @item
  10313. Inspect full 5th line of video frame of height 1080.
  10314. @example
  10315. oscilloscope=x=0.5:y=5/1080:s=1
  10316. @end example
  10317. @item
  10318. Inspect full last column of video frame.
  10319. @example
  10320. oscilloscope=x=1:y=0.5:s=1:t=1
  10321. @end example
  10322. @end itemize
  10323. @anchor{overlay}
  10324. @section overlay
  10325. Overlay one video on top of another.
  10326. It takes two inputs and has one output. The first input is the "main"
  10327. video on which the second input is overlaid.
  10328. It accepts the following parameters:
  10329. A description of the accepted options follows.
  10330. @table @option
  10331. @item x
  10332. @item y
  10333. Set the expression for the x and y coordinates of the overlaid video
  10334. on the main video. Default value is "0" for both expressions. In case
  10335. the expression is invalid, it is set to a huge value (meaning that the
  10336. overlay will not be displayed within the output visible area).
  10337. @item eof_action
  10338. See @ref{framesync}.
  10339. @item eval
  10340. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10341. It accepts the following values:
  10342. @table @samp
  10343. @item init
  10344. only evaluate expressions once during the filter initialization or
  10345. when a command is processed
  10346. @item frame
  10347. evaluate expressions for each incoming frame
  10348. @end table
  10349. Default value is @samp{frame}.
  10350. @item shortest
  10351. See @ref{framesync}.
  10352. @item format
  10353. Set the format for the output video.
  10354. It accepts the following values:
  10355. @table @samp
  10356. @item yuv420
  10357. force YUV420 output
  10358. @item yuv422
  10359. force YUV422 output
  10360. @item yuv444
  10361. force YUV444 output
  10362. @item rgb
  10363. force packed RGB output
  10364. @item gbrp
  10365. force planar RGB output
  10366. @item auto
  10367. automatically pick format
  10368. @end table
  10369. Default value is @samp{yuv420}.
  10370. @item repeatlast
  10371. See @ref{framesync}.
  10372. @item alpha
  10373. Set format of alpha of the overlaid video, it can be @var{straight} or
  10374. @var{premultiplied}. Default is @var{straight}.
  10375. @end table
  10376. The @option{x}, and @option{y} expressions can contain the following
  10377. parameters.
  10378. @table @option
  10379. @item main_w, W
  10380. @item main_h, H
  10381. The main input width and height.
  10382. @item overlay_w, w
  10383. @item overlay_h, h
  10384. The overlay input width and height.
  10385. @item x
  10386. @item y
  10387. The computed values for @var{x} and @var{y}. They are evaluated for
  10388. each new frame.
  10389. @item hsub
  10390. @item vsub
  10391. horizontal and vertical chroma subsample values of the output
  10392. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10393. @var{vsub} is 1.
  10394. @item n
  10395. the number of input frame, starting from 0
  10396. @item pos
  10397. the position in the file of the input frame, NAN if unknown
  10398. @item t
  10399. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10400. @end table
  10401. This filter also supports the @ref{framesync} options.
  10402. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10403. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10404. when @option{eval} is set to @samp{init}.
  10405. Be aware that frames are taken from each input video in timestamp
  10406. order, hence, if their initial timestamps differ, it is a good idea
  10407. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10408. have them begin in the same zero timestamp, as the example for
  10409. the @var{movie} filter does.
  10410. You can chain together more overlays but you should test the
  10411. efficiency of such approach.
  10412. @subsection Commands
  10413. This filter supports the following commands:
  10414. @table @option
  10415. @item x
  10416. @item y
  10417. Modify the x and y of the overlay input.
  10418. The command accepts the same syntax of the corresponding option.
  10419. If the specified expression is not valid, it is kept at its current
  10420. value.
  10421. @end table
  10422. @subsection Examples
  10423. @itemize
  10424. @item
  10425. Draw the overlay at 10 pixels from the bottom right corner of the main
  10426. video:
  10427. @example
  10428. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10429. @end example
  10430. Using named options the example above becomes:
  10431. @example
  10432. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10433. @end example
  10434. @item
  10435. Insert a transparent PNG logo in the bottom left corner of the input,
  10436. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10437. @example
  10438. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10439. @end example
  10440. @item
  10441. Insert 2 different transparent PNG logos (second logo on bottom
  10442. right corner) using the @command{ffmpeg} tool:
  10443. @example
  10444. 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
  10445. @end example
  10446. @item
  10447. Add a transparent color layer on top of the main video; @code{WxH}
  10448. must specify the size of the main input to the overlay filter:
  10449. @example
  10450. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10451. @end example
  10452. @item
  10453. Play an original video and a filtered version (here with the deshake
  10454. filter) side by side using the @command{ffplay} tool:
  10455. @example
  10456. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10457. @end example
  10458. The above command is the same as:
  10459. @example
  10460. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10461. @end example
  10462. @item
  10463. Make a sliding overlay appearing from the left to the right top part of the
  10464. screen starting since time 2:
  10465. @example
  10466. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10467. @end example
  10468. @item
  10469. Compose output by putting two input videos side to side:
  10470. @example
  10471. ffmpeg -i left.avi -i right.avi -filter_complex "
  10472. nullsrc=size=200x100 [background];
  10473. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10474. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10475. [background][left] overlay=shortest=1 [background+left];
  10476. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10477. "
  10478. @end example
  10479. @item
  10480. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10481. @example
  10482. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10483. -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]'
  10484. masked.avi
  10485. @end example
  10486. @item
  10487. Chain several overlays in cascade:
  10488. @example
  10489. nullsrc=s=200x200 [bg];
  10490. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10491. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10492. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10493. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10494. [in3] null, [mid2] overlay=100:100 [out0]
  10495. @end example
  10496. @end itemize
  10497. @section owdenoise
  10498. Apply Overcomplete Wavelet denoiser.
  10499. The filter accepts the following options:
  10500. @table @option
  10501. @item depth
  10502. Set depth.
  10503. Larger depth values will denoise lower frequency components more, but
  10504. slow down filtering.
  10505. Must be an int in the range 8-16, default is @code{8}.
  10506. @item luma_strength, ls
  10507. Set luma strength.
  10508. Must be a double value in the range 0-1000, default is @code{1.0}.
  10509. @item chroma_strength, cs
  10510. Set chroma strength.
  10511. Must be a double value in the range 0-1000, default is @code{1.0}.
  10512. @end table
  10513. @anchor{pad}
  10514. @section pad
  10515. Add paddings to the input image, and place the original input at the
  10516. provided @var{x}, @var{y} coordinates.
  10517. It accepts the following parameters:
  10518. @table @option
  10519. @item width, w
  10520. @item height, h
  10521. Specify an expression for the size of the output image with the
  10522. paddings added. If the value for @var{width} or @var{height} is 0, the
  10523. corresponding input size is used for the output.
  10524. The @var{width} expression can reference the value set by the
  10525. @var{height} expression, and vice versa.
  10526. The default value of @var{width} and @var{height} is 0.
  10527. @item x
  10528. @item y
  10529. Specify the offsets to place the input image at within the padded area,
  10530. with respect to the top/left border of the output image.
  10531. The @var{x} expression can reference the value set by the @var{y}
  10532. expression, and vice versa.
  10533. The default value of @var{x} and @var{y} is 0.
  10534. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10535. so the input image is centered on the padded area.
  10536. @item color
  10537. Specify the color of the padded area. For the syntax of this option,
  10538. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10539. manual,ffmpeg-utils}.
  10540. The default value of @var{color} is "black".
  10541. @item eval
  10542. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10543. It accepts the following values:
  10544. @table @samp
  10545. @item init
  10546. Only evaluate expressions once during the filter initialization or when
  10547. a command is processed.
  10548. @item frame
  10549. Evaluate expressions for each incoming frame.
  10550. @end table
  10551. Default value is @samp{init}.
  10552. @item aspect
  10553. Pad to aspect instead to a resolution.
  10554. @end table
  10555. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10556. options are expressions containing the following constants:
  10557. @table @option
  10558. @item in_w
  10559. @item in_h
  10560. The input video width and height.
  10561. @item iw
  10562. @item ih
  10563. These are the same as @var{in_w} and @var{in_h}.
  10564. @item out_w
  10565. @item out_h
  10566. The output width and height (the size of the padded area), as
  10567. specified by the @var{width} and @var{height} expressions.
  10568. @item ow
  10569. @item oh
  10570. These are the same as @var{out_w} and @var{out_h}.
  10571. @item x
  10572. @item y
  10573. The x and y offsets as specified by the @var{x} and @var{y}
  10574. expressions, or NAN if not yet specified.
  10575. @item a
  10576. same as @var{iw} / @var{ih}
  10577. @item sar
  10578. input sample aspect ratio
  10579. @item dar
  10580. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10581. @item hsub
  10582. @item vsub
  10583. The horizontal and vertical chroma subsample values. For example for the
  10584. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10585. @end table
  10586. @subsection Examples
  10587. @itemize
  10588. @item
  10589. Add paddings with the color "violet" to the input video. The output video
  10590. size is 640x480, and the top-left corner of the input video is placed at
  10591. column 0, row 40
  10592. @example
  10593. pad=640:480:0:40:violet
  10594. @end example
  10595. The example above is equivalent to the following command:
  10596. @example
  10597. pad=width=640:height=480:x=0:y=40:color=violet
  10598. @end example
  10599. @item
  10600. Pad the input to get an output with dimensions increased by 3/2,
  10601. and put the input video at the center of the padded area:
  10602. @example
  10603. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10604. @end example
  10605. @item
  10606. Pad the input to get a squared output with size equal to the maximum
  10607. value between the input width and height, and put the input video at
  10608. the center of the padded area:
  10609. @example
  10610. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10611. @end example
  10612. @item
  10613. Pad the input to get a final w/h ratio of 16:9:
  10614. @example
  10615. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10616. @end example
  10617. @item
  10618. In case of anamorphic video, in order to set the output display aspect
  10619. correctly, it is necessary to use @var{sar} in the expression,
  10620. according to the relation:
  10621. @example
  10622. (ih * X / ih) * sar = output_dar
  10623. X = output_dar / sar
  10624. @end example
  10625. Thus the previous example needs to be modified to:
  10626. @example
  10627. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10628. @end example
  10629. @item
  10630. Double the output size and put the input video in the bottom-right
  10631. corner of the output padded area:
  10632. @example
  10633. pad="2*iw:2*ih:ow-iw:oh-ih"
  10634. @end example
  10635. @end itemize
  10636. @anchor{palettegen}
  10637. @section palettegen
  10638. Generate one palette for a whole video stream.
  10639. It accepts the following options:
  10640. @table @option
  10641. @item max_colors
  10642. Set the maximum number of colors to quantize in the palette.
  10643. Note: the palette will still contain 256 colors; the unused palette entries
  10644. will be black.
  10645. @item reserve_transparent
  10646. Create a palette of 255 colors maximum and reserve the last one for
  10647. transparency. Reserving the transparency color is useful for GIF optimization.
  10648. If not set, the maximum of colors in the palette will be 256. You probably want
  10649. to disable this option for a standalone image.
  10650. Set by default.
  10651. @item transparency_color
  10652. Set the color that will be used as background for transparency.
  10653. @item stats_mode
  10654. Set statistics mode.
  10655. It accepts the following values:
  10656. @table @samp
  10657. @item full
  10658. Compute full frame histograms.
  10659. @item diff
  10660. Compute histograms only for the part that differs from previous frame. This
  10661. might be relevant to give more importance to the moving part of your input if
  10662. the background is static.
  10663. @item single
  10664. Compute new histogram for each frame.
  10665. @end table
  10666. Default value is @var{full}.
  10667. @end table
  10668. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10669. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10670. color quantization of the palette. This information is also visible at
  10671. @var{info} logging level.
  10672. @subsection Examples
  10673. @itemize
  10674. @item
  10675. Generate a representative palette of a given video using @command{ffmpeg}:
  10676. @example
  10677. ffmpeg -i input.mkv -vf palettegen palette.png
  10678. @end example
  10679. @end itemize
  10680. @section paletteuse
  10681. Use a palette to downsample an input video stream.
  10682. The filter takes two inputs: one video stream and a palette. The palette must
  10683. be a 256 pixels image.
  10684. It accepts the following options:
  10685. @table @option
  10686. @item dither
  10687. Select dithering mode. Available algorithms are:
  10688. @table @samp
  10689. @item bayer
  10690. Ordered 8x8 bayer dithering (deterministic)
  10691. @item heckbert
  10692. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10693. Note: this dithering is sometimes considered "wrong" and is included as a
  10694. reference.
  10695. @item floyd_steinberg
  10696. Floyd and Steingberg dithering (error diffusion)
  10697. @item sierra2
  10698. Frankie Sierra dithering v2 (error diffusion)
  10699. @item sierra2_4a
  10700. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10701. @end table
  10702. Default is @var{sierra2_4a}.
  10703. @item bayer_scale
  10704. When @var{bayer} dithering is selected, this option defines the scale of the
  10705. pattern (how much the crosshatch pattern is visible). A low value means more
  10706. visible pattern for less banding, and higher value means less visible pattern
  10707. at the cost of more banding.
  10708. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10709. @item diff_mode
  10710. If set, define the zone to process
  10711. @table @samp
  10712. @item rectangle
  10713. Only the changing rectangle will be reprocessed. This is similar to GIF
  10714. cropping/offsetting compression mechanism. This option can be useful for speed
  10715. if only a part of the image is changing, and has use cases such as limiting the
  10716. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10717. moving scene (it leads to more deterministic output if the scene doesn't change
  10718. much, and as a result less moving noise and better GIF compression).
  10719. @end table
  10720. Default is @var{none}.
  10721. @item new
  10722. Take new palette for each output frame.
  10723. @item alpha_threshold
  10724. Sets the alpha threshold for transparency. Alpha values above this threshold
  10725. will be treated as completely opaque, and values below this threshold will be
  10726. treated as completely transparent.
  10727. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10728. @end table
  10729. @subsection Examples
  10730. @itemize
  10731. @item
  10732. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10733. using @command{ffmpeg}:
  10734. @example
  10735. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10736. @end example
  10737. @end itemize
  10738. @section perspective
  10739. Correct perspective of video not recorded perpendicular to the screen.
  10740. A description of the accepted parameters follows.
  10741. @table @option
  10742. @item x0
  10743. @item y0
  10744. @item x1
  10745. @item y1
  10746. @item x2
  10747. @item y2
  10748. @item x3
  10749. @item y3
  10750. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10751. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10752. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10753. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10754. then the corners of the source will be sent to the specified coordinates.
  10755. The expressions can use the following variables:
  10756. @table @option
  10757. @item W
  10758. @item H
  10759. the width and height of video frame.
  10760. @item in
  10761. Input frame count.
  10762. @item on
  10763. Output frame count.
  10764. @end table
  10765. @item interpolation
  10766. Set interpolation for perspective correction.
  10767. It accepts the following values:
  10768. @table @samp
  10769. @item linear
  10770. @item cubic
  10771. @end table
  10772. Default value is @samp{linear}.
  10773. @item sense
  10774. Set interpretation of coordinate options.
  10775. It accepts the following values:
  10776. @table @samp
  10777. @item 0, source
  10778. Send point in the source specified by the given coordinates to
  10779. the corners of the destination.
  10780. @item 1, destination
  10781. Send the corners of the source to the point in the destination specified
  10782. by the given coordinates.
  10783. Default value is @samp{source}.
  10784. @end table
  10785. @item eval
  10786. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10787. It accepts the following values:
  10788. @table @samp
  10789. @item init
  10790. only evaluate expressions once during the filter initialization or
  10791. when a command is processed
  10792. @item frame
  10793. evaluate expressions for each incoming frame
  10794. @end table
  10795. Default value is @samp{init}.
  10796. @end table
  10797. @section phase
  10798. Delay interlaced video by one field time so that the field order changes.
  10799. The intended use is to fix PAL movies that have been captured with the
  10800. opposite field order to the film-to-video transfer.
  10801. A description of the accepted parameters follows.
  10802. @table @option
  10803. @item mode
  10804. Set phase mode.
  10805. It accepts the following values:
  10806. @table @samp
  10807. @item t
  10808. Capture field order top-first, transfer bottom-first.
  10809. Filter will delay the bottom field.
  10810. @item b
  10811. Capture field order bottom-first, transfer top-first.
  10812. Filter will delay the top field.
  10813. @item p
  10814. Capture and transfer with the same field order. This mode only exists
  10815. for the documentation of the other options to refer to, but if you
  10816. actually select it, the filter will faithfully do nothing.
  10817. @item a
  10818. Capture field order determined automatically by field flags, transfer
  10819. opposite.
  10820. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10821. basis using field flags. If no field information is available,
  10822. then this works just like @samp{u}.
  10823. @item u
  10824. Capture unknown or varying, transfer opposite.
  10825. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10826. analyzing the images and selecting the alternative that produces best
  10827. match between the fields.
  10828. @item T
  10829. Capture top-first, transfer unknown or varying.
  10830. Filter selects among @samp{t} and @samp{p} using image analysis.
  10831. @item B
  10832. Capture bottom-first, transfer unknown or varying.
  10833. Filter selects among @samp{b} and @samp{p} using image analysis.
  10834. @item A
  10835. Capture determined by field flags, transfer unknown or varying.
  10836. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10837. image analysis. If no field information is available, then this works just
  10838. like @samp{U}. This is the default mode.
  10839. @item U
  10840. Both capture and transfer unknown or varying.
  10841. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10842. @end table
  10843. @end table
  10844. @section photosensitivity
  10845. Reduce various flashes in video, so to help users with epilepsy.
  10846. It accepts the following options:
  10847. @table @option
  10848. @item frames, f
  10849. Set how many frames to use when filtering. Default is 30.
  10850. @item threshold, t
  10851. Set detection threshold factor. Default is 1.
  10852. Lower is stricter.
  10853. @item skip
  10854. Set how many pixels to skip when sampling frames. Defalt is 1.
  10855. Allowed range is from 1 to 1024.
  10856. @item bypass
  10857. Leave frames unchanged. Default is disabled.
  10858. @end table
  10859. @section pixdesctest
  10860. Pixel format descriptor test filter, mainly useful for internal
  10861. testing. The output video should be equal to the input video.
  10862. For example:
  10863. @example
  10864. format=monow, pixdesctest
  10865. @end example
  10866. can be used to test the monowhite pixel format descriptor definition.
  10867. @section pixscope
  10868. Display sample values of color channels. Mainly useful for checking color
  10869. and levels. Minimum supported resolution is 640x480.
  10870. The filters accept the following options:
  10871. @table @option
  10872. @item x
  10873. Set scope X position, relative offset on X axis.
  10874. @item y
  10875. Set scope Y position, relative offset on Y axis.
  10876. @item w
  10877. Set scope width.
  10878. @item h
  10879. Set scope height.
  10880. @item o
  10881. Set window opacity. This window also holds statistics about pixel area.
  10882. @item wx
  10883. Set window X position, relative offset on X axis.
  10884. @item wy
  10885. Set window Y position, relative offset on Y axis.
  10886. @end table
  10887. @section pp
  10888. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10889. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10890. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10891. Each subfilter and some options have a short and a long name that can be used
  10892. interchangeably, i.e. dr/dering are the same.
  10893. The filters accept the following options:
  10894. @table @option
  10895. @item subfilters
  10896. Set postprocessing subfilters string.
  10897. @end table
  10898. All subfilters share common options to determine their scope:
  10899. @table @option
  10900. @item a/autoq
  10901. Honor the quality commands for this subfilter.
  10902. @item c/chrom
  10903. Do chrominance filtering, too (default).
  10904. @item y/nochrom
  10905. Do luminance filtering only (no chrominance).
  10906. @item n/noluma
  10907. Do chrominance filtering only (no luminance).
  10908. @end table
  10909. These options can be appended after the subfilter name, separated by a '|'.
  10910. Available subfilters are:
  10911. @table @option
  10912. @item hb/hdeblock[|difference[|flatness]]
  10913. Horizontal deblocking filter
  10914. @table @option
  10915. @item difference
  10916. Difference factor where higher values mean more deblocking (default: @code{32}).
  10917. @item flatness
  10918. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10919. @end table
  10920. @item vb/vdeblock[|difference[|flatness]]
  10921. Vertical deblocking filter
  10922. @table @option
  10923. @item difference
  10924. Difference factor where higher values mean more deblocking (default: @code{32}).
  10925. @item flatness
  10926. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10927. @end table
  10928. @item ha/hadeblock[|difference[|flatness]]
  10929. Accurate horizontal deblocking filter
  10930. @table @option
  10931. @item difference
  10932. Difference factor where higher values mean more deblocking (default: @code{32}).
  10933. @item flatness
  10934. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10935. @end table
  10936. @item va/vadeblock[|difference[|flatness]]
  10937. Accurate vertical deblocking filter
  10938. @table @option
  10939. @item difference
  10940. Difference factor where higher values mean more deblocking (default: @code{32}).
  10941. @item flatness
  10942. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10943. @end table
  10944. @end table
  10945. The horizontal and vertical deblocking filters share the difference and
  10946. flatness values so you cannot set different horizontal and vertical
  10947. thresholds.
  10948. @table @option
  10949. @item h1/x1hdeblock
  10950. Experimental horizontal deblocking filter
  10951. @item v1/x1vdeblock
  10952. Experimental vertical deblocking filter
  10953. @item dr/dering
  10954. Deringing filter
  10955. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10956. @table @option
  10957. @item threshold1
  10958. larger -> stronger filtering
  10959. @item threshold2
  10960. larger -> stronger filtering
  10961. @item threshold3
  10962. larger -> stronger filtering
  10963. @end table
  10964. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10965. @table @option
  10966. @item f/fullyrange
  10967. Stretch luminance to @code{0-255}.
  10968. @end table
  10969. @item lb/linblenddeint
  10970. Linear blend deinterlacing filter that deinterlaces the given block by
  10971. filtering all lines with a @code{(1 2 1)} filter.
  10972. @item li/linipoldeint
  10973. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10974. linearly interpolating every second line.
  10975. @item ci/cubicipoldeint
  10976. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10977. cubically interpolating every second line.
  10978. @item md/mediandeint
  10979. Median deinterlacing filter that deinterlaces the given block by applying a
  10980. median filter to every second line.
  10981. @item fd/ffmpegdeint
  10982. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10983. second line with a @code{(-1 4 2 4 -1)} filter.
  10984. @item l5/lowpass5
  10985. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10986. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10987. @item fq/forceQuant[|quantizer]
  10988. Overrides the quantizer table from the input with the constant quantizer you
  10989. specify.
  10990. @table @option
  10991. @item quantizer
  10992. Quantizer to use
  10993. @end table
  10994. @item de/default
  10995. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10996. @item fa/fast
  10997. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10998. @item ac
  10999. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  11000. @end table
  11001. @subsection Examples
  11002. @itemize
  11003. @item
  11004. Apply horizontal and vertical deblocking, deringing and automatic
  11005. brightness/contrast:
  11006. @example
  11007. pp=hb/vb/dr/al
  11008. @end example
  11009. @item
  11010. Apply default filters without brightness/contrast correction:
  11011. @example
  11012. pp=de/-al
  11013. @end example
  11014. @item
  11015. Apply default filters and temporal denoiser:
  11016. @example
  11017. pp=default/tmpnoise|1|2|3
  11018. @end example
  11019. @item
  11020. Apply deblocking on luminance only, and switch vertical deblocking on or off
  11021. automatically depending on available CPU time:
  11022. @example
  11023. pp=hb|y/vb|a
  11024. @end example
  11025. @end itemize
  11026. @section pp7
  11027. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  11028. similar to spp = 6 with 7 point DCT, where only the center sample is
  11029. used after IDCT.
  11030. The filter accepts the following options:
  11031. @table @option
  11032. @item qp
  11033. Force a constant quantization parameter. It accepts an integer in range
  11034. 0 to 63. If not set, the filter will use the QP from the video stream
  11035. (if available).
  11036. @item mode
  11037. Set thresholding mode. Available modes are:
  11038. @table @samp
  11039. @item hard
  11040. Set hard thresholding.
  11041. @item soft
  11042. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11043. @item medium
  11044. Set medium thresholding (good results, default).
  11045. @end table
  11046. @end table
  11047. @section premultiply
  11048. Apply alpha premultiply effect to input video stream using first plane
  11049. of second stream as alpha.
  11050. Both streams must have same dimensions and same pixel format.
  11051. The filter accepts the following option:
  11052. @table @option
  11053. @item planes
  11054. Set which planes will be processed, unprocessed planes will be copied.
  11055. By default value 0xf, all planes will be processed.
  11056. @item inplace
  11057. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11058. @end table
  11059. @section prewitt
  11060. Apply prewitt operator to input video stream.
  11061. The filter accepts the following option:
  11062. @table @option
  11063. @item planes
  11064. Set which planes will be processed, unprocessed planes will be copied.
  11065. By default value 0xf, all planes will be processed.
  11066. @item scale
  11067. Set value which will be multiplied with filtered result.
  11068. @item delta
  11069. Set value which will be added to filtered result.
  11070. @end table
  11071. @anchor{program_opencl}
  11072. @section program_opencl
  11073. Filter video using an OpenCL program.
  11074. @table @option
  11075. @item source
  11076. OpenCL program source file.
  11077. @item kernel
  11078. Kernel name in program.
  11079. @item inputs
  11080. Number of inputs to the filter. Defaults to 1.
  11081. @item size, s
  11082. Size of output frames. Defaults to the same as the first input.
  11083. @end table
  11084. The program source file must contain a kernel function with the given name,
  11085. which will be run once for each plane of the output. Each run on a plane
  11086. gets enqueued as a separate 2D global NDRange with one work-item for each
  11087. pixel to be generated. The global ID offset for each work-item is therefore
  11088. the coordinates of a pixel in the destination image.
  11089. The kernel function needs to take the following arguments:
  11090. @itemize
  11091. @item
  11092. Destination image, @var{__write_only image2d_t}.
  11093. This image will become the output; the kernel should write all of it.
  11094. @item
  11095. Frame index, @var{unsigned int}.
  11096. This is a counter starting from zero and increasing by one for each frame.
  11097. @item
  11098. Source images, @var{__read_only image2d_t}.
  11099. These are the most recent images on each input. The kernel may read from
  11100. them to generate the output, but they can't be written to.
  11101. @end itemize
  11102. Example programs:
  11103. @itemize
  11104. @item
  11105. Copy the input to the output (output must be the same size as the input).
  11106. @verbatim
  11107. __kernel void copy(__write_only image2d_t destination,
  11108. unsigned int index,
  11109. __read_only image2d_t source)
  11110. {
  11111. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  11112. int2 location = (int2)(get_global_id(0), get_global_id(1));
  11113. float4 value = read_imagef(source, sampler, location);
  11114. write_imagef(destination, location, value);
  11115. }
  11116. @end verbatim
  11117. @item
  11118. Apply a simple transformation, rotating the input by an amount increasing
  11119. with the index counter. Pixel values are linearly interpolated by the
  11120. sampler, and the output need not have the same dimensions as the input.
  11121. @verbatim
  11122. __kernel void rotate_image(__write_only image2d_t dst,
  11123. unsigned int index,
  11124. __read_only image2d_t src)
  11125. {
  11126. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11127. CLK_FILTER_LINEAR);
  11128. float angle = (float)index / 100.0f;
  11129. float2 dst_dim = convert_float2(get_image_dim(dst));
  11130. float2 src_dim = convert_float2(get_image_dim(src));
  11131. float2 dst_cen = dst_dim / 2.0f;
  11132. float2 src_cen = src_dim / 2.0f;
  11133. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11134. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  11135. float2 src_pos = {
  11136. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  11137. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  11138. };
  11139. src_pos = src_pos * src_dim / dst_dim;
  11140. float2 src_loc = src_pos + src_cen;
  11141. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  11142. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  11143. write_imagef(dst, dst_loc, 0.5f);
  11144. else
  11145. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  11146. }
  11147. @end verbatim
  11148. @item
  11149. Blend two inputs together, with the amount of each input used varying
  11150. with the index counter.
  11151. @verbatim
  11152. __kernel void blend_images(__write_only image2d_t dst,
  11153. unsigned int index,
  11154. __read_only image2d_t src1,
  11155. __read_only image2d_t src2)
  11156. {
  11157. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11158. CLK_FILTER_LINEAR);
  11159. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  11160. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11161. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  11162. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  11163. float4 val1 = read_imagef(src1, sampler, src1_loc);
  11164. float4 val2 = read_imagef(src2, sampler, src2_loc);
  11165. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  11166. }
  11167. @end verbatim
  11168. @end itemize
  11169. @section pseudocolor
  11170. Alter frame colors in video with pseudocolors.
  11171. This filter accepts the following options:
  11172. @table @option
  11173. @item c0
  11174. set pixel first component expression
  11175. @item c1
  11176. set pixel second component expression
  11177. @item c2
  11178. set pixel third component expression
  11179. @item c3
  11180. set pixel fourth component expression, corresponds to the alpha component
  11181. @item i
  11182. set component to use as base for altering colors
  11183. @end table
  11184. Each of them specifies the expression to use for computing the lookup table for
  11185. the corresponding pixel component values.
  11186. The expressions can contain the following constants and functions:
  11187. @table @option
  11188. @item w
  11189. @item h
  11190. The input width and height.
  11191. @item val
  11192. The input value for the pixel component.
  11193. @item ymin, umin, vmin, amin
  11194. The minimum allowed component value.
  11195. @item ymax, umax, vmax, amax
  11196. The maximum allowed component value.
  11197. @end table
  11198. All expressions default to "val".
  11199. @subsection Examples
  11200. @itemize
  11201. @item
  11202. Change too high luma values to gradient:
  11203. @example
  11204. 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'"
  11205. @end example
  11206. @end itemize
  11207. @section psnr
  11208. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11209. Ratio) between two input videos.
  11210. This filter takes in input two input videos, the first input is
  11211. considered the "main" source and is passed unchanged to the
  11212. output. The second input is used as a "reference" video for computing
  11213. the PSNR.
  11214. Both video inputs must have the same resolution and pixel format for
  11215. this filter to work correctly. Also it assumes that both inputs
  11216. have the same number of frames, which are compared one by one.
  11217. The obtained average PSNR is printed through the logging system.
  11218. The filter stores the accumulated MSE (mean squared error) of each
  11219. frame, and at the end of the processing it is averaged across all frames
  11220. equally, and the following formula is applied to obtain the PSNR:
  11221. @example
  11222. PSNR = 10*log10(MAX^2/MSE)
  11223. @end example
  11224. Where MAX is the average of the maximum values of each component of the
  11225. image.
  11226. The description of the accepted parameters follows.
  11227. @table @option
  11228. @item stats_file, f
  11229. If specified the filter will use the named file to save the PSNR of
  11230. each individual frame. When filename equals "-" the data is sent to
  11231. standard output.
  11232. @item stats_version
  11233. Specifies which version of the stats file format to use. Details of
  11234. each format are written below.
  11235. Default value is 1.
  11236. @item stats_add_max
  11237. Determines whether the max value is output to the stats log.
  11238. Default value is 0.
  11239. Requires stats_version >= 2. If this is set and stats_version < 2,
  11240. the filter will return an error.
  11241. @end table
  11242. This filter also supports the @ref{framesync} options.
  11243. The file printed if @var{stats_file} is selected, contains a sequence of
  11244. key/value pairs of the form @var{key}:@var{value} for each compared
  11245. couple of frames.
  11246. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11247. the list of per-frame-pair stats, with key value pairs following the frame
  11248. format with the following parameters:
  11249. @table @option
  11250. @item psnr_log_version
  11251. The version of the log file format. Will match @var{stats_version}.
  11252. @item fields
  11253. A comma separated list of the per-frame-pair parameters included in
  11254. the log.
  11255. @end table
  11256. A description of each shown per-frame-pair parameter follows:
  11257. @table @option
  11258. @item n
  11259. sequential number of the input frame, starting from 1
  11260. @item mse_avg
  11261. Mean Square Error pixel-by-pixel average difference of the compared
  11262. frames, averaged over all the image components.
  11263. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11264. Mean Square Error pixel-by-pixel average difference of the compared
  11265. frames for the component specified by the suffix.
  11266. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11267. Peak Signal to Noise ratio of the compared frames for the component
  11268. specified by the suffix.
  11269. @item max_avg, max_y, max_u, max_v
  11270. Maximum allowed value for each channel, and average over all
  11271. channels.
  11272. @end table
  11273. For example:
  11274. @example
  11275. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11276. [main][ref] psnr="stats_file=stats.log" [out]
  11277. @end example
  11278. On this example the input file being processed is compared with the
  11279. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11280. is stored in @file{stats.log}.
  11281. @anchor{pullup}
  11282. @section pullup
  11283. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11284. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11285. content.
  11286. The pullup filter is designed to take advantage of future context in making
  11287. its decisions. This filter is stateless in the sense that it does not lock
  11288. onto a pattern to follow, but it instead looks forward to the following
  11289. fields in order to identify matches and rebuild progressive frames.
  11290. To produce content with an even framerate, insert the fps filter after
  11291. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11292. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11293. The filter accepts the following options:
  11294. @table @option
  11295. @item jl
  11296. @item jr
  11297. @item jt
  11298. @item jb
  11299. These options set the amount of "junk" to ignore at the left, right, top, and
  11300. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11301. while top and bottom are in units of 2 lines.
  11302. The default is 8 pixels on each side.
  11303. @item sb
  11304. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11305. filter generating an occasional mismatched frame, but it may also cause an
  11306. excessive number of frames to be dropped during high motion sequences.
  11307. Conversely, setting it to -1 will make filter match fields more easily.
  11308. This may help processing of video where there is slight blurring between
  11309. the fields, but may also cause there to be interlaced frames in the output.
  11310. Default value is @code{0}.
  11311. @item mp
  11312. Set the metric plane to use. It accepts the following values:
  11313. @table @samp
  11314. @item l
  11315. Use luma plane.
  11316. @item u
  11317. Use chroma blue plane.
  11318. @item v
  11319. Use chroma red plane.
  11320. @end table
  11321. This option may be set to use chroma plane instead of the default luma plane
  11322. for doing filter's computations. This may improve accuracy on very clean
  11323. source material, but more likely will decrease accuracy, especially if there
  11324. is chroma noise (rainbow effect) or any grayscale video.
  11325. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11326. load and make pullup usable in realtime on slow machines.
  11327. @end table
  11328. For best results (without duplicated frames in the output file) it is
  11329. necessary to change the output frame rate. For example, to inverse
  11330. telecine NTSC input:
  11331. @example
  11332. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11333. @end example
  11334. @section qp
  11335. Change video quantization parameters (QP).
  11336. The filter accepts the following option:
  11337. @table @option
  11338. @item qp
  11339. Set expression for quantization parameter.
  11340. @end table
  11341. The expression is evaluated through the eval API and can contain, among others,
  11342. the following constants:
  11343. @table @var
  11344. @item known
  11345. 1 if index is not 129, 0 otherwise.
  11346. @item qp
  11347. Sequential index starting from -129 to 128.
  11348. @end table
  11349. @subsection Examples
  11350. @itemize
  11351. @item
  11352. Some equation like:
  11353. @example
  11354. qp=2+2*sin(PI*qp)
  11355. @end example
  11356. @end itemize
  11357. @section random
  11358. Flush video frames from internal cache of frames into a random order.
  11359. No frame is discarded.
  11360. Inspired by @ref{frei0r} nervous filter.
  11361. @table @option
  11362. @item frames
  11363. Set size in number of frames of internal cache, in range from @code{2} to
  11364. @code{512}. Default is @code{30}.
  11365. @item seed
  11366. Set seed for random number generator, must be an integer included between
  11367. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11368. less than @code{0}, the filter will try to use a good random seed on a
  11369. best effort basis.
  11370. @end table
  11371. @section readeia608
  11372. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11373. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11374. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11375. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11376. @table @option
  11377. @item lavfi.readeia608.X.cc
  11378. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11379. @item lavfi.readeia608.X.line
  11380. The number of the line on which the EIA-608 data was identified and read.
  11381. @end table
  11382. This filter accepts the following options:
  11383. @table @option
  11384. @item scan_min
  11385. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11386. @item scan_max
  11387. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11388. @item mac
  11389. Set minimal acceptable amplitude change for sync codes detection.
  11390. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  11391. @item spw
  11392. Set the ratio of width reserved for sync code detection.
  11393. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  11394. @item mhd
  11395. Set the max peaks height difference for sync code detection.
  11396. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11397. @item mpd
  11398. Set max peaks period difference for sync code detection.
  11399. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11400. @item msd
  11401. Set the first two max start code bits differences.
  11402. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  11403. @item bhd
  11404. Set the minimum ratio of bits height compared to 3rd start code bit.
  11405. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  11406. @item th_w
  11407. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  11408. @item th_b
  11409. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  11410. @item chp
  11411. Enable checking the parity bit. In the event of a parity error, the filter will output
  11412. @code{0x00} for that character. Default is false.
  11413. @item lp
  11414. Lowpass lines prior to further processing. Default is disabled.
  11415. @end table
  11416. @subsection Examples
  11417. @itemize
  11418. @item
  11419. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11420. @example
  11421. 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
  11422. @end example
  11423. @end itemize
  11424. @section readvitc
  11425. Read vertical interval timecode (VITC) information from the top lines of a
  11426. video frame.
  11427. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11428. timecode value, if a valid timecode has been detected. Further metadata key
  11429. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11430. timecode data has been found or not.
  11431. This filter accepts the following options:
  11432. @table @option
  11433. @item scan_max
  11434. Set the maximum number of lines to scan for VITC data. If the value is set to
  11435. @code{-1} the full video frame is scanned. Default is @code{45}.
  11436. @item thr_b
  11437. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11438. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11439. @item thr_w
  11440. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11441. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11442. @end table
  11443. @subsection Examples
  11444. @itemize
  11445. @item
  11446. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11447. draw @code{--:--:--:--} as a placeholder:
  11448. @example
  11449. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11450. @end example
  11451. @end itemize
  11452. @section remap
  11453. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11454. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11455. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11456. value for pixel will be used for destination pixel.
  11457. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11458. will have Xmap/Ymap video stream dimensions.
  11459. Xmap and Ymap input video streams are 16bit depth, single channel.
  11460. @table @option
  11461. @item format
  11462. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11463. Default is @code{color}.
  11464. @end table
  11465. @section removegrain
  11466. The removegrain filter is a spatial denoiser for progressive video.
  11467. @table @option
  11468. @item m0
  11469. Set mode for the first plane.
  11470. @item m1
  11471. Set mode for the second plane.
  11472. @item m2
  11473. Set mode for the third plane.
  11474. @item m3
  11475. Set mode for the fourth plane.
  11476. @end table
  11477. Range of mode is from 0 to 24. Description of each mode follows:
  11478. @table @var
  11479. @item 0
  11480. Leave input plane unchanged. Default.
  11481. @item 1
  11482. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11483. @item 2
  11484. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11485. @item 3
  11486. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11487. @item 4
  11488. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11489. This is equivalent to a median filter.
  11490. @item 5
  11491. Line-sensitive clipping giving the minimal change.
  11492. @item 6
  11493. Line-sensitive clipping, intermediate.
  11494. @item 7
  11495. Line-sensitive clipping, intermediate.
  11496. @item 8
  11497. Line-sensitive clipping, intermediate.
  11498. @item 9
  11499. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11500. @item 10
  11501. Replaces the target pixel with the closest neighbour.
  11502. @item 11
  11503. [1 2 1] horizontal and vertical kernel blur.
  11504. @item 12
  11505. Same as mode 11.
  11506. @item 13
  11507. Bob mode, interpolates top field from the line where the neighbours
  11508. pixels are the closest.
  11509. @item 14
  11510. Bob mode, interpolates bottom field from the line where the neighbours
  11511. pixels are the closest.
  11512. @item 15
  11513. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11514. interpolation formula.
  11515. @item 16
  11516. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11517. interpolation formula.
  11518. @item 17
  11519. Clips the pixel with the minimum and maximum of respectively the maximum and
  11520. minimum of each pair of opposite neighbour pixels.
  11521. @item 18
  11522. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11523. the current pixel is minimal.
  11524. @item 19
  11525. Replaces the pixel with the average of its 8 neighbours.
  11526. @item 20
  11527. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11528. @item 21
  11529. Clips pixels using the averages of opposite neighbour.
  11530. @item 22
  11531. Same as mode 21 but simpler and faster.
  11532. @item 23
  11533. Small edge and halo removal, but reputed useless.
  11534. @item 24
  11535. Similar as 23.
  11536. @end table
  11537. @section removelogo
  11538. Suppress a TV station logo, using an image file to determine which
  11539. pixels comprise the logo. It works by filling in the pixels that
  11540. comprise the logo with neighboring pixels.
  11541. The filter accepts the following options:
  11542. @table @option
  11543. @item filename, f
  11544. Set the filter bitmap file, which can be any image format supported by
  11545. libavformat. The width and height of the image file must match those of the
  11546. video stream being processed.
  11547. @end table
  11548. Pixels in the provided bitmap image with a value of zero are not
  11549. considered part of the logo, non-zero pixels are considered part of
  11550. the logo. If you use white (255) for the logo and black (0) for the
  11551. rest, you will be safe. For making the filter bitmap, it is
  11552. recommended to take a screen capture of a black frame with the logo
  11553. visible, and then using a threshold filter followed by the erode
  11554. filter once or twice.
  11555. If needed, little splotches can be fixed manually. Remember that if
  11556. logo pixels are not covered, the filter quality will be much
  11557. reduced. Marking too many pixels as part of the logo does not hurt as
  11558. much, but it will increase the amount of blurring needed to cover over
  11559. the image and will destroy more information than necessary, and extra
  11560. pixels will slow things down on a large logo.
  11561. @section repeatfields
  11562. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11563. fields based on its value.
  11564. @section reverse
  11565. Reverse a video clip.
  11566. Warning: This filter requires memory to buffer the entire clip, so trimming
  11567. is suggested.
  11568. @subsection Examples
  11569. @itemize
  11570. @item
  11571. Take the first 5 seconds of a clip, and reverse it.
  11572. @example
  11573. trim=end=5,reverse
  11574. @end example
  11575. @end itemize
  11576. @section rgbashift
  11577. Shift R/G/B/A pixels horizontally and/or vertically.
  11578. The filter accepts the following options:
  11579. @table @option
  11580. @item rh
  11581. Set amount to shift red horizontally.
  11582. @item rv
  11583. Set amount to shift red vertically.
  11584. @item gh
  11585. Set amount to shift green horizontally.
  11586. @item gv
  11587. Set amount to shift green vertically.
  11588. @item bh
  11589. Set amount to shift blue horizontally.
  11590. @item bv
  11591. Set amount to shift blue vertically.
  11592. @item ah
  11593. Set amount to shift alpha horizontally.
  11594. @item av
  11595. Set amount to shift alpha vertically.
  11596. @item edge
  11597. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11598. @end table
  11599. @section roberts
  11600. Apply roberts cross operator to input video stream.
  11601. The filter accepts the following option:
  11602. @table @option
  11603. @item planes
  11604. Set which planes will be processed, unprocessed planes will be copied.
  11605. By default value 0xf, all planes will be processed.
  11606. @item scale
  11607. Set value which will be multiplied with filtered result.
  11608. @item delta
  11609. Set value which will be added to filtered result.
  11610. @end table
  11611. @section rotate
  11612. Rotate video by an arbitrary angle expressed in radians.
  11613. The filter accepts the following options:
  11614. A description of the optional parameters follows.
  11615. @table @option
  11616. @item angle, a
  11617. Set an expression for the angle by which to rotate the input video
  11618. clockwise, expressed as a number of radians. A negative value will
  11619. result in a counter-clockwise rotation. By default it is set to "0".
  11620. This expression is evaluated for each frame.
  11621. @item out_w, ow
  11622. Set the output width expression, default value is "iw".
  11623. This expression is evaluated just once during configuration.
  11624. @item out_h, oh
  11625. Set the output height expression, default value is "ih".
  11626. This expression is evaluated just once during configuration.
  11627. @item bilinear
  11628. Enable bilinear interpolation if set to 1, a value of 0 disables
  11629. it. Default value is 1.
  11630. @item fillcolor, c
  11631. Set the color used to fill the output area not covered by the rotated
  11632. image. For the general syntax of this option, check the
  11633. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11634. If the special value "none" is selected then no
  11635. background is printed (useful for example if the background is never shown).
  11636. Default value is "black".
  11637. @end table
  11638. The expressions for the angle and the output size can contain the
  11639. following constants and functions:
  11640. @table @option
  11641. @item n
  11642. sequential number of the input frame, starting from 0. It is always NAN
  11643. before the first frame is filtered.
  11644. @item t
  11645. time in seconds of the input frame, it is set to 0 when the filter is
  11646. configured. It is always NAN before the first frame is filtered.
  11647. @item hsub
  11648. @item vsub
  11649. horizontal and vertical chroma subsample values. For example for the
  11650. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11651. @item in_w, iw
  11652. @item in_h, ih
  11653. the input video width and height
  11654. @item out_w, ow
  11655. @item out_h, oh
  11656. the output width and height, that is the size of the padded area as
  11657. specified by the @var{width} and @var{height} expressions
  11658. @item rotw(a)
  11659. @item roth(a)
  11660. the minimal width/height required for completely containing the input
  11661. video rotated by @var{a} radians.
  11662. These are only available when computing the @option{out_w} and
  11663. @option{out_h} expressions.
  11664. @end table
  11665. @subsection Examples
  11666. @itemize
  11667. @item
  11668. Rotate the input by PI/6 radians clockwise:
  11669. @example
  11670. rotate=PI/6
  11671. @end example
  11672. @item
  11673. Rotate the input by PI/6 radians counter-clockwise:
  11674. @example
  11675. rotate=-PI/6
  11676. @end example
  11677. @item
  11678. Rotate the input by 45 degrees clockwise:
  11679. @example
  11680. rotate=45*PI/180
  11681. @end example
  11682. @item
  11683. Apply a constant rotation with period T, starting from an angle of PI/3:
  11684. @example
  11685. rotate=PI/3+2*PI*t/T
  11686. @end example
  11687. @item
  11688. Make the input video rotation oscillating with a period of T
  11689. seconds and an amplitude of A radians:
  11690. @example
  11691. rotate=A*sin(2*PI/T*t)
  11692. @end example
  11693. @item
  11694. Rotate the video, output size is chosen so that the whole rotating
  11695. input video is always completely contained in the output:
  11696. @example
  11697. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11698. @end example
  11699. @item
  11700. Rotate the video, reduce the output size so that no background is ever
  11701. shown:
  11702. @example
  11703. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11704. @end example
  11705. @end itemize
  11706. @subsection Commands
  11707. The filter supports the following commands:
  11708. @table @option
  11709. @item a, angle
  11710. Set the angle expression.
  11711. The command accepts the same syntax of the corresponding option.
  11712. If the specified expression is not valid, it is kept at its current
  11713. value.
  11714. @end table
  11715. @section sab
  11716. Apply Shape Adaptive Blur.
  11717. The filter accepts the following options:
  11718. @table @option
  11719. @item luma_radius, lr
  11720. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11721. value is 1.0. A greater value will result in a more blurred image, and
  11722. in slower processing.
  11723. @item luma_pre_filter_radius, lpfr
  11724. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11725. value is 1.0.
  11726. @item luma_strength, ls
  11727. Set luma maximum difference between pixels to still be considered, must
  11728. be a value in the 0.1-100.0 range, default value is 1.0.
  11729. @item chroma_radius, cr
  11730. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11731. greater value will result in a more blurred image, and in slower
  11732. processing.
  11733. @item chroma_pre_filter_radius, cpfr
  11734. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11735. @item chroma_strength, cs
  11736. Set chroma maximum difference between pixels to still be considered,
  11737. must be a value in the -0.9-100.0 range.
  11738. @end table
  11739. Each chroma option value, if not explicitly specified, is set to the
  11740. corresponding luma option value.
  11741. @anchor{scale}
  11742. @section scale
  11743. Scale (resize) the input video, using the libswscale library.
  11744. The scale filter forces the output display aspect ratio to be the same
  11745. of the input, by changing the output sample aspect ratio.
  11746. If the input image format is different from the format requested by
  11747. the next filter, the scale filter will convert the input to the
  11748. requested format.
  11749. @subsection Options
  11750. The filter accepts the following options, or any of the options
  11751. supported by the libswscale scaler.
  11752. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11753. the complete list of scaler options.
  11754. @table @option
  11755. @item width, w
  11756. @item height, h
  11757. Set the output video dimension expression. Default value is the input
  11758. dimension.
  11759. If the @var{width} or @var{w} value is 0, the input width is used for
  11760. the output. If the @var{height} or @var{h} value is 0, the input height
  11761. is used for the output.
  11762. If one and only one of the values is -n with n >= 1, the scale filter
  11763. will use a value that maintains the aspect ratio of the input image,
  11764. calculated from the other specified dimension. After that it will,
  11765. however, make sure that the calculated dimension is divisible by n and
  11766. adjust the value if necessary.
  11767. If both values are -n with n >= 1, the behavior will be identical to
  11768. both values being set to 0 as previously detailed.
  11769. See below for the list of accepted constants for use in the dimension
  11770. expression.
  11771. @item eval
  11772. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11773. @table @samp
  11774. @item init
  11775. Only evaluate expressions once during the filter initialization or when a command is processed.
  11776. @item frame
  11777. Evaluate expressions for each incoming frame.
  11778. @end table
  11779. Default value is @samp{init}.
  11780. @item interl
  11781. Set the interlacing mode. It accepts the following values:
  11782. @table @samp
  11783. @item 1
  11784. Force interlaced aware scaling.
  11785. @item 0
  11786. Do not apply interlaced scaling.
  11787. @item -1
  11788. Select interlaced aware scaling depending on whether the source frames
  11789. are flagged as interlaced or not.
  11790. @end table
  11791. Default value is @samp{0}.
  11792. @item flags
  11793. Set libswscale scaling flags. See
  11794. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11795. complete list of values. If not explicitly specified the filter applies
  11796. the default flags.
  11797. @item param0, param1
  11798. Set libswscale input parameters for scaling algorithms that need them. See
  11799. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11800. complete documentation. If not explicitly specified the filter applies
  11801. empty parameters.
  11802. @item size, s
  11803. Set the video size. For the syntax of this option, check the
  11804. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11805. @item in_color_matrix
  11806. @item out_color_matrix
  11807. Set in/output YCbCr color space type.
  11808. This allows the autodetected value to be overridden as well as allows forcing
  11809. a specific value used for the output and encoder.
  11810. If not specified, the color space type depends on the pixel format.
  11811. Possible values:
  11812. @table @samp
  11813. @item auto
  11814. Choose automatically.
  11815. @item bt709
  11816. Format conforming to International Telecommunication Union (ITU)
  11817. Recommendation BT.709.
  11818. @item fcc
  11819. Set color space conforming to the United States Federal Communications
  11820. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11821. @item bt601
  11822. @item bt470
  11823. @item smpte170m
  11824. Set color space conforming to:
  11825. @itemize
  11826. @item
  11827. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11828. @item
  11829. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11830. @item
  11831. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11832. @end itemize
  11833. @item smpte240m
  11834. Set color space conforming to SMPTE ST 240:1999.
  11835. @item bt2020
  11836. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  11837. @end table
  11838. @item in_range
  11839. @item out_range
  11840. Set in/output YCbCr sample range.
  11841. This allows the autodetected value to be overridden as well as allows forcing
  11842. a specific value used for the output and encoder. If not specified, the
  11843. range depends on the pixel format. Possible values:
  11844. @table @samp
  11845. @item auto/unknown
  11846. Choose automatically.
  11847. @item jpeg/full/pc
  11848. Set full range (0-255 in case of 8-bit luma).
  11849. @item mpeg/limited/tv
  11850. Set "MPEG" range (16-235 in case of 8-bit luma).
  11851. @end table
  11852. @item force_original_aspect_ratio
  11853. Enable decreasing or increasing output video width or height if necessary to
  11854. keep the original aspect ratio. Possible values:
  11855. @table @samp
  11856. @item disable
  11857. Scale the video as specified and disable this feature.
  11858. @item decrease
  11859. The output video dimensions will automatically be decreased if needed.
  11860. @item increase
  11861. The output video dimensions will automatically be increased if needed.
  11862. @end table
  11863. One useful instance of this option is that when you know a specific device's
  11864. maximum allowed resolution, you can use this to limit the output video to
  11865. that, while retaining the aspect ratio. For example, device A allows
  11866. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11867. decrease) and specifying 1280x720 to the command line makes the output
  11868. 1280x533.
  11869. Please note that this is a different thing than specifying -1 for @option{w}
  11870. or @option{h}, you still need to specify the output resolution for this option
  11871. to work.
  11872. @item force_divisible_by Ensures that the output resolution is divisible by the
  11873. given integer when used together with @option{force_original_aspect_ratio}. This
  11874. works similar to using -n in the @option{w} and @option{h} options.
  11875. This option respects the value set for @option{force_original_aspect_ratio},
  11876. increasing or decreasing the resolution accordingly. This may slightly modify
  11877. the video's aspect ration.
  11878. This can be handy, for example, if you want to have a video fit within a defined
  11879. resolution using the @option{force_original_aspect_ratio} option but have
  11880. encoder restrictions when it comes to width or height.
  11881. @end table
  11882. The values of the @option{w} and @option{h} options are expressions
  11883. containing the following constants:
  11884. @table @var
  11885. @item in_w
  11886. @item in_h
  11887. The input width and height
  11888. @item iw
  11889. @item ih
  11890. These are the same as @var{in_w} and @var{in_h}.
  11891. @item out_w
  11892. @item out_h
  11893. The output (scaled) width and height
  11894. @item ow
  11895. @item oh
  11896. These are the same as @var{out_w} and @var{out_h}
  11897. @item a
  11898. The same as @var{iw} / @var{ih}
  11899. @item sar
  11900. input sample aspect ratio
  11901. @item dar
  11902. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11903. @item hsub
  11904. @item vsub
  11905. horizontal and vertical input chroma subsample values. For example for the
  11906. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11907. @item ohsub
  11908. @item ovsub
  11909. horizontal and vertical output chroma subsample values. For example for the
  11910. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11911. @end table
  11912. @subsection Examples
  11913. @itemize
  11914. @item
  11915. Scale the input video to a size of 200x100
  11916. @example
  11917. scale=w=200:h=100
  11918. @end example
  11919. This is equivalent to:
  11920. @example
  11921. scale=200:100
  11922. @end example
  11923. or:
  11924. @example
  11925. scale=200x100
  11926. @end example
  11927. @item
  11928. Specify a size abbreviation for the output size:
  11929. @example
  11930. scale=qcif
  11931. @end example
  11932. which can also be written as:
  11933. @example
  11934. scale=size=qcif
  11935. @end example
  11936. @item
  11937. Scale the input to 2x:
  11938. @example
  11939. scale=w=2*iw:h=2*ih
  11940. @end example
  11941. @item
  11942. The above is the same as:
  11943. @example
  11944. scale=2*in_w:2*in_h
  11945. @end example
  11946. @item
  11947. Scale the input to 2x with forced interlaced scaling:
  11948. @example
  11949. scale=2*iw:2*ih:interl=1
  11950. @end example
  11951. @item
  11952. Scale the input to half size:
  11953. @example
  11954. scale=w=iw/2:h=ih/2
  11955. @end example
  11956. @item
  11957. Increase the width, and set the height to the same size:
  11958. @example
  11959. scale=3/2*iw:ow
  11960. @end example
  11961. @item
  11962. Seek Greek harmony:
  11963. @example
  11964. scale=iw:1/PHI*iw
  11965. scale=ih*PHI:ih
  11966. @end example
  11967. @item
  11968. Increase the height, and set the width to 3/2 of the height:
  11969. @example
  11970. scale=w=3/2*oh:h=3/5*ih
  11971. @end example
  11972. @item
  11973. Increase the size, making the size a multiple of the chroma
  11974. subsample values:
  11975. @example
  11976. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11977. @end example
  11978. @item
  11979. Increase the width to a maximum of 500 pixels,
  11980. keeping the same aspect ratio as the input:
  11981. @example
  11982. scale=w='min(500\, iw*3/2):h=-1'
  11983. @end example
  11984. @item
  11985. Make pixels square by combining scale and setsar:
  11986. @example
  11987. scale='trunc(ih*dar):ih',setsar=1/1
  11988. @end example
  11989. @item
  11990. Make pixels square by combining scale and setsar,
  11991. making sure the resulting resolution is even (required by some codecs):
  11992. @example
  11993. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11994. @end example
  11995. @end itemize
  11996. @subsection Commands
  11997. This filter supports the following commands:
  11998. @table @option
  11999. @item width, w
  12000. @item height, h
  12001. Set the output video dimension expression.
  12002. The command accepts the same syntax of the corresponding option.
  12003. If the specified expression is not valid, it is kept at its current
  12004. value.
  12005. @end table
  12006. @section scale_npp
  12007. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  12008. format conversion on CUDA video frames. Setting the output width and height
  12009. works in the same way as for the @var{scale} filter.
  12010. The following additional options are accepted:
  12011. @table @option
  12012. @item format
  12013. The pixel format of the output CUDA frames. If set to the string "same" (the
  12014. default), the input format will be kept. Note that automatic format negotiation
  12015. and conversion is not yet supported for hardware frames
  12016. @item interp_algo
  12017. The interpolation algorithm used for resizing. One of the following:
  12018. @table @option
  12019. @item nn
  12020. Nearest neighbour.
  12021. @item linear
  12022. @item cubic
  12023. @item cubic2p_bspline
  12024. 2-parameter cubic (B=1, C=0)
  12025. @item cubic2p_catmullrom
  12026. 2-parameter cubic (B=0, C=1/2)
  12027. @item cubic2p_b05c03
  12028. 2-parameter cubic (B=1/2, C=3/10)
  12029. @item super
  12030. Supersampling
  12031. @item lanczos
  12032. @end table
  12033. @end table
  12034. @section scale2ref
  12035. Scale (resize) the input video, based on a reference video.
  12036. See the scale filter for available options, scale2ref supports the same but
  12037. uses the reference video instead of the main input as basis. scale2ref also
  12038. supports the following additional constants for the @option{w} and
  12039. @option{h} options:
  12040. @table @var
  12041. @item main_w
  12042. @item main_h
  12043. The main input video's width and height
  12044. @item main_a
  12045. The same as @var{main_w} / @var{main_h}
  12046. @item main_sar
  12047. The main input video's sample aspect ratio
  12048. @item main_dar, mdar
  12049. The main input video's display aspect ratio. Calculated from
  12050. @code{(main_w / main_h) * main_sar}.
  12051. @item main_hsub
  12052. @item main_vsub
  12053. The main input video's horizontal and vertical chroma subsample values.
  12054. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  12055. is 1.
  12056. @end table
  12057. @subsection Examples
  12058. @itemize
  12059. @item
  12060. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  12061. @example
  12062. 'scale2ref[b][a];[a][b]overlay'
  12063. @end example
  12064. @item
  12065. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  12066. @example
  12067. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  12068. @end example
  12069. @end itemize
  12070. @section scroll
  12071. Scroll input video horizontally and/or vertically by constant speed.
  12072. The filter accepts the following options:
  12073. @table @option
  12074. @item horizontal, h
  12075. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12076. Negative values changes scrolling direction.
  12077. @item vertical, v
  12078. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  12079. Negative values changes scrolling direction.
  12080. @item hpos
  12081. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  12082. @item vpos
  12083. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  12084. @end table
  12085. @subsection Commands
  12086. This filter supports the following @ref{commands}:
  12087. @table @option
  12088. @item horizontal, h
  12089. Set the horizontal scrolling speed.
  12090. @item vertical, v
  12091. Set the vertical scrolling speed.
  12092. @end table
  12093. @anchor{selectivecolor}
  12094. @section selectivecolor
  12095. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  12096. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  12097. by the "purity" of the color (that is, how saturated it already is).
  12098. This filter is similar to the Adobe Photoshop Selective Color tool.
  12099. The filter accepts the following options:
  12100. @table @option
  12101. @item correction_method
  12102. Select color correction method.
  12103. Available values are:
  12104. @table @samp
  12105. @item absolute
  12106. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12107. component value).
  12108. @item relative
  12109. Specified adjustments are relative to the original component value.
  12110. @end table
  12111. Default is @code{absolute}.
  12112. @item reds
  12113. Adjustments for red pixels (pixels where the red component is the maximum)
  12114. @item yellows
  12115. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12116. @item greens
  12117. Adjustments for green pixels (pixels where the green component is the maximum)
  12118. @item cyans
  12119. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12120. @item blues
  12121. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12122. @item magentas
  12123. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12124. @item whites
  12125. Adjustments for white pixels (pixels where all components are greater than 128)
  12126. @item neutrals
  12127. Adjustments for all pixels except pure black and pure white
  12128. @item blacks
  12129. Adjustments for black pixels (pixels where all components are lesser than 128)
  12130. @item psfile
  12131. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12132. @end table
  12133. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12134. 4 space separated floating point adjustment values in the [-1,1] range,
  12135. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12136. pixels of its range.
  12137. @subsection Examples
  12138. @itemize
  12139. @item
  12140. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12141. increase magenta by 27% in blue areas:
  12142. @example
  12143. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12144. @end example
  12145. @item
  12146. Use a Photoshop selective color preset:
  12147. @example
  12148. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12149. @end example
  12150. @end itemize
  12151. @anchor{separatefields}
  12152. @section separatefields
  12153. The @code{separatefields} takes a frame-based video input and splits
  12154. each frame into its components fields, producing a new half height clip
  12155. with twice the frame rate and twice the frame count.
  12156. This filter use field-dominance information in frame to decide which
  12157. of each pair of fields to place first in the output.
  12158. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12159. @section setdar, setsar
  12160. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12161. output video.
  12162. This is done by changing the specified Sample (aka Pixel) Aspect
  12163. Ratio, according to the following equation:
  12164. @example
  12165. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12166. @end example
  12167. Keep in mind that the @code{setdar} filter does not modify the pixel
  12168. dimensions of the video frame. Also, the display aspect ratio set by
  12169. this filter may be changed by later filters in the filterchain,
  12170. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12171. applied.
  12172. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12173. the filter output video.
  12174. Note that as a consequence of the application of this filter, the
  12175. output display aspect ratio will change according to the equation
  12176. above.
  12177. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12178. filter may be changed by later filters in the filterchain, e.g. if
  12179. another "setsar" or a "setdar" filter is applied.
  12180. It accepts the following parameters:
  12181. @table @option
  12182. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12183. Set the aspect ratio used by the filter.
  12184. The parameter can be a floating point number string, an expression, or
  12185. a string of the form @var{num}:@var{den}, where @var{num} and
  12186. @var{den} are the numerator and denominator of the aspect ratio. If
  12187. the parameter is not specified, it is assumed the value "0".
  12188. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12189. should be escaped.
  12190. @item max
  12191. Set the maximum integer value to use for expressing numerator and
  12192. denominator when reducing the expressed aspect ratio to a rational.
  12193. Default value is @code{100}.
  12194. @end table
  12195. The parameter @var{sar} is an expression containing
  12196. the following constants:
  12197. @table @option
  12198. @item E, PI, PHI
  12199. These are approximated values for the mathematical constants e
  12200. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12201. @item w, h
  12202. The input width and height.
  12203. @item a
  12204. These are the same as @var{w} / @var{h}.
  12205. @item sar
  12206. The input sample aspect ratio.
  12207. @item dar
  12208. The input display aspect ratio. It is the same as
  12209. (@var{w} / @var{h}) * @var{sar}.
  12210. @item hsub, vsub
  12211. Horizontal and vertical chroma subsample values. For example, for the
  12212. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12213. @end table
  12214. @subsection Examples
  12215. @itemize
  12216. @item
  12217. To change the display aspect ratio to 16:9, specify one of the following:
  12218. @example
  12219. setdar=dar=1.77777
  12220. setdar=dar=16/9
  12221. @end example
  12222. @item
  12223. To change the sample aspect ratio to 10:11, specify:
  12224. @example
  12225. setsar=sar=10/11
  12226. @end example
  12227. @item
  12228. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12229. 1000 in the aspect ratio reduction, use the command:
  12230. @example
  12231. setdar=ratio=16/9:max=1000
  12232. @end example
  12233. @end itemize
  12234. @anchor{setfield}
  12235. @section setfield
  12236. Force field for the output video frame.
  12237. The @code{setfield} filter marks the interlace type field for the
  12238. output frames. It does not change the input frame, but only sets the
  12239. corresponding property, which affects how the frame is treated by
  12240. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12241. The filter accepts the following options:
  12242. @table @option
  12243. @item mode
  12244. Available values are:
  12245. @table @samp
  12246. @item auto
  12247. Keep the same field property.
  12248. @item bff
  12249. Mark the frame as bottom-field-first.
  12250. @item tff
  12251. Mark the frame as top-field-first.
  12252. @item prog
  12253. Mark the frame as progressive.
  12254. @end table
  12255. @end table
  12256. @anchor{setparams}
  12257. @section setparams
  12258. Force frame parameter for the output video frame.
  12259. The @code{setparams} filter marks interlace and color range for the
  12260. output frames. It does not change the input frame, but only sets the
  12261. corresponding property, which affects how the frame is treated by
  12262. filters/encoders.
  12263. @table @option
  12264. @item field_mode
  12265. Available values are:
  12266. @table @samp
  12267. @item auto
  12268. Keep the same field property (default).
  12269. @item bff
  12270. Mark the frame as bottom-field-first.
  12271. @item tff
  12272. Mark the frame as top-field-first.
  12273. @item prog
  12274. Mark the frame as progressive.
  12275. @end table
  12276. @item range
  12277. Available values are:
  12278. @table @samp
  12279. @item auto
  12280. Keep the same color range property (default).
  12281. @item unspecified, unknown
  12282. Mark the frame as unspecified color range.
  12283. @item limited, tv, mpeg
  12284. Mark the frame as limited range.
  12285. @item full, pc, jpeg
  12286. Mark the frame as full range.
  12287. @end table
  12288. @item color_primaries
  12289. Set the color primaries.
  12290. Available values are:
  12291. @table @samp
  12292. @item auto
  12293. Keep the same color primaries property (default).
  12294. @item bt709
  12295. @item unknown
  12296. @item bt470m
  12297. @item bt470bg
  12298. @item smpte170m
  12299. @item smpte240m
  12300. @item film
  12301. @item bt2020
  12302. @item smpte428
  12303. @item smpte431
  12304. @item smpte432
  12305. @item jedec-p22
  12306. @end table
  12307. @item color_trc
  12308. Set the color transfer.
  12309. Available values are:
  12310. @table @samp
  12311. @item auto
  12312. Keep the same color trc property (default).
  12313. @item bt709
  12314. @item unknown
  12315. @item bt470m
  12316. @item bt470bg
  12317. @item smpte170m
  12318. @item smpte240m
  12319. @item linear
  12320. @item log100
  12321. @item log316
  12322. @item iec61966-2-4
  12323. @item bt1361e
  12324. @item iec61966-2-1
  12325. @item bt2020-10
  12326. @item bt2020-12
  12327. @item smpte2084
  12328. @item smpte428
  12329. @item arib-std-b67
  12330. @end table
  12331. @item colorspace
  12332. Set the colorspace.
  12333. Available values are:
  12334. @table @samp
  12335. @item auto
  12336. Keep the same colorspace property (default).
  12337. @item gbr
  12338. @item bt709
  12339. @item unknown
  12340. @item fcc
  12341. @item bt470bg
  12342. @item smpte170m
  12343. @item smpte240m
  12344. @item ycgco
  12345. @item bt2020nc
  12346. @item bt2020c
  12347. @item smpte2085
  12348. @item chroma-derived-nc
  12349. @item chroma-derived-c
  12350. @item ictcp
  12351. @end table
  12352. @end table
  12353. @section showinfo
  12354. Show a line containing various information for each input video frame.
  12355. The input video is not modified.
  12356. This filter supports the following options:
  12357. @table @option
  12358. @item checksum
  12359. Calculate checksums of each plane. By default enabled.
  12360. @end table
  12361. The shown line contains a sequence of key/value pairs of the form
  12362. @var{key}:@var{value}.
  12363. The following values are shown in the output:
  12364. @table @option
  12365. @item n
  12366. The (sequential) number of the input frame, starting from 0.
  12367. @item pts
  12368. The Presentation TimeStamp of the input frame, expressed as a number of
  12369. time base units. The time base unit depends on the filter input pad.
  12370. @item pts_time
  12371. The Presentation TimeStamp of the input frame, expressed as a number of
  12372. seconds.
  12373. @item pos
  12374. The position of the frame in the input stream, or -1 if this information is
  12375. unavailable and/or meaningless (for example in case of synthetic video).
  12376. @item fmt
  12377. The pixel format name.
  12378. @item sar
  12379. The sample aspect ratio of the input frame, expressed in the form
  12380. @var{num}/@var{den}.
  12381. @item s
  12382. The size of the input frame. For the syntax of this option, check the
  12383. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12384. @item i
  12385. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12386. for bottom field first).
  12387. @item iskey
  12388. This is 1 if the frame is a key frame, 0 otherwise.
  12389. @item type
  12390. The picture type of the input frame ("I" for an I-frame, "P" for a
  12391. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12392. Also refer to the documentation of the @code{AVPictureType} enum and of
  12393. the @code{av_get_picture_type_char} function defined in
  12394. @file{libavutil/avutil.h}.
  12395. @item checksum
  12396. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12397. @item plane_checksum
  12398. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12399. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12400. @end table
  12401. @section showpalette
  12402. Displays the 256 colors palette of each frame. This filter is only relevant for
  12403. @var{pal8} pixel format frames.
  12404. It accepts the following option:
  12405. @table @option
  12406. @item s
  12407. Set the size of the box used to represent one palette color entry. Default is
  12408. @code{30} (for a @code{30x30} pixel box).
  12409. @end table
  12410. @section shuffleframes
  12411. Reorder and/or duplicate and/or drop video frames.
  12412. It accepts the following parameters:
  12413. @table @option
  12414. @item mapping
  12415. Set the destination indexes of input frames.
  12416. This is space or '|' separated list of indexes that maps input frames to output
  12417. frames. Number of indexes also sets maximal value that each index may have.
  12418. '-1' index have special meaning and that is to drop frame.
  12419. @end table
  12420. The first frame has the index 0. The default is to keep the input unchanged.
  12421. @subsection Examples
  12422. @itemize
  12423. @item
  12424. Swap second and third frame of every three frames of the input:
  12425. @example
  12426. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12427. @end example
  12428. @item
  12429. Swap 10th and 1st frame of every ten frames of the input:
  12430. @example
  12431. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12432. @end example
  12433. @end itemize
  12434. @section shuffleplanes
  12435. Reorder and/or duplicate video planes.
  12436. It accepts the following parameters:
  12437. @table @option
  12438. @item map0
  12439. The index of the input plane to be used as the first output plane.
  12440. @item map1
  12441. The index of the input plane to be used as the second output plane.
  12442. @item map2
  12443. The index of the input plane to be used as the third output plane.
  12444. @item map3
  12445. The index of the input plane to be used as the fourth output plane.
  12446. @end table
  12447. The first plane has the index 0. The default is to keep the input unchanged.
  12448. @subsection Examples
  12449. @itemize
  12450. @item
  12451. Swap the second and third planes of the input:
  12452. @example
  12453. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12454. @end example
  12455. @end itemize
  12456. @anchor{signalstats}
  12457. @section signalstats
  12458. Evaluate various visual metrics that assist in determining issues associated
  12459. with the digitization of analog video media.
  12460. By default the filter will log these metadata values:
  12461. @table @option
  12462. @item YMIN
  12463. Display the minimal Y value contained within the input frame. Expressed in
  12464. range of [0-255].
  12465. @item YLOW
  12466. Display the Y value at the 10% percentile within the input frame. Expressed in
  12467. range of [0-255].
  12468. @item YAVG
  12469. Display the average Y value within the input frame. Expressed in range of
  12470. [0-255].
  12471. @item YHIGH
  12472. Display the Y value at the 90% percentile within the input frame. Expressed in
  12473. range of [0-255].
  12474. @item YMAX
  12475. Display the maximum Y value contained within the input frame. Expressed in
  12476. range of [0-255].
  12477. @item UMIN
  12478. Display the minimal U value contained within the input frame. Expressed in
  12479. range of [0-255].
  12480. @item ULOW
  12481. Display the U value at the 10% percentile within the input frame. Expressed in
  12482. range of [0-255].
  12483. @item UAVG
  12484. Display the average U value within the input frame. Expressed in range of
  12485. [0-255].
  12486. @item UHIGH
  12487. Display the U value at the 90% percentile within the input frame. Expressed in
  12488. range of [0-255].
  12489. @item UMAX
  12490. Display the maximum U value contained within the input frame. Expressed in
  12491. range of [0-255].
  12492. @item VMIN
  12493. Display the minimal V value contained within the input frame. Expressed in
  12494. range of [0-255].
  12495. @item VLOW
  12496. Display the V value at the 10% percentile within the input frame. Expressed in
  12497. range of [0-255].
  12498. @item VAVG
  12499. Display the average V value within the input frame. Expressed in range of
  12500. [0-255].
  12501. @item VHIGH
  12502. Display the V value at the 90% percentile within the input frame. Expressed in
  12503. range of [0-255].
  12504. @item VMAX
  12505. Display the maximum V value contained within the input frame. Expressed in
  12506. range of [0-255].
  12507. @item SATMIN
  12508. Display the minimal saturation value contained within the input frame.
  12509. Expressed in range of [0-~181.02].
  12510. @item SATLOW
  12511. Display the saturation value at the 10% percentile within the input frame.
  12512. Expressed in range of [0-~181.02].
  12513. @item SATAVG
  12514. Display the average saturation value within the input frame. Expressed in range
  12515. of [0-~181.02].
  12516. @item SATHIGH
  12517. Display the saturation value at the 90% percentile within the input frame.
  12518. Expressed in range of [0-~181.02].
  12519. @item SATMAX
  12520. Display the maximum saturation value contained within the input frame.
  12521. Expressed in range of [0-~181.02].
  12522. @item HUEMED
  12523. Display the median value for hue within the input frame. Expressed in range of
  12524. [0-360].
  12525. @item HUEAVG
  12526. Display the average value for hue within the input frame. Expressed in range of
  12527. [0-360].
  12528. @item YDIF
  12529. Display the average of sample value difference between all values of the Y
  12530. plane in the current frame and corresponding values of the previous input frame.
  12531. Expressed in range of [0-255].
  12532. @item UDIF
  12533. Display the average of sample value difference between all values of the U
  12534. plane in the current frame and corresponding values of the previous input frame.
  12535. Expressed in range of [0-255].
  12536. @item VDIF
  12537. Display the average of sample value difference between all values of the V
  12538. plane in the current frame and corresponding values of the previous input frame.
  12539. Expressed in range of [0-255].
  12540. @item YBITDEPTH
  12541. Display bit depth of Y plane in current frame.
  12542. Expressed in range of [0-16].
  12543. @item UBITDEPTH
  12544. Display bit depth of U plane in current frame.
  12545. Expressed in range of [0-16].
  12546. @item VBITDEPTH
  12547. Display bit depth of V plane in current frame.
  12548. Expressed in range of [0-16].
  12549. @end table
  12550. The filter accepts the following options:
  12551. @table @option
  12552. @item stat
  12553. @item out
  12554. @option{stat} specify an additional form of image analysis.
  12555. @option{out} output video with the specified type of pixel highlighted.
  12556. Both options accept the following values:
  12557. @table @samp
  12558. @item tout
  12559. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12560. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12561. include the results of video dropouts, head clogs, or tape tracking issues.
  12562. @item vrep
  12563. Identify @var{vertical line repetition}. Vertical line repetition includes
  12564. similar rows of pixels within a frame. In born-digital video vertical line
  12565. repetition is common, but this pattern is uncommon in video digitized from an
  12566. analog source. When it occurs in video that results from the digitization of an
  12567. analog source it can indicate concealment from a dropout compensator.
  12568. @item brng
  12569. Identify pixels that fall outside of legal broadcast range.
  12570. @end table
  12571. @item color, c
  12572. Set the highlight color for the @option{out} option. The default color is
  12573. yellow.
  12574. @end table
  12575. @subsection Examples
  12576. @itemize
  12577. @item
  12578. Output data of various video metrics:
  12579. @example
  12580. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12581. @end example
  12582. @item
  12583. Output specific data about the minimum and maximum values of the Y plane per frame:
  12584. @example
  12585. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12586. @end example
  12587. @item
  12588. Playback video while highlighting pixels that are outside of broadcast range in red.
  12589. @example
  12590. ffplay example.mov -vf signalstats="out=brng:color=red"
  12591. @end example
  12592. @item
  12593. Playback video with signalstats metadata drawn over the frame.
  12594. @example
  12595. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12596. @end example
  12597. The contents of signalstat_drawtext.txt used in the command are:
  12598. @example
  12599. time %@{pts:hms@}
  12600. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12601. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12602. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12603. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12604. @end example
  12605. @end itemize
  12606. @anchor{signature}
  12607. @section signature
  12608. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12609. input. In this case the matching between the inputs can be calculated additionally.
  12610. The filter always passes through the first input. The signature of each stream can
  12611. be written into a file.
  12612. It accepts the following options:
  12613. @table @option
  12614. @item detectmode
  12615. Enable or disable the matching process.
  12616. Available values are:
  12617. @table @samp
  12618. @item off
  12619. Disable the calculation of a matching (default).
  12620. @item full
  12621. Calculate the matching for the whole video and output whether the whole video
  12622. matches or only parts.
  12623. @item fast
  12624. Calculate only until a matching is found or the video ends. Should be faster in
  12625. some cases.
  12626. @end table
  12627. @item nb_inputs
  12628. Set the number of inputs. The option value must be a non negative integer.
  12629. Default value is 1.
  12630. @item filename
  12631. Set the path to which the output is written. If there is more than one input,
  12632. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12633. integer), that will be replaced with the input number. If no filename is
  12634. specified, no output will be written. This is the default.
  12635. @item format
  12636. Choose the output format.
  12637. Available values are:
  12638. @table @samp
  12639. @item binary
  12640. Use the specified binary representation (default).
  12641. @item xml
  12642. Use the specified xml representation.
  12643. @end table
  12644. @item th_d
  12645. Set threshold to detect one word as similar. The option value must be an integer
  12646. greater than zero. The default value is 9000.
  12647. @item th_dc
  12648. Set threshold to detect all words as similar. The option value must be an integer
  12649. greater than zero. The default value is 60000.
  12650. @item th_xh
  12651. Set threshold to detect frames as similar. The option value must be an integer
  12652. greater than zero. The default value is 116.
  12653. @item th_di
  12654. Set the minimum length of a sequence in frames to recognize it as matching
  12655. sequence. The option value must be a non negative integer value.
  12656. The default value is 0.
  12657. @item th_it
  12658. Set the minimum relation, that matching frames to all frames must have.
  12659. The option value must be a double value between 0 and 1. The default value is 0.5.
  12660. @end table
  12661. @subsection Examples
  12662. @itemize
  12663. @item
  12664. To calculate the signature of an input video and store it in signature.bin:
  12665. @example
  12666. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12667. @end example
  12668. @item
  12669. To detect whether two videos match and store the signatures in XML format in
  12670. signature0.xml and signature1.xml:
  12671. @example
  12672. 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 -
  12673. @end example
  12674. @end itemize
  12675. @anchor{smartblur}
  12676. @section smartblur
  12677. Blur the input video without impacting the outlines.
  12678. It accepts the following options:
  12679. @table @option
  12680. @item luma_radius, lr
  12681. Set the luma radius. The option value must be a float number in
  12682. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12683. used to blur the image (slower if larger). Default value is 1.0.
  12684. @item luma_strength, ls
  12685. Set the luma strength. The option value must be a float number
  12686. in the range [-1.0,1.0] that configures the blurring. A value included
  12687. in [0.0,1.0] will blur the image whereas a value included in
  12688. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12689. @item luma_threshold, lt
  12690. Set the luma threshold used as a coefficient to determine
  12691. whether a pixel should be blurred or not. The option value must be an
  12692. integer in the range [-30,30]. A value of 0 will filter all the image,
  12693. a value included in [0,30] will filter flat areas and a value included
  12694. in [-30,0] will filter edges. Default value is 0.
  12695. @item chroma_radius, cr
  12696. Set the chroma radius. The option value must be a float number in
  12697. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12698. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12699. @item chroma_strength, cs
  12700. Set the chroma strength. The option value must be a float number
  12701. in the range [-1.0,1.0] that configures the blurring. A value included
  12702. in [0.0,1.0] will blur the image whereas a value included in
  12703. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12704. @item chroma_threshold, ct
  12705. Set the chroma threshold used as a coefficient to determine
  12706. whether a pixel should be blurred or not. The option value must be an
  12707. integer in the range [-30,30]. A value of 0 will filter all the image,
  12708. a value included in [0,30] will filter flat areas and a value included
  12709. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12710. @end table
  12711. If a chroma option is not explicitly set, the corresponding luma value
  12712. is set.
  12713. @section sobel
  12714. Apply sobel operator to input video stream.
  12715. The filter accepts the following option:
  12716. @table @option
  12717. @item planes
  12718. Set which planes will be processed, unprocessed planes will be copied.
  12719. By default value 0xf, all planes will be processed.
  12720. @item scale
  12721. Set value which will be multiplied with filtered result.
  12722. @item delta
  12723. Set value which will be added to filtered result.
  12724. @end table
  12725. @anchor{spp}
  12726. @section spp
  12727. Apply a simple postprocessing filter that compresses and decompresses the image
  12728. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12729. and average the results.
  12730. The filter accepts the following options:
  12731. @table @option
  12732. @item quality
  12733. Set quality. This option defines the number of levels for averaging. It accepts
  12734. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12735. effect. A value of @code{6} means the higher quality. For each increment of
  12736. that value the speed drops by a factor of approximately 2. Default value is
  12737. @code{3}.
  12738. @item qp
  12739. Force a constant quantization parameter. If not set, the filter will use the QP
  12740. from the video stream (if available).
  12741. @item mode
  12742. Set thresholding mode. Available modes are:
  12743. @table @samp
  12744. @item hard
  12745. Set hard thresholding (default).
  12746. @item soft
  12747. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12748. @end table
  12749. @item use_bframe_qp
  12750. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12751. option may cause flicker since the B-Frames have often larger QP. Default is
  12752. @code{0} (not enabled).
  12753. @end table
  12754. @section sr
  12755. Scale the input by applying one of the super-resolution methods based on
  12756. convolutional neural networks. Supported models:
  12757. @itemize
  12758. @item
  12759. Super-Resolution Convolutional Neural Network model (SRCNN).
  12760. See @url{https://arxiv.org/abs/1501.00092}.
  12761. @item
  12762. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12763. See @url{https://arxiv.org/abs/1609.05158}.
  12764. @end itemize
  12765. Training scripts as well as scripts for model file (.pb) saving can be found at
  12766. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  12767. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12768. Native model files (.model) can be generated from TensorFlow model
  12769. files (.pb) by using tools/python/convert.py
  12770. The filter accepts the following options:
  12771. @table @option
  12772. @item dnn_backend
  12773. Specify which DNN backend to use for model loading and execution. This option accepts
  12774. the following values:
  12775. @table @samp
  12776. @item native
  12777. Native implementation of DNN loading and execution.
  12778. @item tensorflow
  12779. TensorFlow backend. To enable this backend you
  12780. need to install the TensorFlow for C library (see
  12781. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12782. @code{--enable-libtensorflow}
  12783. @end table
  12784. Default value is @samp{native}.
  12785. @item model
  12786. Set path to model file specifying network architecture and its parameters.
  12787. Note that different backends use different file formats. TensorFlow backend
  12788. can load files for both formats, while native backend can load files for only
  12789. its format.
  12790. @item scale_factor
  12791. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12792. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12793. input upscaled using bicubic upscaling with proper scale factor.
  12794. @end table
  12795. @section ssim
  12796. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12797. This filter takes in input two input videos, the first input is
  12798. considered the "main" source and is passed unchanged to the
  12799. output. The second input is used as a "reference" video for computing
  12800. the SSIM.
  12801. Both video inputs must have the same resolution and pixel format for
  12802. this filter to work correctly. Also it assumes that both inputs
  12803. have the same number of frames, which are compared one by one.
  12804. The filter stores the calculated SSIM of each frame.
  12805. The description of the accepted parameters follows.
  12806. @table @option
  12807. @item stats_file, f
  12808. If specified the filter will use the named file to save the SSIM of
  12809. each individual frame. When filename equals "-" the data is sent to
  12810. standard output.
  12811. @end table
  12812. The file printed if @var{stats_file} is selected, contains a sequence of
  12813. key/value pairs of the form @var{key}:@var{value} for each compared
  12814. couple of frames.
  12815. A description of each shown parameter follows:
  12816. @table @option
  12817. @item n
  12818. sequential number of the input frame, starting from 1
  12819. @item Y, U, V, R, G, B
  12820. SSIM of the compared frames for the component specified by the suffix.
  12821. @item All
  12822. SSIM of the compared frames for the whole frame.
  12823. @item dB
  12824. Same as above but in dB representation.
  12825. @end table
  12826. This filter also supports the @ref{framesync} options.
  12827. For example:
  12828. @example
  12829. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12830. [main][ref] ssim="stats_file=stats.log" [out]
  12831. @end example
  12832. On this example the input file being processed is compared with the
  12833. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12834. is stored in @file{stats.log}.
  12835. Another example with both psnr and ssim at same time:
  12836. @example
  12837. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12838. @end example
  12839. @section stereo3d
  12840. Convert between different stereoscopic image formats.
  12841. The filters accept the following options:
  12842. @table @option
  12843. @item in
  12844. Set stereoscopic image format of input.
  12845. Available values for input image formats are:
  12846. @table @samp
  12847. @item sbsl
  12848. side by side parallel (left eye left, right eye right)
  12849. @item sbsr
  12850. side by side crosseye (right eye left, left eye right)
  12851. @item sbs2l
  12852. side by side parallel with half width resolution
  12853. (left eye left, right eye right)
  12854. @item sbs2r
  12855. side by side crosseye with half width resolution
  12856. (right eye left, left eye right)
  12857. @item abl
  12858. @item tbl
  12859. above-below (left eye above, right eye below)
  12860. @item abr
  12861. @item tbr
  12862. above-below (right eye above, left eye below)
  12863. @item ab2l
  12864. @item tb2l
  12865. above-below with half height resolution
  12866. (left eye above, right eye below)
  12867. @item ab2r
  12868. @item tb2r
  12869. above-below with half height resolution
  12870. (right eye above, left eye below)
  12871. @item al
  12872. alternating frames (left eye first, right eye second)
  12873. @item ar
  12874. alternating frames (right eye first, left eye second)
  12875. @item irl
  12876. interleaved rows (left eye has top row, right eye starts on next row)
  12877. @item irr
  12878. interleaved rows (right eye has top row, left eye starts on next row)
  12879. @item icl
  12880. interleaved columns, left eye first
  12881. @item icr
  12882. interleaved columns, right eye first
  12883. Default value is @samp{sbsl}.
  12884. @end table
  12885. @item out
  12886. Set stereoscopic image format of output.
  12887. @table @samp
  12888. @item sbsl
  12889. side by side parallel (left eye left, right eye right)
  12890. @item sbsr
  12891. side by side crosseye (right eye left, left eye right)
  12892. @item sbs2l
  12893. side by side parallel with half width resolution
  12894. (left eye left, right eye right)
  12895. @item sbs2r
  12896. side by side crosseye with half width resolution
  12897. (right eye left, left eye right)
  12898. @item abl
  12899. @item tbl
  12900. above-below (left eye above, right eye below)
  12901. @item abr
  12902. @item tbr
  12903. above-below (right eye above, left eye below)
  12904. @item ab2l
  12905. @item tb2l
  12906. above-below with half height resolution
  12907. (left eye above, right eye below)
  12908. @item ab2r
  12909. @item tb2r
  12910. above-below with half height resolution
  12911. (right eye above, left eye below)
  12912. @item al
  12913. alternating frames (left eye first, right eye second)
  12914. @item ar
  12915. alternating frames (right eye first, left eye second)
  12916. @item irl
  12917. interleaved rows (left eye has top row, right eye starts on next row)
  12918. @item irr
  12919. interleaved rows (right eye has top row, left eye starts on next row)
  12920. @item arbg
  12921. anaglyph red/blue gray
  12922. (red filter on left eye, blue filter on right eye)
  12923. @item argg
  12924. anaglyph red/green gray
  12925. (red filter on left eye, green filter on right eye)
  12926. @item arcg
  12927. anaglyph red/cyan gray
  12928. (red filter on left eye, cyan filter on right eye)
  12929. @item arch
  12930. anaglyph red/cyan half colored
  12931. (red filter on left eye, cyan filter on right eye)
  12932. @item arcc
  12933. anaglyph red/cyan color
  12934. (red filter on left eye, cyan filter on right eye)
  12935. @item arcd
  12936. anaglyph red/cyan color optimized with the least squares projection of dubois
  12937. (red filter on left eye, cyan filter on right eye)
  12938. @item agmg
  12939. anaglyph green/magenta gray
  12940. (green filter on left eye, magenta filter on right eye)
  12941. @item agmh
  12942. anaglyph green/magenta half colored
  12943. (green filter on left eye, magenta filter on right eye)
  12944. @item agmc
  12945. anaglyph green/magenta colored
  12946. (green filter on left eye, magenta filter on right eye)
  12947. @item agmd
  12948. anaglyph green/magenta color optimized with the least squares projection of dubois
  12949. (green filter on left eye, magenta filter on right eye)
  12950. @item aybg
  12951. anaglyph yellow/blue gray
  12952. (yellow filter on left eye, blue filter on right eye)
  12953. @item aybh
  12954. anaglyph yellow/blue half colored
  12955. (yellow filter on left eye, blue filter on right eye)
  12956. @item aybc
  12957. anaglyph yellow/blue colored
  12958. (yellow filter on left eye, blue filter on right eye)
  12959. @item aybd
  12960. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12961. (yellow filter on left eye, blue filter on right eye)
  12962. @item ml
  12963. mono output (left eye only)
  12964. @item mr
  12965. mono output (right eye only)
  12966. @item chl
  12967. checkerboard, left eye first
  12968. @item chr
  12969. checkerboard, right eye first
  12970. @item icl
  12971. interleaved columns, left eye first
  12972. @item icr
  12973. interleaved columns, right eye first
  12974. @item hdmi
  12975. HDMI frame pack
  12976. @end table
  12977. Default value is @samp{arcd}.
  12978. @end table
  12979. @subsection Examples
  12980. @itemize
  12981. @item
  12982. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12983. @example
  12984. stereo3d=sbsl:aybd
  12985. @end example
  12986. @item
  12987. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12988. @example
  12989. stereo3d=abl:sbsr
  12990. @end example
  12991. @end itemize
  12992. @section streamselect, astreamselect
  12993. Select video or audio streams.
  12994. The filter accepts the following options:
  12995. @table @option
  12996. @item inputs
  12997. Set number of inputs. Default is 2.
  12998. @item map
  12999. Set input indexes to remap to outputs.
  13000. @end table
  13001. @subsection Commands
  13002. The @code{streamselect} and @code{astreamselect} filter supports the following
  13003. commands:
  13004. @table @option
  13005. @item map
  13006. Set input indexes to remap to outputs.
  13007. @end table
  13008. @subsection Examples
  13009. @itemize
  13010. @item
  13011. Select first 5 seconds 1st stream and rest of time 2nd stream:
  13012. @example
  13013. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  13014. @end example
  13015. @item
  13016. Same as above, but for audio:
  13017. @example
  13018. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  13019. @end example
  13020. @end itemize
  13021. @anchor{subtitles}
  13022. @section subtitles
  13023. Draw subtitles on top of input video using the libass library.
  13024. To enable compilation of this filter you need to configure FFmpeg with
  13025. @code{--enable-libass}. This filter also requires a build with libavcodec and
  13026. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  13027. Alpha) subtitles format.
  13028. The filter accepts the following options:
  13029. @table @option
  13030. @item filename, f
  13031. Set the filename of the subtitle file to read. It must be specified.
  13032. @item original_size
  13033. Specify the size of the original video, the video for which the ASS file
  13034. was composed. For the syntax of this option, check the
  13035. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13036. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  13037. correctly scale the fonts if the aspect ratio has been changed.
  13038. @item fontsdir
  13039. Set a directory path containing fonts that can be used by the filter.
  13040. These fonts will be used in addition to whatever the font provider uses.
  13041. @item alpha
  13042. Process alpha channel, by default alpha channel is untouched.
  13043. @item charenc
  13044. Set subtitles input character encoding. @code{subtitles} filter only. Only
  13045. useful if not UTF-8.
  13046. @item stream_index, si
  13047. Set subtitles stream index. @code{subtitles} filter only.
  13048. @item force_style
  13049. Override default style or script info parameters of the subtitles. It accepts a
  13050. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  13051. @end table
  13052. If the first key is not specified, it is assumed that the first value
  13053. specifies the @option{filename}.
  13054. For example, to render the file @file{sub.srt} on top of the input
  13055. video, use the command:
  13056. @example
  13057. subtitles=sub.srt
  13058. @end example
  13059. which is equivalent to:
  13060. @example
  13061. subtitles=filename=sub.srt
  13062. @end example
  13063. To render the default subtitles stream from file @file{video.mkv}, use:
  13064. @example
  13065. subtitles=video.mkv
  13066. @end example
  13067. To render the second subtitles stream from that file, use:
  13068. @example
  13069. subtitles=video.mkv:si=1
  13070. @end example
  13071. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  13072. @code{DejaVu Serif}, use:
  13073. @example
  13074. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  13075. @end example
  13076. @section super2xsai
  13077. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  13078. Interpolate) pixel art scaling algorithm.
  13079. Useful for enlarging pixel art images without reducing sharpness.
  13080. @section swaprect
  13081. Swap two rectangular objects in video.
  13082. This filter accepts the following options:
  13083. @table @option
  13084. @item w
  13085. Set object width.
  13086. @item h
  13087. Set object height.
  13088. @item x1
  13089. Set 1st rect x coordinate.
  13090. @item y1
  13091. Set 1st rect y coordinate.
  13092. @item x2
  13093. Set 2nd rect x coordinate.
  13094. @item y2
  13095. Set 2nd rect y coordinate.
  13096. All expressions are evaluated once for each frame.
  13097. @end table
  13098. The all options are expressions containing the following constants:
  13099. @table @option
  13100. @item w
  13101. @item h
  13102. The input width and height.
  13103. @item a
  13104. same as @var{w} / @var{h}
  13105. @item sar
  13106. input sample aspect ratio
  13107. @item dar
  13108. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13109. @item n
  13110. The number of the input frame, starting from 0.
  13111. @item t
  13112. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13113. @item pos
  13114. the position in the file of the input frame, NAN if unknown
  13115. @end table
  13116. @section swapuv
  13117. Swap U & V plane.
  13118. @section telecine
  13119. Apply telecine process to the video.
  13120. This filter accepts the following options:
  13121. @table @option
  13122. @item first_field
  13123. @table @samp
  13124. @item top, t
  13125. top field first
  13126. @item bottom, b
  13127. bottom field first
  13128. The default value is @code{top}.
  13129. @end table
  13130. @item pattern
  13131. A string of numbers representing the pulldown pattern you wish to apply.
  13132. The default value is @code{23}.
  13133. @end table
  13134. @example
  13135. Some typical patterns:
  13136. NTSC output (30i):
  13137. 27.5p: 32222
  13138. 24p: 23 (classic)
  13139. 24p: 2332 (preferred)
  13140. 20p: 33
  13141. 18p: 334
  13142. 16p: 3444
  13143. PAL output (25i):
  13144. 27.5p: 12222
  13145. 24p: 222222222223 ("Euro pulldown")
  13146. 16.67p: 33
  13147. 16p: 33333334
  13148. @end example
  13149. @section threshold
  13150. Apply threshold effect to video stream.
  13151. This filter needs four video streams to perform thresholding.
  13152. First stream is stream we are filtering.
  13153. Second stream is holding threshold values, third stream is holding min values,
  13154. and last, fourth stream is holding max values.
  13155. The filter accepts the following option:
  13156. @table @option
  13157. @item planes
  13158. Set which planes will be processed, unprocessed planes will be copied.
  13159. By default value 0xf, all planes will be processed.
  13160. @end table
  13161. For example if first stream pixel's component value is less then threshold value
  13162. of pixel component from 2nd threshold stream, third stream value will picked,
  13163. otherwise fourth stream pixel component value will be picked.
  13164. Using color source filter one can perform various types of thresholding:
  13165. @subsection Examples
  13166. @itemize
  13167. @item
  13168. Binary threshold, using gray color as threshold:
  13169. @example
  13170. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13171. @end example
  13172. @item
  13173. Inverted binary threshold, using gray color as threshold:
  13174. @example
  13175. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13176. @end example
  13177. @item
  13178. Truncate binary threshold, using gray color as threshold:
  13179. @example
  13180. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13181. @end example
  13182. @item
  13183. Threshold to zero, using gray color as threshold:
  13184. @example
  13185. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13186. @end example
  13187. @item
  13188. Inverted threshold to zero, using gray color as threshold:
  13189. @example
  13190. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13191. @end example
  13192. @end itemize
  13193. @section thumbnail
  13194. Select the most representative frame in a given sequence of consecutive frames.
  13195. The filter accepts the following options:
  13196. @table @option
  13197. @item n
  13198. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13199. will pick one of them, and then handle the next batch of @var{n} frames until
  13200. the end. Default is @code{100}.
  13201. @end table
  13202. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13203. value will result in a higher memory usage, so a high value is not recommended.
  13204. @subsection Examples
  13205. @itemize
  13206. @item
  13207. Extract one picture each 50 frames:
  13208. @example
  13209. thumbnail=50
  13210. @end example
  13211. @item
  13212. Complete example of a thumbnail creation with @command{ffmpeg}:
  13213. @example
  13214. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13215. @end example
  13216. @end itemize
  13217. @section tile
  13218. Tile several successive frames together.
  13219. The filter accepts the following options:
  13220. @table @option
  13221. @item layout
  13222. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13223. this option, check the
  13224. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13225. @item nb_frames
  13226. Set the maximum number of frames to render in the given area. It must be less
  13227. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13228. the area will be used.
  13229. @item margin
  13230. Set the outer border margin in pixels.
  13231. @item padding
  13232. Set the inner border thickness (i.e. the number of pixels between frames). For
  13233. more advanced padding options (such as having different values for the edges),
  13234. refer to the pad video filter.
  13235. @item color
  13236. Specify the color of the unused area. For the syntax of this option, check the
  13237. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13238. The default value of @var{color} is "black".
  13239. @item overlap
  13240. Set the number of frames to overlap when tiling several successive frames together.
  13241. The value must be between @code{0} and @var{nb_frames - 1}.
  13242. @item init_padding
  13243. Set the number of frames to initially be empty before displaying first output frame.
  13244. This controls how soon will one get first output frame.
  13245. The value must be between @code{0} and @var{nb_frames - 1}.
  13246. @end table
  13247. @subsection Examples
  13248. @itemize
  13249. @item
  13250. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13251. @example
  13252. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13253. @end example
  13254. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13255. duplicating each output frame to accommodate the originally detected frame
  13256. rate.
  13257. @item
  13258. Display @code{5} pictures in an area of @code{3x2} frames,
  13259. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13260. mixed flat and named options:
  13261. @example
  13262. tile=3x2:nb_frames=5:padding=7:margin=2
  13263. @end example
  13264. @end itemize
  13265. @section tinterlace
  13266. Perform various types of temporal field interlacing.
  13267. Frames are counted starting from 1, so the first input frame is
  13268. considered odd.
  13269. The filter accepts the following options:
  13270. @table @option
  13271. @item mode
  13272. Specify the mode of the interlacing. This option can also be specified
  13273. as a value alone. See below for a list of values for this option.
  13274. Available values are:
  13275. @table @samp
  13276. @item merge, 0
  13277. Move odd frames into the upper field, even into the lower field,
  13278. generating a double height frame at half frame rate.
  13279. @example
  13280. ------> time
  13281. Input:
  13282. Frame 1 Frame 2 Frame 3 Frame 4
  13283. 11111 22222 33333 44444
  13284. 11111 22222 33333 44444
  13285. 11111 22222 33333 44444
  13286. 11111 22222 33333 44444
  13287. Output:
  13288. 11111 33333
  13289. 22222 44444
  13290. 11111 33333
  13291. 22222 44444
  13292. 11111 33333
  13293. 22222 44444
  13294. 11111 33333
  13295. 22222 44444
  13296. @end example
  13297. @item drop_even, 1
  13298. Only output odd frames, even frames are dropped, generating a frame with
  13299. unchanged height at half frame rate.
  13300. @example
  13301. ------> time
  13302. Input:
  13303. Frame 1 Frame 2 Frame 3 Frame 4
  13304. 11111 22222 33333 44444
  13305. 11111 22222 33333 44444
  13306. 11111 22222 33333 44444
  13307. 11111 22222 33333 44444
  13308. Output:
  13309. 11111 33333
  13310. 11111 33333
  13311. 11111 33333
  13312. 11111 33333
  13313. @end example
  13314. @item drop_odd, 2
  13315. Only output even frames, odd frames are dropped, generating a frame with
  13316. unchanged height at half frame rate.
  13317. @example
  13318. ------> time
  13319. Input:
  13320. Frame 1 Frame 2 Frame 3 Frame 4
  13321. 11111 22222 33333 44444
  13322. 11111 22222 33333 44444
  13323. 11111 22222 33333 44444
  13324. 11111 22222 33333 44444
  13325. Output:
  13326. 22222 44444
  13327. 22222 44444
  13328. 22222 44444
  13329. 22222 44444
  13330. @end example
  13331. @item pad, 3
  13332. Expand each frame to full height, but pad alternate lines with black,
  13333. generating a frame with double height at the same input frame rate.
  13334. @example
  13335. ------> time
  13336. Input:
  13337. Frame 1 Frame 2 Frame 3 Frame 4
  13338. 11111 22222 33333 44444
  13339. 11111 22222 33333 44444
  13340. 11111 22222 33333 44444
  13341. 11111 22222 33333 44444
  13342. Output:
  13343. 11111 ..... 33333 .....
  13344. ..... 22222 ..... 44444
  13345. 11111 ..... 33333 .....
  13346. ..... 22222 ..... 44444
  13347. 11111 ..... 33333 .....
  13348. ..... 22222 ..... 44444
  13349. 11111 ..... 33333 .....
  13350. ..... 22222 ..... 44444
  13351. @end example
  13352. @item interleave_top, 4
  13353. Interleave the upper field from odd frames with the lower field from
  13354. even frames, generating a frame with unchanged height at half frame rate.
  13355. @example
  13356. ------> time
  13357. Input:
  13358. Frame 1 Frame 2 Frame 3 Frame 4
  13359. 11111<- 22222 33333<- 44444
  13360. 11111 22222<- 33333 44444<-
  13361. 11111<- 22222 33333<- 44444
  13362. 11111 22222<- 33333 44444<-
  13363. Output:
  13364. 11111 33333
  13365. 22222 44444
  13366. 11111 33333
  13367. 22222 44444
  13368. @end example
  13369. @item interleave_bottom, 5
  13370. Interleave the lower field from odd frames with the upper field from
  13371. even frames, generating a frame with unchanged height at half frame rate.
  13372. @example
  13373. ------> time
  13374. Input:
  13375. Frame 1 Frame 2 Frame 3 Frame 4
  13376. 11111 22222<- 33333 44444<-
  13377. 11111<- 22222 33333<- 44444
  13378. 11111 22222<- 33333 44444<-
  13379. 11111<- 22222 33333<- 44444
  13380. Output:
  13381. 22222 44444
  13382. 11111 33333
  13383. 22222 44444
  13384. 11111 33333
  13385. @end example
  13386. @item interlacex2, 6
  13387. Double frame rate with unchanged height. Frames are inserted each
  13388. containing the second temporal field from the previous input frame and
  13389. the first temporal field from the next input frame. This mode relies on
  13390. the top_field_first flag. Useful for interlaced video displays with no
  13391. field synchronisation.
  13392. @example
  13393. ------> time
  13394. Input:
  13395. Frame 1 Frame 2 Frame 3 Frame 4
  13396. 11111 22222 33333 44444
  13397. 11111 22222 33333 44444
  13398. 11111 22222 33333 44444
  13399. 11111 22222 33333 44444
  13400. Output:
  13401. 11111 22222 22222 33333 33333 44444 44444
  13402. 11111 11111 22222 22222 33333 33333 44444
  13403. 11111 22222 22222 33333 33333 44444 44444
  13404. 11111 11111 22222 22222 33333 33333 44444
  13405. @end example
  13406. @item mergex2, 7
  13407. Move odd frames into the upper field, even into the lower field,
  13408. generating a double height frame at same frame rate.
  13409. @example
  13410. ------> time
  13411. Input:
  13412. Frame 1 Frame 2 Frame 3 Frame 4
  13413. 11111 22222 33333 44444
  13414. 11111 22222 33333 44444
  13415. 11111 22222 33333 44444
  13416. 11111 22222 33333 44444
  13417. Output:
  13418. 11111 33333 33333 55555
  13419. 22222 22222 44444 44444
  13420. 11111 33333 33333 55555
  13421. 22222 22222 44444 44444
  13422. 11111 33333 33333 55555
  13423. 22222 22222 44444 44444
  13424. 11111 33333 33333 55555
  13425. 22222 22222 44444 44444
  13426. @end example
  13427. @end table
  13428. Numeric values are deprecated but are accepted for backward
  13429. compatibility reasons.
  13430. Default mode is @code{merge}.
  13431. @item flags
  13432. Specify flags influencing the filter process.
  13433. Available value for @var{flags} is:
  13434. @table @option
  13435. @item low_pass_filter, vlpf
  13436. Enable linear vertical low-pass filtering in the filter.
  13437. Vertical low-pass filtering is required when creating an interlaced
  13438. destination from a progressive source which contains high-frequency
  13439. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13440. patterning.
  13441. @item complex_filter, cvlpf
  13442. Enable complex vertical low-pass filtering.
  13443. This will slightly less reduce interlace 'twitter' and Moire
  13444. patterning but better retain detail and subjective sharpness impression.
  13445. @end table
  13446. Vertical low-pass filtering can only be enabled for @option{mode}
  13447. @var{interleave_top} and @var{interleave_bottom}.
  13448. @end table
  13449. @section tmix
  13450. Mix successive video frames.
  13451. A description of the accepted options follows.
  13452. @table @option
  13453. @item frames
  13454. The number of successive frames to mix. If unspecified, it defaults to 3.
  13455. @item weights
  13456. Specify weight of each input video frame.
  13457. Each weight is separated by space. If number of weights is smaller than
  13458. number of @var{frames} last specified weight will be used for all remaining
  13459. unset weights.
  13460. @item scale
  13461. Specify scale, if it is set it will be multiplied with sum
  13462. of each weight multiplied with pixel values to give final destination
  13463. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13464. @end table
  13465. @subsection Examples
  13466. @itemize
  13467. @item
  13468. Average 7 successive frames:
  13469. @example
  13470. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13471. @end example
  13472. @item
  13473. Apply simple temporal convolution:
  13474. @example
  13475. tmix=frames=3:weights="-1 3 -1"
  13476. @end example
  13477. @item
  13478. Similar as above but only showing temporal differences:
  13479. @example
  13480. tmix=frames=3:weights="-1 2 -1":scale=1
  13481. @end example
  13482. @end itemize
  13483. @anchor{tonemap}
  13484. @section tonemap
  13485. Tone map colors from different dynamic ranges.
  13486. This filter expects data in single precision floating point, as it needs to
  13487. operate on (and can output) out-of-range values. Another filter, such as
  13488. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13489. The tonemapping algorithms implemented only work on linear light, so input
  13490. data should be linearized beforehand (and possibly correctly tagged).
  13491. @example
  13492. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13493. @end example
  13494. @subsection Options
  13495. The filter accepts the following options.
  13496. @table @option
  13497. @item tonemap
  13498. Set the tone map algorithm to use.
  13499. Possible values are:
  13500. @table @var
  13501. @item none
  13502. Do not apply any tone map, only desaturate overbright pixels.
  13503. @item clip
  13504. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13505. in-range values, while distorting out-of-range values.
  13506. @item linear
  13507. Stretch the entire reference gamut to a linear multiple of the display.
  13508. @item gamma
  13509. Fit a logarithmic transfer between the tone curves.
  13510. @item reinhard
  13511. Preserve overall image brightness with a simple curve, using nonlinear
  13512. contrast, which results in flattening details and degrading color accuracy.
  13513. @item hable
  13514. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13515. of slightly darkening everything. Use it when detail preservation is more
  13516. important than color and brightness accuracy.
  13517. @item mobius
  13518. Smoothly map out-of-range values, while retaining contrast and colors for
  13519. in-range material as much as possible. Use it when color accuracy is more
  13520. important than detail preservation.
  13521. @end table
  13522. Default is none.
  13523. @item param
  13524. Tune the tone mapping algorithm.
  13525. This affects the following algorithms:
  13526. @table @var
  13527. @item none
  13528. Ignored.
  13529. @item linear
  13530. Specifies the scale factor to use while stretching.
  13531. Default to 1.0.
  13532. @item gamma
  13533. Specifies the exponent of the function.
  13534. Default to 1.8.
  13535. @item clip
  13536. Specify an extra linear coefficient to multiply into the signal before clipping.
  13537. Default to 1.0.
  13538. @item reinhard
  13539. Specify the local contrast coefficient at the display peak.
  13540. Default to 0.5, which means that in-gamut values will be about half as bright
  13541. as when clipping.
  13542. @item hable
  13543. Ignored.
  13544. @item mobius
  13545. Specify the transition point from linear to mobius transform. Every value
  13546. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13547. more accurate the result will be, at the cost of losing bright details.
  13548. Default to 0.3, which due to the steep initial slope still preserves in-range
  13549. colors fairly accurately.
  13550. @end table
  13551. @item desat
  13552. Apply desaturation for highlights that exceed this level of brightness. The
  13553. higher the parameter, the more color information will be preserved. This
  13554. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13555. (smoothly) turning into white instead. This makes images feel more natural,
  13556. at the cost of reducing information about out-of-range colors.
  13557. The default of 2.0 is somewhat conservative and will mostly just apply to
  13558. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13559. This option works only if the input frame has a supported color tag.
  13560. @item peak
  13561. Override signal/nominal/reference peak with this value. Useful when the
  13562. embedded peak information in display metadata is not reliable or when tone
  13563. mapping from a lower range to a higher range.
  13564. @end table
  13565. @section tpad
  13566. Temporarily pad video frames.
  13567. The filter accepts the following options:
  13568. @table @option
  13569. @item start
  13570. Specify number of delay frames before input video stream.
  13571. @item stop
  13572. Specify number of padding frames after input video stream.
  13573. Set to -1 to pad indefinitely.
  13574. @item start_mode
  13575. Set kind of frames added to beginning of stream.
  13576. Can be either @var{add} or @var{clone}.
  13577. With @var{add} frames of solid-color are added.
  13578. With @var{clone} frames are clones of first frame.
  13579. @item stop_mode
  13580. Set kind of frames added to end of stream.
  13581. Can be either @var{add} or @var{clone}.
  13582. With @var{add} frames of solid-color are added.
  13583. With @var{clone} frames are clones of last frame.
  13584. @item start_duration, stop_duration
  13585. Specify the duration of the start/stop delay. See
  13586. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13587. for the accepted syntax.
  13588. These options override @var{start} and @var{stop}.
  13589. @item color
  13590. Specify the color of the padded area. For the syntax of this option,
  13591. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13592. manual,ffmpeg-utils}.
  13593. The default value of @var{color} is "black".
  13594. @end table
  13595. @anchor{transpose}
  13596. @section transpose
  13597. Transpose rows with columns in the input video and optionally flip it.
  13598. It accepts the following parameters:
  13599. @table @option
  13600. @item dir
  13601. Specify the transposition direction.
  13602. Can assume the following values:
  13603. @table @samp
  13604. @item 0, 4, cclock_flip
  13605. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13606. @example
  13607. L.R L.l
  13608. . . -> . .
  13609. l.r R.r
  13610. @end example
  13611. @item 1, 5, clock
  13612. Rotate by 90 degrees clockwise, that is:
  13613. @example
  13614. L.R l.L
  13615. . . -> . .
  13616. l.r r.R
  13617. @end example
  13618. @item 2, 6, cclock
  13619. Rotate by 90 degrees counterclockwise, that is:
  13620. @example
  13621. L.R R.r
  13622. . . -> . .
  13623. l.r L.l
  13624. @end example
  13625. @item 3, 7, clock_flip
  13626. Rotate by 90 degrees clockwise and vertically flip, that is:
  13627. @example
  13628. L.R r.R
  13629. . . -> . .
  13630. l.r l.L
  13631. @end example
  13632. @end table
  13633. For values between 4-7, the transposition is only done if the input
  13634. video geometry is portrait and not landscape. These values are
  13635. deprecated, the @code{passthrough} option should be used instead.
  13636. Numerical values are deprecated, and should be dropped in favor of
  13637. symbolic constants.
  13638. @item passthrough
  13639. Do not apply the transposition if the input geometry matches the one
  13640. specified by the specified value. It accepts the following values:
  13641. @table @samp
  13642. @item none
  13643. Always apply transposition.
  13644. @item portrait
  13645. Preserve portrait geometry (when @var{height} >= @var{width}).
  13646. @item landscape
  13647. Preserve landscape geometry (when @var{width} >= @var{height}).
  13648. @end table
  13649. Default value is @code{none}.
  13650. @end table
  13651. For example to rotate by 90 degrees clockwise and preserve portrait
  13652. layout:
  13653. @example
  13654. transpose=dir=1:passthrough=portrait
  13655. @end example
  13656. The command above can also be specified as:
  13657. @example
  13658. transpose=1:portrait
  13659. @end example
  13660. @section transpose_npp
  13661. Transpose rows with columns in the input video and optionally flip it.
  13662. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13663. It accepts the following parameters:
  13664. @table @option
  13665. @item dir
  13666. Specify the transposition direction.
  13667. Can assume the following values:
  13668. @table @samp
  13669. @item cclock_flip
  13670. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13671. @item clock
  13672. Rotate by 90 degrees clockwise.
  13673. @item cclock
  13674. Rotate by 90 degrees counterclockwise.
  13675. @item clock_flip
  13676. Rotate by 90 degrees clockwise and vertically flip.
  13677. @end table
  13678. @item passthrough
  13679. Do not apply the transposition if the input geometry matches the one
  13680. specified by the specified value. It accepts the following values:
  13681. @table @samp
  13682. @item none
  13683. Always apply transposition. (default)
  13684. @item portrait
  13685. Preserve portrait geometry (when @var{height} >= @var{width}).
  13686. @item landscape
  13687. Preserve landscape geometry (when @var{width} >= @var{height}).
  13688. @end table
  13689. @end table
  13690. @section trim
  13691. Trim the input so that the output contains one continuous subpart of the input.
  13692. It accepts the following parameters:
  13693. @table @option
  13694. @item start
  13695. Specify the time of the start of the kept section, i.e. the frame with the
  13696. timestamp @var{start} will be the first frame in the output.
  13697. @item end
  13698. Specify the time of the first frame that will be dropped, i.e. the frame
  13699. immediately preceding the one with the timestamp @var{end} will be the last
  13700. frame in the output.
  13701. @item start_pts
  13702. This is the same as @var{start}, except this option sets the start timestamp
  13703. in timebase units instead of seconds.
  13704. @item end_pts
  13705. This is the same as @var{end}, except this option sets the end timestamp
  13706. in timebase units instead of seconds.
  13707. @item duration
  13708. The maximum duration of the output in seconds.
  13709. @item start_frame
  13710. The number of the first frame that should be passed to the output.
  13711. @item end_frame
  13712. The number of the first frame that should be dropped.
  13713. @end table
  13714. @option{start}, @option{end}, and @option{duration} are expressed as time
  13715. duration specifications; see
  13716. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13717. for the accepted syntax.
  13718. Note that the first two sets of the start/end options and the @option{duration}
  13719. option look at the frame timestamp, while the _frame variants simply count the
  13720. frames that pass through the filter. Also note that this filter does not modify
  13721. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13722. setpts filter after the trim filter.
  13723. If multiple start or end options are set, this filter tries to be greedy and
  13724. keep all the frames that match at least one of the specified constraints. To keep
  13725. only the part that matches all the constraints at once, chain multiple trim
  13726. filters.
  13727. The defaults are such that all the input is kept. So it is possible to set e.g.
  13728. just the end values to keep everything before the specified time.
  13729. Examples:
  13730. @itemize
  13731. @item
  13732. Drop everything except the second minute of input:
  13733. @example
  13734. ffmpeg -i INPUT -vf trim=60:120
  13735. @end example
  13736. @item
  13737. Keep only the first second:
  13738. @example
  13739. ffmpeg -i INPUT -vf trim=duration=1
  13740. @end example
  13741. @end itemize
  13742. @section unpremultiply
  13743. Apply alpha unpremultiply effect to input video stream using first plane
  13744. of second stream as alpha.
  13745. Both streams must have same dimensions and same pixel format.
  13746. The filter accepts the following option:
  13747. @table @option
  13748. @item planes
  13749. Set which planes will be processed, unprocessed planes will be copied.
  13750. By default value 0xf, all planes will be processed.
  13751. If the format has 1 or 2 components, then luma is bit 0.
  13752. If the format has 3 or 4 components:
  13753. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13754. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13755. If present, the alpha channel is always the last bit.
  13756. @item inplace
  13757. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13758. @end table
  13759. @anchor{unsharp}
  13760. @section unsharp
  13761. Sharpen or blur the input video.
  13762. It accepts the following parameters:
  13763. @table @option
  13764. @item luma_msize_x, lx
  13765. Set the luma matrix horizontal size. It must be an odd integer between
  13766. 3 and 23. The default value is 5.
  13767. @item luma_msize_y, ly
  13768. Set the luma matrix vertical size. It must be an odd integer between 3
  13769. and 23. The default value is 5.
  13770. @item luma_amount, la
  13771. Set the luma effect strength. It must be a floating point number, reasonable
  13772. values lay between -1.5 and 1.5.
  13773. Negative values will blur the input video, while positive values will
  13774. sharpen it, a value of zero will disable the effect.
  13775. Default value is 1.0.
  13776. @item chroma_msize_x, cx
  13777. Set the chroma matrix horizontal size. It must be an odd integer
  13778. between 3 and 23. The default value is 5.
  13779. @item chroma_msize_y, cy
  13780. Set the chroma matrix vertical size. It must be an odd integer
  13781. between 3 and 23. The default value is 5.
  13782. @item chroma_amount, ca
  13783. Set the chroma effect strength. It must be a floating point number, reasonable
  13784. values lay between -1.5 and 1.5.
  13785. Negative values will blur the input video, while positive values will
  13786. sharpen it, a value of zero will disable the effect.
  13787. Default value is 0.0.
  13788. @end table
  13789. All parameters are optional and default to the equivalent of the
  13790. string '5:5:1.0:5:5:0.0'.
  13791. @subsection Examples
  13792. @itemize
  13793. @item
  13794. Apply strong luma sharpen effect:
  13795. @example
  13796. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13797. @end example
  13798. @item
  13799. Apply a strong blur of both luma and chroma parameters:
  13800. @example
  13801. unsharp=7:7:-2:7:7:-2
  13802. @end example
  13803. @end itemize
  13804. @section uspp
  13805. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13806. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13807. shifts and average the results.
  13808. The way this differs from the behavior of spp is that uspp actually encodes &
  13809. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13810. DCT similar to MJPEG.
  13811. The filter accepts the following options:
  13812. @table @option
  13813. @item quality
  13814. Set quality. This option defines the number of levels for averaging. It accepts
  13815. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13816. effect. A value of @code{8} means the higher quality. For each increment of
  13817. that value the speed drops by a factor of approximately 2. Default value is
  13818. @code{3}.
  13819. @item qp
  13820. Force a constant quantization parameter. If not set, the filter will use the QP
  13821. from the video stream (if available).
  13822. @end table
  13823. @section v360
  13824. Convert 360 videos between various formats.
  13825. The filter accepts the following options:
  13826. @table @option
  13827. @item input
  13828. @item output
  13829. Set format of the input/output video.
  13830. Available formats:
  13831. @table @samp
  13832. @item e
  13833. @item equirect
  13834. Equirectangular projection.
  13835. @item c3x2
  13836. @item c6x1
  13837. @item c1x6
  13838. Cubemap with 3x2/6x1/1x6 layout.
  13839. Format specific options:
  13840. @table @option
  13841. @item in_pad
  13842. @item out_pad
  13843. Set padding proportion for the input/output cubemap. Values in decimals.
  13844. Example values:
  13845. @table @samp
  13846. @item 0
  13847. No padding.
  13848. @item 0.01
  13849. 1% of face is padding. For example, with 1920x1280 resolution face size would be 640x640 and padding would be 3 pixels from each side. (640 * 0.01 = 6 pixels)
  13850. @end table
  13851. Default value is @b{@samp{0}}.
  13852. @item fin_pad
  13853. @item fout_pad
  13854. Set fixed padding for the input/output cubemap. Values in pixels.
  13855. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  13856. @item in_forder
  13857. @item out_forder
  13858. Set order of faces for the input/output cubemap. Choose one direction for each position.
  13859. Designation of directions:
  13860. @table @samp
  13861. @item r
  13862. right
  13863. @item l
  13864. left
  13865. @item u
  13866. up
  13867. @item d
  13868. down
  13869. @item f
  13870. forward
  13871. @item b
  13872. back
  13873. @end table
  13874. Default value is @b{@samp{rludfb}}.
  13875. @item in_frot
  13876. @item out_frot
  13877. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  13878. Designation of angles:
  13879. @table @samp
  13880. @item 0
  13881. 0 degrees clockwise
  13882. @item 1
  13883. 90 degrees clockwise
  13884. @item 2
  13885. 180 degrees clockwise
  13886. @item 3
  13887. 270 degrees clockwise
  13888. @end table
  13889. Default value is @b{@samp{000000}}.
  13890. @end table
  13891. @item eac
  13892. Equi-Angular Cubemap.
  13893. @item flat
  13894. @item gnomonic
  13895. @item rectilinear
  13896. Regular video. @i{(output only)}
  13897. Format specific options:
  13898. @table @option
  13899. @item h_fov
  13900. @item v_fov
  13901. @item d_fov
  13902. Set horizontal/vertical/diagonal field of view. Values in degrees.
  13903. If diagonal field of view is set it overrides horizontal and vertical field of view.
  13904. @end table
  13905. @item dfisheye
  13906. Dual fisheye.
  13907. Format specific options:
  13908. @table @option
  13909. @item in_pad
  13910. @item out_pad
  13911. Set padding proportion. Values in decimals.
  13912. Example values:
  13913. @table @samp
  13914. @item 0
  13915. No padding.
  13916. @item 0.01
  13917. 1% padding.
  13918. @end table
  13919. Default value is @b{@samp{0}}.
  13920. @end table
  13921. @item barrel
  13922. @item fb
  13923. Facebook's 360 format.
  13924. @item sg
  13925. Stereographic format.
  13926. Format specific options:
  13927. @table @option
  13928. @item h_fov
  13929. @item v_fov
  13930. @item d_fov
  13931. Set horizontal/vertical/diagonal field of view. Values in degrees.
  13932. If diagonal field of view is set it overrides horizontal and vertical field of view.
  13933. @end table
  13934. @item mercator
  13935. Mercator format.
  13936. @item ball
  13937. Ball format, gives significant distortion toward the back.
  13938. @item hammer
  13939. Hammer-Aitoff map projection format.
  13940. @item sinusoidal
  13941. Sinusoidal map projection format.
  13942. @end table
  13943. @item interp
  13944. Set interpolation method.@*
  13945. @i{Note: more complex interpolation methods require much more memory to run.}
  13946. Available methods:
  13947. @table @samp
  13948. @item near
  13949. @item nearest
  13950. Nearest neighbour.
  13951. @item line
  13952. @item linear
  13953. Bilinear interpolation.
  13954. @item cube
  13955. @item cubic
  13956. Bicubic interpolation.
  13957. @item lanc
  13958. @item lanczos
  13959. Lanczos interpolation.
  13960. @end table
  13961. Default value is @b{@samp{line}}.
  13962. @item w
  13963. @item h
  13964. Set the output video resolution.
  13965. Default resolution depends on formats.
  13966. @item in_stereo
  13967. @item out_stereo
  13968. Set the input/output stereo format.
  13969. @table @samp
  13970. @item 2d
  13971. 2D mono
  13972. @item sbs
  13973. Side by side
  13974. @item tb
  13975. Top bottom
  13976. @end table
  13977. Default value is @b{@samp{2d}} for input and output format.
  13978. @item yaw
  13979. @item pitch
  13980. @item roll
  13981. Set rotation for the output video. Values in degrees.
  13982. @item rorder
  13983. Set rotation order for the output video. Choose one item for each position.
  13984. @table @samp
  13985. @item y, Y
  13986. yaw
  13987. @item p, P
  13988. pitch
  13989. @item r, R
  13990. roll
  13991. @end table
  13992. Default value is @b{@samp{ypr}}.
  13993. @item h_flip
  13994. @item v_flip
  13995. @item d_flip
  13996. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  13997. @item ih_flip
  13998. @item iv_flip
  13999. Set if input video is flipped horizontally/vertically. Boolean values.
  14000. @item in_trans
  14001. Set if input video is transposed. Boolean value, by default disabled.
  14002. @item out_trans
  14003. Set if output video needs to be transposed. Boolean value, by default disabled.
  14004. @end table
  14005. @subsection Examples
  14006. @itemize
  14007. @item
  14008. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  14009. @example
  14010. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  14011. @end example
  14012. @item
  14013. Extract back view of Equi-Angular Cubemap:
  14014. @example
  14015. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  14016. @end example
  14017. @item
  14018. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  14019. @example
  14020. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  14021. @end example
  14022. @end itemize
  14023. @section vaguedenoiser
  14024. Apply a wavelet based denoiser.
  14025. It transforms each frame from the video input into the wavelet domain,
  14026. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  14027. the obtained coefficients. It does an inverse wavelet transform after.
  14028. Due to wavelet properties, it should give a nice smoothed result, and
  14029. reduced noise, without blurring picture features.
  14030. This filter accepts the following options:
  14031. @table @option
  14032. @item threshold
  14033. The filtering strength. The higher, the more filtered the video will be.
  14034. Hard thresholding can use a higher threshold than soft thresholding
  14035. before the video looks overfiltered. Default value is 2.
  14036. @item method
  14037. The filtering method the filter will use.
  14038. It accepts the following values:
  14039. @table @samp
  14040. @item hard
  14041. All values under the threshold will be zeroed.
  14042. @item soft
  14043. All values under the threshold will be zeroed. All values above will be
  14044. reduced by the threshold.
  14045. @item garrote
  14046. Scales or nullifies coefficients - intermediary between (more) soft and
  14047. (less) hard thresholding.
  14048. @end table
  14049. Default is garrote.
  14050. @item nsteps
  14051. Number of times, the wavelet will decompose the picture. Picture can't
  14052. be decomposed beyond a particular point (typically, 8 for a 640x480
  14053. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  14054. @item percent
  14055. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  14056. @item planes
  14057. A list of the planes to process. By default all planes are processed.
  14058. @end table
  14059. @section vectorscope
  14060. Display 2 color component values in the two dimensional graph (which is called
  14061. a vectorscope).
  14062. This filter accepts the following options:
  14063. @table @option
  14064. @item mode, m
  14065. Set vectorscope mode.
  14066. It accepts the following values:
  14067. @table @samp
  14068. @item gray
  14069. Gray values are displayed on graph, higher brightness means more pixels have
  14070. same component color value on location in graph. This is the default mode.
  14071. @item color
  14072. Gray values are displayed on graph. Surrounding pixels values which are not
  14073. present in video frame are drawn in gradient of 2 color components which are
  14074. set by option @code{x} and @code{y}. The 3rd color component is static.
  14075. @item color2
  14076. Actual color components values present in video frame are displayed on graph.
  14077. @item color3
  14078. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  14079. on graph increases value of another color component, which is luminance by
  14080. default values of @code{x} and @code{y}.
  14081. @item color4
  14082. Actual colors present in video frame are displayed on graph. If two different
  14083. colors map to same position on graph then color with higher value of component
  14084. not present in graph is picked.
  14085. @item color5
  14086. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  14087. component picked from radial gradient.
  14088. @end table
  14089. @item x
  14090. Set which color component will be represented on X-axis. Default is @code{1}.
  14091. @item y
  14092. Set which color component will be represented on Y-axis. Default is @code{2}.
  14093. @item intensity, i
  14094. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  14095. of color component which represents frequency of (X, Y) location in graph.
  14096. @item envelope, e
  14097. @table @samp
  14098. @item none
  14099. No envelope, this is default.
  14100. @item instant
  14101. Instant envelope, even darkest single pixel will be clearly highlighted.
  14102. @item peak
  14103. Hold maximum and minimum values presented in graph over time. This way you
  14104. can still spot out of range values without constantly looking at vectorscope.
  14105. @item peak+instant
  14106. Peak and instant envelope combined together.
  14107. @end table
  14108. @item graticule, g
  14109. Set what kind of graticule to draw.
  14110. @table @samp
  14111. @item none
  14112. @item green
  14113. @item color
  14114. @end table
  14115. @item opacity, o
  14116. Set graticule opacity.
  14117. @item flags, f
  14118. Set graticule flags.
  14119. @table @samp
  14120. @item white
  14121. Draw graticule for white point.
  14122. @item black
  14123. Draw graticule for black point.
  14124. @item name
  14125. Draw color points short names.
  14126. @end table
  14127. @item bgopacity, b
  14128. Set background opacity.
  14129. @item lthreshold, l
  14130. Set low threshold for color component not represented on X or Y axis.
  14131. Values lower than this value will be ignored. Default is 0.
  14132. Note this value is multiplied with actual max possible value one pixel component
  14133. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  14134. is 0.1 * 255 = 25.
  14135. @item hthreshold, h
  14136. Set high threshold for color component not represented on X or Y axis.
  14137. Values higher than this value will be ignored. Default is 1.
  14138. Note this value is multiplied with actual max possible value one pixel component
  14139. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  14140. is 0.9 * 255 = 230.
  14141. @item colorspace, c
  14142. Set what kind of colorspace to use when drawing graticule.
  14143. @table @samp
  14144. @item auto
  14145. @item 601
  14146. @item 709
  14147. @end table
  14148. Default is auto.
  14149. @end table
  14150. @anchor{vidstabdetect}
  14151. @section vidstabdetect
  14152. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  14153. @ref{vidstabtransform} for pass 2.
  14154. This filter generates a file with relative translation and rotation
  14155. transform information about subsequent frames, which is then used by
  14156. the @ref{vidstabtransform} filter.
  14157. To enable compilation of this filter you need to configure FFmpeg with
  14158. @code{--enable-libvidstab}.
  14159. This filter accepts the following options:
  14160. @table @option
  14161. @item result
  14162. Set the path to the file used to write the transforms information.
  14163. Default value is @file{transforms.trf}.
  14164. @item shakiness
  14165. Set how shaky the video is and how quick the camera is. It accepts an
  14166. integer in the range 1-10, a value of 1 means little shakiness, a
  14167. value of 10 means strong shakiness. Default value is 5.
  14168. @item accuracy
  14169. Set the accuracy of the detection process. It must be a value in the
  14170. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  14171. accuracy. Default value is 15.
  14172. @item stepsize
  14173. Set stepsize of the search process. The region around minimum is
  14174. scanned with 1 pixel resolution. Default value is 6.
  14175. @item mincontrast
  14176. Set minimum contrast. Below this value a local measurement field is
  14177. discarded. Must be a floating point value in the range 0-1. Default
  14178. value is 0.3.
  14179. @item tripod
  14180. Set reference frame number for tripod mode.
  14181. If enabled, the motion of the frames is compared to a reference frame
  14182. in the filtered stream, identified by the specified number. The idea
  14183. is to compensate all movements in a more-or-less static scene and keep
  14184. the camera view absolutely still.
  14185. If set to 0, it is disabled. The frames are counted starting from 1.
  14186. @item show
  14187. Show fields and transforms in the resulting frames. It accepts an
  14188. integer in the range 0-2. Default value is 0, which disables any
  14189. visualization.
  14190. @end table
  14191. @subsection Examples
  14192. @itemize
  14193. @item
  14194. Use default values:
  14195. @example
  14196. vidstabdetect
  14197. @end example
  14198. @item
  14199. Analyze strongly shaky movie and put the results in file
  14200. @file{mytransforms.trf}:
  14201. @example
  14202. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  14203. @end example
  14204. @item
  14205. Visualize the result of internal transformations in the resulting
  14206. video:
  14207. @example
  14208. vidstabdetect=show=1
  14209. @end example
  14210. @item
  14211. Analyze a video with medium shakiness using @command{ffmpeg}:
  14212. @example
  14213. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  14214. @end example
  14215. @end itemize
  14216. @anchor{vidstabtransform}
  14217. @section vidstabtransform
  14218. Video stabilization/deshaking: pass 2 of 2,
  14219. see @ref{vidstabdetect} for pass 1.
  14220. Read a file with transform information for each frame and
  14221. apply/compensate them. Together with the @ref{vidstabdetect}
  14222. filter this can be used to deshake videos. See also
  14223. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  14224. the @ref{unsharp} filter, see below.
  14225. To enable compilation of this filter you need to configure FFmpeg with
  14226. @code{--enable-libvidstab}.
  14227. @subsection Options
  14228. @table @option
  14229. @item input
  14230. Set path to the file used to read the transforms. Default value is
  14231. @file{transforms.trf}.
  14232. @item smoothing
  14233. Set the number of frames (value*2 + 1) used for lowpass filtering the
  14234. camera movements. Default value is 10.
  14235. For example a number of 10 means that 21 frames are used (10 in the
  14236. past and 10 in the future) to smoothen the motion in the video. A
  14237. larger value leads to a smoother video, but limits the acceleration of
  14238. the camera (pan/tilt movements). 0 is a special case where a static
  14239. camera is simulated.
  14240. @item optalgo
  14241. Set the camera path optimization algorithm.
  14242. Accepted values are:
  14243. @table @samp
  14244. @item gauss
  14245. gaussian kernel low-pass filter on camera motion (default)
  14246. @item avg
  14247. averaging on transformations
  14248. @end table
  14249. @item maxshift
  14250. Set maximal number of pixels to translate frames. Default value is -1,
  14251. meaning no limit.
  14252. @item maxangle
  14253. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  14254. value is -1, meaning no limit.
  14255. @item crop
  14256. Specify how to deal with borders that may be visible due to movement
  14257. compensation.
  14258. Available values are:
  14259. @table @samp
  14260. @item keep
  14261. keep image information from previous frame (default)
  14262. @item black
  14263. fill the border black
  14264. @end table
  14265. @item invert
  14266. Invert transforms if set to 1. Default value is 0.
  14267. @item relative
  14268. Consider transforms as relative to previous frame if set to 1,
  14269. absolute if set to 0. Default value is 0.
  14270. @item zoom
  14271. Set percentage to zoom. A positive value will result in a zoom-in
  14272. effect, a negative value in a zoom-out effect. Default value is 0 (no
  14273. zoom).
  14274. @item optzoom
  14275. Set optimal zooming to avoid borders.
  14276. Accepted values are:
  14277. @table @samp
  14278. @item 0
  14279. disabled
  14280. @item 1
  14281. optimal static zoom value is determined (only very strong movements
  14282. will lead to visible borders) (default)
  14283. @item 2
  14284. optimal adaptive zoom value is determined (no borders will be
  14285. visible), see @option{zoomspeed}
  14286. @end table
  14287. Note that the value given at zoom is added to the one calculated here.
  14288. @item zoomspeed
  14289. Set percent to zoom maximally each frame (enabled when
  14290. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  14291. 0.25.
  14292. @item interpol
  14293. Specify type of interpolation.
  14294. Available values are:
  14295. @table @samp
  14296. @item no
  14297. no interpolation
  14298. @item linear
  14299. linear only horizontal
  14300. @item bilinear
  14301. linear in both directions (default)
  14302. @item bicubic
  14303. cubic in both directions (slow)
  14304. @end table
  14305. @item tripod
  14306. Enable virtual tripod mode if set to 1, which is equivalent to
  14307. @code{relative=0:smoothing=0}. Default value is 0.
  14308. Use also @code{tripod} option of @ref{vidstabdetect}.
  14309. @item debug
  14310. Increase log verbosity if set to 1. Also the detected global motions
  14311. are written to the temporary file @file{global_motions.trf}. Default
  14312. value is 0.
  14313. @end table
  14314. @subsection Examples
  14315. @itemize
  14316. @item
  14317. Use @command{ffmpeg} for a typical stabilization with default values:
  14318. @example
  14319. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  14320. @end example
  14321. Note the use of the @ref{unsharp} filter which is always recommended.
  14322. @item
  14323. Zoom in a bit more and load transform data from a given file:
  14324. @example
  14325. vidstabtransform=zoom=5:input="mytransforms.trf"
  14326. @end example
  14327. @item
  14328. Smoothen the video even more:
  14329. @example
  14330. vidstabtransform=smoothing=30
  14331. @end example
  14332. @end itemize
  14333. @section vflip
  14334. Flip the input video vertically.
  14335. For example, to vertically flip a video with @command{ffmpeg}:
  14336. @example
  14337. ffmpeg -i in.avi -vf "vflip" out.avi
  14338. @end example
  14339. @section vfrdet
  14340. Detect variable frame rate video.
  14341. This filter tries to detect if the input is variable or constant frame rate.
  14342. At end it will output number of frames detected as having variable delta pts,
  14343. and ones with constant delta pts.
  14344. If there was frames with variable delta, than it will also show min and max delta
  14345. encountered.
  14346. @section vibrance
  14347. Boost or alter saturation.
  14348. The filter accepts the following options:
  14349. @table @option
  14350. @item intensity
  14351. Set strength of boost if positive value or strength of alter if negative value.
  14352. Default is 0. Allowed range is from -2 to 2.
  14353. @item rbal
  14354. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  14355. @item gbal
  14356. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  14357. @item bbal
  14358. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  14359. @item rlum
  14360. Set the red luma coefficient.
  14361. @item glum
  14362. Set the green luma coefficient.
  14363. @item blum
  14364. Set the blue luma coefficient.
  14365. @item alternate
  14366. If @code{intensity} is negative and this is set to 1, colors will change,
  14367. otherwise colors will be less saturated, more towards gray.
  14368. @end table
  14369. @anchor{vignette}
  14370. @section vignette
  14371. Make or reverse a natural vignetting effect.
  14372. The filter accepts the following options:
  14373. @table @option
  14374. @item angle, a
  14375. Set lens angle expression as a number of radians.
  14376. The value is clipped in the @code{[0,PI/2]} range.
  14377. Default value: @code{"PI/5"}
  14378. @item x0
  14379. @item y0
  14380. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  14381. by default.
  14382. @item mode
  14383. Set forward/backward mode.
  14384. Available modes are:
  14385. @table @samp
  14386. @item forward
  14387. The larger the distance from the central point, the darker the image becomes.
  14388. @item backward
  14389. The larger the distance from the central point, the brighter the image becomes.
  14390. This can be used to reverse a vignette effect, though there is no automatic
  14391. detection to extract the lens @option{angle} and other settings (yet). It can
  14392. also be used to create a burning effect.
  14393. @end table
  14394. Default value is @samp{forward}.
  14395. @item eval
  14396. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  14397. It accepts the following values:
  14398. @table @samp
  14399. @item init
  14400. Evaluate expressions only once during the filter initialization.
  14401. @item frame
  14402. Evaluate expressions for each incoming frame. This is way slower than the
  14403. @samp{init} mode since it requires all the scalers to be re-computed, but it
  14404. allows advanced dynamic expressions.
  14405. @end table
  14406. Default value is @samp{init}.
  14407. @item dither
  14408. Set dithering to reduce the circular banding effects. Default is @code{1}
  14409. (enabled).
  14410. @item aspect
  14411. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  14412. Setting this value to the SAR of the input will make a rectangular vignetting
  14413. following the dimensions of the video.
  14414. Default is @code{1/1}.
  14415. @end table
  14416. @subsection Expressions
  14417. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  14418. following parameters.
  14419. @table @option
  14420. @item w
  14421. @item h
  14422. input width and height
  14423. @item n
  14424. the number of input frame, starting from 0
  14425. @item pts
  14426. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  14427. @var{TB} units, NAN if undefined
  14428. @item r
  14429. frame rate of the input video, NAN if the input frame rate is unknown
  14430. @item t
  14431. the PTS (Presentation TimeStamp) of the filtered video frame,
  14432. expressed in seconds, NAN if undefined
  14433. @item tb
  14434. time base of the input video
  14435. @end table
  14436. @subsection Examples
  14437. @itemize
  14438. @item
  14439. Apply simple strong vignetting effect:
  14440. @example
  14441. vignette=PI/4
  14442. @end example
  14443. @item
  14444. Make a flickering vignetting:
  14445. @example
  14446. vignette='PI/4+random(1)*PI/50':eval=frame
  14447. @end example
  14448. @end itemize
  14449. @section vmafmotion
  14450. Obtain the average vmaf motion score of a video.
  14451. It is one of the component filters of VMAF.
  14452. The obtained average motion score is printed through the logging system.
  14453. In the below example the input file @file{ref.mpg} is being processed and score
  14454. is computed.
  14455. @example
  14456. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  14457. @end example
  14458. @section vstack
  14459. Stack input videos vertically.
  14460. All streams must be of same pixel format and of same width.
  14461. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  14462. to create same output.
  14463. The filter accepts the following options:
  14464. @table @option
  14465. @item inputs
  14466. Set number of input streams. Default is 2.
  14467. @item shortest
  14468. If set to 1, force the output to terminate when the shortest input
  14469. terminates. Default value is 0.
  14470. @end table
  14471. @section w3fdif
  14472. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  14473. Deinterlacing Filter").
  14474. Based on the process described by Martin Weston for BBC R&D, and
  14475. implemented based on the de-interlace algorithm written by Jim
  14476. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  14477. uses filter coefficients calculated by BBC R&D.
  14478. This filter uses field-dominance information in frame to decide which
  14479. of each pair of fields to place first in the output.
  14480. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  14481. There are two sets of filter coefficients, so called "simple"
  14482. and "complex". Which set of filter coefficients is used can
  14483. be set by passing an optional parameter:
  14484. @table @option
  14485. @item filter
  14486. Set the interlacing filter coefficients. Accepts one of the following values:
  14487. @table @samp
  14488. @item simple
  14489. Simple filter coefficient set.
  14490. @item complex
  14491. More-complex filter coefficient set.
  14492. @end table
  14493. Default value is @samp{complex}.
  14494. @item deint
  14495. Specify which frames to deinterlace. Accepts one of the following values:
  14496. @table @samp
  14497. @item all
  14498. Deinterlace all frames,
  14499. @item interlaced
  14500. Only deinterlace frames marked as interlaced.
  14501. @end table
  14502. Default value is @samp{all}.
  14503. @end table
  14504. @section waveform
  14505. Video waveform monitor.
  14506. The waveform monitor plots color component intensity. By default luminance
  14507. only. Each column of the waveform corresponds to a column of pixels in the
  14508. source video.
  14509. It accepts the following options:
  14510. @table @option
  14511. @item mode, m
  14512. Can be either @code{row}, or @code{column}. Default is @code{column}.
  14513. In row mode, the graph on the left side represents color component value 0 and
  14514. the right side represents value = 255. In column mode, the top side represents
  14515. color component value = 0 and bottom side represents value = 255.
  14516. @item intensity, i
  14517. Set intensity. Smaller values are useful to find out how many values of the same
  14518. luminance are distributed across input rows/columns.
  14519. Default value is @code{0.04}. Allowed range is [0, 1].
  14520. @item mirror, r
  14521. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  14522. In mirrored mode, higher values will be represented on the left
  14523. side for @code{row} mode and at the top for @code{column} mode. Default is
  14524. @code{1} (mirrored).
  14525. @item display, d
  14526. Set display mode.
  14527. It accepts the following values:
  14528. @table @samp
  14529. @item overlay
  14530. Presents information identical to that in the @code{parade}, except
  14531. that the graphs representing color components are superimposed directly
  14532. over one another.
  14533. This display mode makes it easier to spot relative differences or similarities
  14534. in overlapping areas of the color components that are supposed to be identical,
  14535. such as neutral whites, grays, or blacks.
  14536. @item stack
  14537. Display separate graph for the color components side by side in
  14538. @code{row} mode or one below the other in @code{column} mode.
  14539. @item parade
  14540. Display separate graph for the color components side by side in
  14541. @code{column} mode or one below the other in @code{row} mode.
  14542. Using this display mode makes it easy to spot color casts in the highlights
  14543. and shadows of an image, by comparing the contours of the top and the bottom
  14544. graphs of each waveform. Since whites, grays, and blacks are characterized
  14545. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  14546. should display three waveforms of roughly equal width/height. If not, the
  14547. correction is easy to perform by making level adjustments the three waveforms.
  14548. @end table
  14549. Default is @code{stack}.
  14550. @item components, c
  14551. Set which color components to display. Default is 1, which means only luminance
  14552. or red color component if input is in RGB colorspace. If is set for example to
  14553. 7 it will display all 3 (if) available color components.
  14554. @item envelope, e
  14555. @table @samp
  14556. @item none
  14557. No envelope, this is default.
  14558. @item instant
  14559. Instant envelope, minimum and maximum values presented in graph will be easily
  14560. visible even with small @code{step} value.
  14561. @item peak
  14562. Hold minimum and maximum values presented in graph across time. This way you
  14563. can still spot out of range values without constantly looking at waveforms.
  14564. @item peak+instant
  14565. Peak and instant envelope combined together.
  14566. @end table
  14567. @item filter, f
  14568. @table @samp
  14569. @item lowpass
  14570. No filtering, this is default.
  14571. @item flat
  14572. Luma and chroma combined together.
  14573. @item aflat
  14574. Similar as above, but shows difference between blue and red chroma.
  14575. @item xflat
  14576. Similar as above, but use different colors.
  14577. @item yflat
  14578. Similar as above, but again with different colors.
  14579. @item chroma
  14580. Displays only chroma.
  14581. @item color
  14582. Displays actual color value on waveform.
  14583. @item acolor
  14584. Similar as above, but with luma showing frequency of chroma values.
  14585. @end table
  14586. @item graticule, g
  14587. Set which graticule to display.
  14588. @table @samp
  14589. @item none
  14590. Do not display graticule.
  14591. @item green
  14592. Display green graticule showing legal broadcast ranges.
  14593. @item orange
  14594. Display orange graticule showing legal broadcast ranges.
  14595. @item invert
  14596. Display invert graticule showing legal broadcast ranges.
  14597. @end table
  14598. @item opacity, o
  14599. Set graticule opacity.
  14600. @item flags, fl
  14601. Set graticule flags.
  14602. @table @samp
  14603. @item numbers
  14604. Draw numbers above lines. By default enabled.
  14605. @item dots
  14606. Draw dots instead of lines.
  14607. @end table
  14608. @item scale, s
  14609. Set scale used for displaying graticule.
  14610. @table @samp
  14611. @item digital
  14612. @item millivolts
  14613. @item ire
  14614. @end table
  14615. Default is digital.
  14616. @item bgopacity, b
  14617. Set background opacity.
  14618. @end table
  14619. @section weave, doubleweave
  14620. The @code{weave} takes a field-based video input and join
  14621. each two sequential fields into single frame, producing a new double
  14622. height clip with half the frame rate and half the frame count.
  14623. The @code{doubleweave} works same as @code{weave} but without
  14624. halving frame rate and frame count.
  14625. It accepts the following option:
  14626. @table @option
  14627. @item first_field
  14628. Set first field. Available values are:
  14629. @table @samp
  14630. @item top, t
  14631. Set the frame as top-field-first.
  14632. @item bottom, b
  14633. Set the frame as bottom-field-first.
  14634. @end table
  14635. @end table
  14636. @subsection Examples
  14637. @itemize
  14638. @item
  14639. Interlace video using @ref{select} and @ref{separatefields} filter:
  14640. @example
  14641. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  14642. @end example
  14643. @end itemize
  14644. @section xbr
  14645. Apply the xBR high-quality magnification filter which is designed for pixel
  14646. art. It follows a set of edge-detection rules, see
  14647. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  14648. It accepts the following option:
  14649. @table @option
  14650. @item n
  14651. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  14652. @code{3xBR} and @code{4} for @code{4xBR}.
  14653. Default is @code{3}.
  14654. @end table
  14655. @section xmedian
  14656. Pick median pixels from several input videos.
  14657. The filter accepts the following options:
  14658. @table @option
  14659. @item inputs
  14660. Set number of inputs.
  14661. Default is 3. Allowed range is from 3 to 255.
  14662. If number of inputs is even number, than result will be mean value between two median values.
  14663. @item planes
  14664. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14665. @end table
  14666. @section xstack
  14667. Stack video inputs into custom layout.
  14668. All streams must be of same pixel format.
  14669. The filter accepts the following options:
  14670. @table @option
  14671. @item inputs
  14672. Set number of input streams. Default is 2.
  14673. @item layout
  14674. Specify layout of inputs.
  14675. This option requires the desired layout configuration to be explicitly set by the user.
  14676. This sets position of each video input in output. Each input
  14677. is separated by '|'.
  14678. The first number represents the column, and the second number represents the row.
  14679. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  14680. where X is video input from which to take width or height.
  14681. Multiple values can be used when separated by '+'. In such
  14682. case values are summed together.
  14683. Note that if inputs are of different sizes gaps may appear, as not all of
  14684. the output video frame will be filled. Similarly, videos can overlap each
  14685. other if their position doesn't leave enough space for the full frame of
  14686. adjoining videos.
  14687. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  14688. a layout must be set by the user.
  14689. @item shortest
  14690. If set to 1, force the output to terminate when the shortest input
  14691. terminates. Default value is 0.
  14692. @end table
  14693. @subsection Examples
  14694. @itemize
  14695. @item
  14696. Display 4 inputs into 2x2 grid.
  14697. Layout:
  14698. @example
  14699. input1(0, 0) | input3(w0, 0)
  14700. input2(0, h0) | input4(w0, h0)
  14701. @end example
  14702. @example
  14703. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  14704. @end example
  14705. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14706. @item
  14707. Display 4 inputs into 1x4 grid.
  14708. Layout:
  14709. @example
  14710. input1(0, 0)
  14711. input2(0, h0)
  14712. input3(0, h0+h1)
  14713. input4(0, h0+h1+h2)
  14714. @end example
  14715. @example
  14716. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  14717. @end example
  14718. Note that if inputs are of different widths, unused space will appear.
  14719. @item
  14720. Display 9 inputs into 3x3 grid.
  14721. Layout:
  14722. @example
  14723. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  14724. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  14725. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  14726. @end example
  14727. @example
  14728. xstack=inputs=9:layout=0_0|0_h0|0_h0+h1|w0_0|w0_h0|w0_h0+h1|w0+w3_0|w0+w3_h0|w0+w3_h0+h1
  14729. @end example
  14730. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14731. @item
  14732. Display 16 inputs into 4x4 grid.
  14733. Layout:
  14734. @example
  14735. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  14736. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  14737. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  14738. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  14739. @end example
  14740. @example
  14741. xstack=inputs=16:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2|w0_0|w0_h0|w0_h0+h1|w0_h0+h1+h2|w0+w4_0|
  14742. w0+w4_h0|w0+w4_h0+h1|w0+w4_h0+h1+h2|w0+w4+w8_0|w0+w4+w8_h0|w0+w4+w8_h0+h1|w0+w4+w8_h0+h1+h2
  14743. @end example
  14744. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14745. @end itemize
  14746. @anchor{yadif}
  14747. @section yadif
  14748. Deinterlace the input video ("yadif" means "yet another deinterlacing
  14749. filter").
  14750. It accepts the following parameters:
  14751. @table @option
  14752. @item mode
  14753. The interlacing mode to adopt. It accepts one of the following values:
  14754. @table @option
  14755. @item 0, send_frame
  14756. Output one frame for each frame.
  14757. @item 1, send_field
  14758. Output one frame for each field.
  14759. @item 2, send_frame_nospatial
  14760. Like @code{send_frame}, but it skips the spatial interlacing check.
  14761. @item 3, send_field_nospatial
  14762. Like @code{send_field}, but it skips the spatial interlacing check.
  14763. @end table
  14764. The default value is @code{send_frame}.
  14765. @item parity
  14766. The picture field parity assumed for the input interlaced video. It accepts one
  14767. of the following values:
  14768. @table @option
  14769. @item 0, tff
  14770. Assume the top field is first.
  14771. @item 1, bff
  14772. Assume the bottom field is first.
  14773. @item -1, auto
  14774. Enable automatic detection of field parity.
  14775. @end table
  14776. The default value is @code{auto}.
  14777. If the interlacing is unknown or the decoder does not export this information,
  14778. top field first will be assumed.
  14779. @item deint
  14780. Specify which frames to deinterlace. Accepts one of the following
  14781. values:
  14782. @table @option
  14783. @item 0, all
  14784. Deinterlace all frames.
  14785. @item 1, interlaced
  14786. Only deinterlace frames marked as interlaced.
  14787. @end table
  14788. The default value is @code{all}.
  14789. @end table
  14790. @section yadif_cuda
  14791. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14792. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14793. and/or nvenc.
  14794. It accepts the following parameters:
  14795. @table @option
  14796. @item mode
  14797. The interlacing mode to adopt. It accepts one of the following values:
  14798. @table @option
  14799. @item 0, send_frame
  14800. Output one frame for each frame.
  14801. @item 1, send_field
  14802. Output one frame for each field.
  14803. @item 2, send_frame_nospatial
  14804. Like @code{send_frame}, but it skips the spatial interlacing check.
  14805. @item 3, send_field_nospatial
  14806. Like @code{send_field}, but it skips the spatial interlacing check.
  14807. @end table
  14808. The default value is @code{send_frame}.
  14809. @item parity
  14810. The picture field parity assumed for the input interlaced video. It accepts one
  14811. of the following values:
  14812. @table @option
  14813. @item 0, tff
  14814. Assume the top field is first.
  14815. @item 1, bff
  14816. Assume the bottom field is first.
  14817. @item -1, auto
  14818. Enable automatic detection of field parity.
  14819. @end table
  14820. The default value is @code{auto}.
  14821. If the interlacing is unknown or the decoder does not export this information,
  14822. top field first will be assumed.
  14823. @item deint
  14824. Specify which frames to deinterlace. Accepts one of the following
  14825. values:
  14826. @table @option
  14827. @item 0, all
  14828. Deinterlace all frames.
  14829. @item 1, interlaced
  14830. Only deinterlace frames marked as interlaced.
  14831. @end table
  14832. The default value is @code{all}.
  14833. @end table
  14834. @section zoompan
  14835. Apply Zoom & Pan effect.
  14836. This filter accepts the following options:
  14837. @table @option
  14838. @item zoom, z
  14839. Set the zoom expression. Range is 1-10. Default is 1.
  14840. @item x
  14841. @item y
  14842. Set the x and y expression. Default is 0.
  14843. @item d
  14844. Set the duration expression in number of frames.
  14845. This sets for how many number of frames effect will last for
  14846. single input image.
  14847. @item s
  14848. Set the output image size, default is 'hd720'.
  14849. @item fps
  14850. Set the output frame rate, default is '25'.
  14851. @end table
  14852. Each expression can contain the following constants:
  14853. @table @option
  14854. @item in_w, iw
  14855. Input width.
  14856. @item in_h, ih
  14857. Input height.
  14858. @item out_w, ow
  14859. Output width.
  14860. @item out_h, oh
  14861. Output height.
  14862. @item in
  14863. Input frame count.
  14864. @item on
  14865. Output frame count.
  14866. @item x
  14867. @item y
  14868. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14869. for current input frame.
  14870. @item px
  14871. @item py
  14872. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14873. not yet such frame (first input frame).
  14874. @item zoom
  14875. Last calculated zoom from 'z' expression for current input frame.
  14876. @item pzoom
  14877. Last calculated zoom of last output frame of previous input frame.
  14878. @item duration
  14879. Number of output frames for current input frame. Calculated from 'd' expression
  14880. for each input frame.
  14881. @item pduration
  14882. number of output frames created for previous input frame
  14883. @item a
  14884. Rational number: input width / input height
  14885. @item sar
  14886. sample aspect ratio
  14887. @item dar
  14888. display aspect ratio
  14889. @end table
  14890. @subsection Examples
  14891. @itemize
  14892. @item
  14893. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14894. @example
  14895. 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
  14896. @end example
  14897. @item
  14898. Zoom-in up to 1.5 and pan always at center of picture:
  14899. @example
  14900. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14901. @end example
  14902. @item
  14903. Same as above but without pausing:
  14904. @example
  14905. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14906. @end example
  14907. @end itemize
  14908. @anchor{zscale}
  14909. @section zscale
  14910. Scale (resize) the input video, using the z.lib library:
  14911. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14912. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14913. The zscale filter forces the output display aspect ratio to be the same
  14914. as the input, by changing the output sample aspect ratio.
  14915. If the input image format is different from the format requested by
  14916. the next filter, the zscale filter will convert the input to the
  14917. requested format.
  14918. @subsection Options
  14919. The filter accepts the following options.
  14920. @table @option
  14921. @item width, w
  14922. @item height, h
  14923. Set the output video dimension expression. Default value is the input
  14924. dimension.
  14925. If the @var{width} or @var{w} value is 0, the input width is used for
  14926. the output. If the @var{height} or @var{h} value is 0, the input height
  14927. is used for the output.
  14928. If one and only one of the values is -n with n >= 1, the zscale filter
  14929. will use a value that maintains the aspect ratio of the input image,
  14930. calculated from the other specified dimension. After that it will,
  14931. however, make sure that the calculated dimension is divisible by n and
  14932. adjust the value if necessary.
  14933. If both values are -n with n >= 1, the behavior will be identical to
  14934. both values being set to 0 as previously detailed.
  14935. See below for the list of accepted constants for use in the dimension
  14936. expression.
  14937. @item size, s
  14938. Set the video size. For the syntax of this option, check the
  14939. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14940. @item dither, d
  14941. Set the dither type.
  14942. Possible values are:
  14943. @table @var
  14944. @item none
  14945. @item ordered
  14946. @item random
  14947. @item error_diffusion
  14948. @end table
  14949. Default is none.
  14950. @item filter, f
  14951. Set the resize filter type.
  14952. Possible values are:
  14953. @table @var
  14954. @item point
  14955. @item bilinear
  14956. @item bicubic
  14957. @item spline16
  14958. @item spline36
  14959. @item lanczos
  14960. @end table
  14961. Default is bilinear.
  14962. @item range, r
  14963. Set the color range.
  14964. Possible values are:
  14965. @table @var
  14966. @item input
  14967. @item limited
  14968. @item full
  14969. @end table
  14970. Default is same as input.
  14971. @item primaries, p
  14972. Set the color primaries.
  14973. Possible values are:
  14974. @table @var
  14975. @item input
  14976. @item 709
  14977. @item unspecified
  14978. @item 170m
  14979. @item 240m
  14980. @item 2020
  14981. @end table
  14982. Default is same as input.
  14983. @item transfer, t
  14984. Set the transfer characteristics.
  14985. Possible values are:
  14986. @table @var
  14987. @item input
  14988. @item 709
  14989. @item unspecified
  14990. @item 601
  14991. @item linear
  14992. @item 2020_10
  14993. @item 2020_12
  14994. @item smpte2084
  14995. @item iec61966-2-1
  14996. @item arib-std-b67
  14997. @end table
  14998. Default is same as input.
  14999. @item matrix, m
  15000. Set the colorspace matrix.
  15001. Possible value are:
  15002. @table @var
  15003. @item input
  15004. @item 709
  15005. @item unspecified
  15006. @item 470bg
  15007. @item 170m
  15008. @item 2020_ncl
  15009. @item 2020_cl
  15010. @end table
  15011. Default is same as input.
  15012. @item rangein, rin
  15013. Set the input color range.
  15014. Possible values are:
  15015. @table @var
  15016. @item input
  15017. @item limited
  15018. @item full
  15019. @end table
  15020. Default is same as input.
  15021. @item primariesin, pin
  15022. Set the input color primaries.
  15023. Possible values are:
  15024. @table @var
  15025. @item input
  15026. @item 709
  15027. @item unspecified
  15028. @item 170m
  15029. @item 240m
  15030. @item 2020
  15031. @end table
  15032. Default is same as input.
  15033. @item transferin, tin
  15034. Set the input transfer characteristics.
  15035. Possible values are:
  15036. @table @var
  15037. @item input
  15038. @item 709
  15039. @item unspecified
  15040. @item 601
  15041. @item linear
  15042. @item 2020_10
  15043. @item 2020_12
  15044. @end table
  15045. Default is same as input.
  15046. @item matrixin, min
  15047. Set the input colorspace matrix.
  15048. Possible value are:
  15049. @table @var
  15050. @item input
  15051. @item 709
  15052. @item unspecified
  15053. @item 470bg
  15054. @item 170m
  15055. @item 2020_ncl
  15056. @item 2020_cl
  15057. @end table
  15058. @item chromal, c
  15059. Set the output chroma location.
  15060. Possible values are:
  15061. @table @var
  15062. @item input
  15063. @item left
  15064. @item center
  15065. @item topleft
  15066. @item top
  15067. @item bottomleft
  15068. @item bottom
  15069. @end table
  15070. @item chromalin, cin
  15071. Set the input chroma location.
  15072. Possible values are:
  15073. @table @var
  15074. @item input
  15075. @item left
  15076. @item center
  15077. @item topleft
  15078. @item top
  15079. @item bottomleft
  15080. @item bottom
  15081. @end table
  15082. @item npl
  15083. Set the nominal peak luminance.
  15084. @end table
  15085. The values of the @option{w} and @option{h} options are expressions
  15086. containing the following constants:
  15087. @table @var
  15088. @item in_w
  15089. @item in_h
  15090. The input width and height
  15091. @item iw
  15092. @item ih
  15093. These are the same as @var{in_w} and @var{in_h}.
  15094. @item out_w
  15095. @item out_h
  15096. The output (scaled) width and height
  15097. @item ow
  15098. @item oh
  15099. These are the same as @var{out_w} and @var{out_h}
  15100. @item a
  15101. The same as @var{iw} / @var{ih}
  15102. @item sar
  15103. input sample aspect ratio
  15104. @item dar
  15105. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  15106. @item hsub
  15107. @item vsub
  15108. horizontal and vertical input chroma subsample values. For example for the
  15109. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15110. @item ohsub
  15111. @item ovsub
  15112. horizontal and vertical output chroma subsample values. For example for the
  15113. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15114. @end table
  15115. @table @option
  15116. @end table
  15117. @c man end VIDEO FILTERS
  15118. @chapter OpenCL Video Filters
  15119. @c man begin OPENCL VIDEO FILTERS
  15120. Below is a description of the currently available OpenCL video filters.
  15121. To enable compilation of these filters you need to configure FFmpeg with
  15122. @code{--enable-opencl}.
  15123. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  15124. @table @option
  15125. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  15126. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  15127. given device parameters.
  15128. @item -filter_hw_device @var{name}
  15129. Pass the hardware device called @var{name} to all filters in any filter graph.
  15130. @end table
  15131. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  15132. @itemize
  15133. @item
  15134. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  15135. @example
  15136. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  15137. @end example
  15138. @end itemize
  15139. Since OpenCL filters are not able to access frame data in normal memory, all frame data needs to be uploaded(@ref{hwupload}) to hardware surfaces connected to the appropriate device before being used and then downloaded(@ref{hwdownload}) back to normal memory. Note that @ref{hwupload} will upload to a surface with the same layout as the software frame, so it may be necessary to add a @ref{format} filter immediately before to get the input into the right format and @ref{hwdownload} does not support all formats on the output - it may be necessary to insert an additional @ref{format} filter immediately following in the graph to get the output in a supported format.
  15140. @section avgblur_opencl
  15141. Apply average blur filter.
  15142. The filter accepts the following options:
  15143. @table @option
  15144. @item sizeX
  15145. Set horizontal radius size.
  15146. Range is @code{[1, 1024]} and default value is @code{1}.
  15147. @item planes
  15148. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15149. @item sizeY
  15150. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  15151. @end table
  15152. @subsection Example
  15153. @itemize
  15154. @item
  15155. Apply average blur filter with horizontal and vertical size of 3, setting each pixel of the output to the average value of the 7x7 region centered on it in the input. For pixels on the edges of the image, the region does not extend beyond the image boundaries, and so out-of-range coordinates are not used in the calculations.
  15156. @example
  15157. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  15158. @end example
  15159. @end itemize
  15160. @section boxblur_opencl
  15161. Apply a boxblur algorithm to the input video.
  15162. It accepts the following parameters:
  15163. @table @option
  15164. @item luma_radius, lr
  15165. @item luma_power, lp
  15166. @item chroma_radius, cr
  15167. @item chroma_power, cp
  15168. @item alpha_radius, ar
  15169. @item alpha_power, ap
  15170. @end table
  15171. A description of the accepted options follows.
  15172. @table @option
  15173. @item luma_radius, lr
  15174. @item chroma_radius, cr
  15175. @item alpha_radius, ar
  15176. Set an expression for the box radius in pixels used for blurring the
  15177. corresponding input plane.
  15178. The radius value must be a non-negative number, and must not be
  15179. greater than the value of the expression @code{min(w,h)/2} for the
  15180. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  15181. planes.
  15182. Default value for @option{luma_radius} is "2". If not specified,
  15183. @option{chroma_radius} and @option{alpha_radius} default to the
  15184. corresponding value set for @option{luma_radius}.
  15185. The expressions can contain the following constants:
  15186. @table @option
  15187. @item w
  15188. @item h
  15189. The input width and height in pixels.
  15190. @item cw
  15191. @item ch
  15192. The input chroma image width and height in pixels.
  15193. @item hsub
  15194. @item vsub
  15195. The horizontal and vertical chroma subsample values. For example, for the
  15196. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  15197. @end table
  15198. @item luma_power, lp
  15199. @item chroma_power, cp
  15200. @item alpha_power, ap
  15201. Specify how many times the boxblur filter is applied to the
  15202. corresponding plane.
  15203. Default value for @option{luma_power} is 2. If not specified,
  15204. @option{chroma_power} and @option{alpha_power} default to the
  15205. corresponding value set for @option{luma_power}.
  15206. A value of 0 will disable the effect.
  15207. @end table
  15208. @subsection Examples
  15209. Apply boxblur filter, setting each pixel of the output to the average value of box-radiuses @var{luma_radius}, @var{chroma_radius}, @var{alpha_radius} for each plane respectively. The filter will apply @var{luma_power}, @var{chroma_power}, @var{alpha_power} times onto the corresponding plane. For pixels on the edges of the image, the radius does not extend beyond the image boundaries, and so out-of-range coordinates are not used in the calculations.
  15210. @itemize
  15211. @item
  15212. Apply a boxblur filter with the luma, chroma, and alpha radius
  15213. set to 2 and luma, chroma, and alpha power set to 3. The filter will run 3 times with box-radius set to 2 for every plane of the image.
  15214. @example
  15215. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  15216. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  15217. @end example
  15218. @item
  15219. Apply a boxblur filter with luma radius set to 2, luma_power to 1, chroma_radius to 4, chroma_power to 5, alpha_radius to 3 and alpha_power to 7.
  15220. For the luma plane, a 2x2 box radius will be run once.
  15221. For the chroma plane, a 4x4 box radius will be run 5 times.
  15222. For the alpha plane, a 3x3 box radius will be run 7 times.
  15223. @example
  15224. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  15225. @end example
  15226. @end itemize
  15227. @section convolution_opencl
  15228. Apply convolution of 3x3, 5x5, 7x7 matrix.
  15229. The filter accepts the following options:
  15230. @table @option
  15231. @item 0m
  15232. @item 1m
  15233. @item 2m
  15234. @item 3m
  15235. Set matrix for each plane.
  15236. Matrix is sequence of 9, 25 or 49 signed numbers.
  15237. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  15238. @item 0rdiv
  15239. @item 1rdiv
  15240. @item 2rdiv
  15241. @item 3rdiv
  15242. Set multiplier for calculated value for each plane.
  15243. If unset or 0, it will be sum of all matrix elements.
  15244. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  15245. @item 0bias
  15246. @item 1bias
  15247. @item 2bias
  15248. @item 3bias
  15249. Set bias for each plane. This value is added to the result of the multiplication.
  15250. Useful for making the overall image brighter or darker.
  15251. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  15252. @end table
  15253. @subsection Examples
  15254. @itemize
  15255. @item
  15256. Apply sharpen:
  15257. @example
  15258. -i INPUT -vf "hwupload, convolution_opencl=0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0, hwdownload" OUTPUT
  15259. @end example
  15260. @item
  15261. Apply blur:
  15262. @example
  15263. -i INPUT -vf "hwupload, convolution_opencl=1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9, hwdownload" OUTPUT
  15264. @end example
  15265. @item
  15266. Apply edge enhance:
  15267. @example
  15268. -i INPUT -vf "hwupload, convolution_opencl=0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128, hwdownload" OUTPUT
  15269. @end example
  15270. @item
  15271. Apply edge detect:
  15272. @example
  15273. -i INPUT -vf "hwupload, convolution_opencl=0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128, hwdownload" OUTPUT
  15274. @end example
  15275. @item
  15276. Apply laplacian edge detector which includes diagonals:
  15277. @example
  15278. -i INPUT -vf "hwupload, convolution_opencl=1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0, hwdownload" OUTPUT
  15279. @end example
  15280. @item
  15281. Apply emboss:
  15282. @example
  15283. -i INPUT -vf "hwupload, convolution_opencl=-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2, hwdownload" OUTPUT
  15284. @end example
  15285. @end itemize
  15286. @section dilation_opencl
  15287. Apply dilation effect to the video.
  15288. This filter replaces the pixel by the local(3x3) maximum.
  15289. It accepts the following options:
  15290. @table @option
  15291. @item threshold0
  15292. @item threshold1
  15293. @item threshold2
  15294. @item threshold3
  15295. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15296. If @code{0}, plane will remain unchanged.
  15297. @item coordinates
  15298. Flag which specifies the pixel to refer to.
  15299. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15300. Flags to local 3x3 coordinates region centered on @code{x}:
  15301. 1 2 3
  15302. 4 x 5
  15303. 6 7 8
  15304. @end table
  15305. @subsection Example
  15306. @itemize
  15307. @item
  15308. Apply dilation filter with threshold0 set to 30, threshold1 set 40, threshold2 set to 50 and coordinates set to 231, setting each pixel of the output to the local maximum between pixels: 1, 2, 3, 6, 7, 8 of the 3x3 region centered on it in the input. If the difference between input pixel and local maximum is more then threshold of the corresponding plane, output pixel will be set to input pixel + threshold of corresponding plane.
  15309. @example
  15310. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15311. @end example
  15312. @end itemize
  15313. @section erosion_opencl
  15314. Apply erosion effect to the video.
  15315. This filter replaces the pixel by the local(3x3) minimum.
  15316. It accepts the following options:
  15317. @table @option
  15318. @item threshold0
  15319. @item threshold1
  15320. @item threshold2
  15321. @item threshold3
  15322. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15323. If @code{0}, plane will remain unchanged.
  15324. @item coordinates
  15325. Flag which specifies the pixel to refer to.
  15326. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15327. Flags to local 3x3 coordinates region centered on @code{x}:
  15328. 1 2 3
  15329. 4 x 5
  15330. 6 7 8
  15331. @end table
  15332. @subsection Example
  15333. @itemize
  15334. @item
  15335. Apply erosion filter with threshold0 set to 30, threshold1 set 40, threshold2 set to 50 and coordinates set to 231, setting each pixel of the output to the local minimum between pixels: 1, 2, 3, 6, 7, 8 of the 3x3 region centered on it in the input. If the difference between input pixel and local minimum is more then threshold of the corresponding plane, output pixel will be set to input pixel - threshold of corresponding plane.
  15336. @example
  15337. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15338. @end example
  15339. @end itemize
  15340. @section colorkey_opencl
  15341. RGB colorspace color keying.
  15342. The filter accepts the following options:
  15343. @table @option
  15344. @item color
  15345. The color which will be replaced with transparency.
  15346. @item similarity
  15347. Similarity percentage with the key color.
  15348. 0.01 matches only the exact key color, while 1.0 matches everything.
  15349. @item blend
  15350. Blend percentage.
  15351. 0.0 makes pixels either fully transparent, or not transparent at all.
  15352. Higher values result in semi-transparent pixels, with a higher transparency
  15353. the more similar the pixels color is to the key color.
  15354. @end table
  15355. @subsection Examples
  15356. @itemize
  15357. @item
  15358. Make every semi-green pixel in the input transparent with some slight blending:
  15359. @example
  15360. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  15361. @end example
  15362. @end itemize
  15363. @section deshake_opencl
  15364. Feature-point based video stabilization filter.
  15365. The filter accepts the following options:
  15366. @table @option
  15367. @item tripod
  15368. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  15369. @item debug
  15370. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  15371. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  15372. Viewing point matches in the output video is only supported for RGB input.
  15373. Defaults to @code{0}.
  15374. @item adaptive_crop
  15375. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  15376. Defaults to @code{1}.
  15377. @item refine_features
  15378. Whether or not feature points should be refined at a sub-pixel level.
  15379. This can be turned off for a slight performance gain at the cost of precision.
  15380. Defaults to @code{1}.
  15381. @item smooth_strength
  15382. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  15383. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  15384. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  15385. Defaults to @code{0.0}.
  15386. @item smooth_window_multiplier
  15387. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  15388. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  15389. Acceptable values range from @code{0.1} to @code{10.0}.
  15390. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  15391. potentially improving smoothness, but also increase latency and memory usage.
  15392. Defaults to @code{2.0}.
  15393. @end table
  15394. @subsection Examples
  15395. @itemize
  15396. @item
  15397. Stabilize a video with a fixed, medium smoothing strength:
  15398. @example
  15399. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  15400. @end example
  15401. @item
  15402. Stabilize a video with debugging (both in console and in rendered video):
  15403. @example
  15404. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  15405. @end example
  15406. @end itemize
  15407. @section nlmeans_opencl
  15408. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  15409. @section overlay_opencl
  15410. Overlay one video on top of another.
  15411. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  15412. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  15413. The filter accepts the following options:
  15414. @table @option
  15415. @item x
  15416. Set the x coordinate of the overlaid video on the main video.
  15417. Default value is @code{0}.
  15418. @item y
  15419. Set the x coordinate of the overlaid video on the main video.
  15420. Default value is @code{0}.
  15421. @end table
  15422. @subsection Examples
  15423. @itemize
  15424. @item
  15425. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  15426. @example
  15427. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15428. @end example
  15429. @item
  15430. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  15431. @example
  15432. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15433. @end example
  15434. @end itemize
  15435. @section prewitt_opencl
  15436. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  15437. The filter accepts the following option:
  15438. @table @option
  15439. @item planes
  15440. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15441. @item scale
  15442. Set value which will be multiplied with filtered result.
  15443. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15444. @item delta
  15445. Set value which will be added to filtered result.
  15446. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15447. @end table
  15448. @subsection Example
  15449. @itemize
  15450. @item
  15451. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  15452. @example
  15453. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15454. @end example
  15455. @end itemize
  15456. @section roberts_opencl
  15457. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  15458. The filter accepts the following option:
  15459. @table @option
  15460. @item planes
  15461. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15462. @item scale
  15463. Set value which will be multiplied with filtered result.
  15464. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15465. @item delta
  15466. Set value which will be added to filtered result.
  15467. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15468. @end table
  15469. @subsection Example
  15470. @itemize
  15471. @item
  15472. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  15473. @example
  15474. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15475. @end example
  15476. @end itemize
  15477. @section sobel_opencl
  15478. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  15479. The filter accepts the following option:
  15480. @table @option
  15481. @item planes
  15482. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15483. @item scale
  15484. Set value which will be multiplied with filtered result.
  15485. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15486. @item delta
  15487. Set value which will be added to filtered result.
  15488. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15489. @end table
  15490. @subsection Example
  15491. @itemize
  15492. @item
  15493. Apply sobel operator with scale set to 2 and delta set to 10
  15494. @example
  15495. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15496. @end example
  15497. @end itemize
  15498. @section tonemap_opencl
  15499. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  15500. It accepts the following parameters:
  15501. @table @option
  15502. @item tonemap
  15503. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  15504. @item param
  15505. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  15506. @item desat
  15507. Apply desaturation for highlights that exceed this level of brightness. The
  15508. higher the parameter, the more color information will be preserved. This
  15509. setting helps prevent unnaturally blown-out colors for super-highlights, by
  15510. (smoothly) turning into white instead. This makes images feel more natural,
  15511. at the cost of reducing information about out-of-range colors.
  15512. The default value is 0.5, and the algorithm here is a little different from
  15513. the cpu version tonemap currently. A setting of 0.0 disables this option.
  15514. @item threshold
  15515. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  15516. is used to detect whether the scene has changed or not. If the distance between
  15517. the current frame average brightness and the current running average exceeds
  15518. a threshold value, we would re-calculate scene average and peak brightness.
  15519. The default value is 0.2.
  15520. @item format
  15521. Specify the output pixel format.
  15522. Currently supported formats are:
  15523. @table @var
  15524. @item p010
  15525. @item nv12
  15526. @end table
  15527. @item range, r
  15528. Set the output color range.
  15529. Possible values are:
  15530. @table @var
  15531. @item tv/mpeg
  15532. @item pc/jpeg
  15533. @end table
  15534. Default is same as input.
  15535. @item primaries, p
  15536. Set the output color primaries.
  15537. Possible values are:
  15538. @table @var
  15539. @item bt709
  15540. @item bt2020
  15541. @end table
  15542. Default is same as input.
  15543. @item transfer, t
  15544. Set the output transfer characteristics.
  15545. Possible values are:
  15546. @table @var
  15547. @item bt709
  15548. @item bt2020
  15549. @end table
  15550. Default is bt709.
  15551. @item matrix, m
  15552. Set the output colorspace matrix.
  15553. Possible value are:
  15554. @table @var
  15555. @item bt709
  15556. @item bt2020
  15557. @end table
  15558. Default is same as input.
  15559. @end table
  15560. @subsection Example
  15561. @itemize
  15562. @item
  15563. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  15564. @example
  15565. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  15566. @end example
  15567. @end itemize
  15568. @section unsharp_opencl
  15569. Sharpen or blur the input video.
  15570. It accepts the following parameters:
  15571. @table @option
  15572. @item luma_msize_x, lx
  15573. Set the luma matrix horizontal size.
  15574. Range is @code{[1, 23]} and default value is @code{5}.
  15575. @item luma_msize_y, ly
  15576. Set the luma matrix vertical size.
  15577. Range is @code{[1, 23]} and default value is @code{5}.
  15578. @item luma_amount, la
  15579. Set the luma effect strength.
  15580. Range is @code{[-10, 10]} and default value is @code{1.0}.
  15581. Negative values will blur the input video, while positive values will
  15582. sharpen it, a value of zero will disable the effect.
  15583. @item chroma_msize_x, cx
  15584. Set the chroma matrix horizontal size.
  15585. Range is @code{[1, 23]} and default value is @code{5}.
  15586. @item chroma_msize_y, cy
  15587. Set the chroma matrix vertical size.
  15588. Range is @code{[1, 23]} and default value is @code{5}.
  15589. @item chroma_amount, ca
  15590. Set the chroma effect strength.
  15591. Range is @code{[-10, 10]} and default value is @code{0.0}.
  15592. Negative values will blur the input video, while positive values will
  15593. sharpen it, a value of zero will disable the effect.
  15594. @end table
  15595. All parameters are optional and default to the equivalent of the
  15596. string '5:5:1.0:5:5:0.0'.
  15597. @subsection Examples
  15598. @itemize
  15599. @item
  15600. Apply strong luma sharpen effect:
  15601. @example
  15602. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  15603. @end example
  15604. @item
  15605. Apply a strong blur of both luma and chroma parameters:
  15606. @example
  15607. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  15608. @end example
  15609. @end itemize
  15610. @c man end OPENCL VIDEO FILTERS
  15611. @chapter Video Sources
  15612. @c man begin VIDEO SOURCES
  15613. Below is a description of the currently available video sources.
  15614. @section buffer
  15615. Buffer video frames, and make them available to the filter chain.
  15616. This source is mainly intended for a programmatic use, in particular
  15617. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  15618. It accepts the following parameters:
  15619. @table @option
  15620. @item video_size
  15621. Specify the size (width and height) of the buffered video frames. For the
  15622. syntax of this option, check the
  15623. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15624. @item width
  15625. The input video width.
  15626. @item height
  15627. The input video height.
  15628. @item pix_fmt
  15629. A string representing the pixel format of the buffered video frames.
  15630. It may be a number corresponding to a pixel format, or a pixel format
  15631. name.
  15632. @item time_base
  15633. Specify the timebase assumed by the timestamps of the buffered frames.
  15634. @item frame_rate
  15635. Specify the frame rate expected for the video stream.
  15636. @item pixel_aspect, sar
  15637. The sample (pixel) aspect ratio of the input video.
  15638. @item sws_param
  15639. Specify the optional parameters to be used for the scale filter which
  15640. is automatically inserted when an input change is detected in the
  15641. input size or format.
  15642. @item hw_frames_ctx
  15643. When using a hardware pixel format, this should be a reference to an
  15644. AVHWFramesContext describing input frames.
  15645. @end table
  15646. For example:
  15647. @example
  15648. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  15649. @end example
  15650. will instruct the source to accept video frames with size 320x240 and
  15651. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  15652. square pixels (1:1 sample aspect ratio).
  15653. Since the pixel format with name "yuv410p" corresponds to the number 6
  15654. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  15655. this example corresponds to:
  15656. @example
  15657. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  15658. @end example
  15659. Alternatively, the options can be specified as a flat string, but this
  15660. syntax is deprecated:
  15661. @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}]
  15662. @section cellauto
  15663. Create a pattern generated by an elementary cellular automaton.
  15664. The initial state of the cellular automaton can be defined through the
  15665. @option{filename} and @option{pattern} options. If such options are
  15666. not specified an initial state is created randomly.
  15667. At each new frame a new row in the video is filled with the result of
  15668. the cellular automaton next generation. The behavior when the whole
  15669. frame is filled is defined by the @option{scroll} option.
  15670. This source accepts the following options:
  15671. @table @option
  15672. @item filename, f
  15673. Read the initial cellular automaton state, i.e. the starting row, from
  15674. the specified file.
  15675. In the file, each non-whitespace character is considered an alive
  15676. cell, a newline will terminate the row, and further characters in the
  15677. file will be ignored.
  15678. @item pattern, p
  15679. Read the initial cellular automaton state, i.e. the starting row, from
  15680. the specified string.
  15681. Each non-whitespace character in the string is considered an alive
  15682. cell, a newline will terminate the row, and further characters in the
  15683. string will be ignored.
  15684. @item rate, r
  15685. Set the video rate, that is the number of frames generated per second.
  15686. Default is 25.
  15687. @item random_fill_ratio, ratio
  15688. Set the random fill ratio for the initial cellular automaton row. It
  15689. is a floating point number value ranging from 0 to 1, defaults to
  15690. 1/PHI.
  15691. This option is ignored when a file or a pattern is specified.
  15692. @item random_seed, seed
  15693. Set the seed for filling randomly the initial row, must be an integer
  15694. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15695. set to -1, the filter will try to use a good random seed on a best
  15696. effort basis.
  15697. @item rule
  15698. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  15699. Default value is 110.
  15700. @item size, s
  15701. Set the size of the output video. For the syntax of this option, check the
  15702. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15703. If @option{filename} or @option{pattern} is specified, the size is set
  15704. by default to the width of the specified initial state row, and the
  15705. height is set to @var{width} * PHI.
  15706. If @option{size} is set, it must contain the width of the specified
  15707. pattern string, and the specified pattern will be centered in the
  15708. larger row.
  15709. If a filename or a pattern string is not specified, the size value
  15710. defaults to "320x518" (used for a randomly generated initial state).
  15711. @item scroll
  15712. If set to 1, scroll the output upward when all the rows in the output
  15713. have been already filled. If set to 0, the new generated row will be
  15714. written over the top row just after the bottom row is filled.
  15715. Defaults to 1.
  15716. @item start_full, full
  15717. If set to 1, completely fill the output with generated rows before
  15718. outputting the first frame.
  15719. This is the default behavior, for disabling set the value to 0.
  15720. @item stitch
  15721. If set to 1, stitch the left and right row edges together.
  15722. This is the default behavior, for disabling set the value to 0.
  15723. @end table
  15724. @subsection Examples
  15725. @itemize
  15726. @item
  15727. Read the initial state from @file{pattern}, and specify an output of
  15728. size 200x400.
  15729. @example
  15730. cellauto=f=pattern:s=200x400
  15731. @end example
  15732. @item
  15733. Generate a random initial row with a width of 200 cells, with a fill
  15734. ratio of 2/3:
  15735. @example
  15736. cellauto=ratio=2/3:s=200x200
  15737. @end example
  15738. @item
  15739. Create a pattern generated by rule 18 starting by a single alive cell
  15740. centered on an initial row with width 100:
  15741. @example
  15742. cellauto=p=@@:s=100x400:full=0:rule=18
  15743. @end example
  15744. @item
  15745. Specify a more elaborated initial pattern:
  15746. @example
  15747. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  15748. @end example
  15749. @end itemize
  15750. @anchor{coreimagesrc}
  15751. @section coreimagesrc
  15752. Video source generated on GPU using Apple's CoreImage API on OSX.
  15753. This video source is a specialized version of the @ref{coreimage} video filter.
  15754. Use a core image generator at the beginning of the applied filterchain to
  15755. generate the content.
  15756. The coreimagesrc video source accepts the following options:
  15757. @table @option
  15758. @item list_generators
  15759. List all available generators along with all their respective options as well as
  15760. possible minimum and maximum values along with the default values.
  15761. @example
  15762. list_generators=true
  15763. @end example
  15764. @item size, s
  15765. Specify the size of the sourced video. For the syntax of this option, check the
  15766. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15767. The default value is @code{320x240}.
  15768. @item rate, r
  15769. Specify the frame rate of the sourced video, as the number of frames
  15770. generated per second. It has to be a string in the format
  15771. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15772. number or a valid video frame rate abbreviation. The default value is
  15773. "25".
  15774. @item sar
  15775. Set the sample aspect ratio of the sourced video.
  15776. @item duration, d
  15777. Set the duration of the sourced video. See
  15778. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15779. for the accepted syntax.
  15780. If not specified, or the expressed duration is negative, the video is
  15781. supposed to be generated forever.
  15782. @end table
  15783. Additionally, all options of the @ref{coreimage} video filter are accepted.
  15784. A complete filterchain can be used for further processing of the
  15785. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  15786. and examples for details.
  15787. @subsection Examples
  15788. @itemize
  15789. @item
  15790. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  15791. given as complete and escaped command-line for Apple's standard bash shell:
  15792. @example
  15793. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  15794. @end example
  15795. This example is equivalent to the QRCode example of @ref{coreimage} without the
  15796. need for a nullsrc video source.
  15797. @end itemize
  15798. @section mandelbrot
  15799. Generate a Mandelbrot set fractal, and progressively zoom towards the
  15800. point specified with @var{start_x} and @var{start_y}.
  15801. This source accepts the following options:
  15802. @table @option
  15803. @item end_pts
  15804. Set the terminal pts value. Default value is 400.
  15805. @item end_scale
  15806. Set the terminal scale value.
  15807. Must be a floating point value. Default value is 0.3.
  15808. @item inner
  15809. Set the inner coloring mode, that is the algorithm used to draw the
  15810. Mandelbrot fractal internal region.
  15811. It shall assume one of the following values:
  15812. @table @option
  15813. @item black
  15814. Set black mode.
  15815. @item convergence
  15816. Show time until convergence.
  15817. @item mincol
  15818. Set color based on point closest to the origin of the iterations.
  15819. @item period
  15820. Set period mode.
  15821. @end table
  15822. Default value is @var{mincol}.
  15823. @item bailout
  15824. Set the bailout value. Default value is 10.0.
  15825. @item maxiter
  15826. Set the maximum of iterations performed by the rendering
  15827. algorithm. Default value is 7189.
  15828. @item outer
  15829. Set outer coloring mode.
  15830. It shall assume one of following values:
  15831. @table @option
  15832. @item iteration_count
  15833. Set iteration count mode.
  15834. @item normalized_iteration_count
  15835. set normalized iteration count mode.
  15836. @end table
  15837. Default value is @var{normalized_iteration_count}.
  15838. @item rate, r
  15839. Set frame rate, expressed as number of frames per second. Default
  15840. value is "25".
  15841. @item size, s
  15842. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15843. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15844. @item start_scale
  15845. Set the initial scale value. Default value is 3.0.
  15846. @item start_x
  15847. Set the initial x position. Must be a floating point value between
  15848. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15849. @item start_y
  15850. Set the initial y position. Must be a floating point value between
  15851. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15852. @end table
  15853. @section mptestsrc
  15854. Generate various test patterns, as generated by the MPlayer test filter.
  15855. The size of the generated video is fixed, and is 256x256.
  15856. This source is useful in particular for testing encoding features.
  15857. This source accepts the following options:
  15858. @table @option
  15859. @item rate, r
  15860. Specify the frame rate of the sourced video, as the number of frames
  15861. generated per second. It has to be a string in the format
  15862. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15863. number or a valid video frame rate abbreviation. The default value is
  15864. "25".
  15865. @item duration, d
  15866. Set the duration of the sourced video. See
  15867. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15868. for the accepted syntax.
  15869. If not specified, or the expressed duration is negative, the video is
  15870. supposed to be generated forever.
  15871. @item test, t
  15872. Set the number or the name of the test to perform. Supported tests are:
  15873. @table @option
  15874. @item dc_luma
  15875. @item dc_chroma
  15876. @item freq_luma
  15877. @item freq_chroma
  15878. @item amp_luma
  15879. @item amp_chroma
  15880. @item cbp
  15881. @item mv
  15882. @item ring1
  15883. @item ring2
  15884. @item all
  15885. @end table
  15886. Default value is "all", which will cycle through the list of all tests.
  15887. @end table
  15888. Some examples:
  15889. @example
  15890. mptestsrc=t=dc_luma
  15891. @end example
  15892. will generate a "dc_luma" test pattern.
  15893. @section frei0r_src
  15894. Provide a frei0r source.
  15895. To enable compilation of this filter you need to install the frei0r
  15896. header and configure FFmpeg with @code{--enable-frei0r}.
  15897. This source accepts the following parameters:
  15898. @table @option
  15899. @item size
  15900. The size of the video to generate. For the syntax of this option, check the
  15901. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15902. @item framerate
  15903. The framerate of the generated video. It may be a string of the form
  15904. @var{num}/@var{den} or a frame rate abbreviation.
  15905. @item filter_name
  15906. The name to the frei0r source to load. For more information regarding frei0r and
  15907. how to set the parameters, read the @ref{frei0r} section in the video filters
  15908. documentation.
  15909. @item filter_params
  15910. A '|'-separated list of parameters to pass to the frei0r source.
  15911. @end table
  15912. For example, to generate a frei0r partik0l source with size 200x200
  15913. and frame rate 10 which is overlaid on the overlay filter main input:
  15914. @example
  15915. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15916. @end example
  15917. @section life
  15918. Generate a life pattern.
  15919. This source is based on a generalization of John Conway's life game.
  15920. The sourced input represents a life grid, each pixel represents a cell
  15921. which can be in one of two possible states, alive or dead. Every cell
  15922. interacts with its eight neighbours, which are the cells that are
  15923. horizontally, vertically, or diagonally adjacent.
  15924. At each interaction the grid evolves according to the adopted rule,
  15925. which specifies the number of neighbor alive cells which will make a
  15926. cell stay alive or born. The @option{rule} option allows one to specify
  15927. the rule to adopt.
  15928. This source accepts the following options:
  15929. @table @option
  15930. @item filename, f
  15931. Set the file from which to read the initial grid state. In the file,
  15932. each non-whitespace character is considered an alive cell, and newline
  15933. is used to delimit the end of each row.
  15934. If this option is not specified, the initial grid is generated
  15935. randomly.
  15936. @item rate, r
  15937. Set the video rate, that is the number of frames generated per second.
  15938. Default is 25.
  15939. @item random_fill_ratio, ratio
  15940. Set the random fill ratio for the initial random grid. It is a
  15941. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15942. It is ignored when a file is specified.
  15943. @item random_seed, seed
  15944. Set the seed for filling the initial random grid, must be an integer
  15945. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15946. set to -1, the filter will try to use a good random seed on a best
  15947. effort basis.
  15948. @item rule
  15949. Set the life rule.
  15950. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15951. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15952. @var{NS} specifies the number of alive neighbor cells which make a
  15953. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15954. which make a dead cell to become alive (i.e. to "born").
  15955. "s" and "b" can be used in place of "S" and "B", respectively.
  15956. Alternatively a rule can be specified by an 18-bits integer. The 9
  15957. high order bits are used to encode the next cell state if it is alive
  15958. for each number of neighbor alive cells, the low order bits specify
  15959. the rule for "borning" new cells. Higher order bits encode for an
  15960. higher number of neighbor cells.
  15961. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15962. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15963. Default value is "S23/B3", which is the original Conway's game of life
  15964. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15965. cells, and will born a new cell if there are three alive cells around
  15966. a dead cell.
  15967. @item size, s
  15968. Set the size of the output video. For the syntax of this option, check the
  15969. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15970. If @option{filename} is specified, the size is set by default to the
  15971. same size of the input file. If @option{size} is set, it must contain
  15972. the size specified in the input file, and the initial grid defined in
  15973. that file is centered in the larger resulting area.
  15974. If a filename is not specified, the size value defaults to "320x240"
  15975. (used for a randomly generated initial grid).
  15976. @item stitch
  15977. If set to 1, stitch the left and right grid edges together, and the
  15978. top and bottom edges also. Defaults to 1.
  15979. @item mold
  15980. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15981. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15982. value from 0 to 255.
  15983. @item life_color
  15984. Set the color of living (or new born) cells.
  15985. @item death_color
  15986. Set the color of dead cells. If @option{mold} is set, this is the first color
  15987. used to represent a dead cell.
  15988. @item mold_color
  15989. Set mold color, for definitely dead and moldy cells.
  15990. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15991. ffmpeg-utils manual,ffmpeg-utils}.
  15992. @end table
  15993. @subsection Examples
  15994. @itemize
  15995. @item
  15996. Read a grid from @file{pattern}, and center it on a grid of size
  15997. 300x300 pixels:
  15998. @example
  15999. life=f=pattern:s=300x300
  16000. @end example
  16001. @item
  16002. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  16003. @example
  16004. life=ratio=2/3:s=200x200
  16005. @end example
  16006. @item
  16007. Specify a custom rule for evolving a randomly generated grid:
  16008. @example
  16009. life=rule=S14/B34
  16010. @end example
  16011. @item
  16012. Full example with slow death effect (mold) using @command{ffplay}:
  16013. @example
  16014. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  16015. @end example
  16016. @end itemize
  16017. @anchor{allrgb}
  16018. @anchor{allyuv}
  16019. @anchor{color}
  16020. @anchor{haldclutsrc}
  16021. @anchor{nullsrc}
  16022. @anchor{pal75bars}
  16023. @anchor{pal100bars}
  16024. @anchor{rgbtestsrc}
  16025. @anchor{smptebars}
  16026. @anchor{smptehdbars}
  16027. @anchor{testsrc}
  16028. @anchor{testsrc2}
  16029. @anchor{yuvtestsrc}
  16030. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  16031. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  16032. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  16033. The @code{color} source provides an uniformly colored input.
  16034. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  16035. @ref{haldclut} filter.
  16036. The @code{nullsrc} source returns unprocessed video frames. It is
  16037. mainly useful to be employed in analysis / debugging tools, or as the
  16038. source for filters which ignore the input data.
  16039. The @code{pal75bars} source generates a color bars pattern, based on
  16040. EBU PAL recommendations with 75% color levels.
  16041. The @code{pal100bars} source generates a color bars pattern, based on
  16042. EBU PAL recommendations with 100% color levels.
  16043. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  16044. detecting RGB vs BGR issues. You should see a red, green and blue
  16045. stripe from top to bottom.
  16046. The @code{smptebars} source generates a color bars pattern, based on
  16047. the SMPTE Engineering Guideline EG 1-1990.
  16048. The @code{smptehdbars} source generates a color bars pattern, based on
  16049. the SMPTE RP 219-2002.
  16050. The @code{testsrc} source generates a test video pattern, showing a
  16051. color pattern, a scrolling gradient and a timestamp. This is mainly
  16052. intended for testing purposes.
  16053. The @code{testsrc2} source is similar to testsrc, but supports more
  16054. pixel formats instead of just @code{rgb24}. This allows using it as an
  16055. input for other tests without requiring a format conversion.
  16056. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  16057. see a y, cb and cr stripe from top to bottom.
  16058. The sources accept the following parameters:
  16059. @table @option
  16060. @item level
  16061. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  16062. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  16063. pixels to be used as identity matrix for 3D lookup tables. Each component is
  16064. coded on a @code{1/(N*N)} scale.
  16065. @item color, c
  16066. Specify the color of the source, only available in the @code{color}
  16067. source. For the syntax of this option, check the
  16068. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16069. @item size, s
  16070. Specify the size of the sourced video. For the syntax of this option, check the
  16071. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16072. The default value is @code{320x240}.
  16073. This option is not available with the @code{allrgb}, @code{allyuv}, and
  16074. @code{haldclutsrc} filters.
  16075. @item rate, r
  16076. Specify the frame rate of the sourced video, as the number of frames
  16077. generated per second. It has to be a string in the format
  16078. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  16079. number or a valid video frame rate abbreviation. The default value is
  16080. "25".
  16081. @item duration, d
  16082. Set the duration of the sourced video. See
  16083. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16084. for the accepted syntax.
  16085. If not specified, or the expressed duration is negative, the video is
  16086. supposed to be generated forever.
  16087. @item sar
  16088. Set the sample aspect ratio of the sourced video.
  16089. @item alpha
  16090. Specify the alpha (opacity) of the background, only available in the
  16091. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  16092. 255 (fully opaque, the default).
  16093. @item decimals, n
  16094. Set the number of decimals to show in the timestamp, only available in the
  16095. @code{testsrc} source.
  16096. The displayed timestamp value will correspond to the original
  16097. timestamp value multiplied by the power of 10 of the specified
  16098. value. Default value is 0.
  16099. @end table
  16100. @subsection Examples
  16101. @itemize
  16102. @item
  16103. Generate a video with a duration of 5.3 seconds, with size
  16104. 176x144 and a frame rate of 10 frames per second:
  16105. @example
  16106. testsrc=duration=5.3:size=qcif:rate=10
  16107. @end example
  16108. @item
  16109. The following graph description will generate a red source
  16110. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  16111. frames per second:
  16112. @example
  16113. color=c=red@@0.2:s=qcif:r=10
  16114. @end example
  16115. @item
  16116. If the input content is to be ignored, @code{nullsrc} can be used. The
  16117. following command generates noise in the luminance plane by employing
  16118. the @code{geq} filter:
  16119. @example
  16120. nullsrc=s=256x256, geq=random(1)*255:128:128
  16121. @end example
  16122. @end itemize
  16123. @subsection Commands
  16124. The @code{color} source supports the following commands:
  16125. @table @option
  16126. @item c, color
  16127. Set the color of the created image. Accepts the same syntax of the
  16128. corresponding @option{color} option.
  16129. @end table
  16130. @section openclsrc
  16131. Generate video using an OpenCL program.
  16132. @table @option
  16133. @item source
  16134. OpenCL program source file.
  16135. @item kernel
  16136. Kernel name in program.
  16137. @item size, s
  16138. Size of frames to generate. This must be set.
  16139. @item format
  16140. Pixel format to use for the generated frames. This must be set.
  16141. @item rate, r
  16142. Number of frames generated every second. Default value is '25'.
  16143. @end table
  16144. For details of how the program loading works, see the @ref{program_opencl}
  16145. filter.
  16146. Example programs:
  16147. @itemize
  16148. @item
  16149. Generate a colour ramp by setting pixel values from the position of the pixel
  16150. in the output image. (Note that this will work with all pixel formats, but
  16151. the generated output will not be the same.)
  16152. @verbatim
  16153. __kernel void ramp(__write_only image2d_t dst,
  16154. unsigned int index)
  16155. {
  16156. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16157. float4 val;
  16158. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  16159. write_imagef(dst, loc, val);
  16160. }
  16161. @end verbatim
  16162. @item
  16163. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  16164. @verbatim
  16165. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  16166. unsigned int index)
  16167. {
  16168. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16169. float4 value = 0.0f;
  16170. int x = loc.x + index;
  16171. int y = loc.y + index;
  16172. while (x > 0 || y > 0) {
  16173. if (x % 3 == 1 && y % 3 == 1) {
  16174. value = 1.0f;
  16175. break;
  16176. }
  16177. x /= 3;
  16178. y /= 3;
  16179. }
  16180. write_imagef(dst, loc, value);
  16181. }
  16182. @end verbatim
  16183. @end itemize
  16184. @section sierpinski
  16185. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  16186. This source accepts the following options:
  16187. @table @option
  16188. @item size, s
  16189. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16190. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16191. @item rate, r
  16192. Set frame rate, expressed as number of frames per second. Default
  16193. value is "25".
  16194. @item seed
  16195. Set seed which is used for random panning.
  16196. @item jump
  16197. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  16198. @item type
  16199. Set fractal type, can be default @code{carpet} or @code{triangle}.
  16200. @end table
  16201. @c man end VIDEO SOURCES
  16202. @chapter Video Sinks
  16203. @c man begin VIDEO SINKS
  16204. Below is a description of the currently available video sinks.
  16205. @section buffersink
  16206. Buffer video frames, and make them available to the end of the filter
  16207. graph.
  16208. This sink is mainly intended for programmatic use, in particular
  16209. through the interface defined in @file{libavfilter/buffersink.h}
  16210. or the options system.
  16211. It accepts a pointer to an AVBufferSinkContext structure, which
  16212. defines the incoming buffers' formats, to be passed as the opaque
  16213. parameter to @code{avfilter_init_filter} for initialization.
  16214. @section nullsink
  16215. Null video sink: do absolutely nothing with the input video. It is
  16216. mainly useful as a template and for use in analysis / debugging
  16217. tools.
  16218. @c man end VIDEO SINKS
  16219. @chapter Multimedia Filters
  16220. @c man begin MULTIMEDIA FILTERS
  16221. Below is a description of the currently available multimedia filters.
  16222. @section abitscope
  16223. Convert input audio to a video output, displaying the audio bit scope.
  16224. The filter accepts the following options:
  16225. @table @option
  16226. @item rate, r
  16227. Set frame rate, expressed as number of frames per second. Default
  16228. value is "25".
  16229. @item size, s
  16230. Specify the video size for the output. For the syntax of this option, check the
  16231. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16232. Default value is @code{1024x256}.
  16233. @item colors
  16234. Specify list of colors separated by space or by '|' which will be used to
  16235. draw channels. Unrecognized or missing colors will be replaced
  16236. by white color.
  16237. @end table
  16238. @section ahistogram
  16239. Convert input audio to a video output, displaying the volume histogram.
  16240. The filter accepts the following options:
  16241. @table @option
  16242. @item dmode
  16243. Specify how histogram is calculated.
  16244. It accepts the following values:
  16245. @table @samp
  16246. @item single
  16247. Use single histogram for all channels.
  16248. @item separate
  16249. Use separate histogram for each channel.
  16250. @end table
  16251. Default is @code{single}.
  16252. @item rate, r
  16253. Set frame rate, expressed as number of frames per second. Default
  16254. value is "25".
  16255. @item size, s
  16256. Specify the video size for the output. For the syntax of this option, check the
  16257. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16258. Default value is @code{hd720}.
  16259. @item scale
  16260. Set display scale.
  16261. It accepts the following values:
  16262. @table @samp
  16263. @item log
  16264. logarithmic
  16265. @item sqrt
  16266. square root
  16267. @item cbrt
  16268. cubic root
  16269. @item lin
  16270. linear
  16271. @item rlog
  16272. reverse logarithmic
  16273. @end table
  16274. Default is @code{log}.
  16275. @item ascale
  16276. Set amplitude scale.
  16277. It accepts the following values:
  16278. @table @samp
  16279. @item log
  16280. logarithmic
  16281. @item lin
  16282. linear
  16283. @end table
  16284. Default is @code{log}.
  16285. @item acount
  16286. Set how much frames to accumulate in histogram.
  16287. Default is 1. Setting this to -1 accumulates all frames.
  16288. @item rheight
  16289. Set histogram ratio of window height.
  16290. @item slide
  16291. Set sonogram sliding.
  16292. It accepts the following values:
  16293. @table @samp
  16294. @item replace
  16295. replace old rows with new ones.
  16296. @item scroll
  16297. scroll from top to bottom.
  16298. @end table
  16299. Default is @code{replace}.
  16300. @end table
  16301. @section aphasemeter
  16302. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  16303. representing mean phase of current audio frame. A video output can also be produced and is
  16304. enabled by default. The audio is passed through as first output.
  16305. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  16306. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  16307. and @code{1} means channels are in phase.
  16308. The filter accepts the following options, all related to its video output:
  16309. @table @option
  16310. @item rate, r
  16311. Set the output frame rate. Default value is @code{25}.
  16312. @item size, s
  16313. Set the video size for the output. For the syntax of this option, check the
  16314. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16315. Default value is @code{800x400}.
  16316. @item rc
  16317. @item gc
  16318. @item bc
  16319. Specify the red, green, blue contrast. Default values are @code{2},
  16320. @code{7} and @code{1}.
  16321. Allowed range is @code{[0, 255]}.
  16322. @item mpc
  16323. Set color which will be used for drawing median phase. If color is
  16324. @code{none} which is default, no median phase value will be drawn.
  16325. @item video
  16326. Enable video output. Default is enabled.
  16327. @end table
  16328. @section avectorscope
  16329. Convert input audio to a video output, representing the audio vector
  16330. scope.
  16331. The filter is used to measure the difference between channels of stereo
  16332. audio stream. A monaural signal, consisting of identical left and right
  16333. signal, results in straight vertical line. Any stereo separation is visible
  16334. as a deviation from this line, creating a Lissajous figure.
  16335. If the straight (or deviation from it) but horizontal line appears this
  16336. indicates that the left and right channels are out of phase.
  16337. The filter accepts the following options:
  16338. @table @option
  16339. @item mode, m
  16340. Set the vectorscope mode.
  16341. Available values are:
  16342. @table @samp
  16343. @item lissajous
  16344. Lissajous rotated by 45 degrees.
  16345. @item lissajous_xy
  16346. Same as above but not rotated.
  16347. @item polar
  16348. Shape resembling half of circle.
  16349. @end table
  16350. Default value is @samp{lissajous}.
  16351. @item size, s
  16352. Set the video size for the output. For the syntax of this option, check the
  16353. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16354. Default value is @code{400x400}.
  16355. @item rate, r
  16356. Set the output frame rate. Default value is @code{25}.
  16357. @item rc
  16358. @item gc
  16359. @item bc
  16360. @item ac
  16361. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  16362. @code{160}, @code{80} and @code{255}.
  16363. Allowed range is @code{[0, 255]}.
  16364. @item rf
  16365. @item gf
  16366. @item bf
  16367. @item af
  16368. Specify the red, green, blue and alpha fade. Default values are @code{15},
  16369. @code{10}, @code{5} and @code{5}.
  16370. Allowed range is @code{[0, 255]}.
  16371. @item zoom
  16372. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  16373. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  16374. @item draw
  16375. Set the vectorscope drawing mode.
  16376. Available values are:
  16377. @table @samp
  16378. @item dot
  16379. Draw dot for each sample.
  16380. @item line
  16381. Draw line between previous and current sample.
  16382. @end table
  16383. Default value is @samp{dot}.
  16384. @item scale
  16385. Specify amplitude scale of audio samples.
  16386. Available values are:
  16387. @table @samp
  16388. @item lin
  16389. Linear.
  16390. @item sqrt
  16391. Square root.
  16392. @item cbrt
  16393. Cubic root.
  16394. @item log
  16395. Logarithmic.
  16396. @end table
  16397. @item swap
  16398. Swap left channel axis with right channel axis.
  16399. @item mirror
  16400. Mirror axis.
  16401. @table @samp
  16402. @item none
  16403. No mirror.
  16404. @item x
  16405. Mirror only x axis.
  16406. @item y
  16407. Mirror only y axis.
  16408. @item xy
  16409. Mirror both axis.
  16410. @end table
  16411. @end table
  16412. @subsection Examples
  16413. @itemize
  16414. @item
  16415. Complete example using @command{ffplay}:
  16416. @example
  16417. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16418. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  16419. @end example
  16420. @end itemize
  16421. @section bench, abench
  16422. Benchmark part of a filtergraph.
  16423. The filter accepts the following options:
  16424. @table @option
  16425. @item action
  16426. Start or stop a timer.
  16427. Available values are:
  16428. @table @samp
  16429. @item start
  16430. Get the current time, set it as frame metadata (using the key
  16431. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  16432. @item stop
  16433. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  16434. the input frame metadata to get the time difference. Time difference, average,
  16435. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  16436. @code{min}) are then printed. The timestamps are expressed in seconds.
  16437. @end table
  16438. @end table
  16439. @subsection Examples
  16440. @itemize
  16441. @item
  16442. Benchmark @ref{selectivecolor} filter:
  16443. @example
  16444. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  16445. @end example
  16446. @end itemize
  16447. @section concat
  16448. Concatenate audio and video streams, joining them together one after the
  16449. other.
  16450. The filter works on segments of synchronized video and audio streams. All
  16451. segments must have the same number of streams of each type, and that will
  16452. also be the number of streams at output.
  16453. The filter accepts the following options:
  16454. @table @option
  16455. @item n
  16456. Set the number of segments. Default is 2.
  16457. @item v
  16458. Set the number of output video streams, that is also the number of video
  16459. streams in each segment. Default is 1.
  16460. @item a
  16461. Set the number of output audio streams, that is also the number of audio
  16462. streams in each segment. Default is 0.
  16463. @item unsafe
  16464. Activate unsafe mode: do not fail if segments have a different format.
  16465. @end table
  16466. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  16467. @var{a} audio outputs.
  16468. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  16469. segment, in the same order as the outputs, then the inputs for the second
  16470. segment, etc.
  16471. Related streams do not always have exactly the same duration, for various
  16472. reasons including codec frame size or sloppy authoring. For that reason,
  16473. related synchronized streams (e.g. a video and its audio track) should be
  16474. concatenated at once. The concat filter will use the duration of the longest
  16475. stream in each segment (except the last one), and if necessary pad shorter
  16476. audio streams with silence.
  16477. For this filter to work correctly, all segments must start at timestamp 0.
  16478. All corresponding streams must have the same parameters in all segments; the
  16479. filtering system will automatically select a common pixel format for video
  16480. streams, and a common sample format, sample rate and channel layout for
  16481. audio streams, but other settings, such as resolution, must be converted
  16482. explicitly by the user.
  16483. Different frame rates are acceptable but will result in variable frame rate
  16484. at output; be sure to configure the output file to handle it.
  16485. @subsection Examples
  16486. @itemize
  16487. @item
  16488. Concatenate an opening, an episode and an ending, all in bilingual version
  16489. (video in stream 0, audio in streams 1 and 2):
  16490. @example
  16491. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  16492. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  16493. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  16494. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  16495. @end example
  16496. @item
  16497. Concatenate two parts, handling audio and video separately, using the
  16498. (a)movie sources, and adjusting the resolution:
  16499. @example
  16500. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  16501. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  16502. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  16503. @end example
  16504. Note that a desync will happen at the stitch if the audio and video streams
  16505. do not have exactly the same duration in the first file.
  16506. @end itemize
  16507. @subsection Commands
  16508. This filter supports the following commands:
  16509. @table @option
  16510. @item next
  16511. Close the current segment and step to the next one
  16512. @end table
  16513. @section drawgraph, adrawgraph
  16514. Draw a graph using input video or audio metadata.
  16515. It accepts the following parameters:
  16516. @table @option
  16517. @item m1
  16518. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  16519. @item fg1
  16520. Set 1st foreground color expression.
  16521. @item m2
  16522. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  16523. @item fg2
  16524. Set 2nd foreground color expression.
  16525. @item m3
  16526. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  16527. @item fg3
  16528. Set 3rd foreground color expression.
  16529. @item m4
  16530. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  16531. @item fg4
  16532. Set 4th foreground color expression.
  16533. @item min
  16534. Set minimal value of metadata value.
  16535. @item max
  16536. Set maximal value of metadata value.
  16537. @item bg
  16538. Set graph background color. Default is white.
  16539. @item mode
  16540. Set graph mode.
  16541. Available values for mode is:
  16542. @table @samp
  16543. @item bar
  16544. @item dot
  16545. @item line
  16546. @end table
  16547. Default is @code{line}.
  16548. @item slide
  16549. Set slide mode.
  16550. Available values for slide is:
  16551. @table @samp
  16552. @item frame
  16553. Draw new frame when right border is reached.
  16554. @item replace
  16555. Replace old columns with new ones.
  16556. @item scroll
  16557. Scroll from right to left.
  16558. @item rscroll
  16559. Scroll from left to right.
  16560. @item picture
  16561. Draw single picture.
  16562. @end table
  16563. Default is @code{frame}.
  16564. @item size
  16565. Set size of graph video. For the syntax of this option, check the
  16566. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16567. The default value is @code{900x256}.
  16568. The foreground color expressions can use the following variables:
  16569. @table @option
  16570. @item MIN
  16571. Minimal value of metadata value.
  16572. @item MAX
  16573. Maximal value of metadata value.
  16574. @item VAL
  16575. Current metadata key value.
  16576. @end table
  16577. The color is defined as 0xAABBGGRR.
  16578. @end table
  16579. Example using metadata from @ref{signalstats} filter:
  16580. @example
  16581. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  16582. @end example
  16583. Example using metadata from @ref{ebur128} filter:
  16584. @example
  16585. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  16586. @end example
  16587. @anchor{ebur128}
  16588. @section ebur128
  16589. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  16590. level. By default, it logs a message at a frequency of 10Hz with the
  16591. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  16592. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  16593. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  16594. sample format is double-precision floating point. The input stream will be converted to
  16595. this specification, if needed. Users may need to insert aformat and/or aresample filters
  16596. after this filter to obtain the original parameters.
  16597. The filter also has a video output (see the @var{video} option) with a real
  16598. time graph to observe the loudness evolution. The graphic contains the logged
  16599. message mentioned above, so it is not printed anymore when this option is set,
  16600. unless the verbose logging is set. The main graphing area contains the
  16601. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  16602. the momentary loudness (400 milliseconds), but can optionally be configured
  16603. to instead display short-term loudness (see @var{gauge}).
  16604. The green area marks a +/- 1LU target range around the target loudness
  16605. (-23LUFS by default, unless modified through @var{target}).
  16606. More information about the Loudness Recommendation EBU R128 on
  16607. @url{http://tech.ebu.ch/loudness}.
  16608. The filter accepts the following options:
  16609. @table @option
  16610. @item video
  16611. Activate the video output. The audio stream is passed unchanged whether this
  16612. option is set or no. The video stream will be the first output stream if
  16613. activated. Default is @code{0}.
  16614. @item size
  16615. Set the video size. This option is for video only. For the syntax of this
  16616. option, check the
  16617. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16618. Default and minimum resolution is @code{640x480}.
  16619. @item meter
  16620. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  16621. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  16622. other integer value between this range is allowed.
  16623. @item metadata
  16624. Set metadata injection. If set to @code{1}, the audio input will be segmented
  16625. into 100ms output frames, each of them containing various loudness information
  16626. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  16627. Default is @code{0}.
  16628. @item framelog
  16629. Force the frame logging level.
  16630. Available values are:
  16631. @table @samp
  16632. @item info
  16633. information logging level
  16634. @item verbose
  16635. verbose logging level
  16636. @end table
  16637. By default, the logging level is set to @var{info}. If the @option{video} or
  16638. the @option{metadata} options are set, it switches to @var{verbose}.
  16639. @item peak
  16640. Set peak mode(s).
  16641. Available modes can be cumulated (the option is a @code{flag} type). Possible
  16642. values are:
  16643. @table @samp
  16644. @item none
  16645. Disable any peak mode (default).
  16646. @item sample
  16647. Enable sample-peak mode.
  16648. Simple peak mode looking for the higher sample value. It logs a message
  16649. for sample-peak (identified by @code{SPK}).
  16650. @item true
  16651. Enable true-peak mode.
  16652. If enabled, the peak lookup is done on an over-sampled version of the input
  16653. stream for better peak accuracy. It logs a message for true-peak.
  16654. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  16655. This mode requires a build with @code{libswresample}.
  16656. @end table
  16657. @item dualmono
  16658. Treat mono input files as "dual mono". If a mono file is intended for playback
  16659. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  16660. If set to @code{true}, this option will compensate for this effect.
  16661. Multi-channel input files are not affected by this option.
  16662. @item panlaw
  16663. Set a specific pan law to be used for the measurement of dual mono files.
  16664. This parameter is optional, and has a default value of -3.01dB.
  16665. @item target
  16666. Set a specific target level (in LUFS) used as relative zero in the visualization.
  16667. This parameter is optional and has a default value of -23LUFS as specified
  16668. by EBU R128. However, material published online may prefer a level of -16LUFS
  16669. (e.g. for use with podcasts or video platforms).
  16670. @item gauge
  16671. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  16672. @code{shortterm}. By default the momentary value will be used, but in certain
  16673. scenarios it may be more useful to observe the short term value instead (e.g.
  16674. live mixing).
  16675. @item scale
  16676. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  16677. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  16678. video output, not the summary or continuous log output.
  16679. @end table
  16680. @subsection Examples
  16681. @itemize
  16682. @item
  16683. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  16684. @example
  16685. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  16686. @end example
  16687. @item
  16688. Run an analysis with @command{ffmpeg}:
  16689. @example
  16690. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  16691. @end example
  16692. @end itemize
  16693. @section interleave, ainterleave
  16694. Temporally interleave frames from several inputs.
  16695. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  16696. These filters read frames from several inputs and send the oldest
  16697. queued frame to the output.
  16698. Input streams must have well defined, monotonically increasing frame
  16699. timestamp values.
  16700. In order to submit one frame to output, these filters need to enqueue
  16701. at least one frame for each input, so they cannot work in case one
  16702. input is not yet terminated and will not receive incoming frames.
  16703. For example consider the case when one input is a @code{select} filter
  16704. which always drops input frames. The @code{interleave} filter will keep
  16705. reading from that input, but it will never be able to send new frames
  16706. to output until the input sends an end-of-stream signal.
  16707. Also, depending on inputs synchronization, the filters will drop
  16708. frames in case one input receives more frames than the other ones, and
  16709. the queue is already filled.
  16710. These filters accept the following options:
  16711. @table @option
  16712. @item nb_inputs, n
  16713. Set the number of different inputs, it is 2 by default.
  16714. @end table
  16715. @subsection Examples
  16716. @itemize
  16717. @item
  16718. Interleave frames belonging to different streams using @command{ffmpeg}:
  16719. @example
  16720. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  16721. @end example
  16722. @item
  16723. Add flickering blur effect:
  16724. @example
  16725. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  16726. @end example
  16727. @end itemize
  16728. @section metadata, ametadata
  16729. Manipulate frame metadata.
  16730. This filter accepts the following options:
  16731. @table @option
  16732. @item mode
  16733. Set mode of operation of the filter.
  16734. Can be one of the following:
  16735. @table @samp
  16736. @item select
  16737. If both @code{value} and @code{key} is set, select frames
  16738. which have such metadata. If only @code{key} is set, select
  16739. every frame that has such key in metadata.
  16740. @item add
  16741. Add new metadata @code{key} and @code{value}. If key is already available
  16742. do nothing.
  16743. @item modify
  16744. Modify value of already present key.
  16745. @item delete
  16746. If @code{value} is set, delete only keys that have such value.
  16747. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  16748. the frame.
  16749. @item print
  16750. Print key and its value if metadata was found. If @code{key} is not set print all
  16751. metadata values available in frame.
  16752. @end table
  16753. @item key
  16754. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  16755. @item value
  16756. Set metadata value which will be used. This option is mandatory for
  16757. @code{modify} and @code{add} mode.
  16758. @item function
  16759. Which function to use when comparing metadata value and @code{value}.
  16760. Can be one of following:
  16761. @table @samp
  16762. @item same_str
  16763. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  16764. @item starts_with
  16765. Values are interpreted as strings, returns true if metadata value starts with
  16766. the @code{value} option string.
  16767. @item less
  16768. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  16769. @item equal
  16770. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  16771. @item greater
  16772. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  16773. @item expr
  16774. Values are interpreted as floats, returns true if expression from option @code{expr}
  16775. evaluates to true.
  16776. @item ends_with
  16777. Values are interpreted as strings, returns true if metadata value ends with
  16778. the @code{value} option string.
  16779. @end table
  16780. @item expr
  16781. Set expression which is used when @code{function} is set to @code{expr}.
  16782. The expression is evaluated through the eval API and can contain the following
  16783. constants:
  16784. @table @option
  16785. @item VALUE1
  16786. Float representation of @code{value} from metadata key.
  16787. @item VALUE2
  16788. Float representation of @code{value} as supplied by user in @code{value} option.
  16789. @end table
  16790. @item file
  16791. If specified in @code{print} mode, output is written to the named file. Instead of
  16792. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  16793. for standard output. If @code{file} option is not set, output is written to the log
  16794. with AV_LOG_INFO loglevel.
  16795. @end table
  16796. @subsection Examples
  16797. @itemize
  16798. @item
  16799. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  16800. between 0 and 1.
  16801. @example
  16802. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  16803. @end example
  16804. @item
  16805. Print silencedetect output to file @file{metadata.txt}.
  16806. @example
  16807. silencedetect,ametadata=mode=print:file=metadata.txt
  16808. @end example
  16809. @item
  16810. Direct all metadata to a pipe with file descriptor 4.
  16811. @example
  16812. metadata=mode=print:file='pipe\:4'
  16813. @end example
  16814. @end itemize
  16815. @section perms, aperms
  16816. Set read/write permissions for the output frames.
  16817. These filters are mainly aimed at developers to test direct path in the
  16818. following filter in the filtergraph.
  16819. The filters accept the following options:
  16820. @table @option
  16821. @item mode
  16822. Select the permissions mode.
  16823. It accepts the following values:
  16824. @table @samp
  16825. @item none
  16826. Do nothing. This is the default.
  16827. @item ro
  16828. Set all the output frames read-only.
  16829. @item rw
  16830. Set all the output frames directly writable.
  16831. @item toggle
  16832. Make the frame read-only if writable, and writable if read-only.
  16833. @item random
  16834. Set each output frame read-only or writable randomly.
  16835. @end table
  16836. @item seed
  16837. Set the seed for the @var{random} mode, must be an integer included between
  16838. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16839. @code{-1}, the filter will try to use a good random seed on a best effort
  16840. basis.
  16841. @end table
  16842. Note: in case of auto-inserted filter between the permission filter and the
  16843. following one, the permission might not be received as expected in that
  16844. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16845. perms/aperms filter can avoid this problem.
  16846. @section realtime, arealtime
  16847. Slow down filtering to match real time approximately.
  16848. These filters will pause the filtering for a variable amount of time to
  16849. match the output rate with the input timestamps.
  16850. They are similar to the @option{re} option to @code{ffmpeg}.
  16851. They accept the following options:
  16852. @table @option
  16853. @item limit
  16854. Time limit for the pauses. Any pause longer than that will be considered
  16855. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16856. @item speed
  16857. Speed factor for processing. The value must be a float larger than zero.
  16858. Values larger than 1.0 will result in faster than realtime processing,
  16859. smaller will slow processing down. The @var{limit} is automatically adapted
  16860. accordingly. Default is 1.0.
  16861. A processing speed faster than what is possible without these filters cannot
  16862. be achieved.
  16863. @end table
  16864. @anchor{select}
  16865. @section select, aselect
  16866. Select frames to pass in output.
  16867. This filter accepts the following options:
  16868. @table @option
  16869. @item expr, e
  16870. Set expression, which is evaluated for each input frame.
  16871. If the expression is evaluated to zero, the frame is discarded.
  16872. If the evaluation result is negative or NaN, the frame is sent to the
  16873. first output; otherwise it is sent to the output with index
  16874. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16875. For example a value of @code{1.2} corresponds to the output with index
  16876. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16877. @item outputs, n
  16878. Set the number of outputs. The output to which to send the selected
  16879. frame is based on the result of the evaluation. Default value is 1.
  16880. @end table
  16881. The expression can contain the following constants:
  16882. @table @option
  16883. @item n
  16884. The (sequential) number of the filtered frame, starting from 0.
  16885. @item selected_n
  16886. The (sequential) number of the selected frame, starting from 0.
  16887. @item prev_selected_n
  16888. The sequential number of the last selected frame. It's NAN if undefined.
  16889. @item TB
  16890. The timebase of the input timestamps.
  16891. @item pts
  16892. The PTS (Presentation TimeStamp) of the filtered video frame,
  16893. expressed in @var{TB} units. It's NAN if undefined.
  16894. @item t
  16895. The PTS of the filtered video frame,
  16896. expressed in seconds. It's NAN if undefined.
  16897. @item prev_pts
  16898. The PTS of the previously filtered video frame. It's NAN if undefined.
  16899. @item prev_selected_pts
  16900. The PTS of the last previously filtered video frame. It's NAN if undefined.
  16901. @item prev_selected_t
  16902. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  16903. @item start_pts
  16904. The PTS of the first video frame in the video. It's NAN if undefined.
  16905. @item start_t
  16906. The time of the first video frame in the video. It's NAN if undefined.
  16907. @item pict_type @emph{(video only)}
  16908. The type of the filtered frame. It can assume one of the following
  16909. values:
  16910. @table @option
  16911. @item I
  16912. @item P
  16913. @item B
  16914. @item S
  16915. @item SI
  16916. @item SP
  16917. @item BI
  16918. @end table
  16919. @item interlace_type @emph{(video only)}
  16920. The frame interlace type. It can assume one of the following values:
  16921. @table @option
  16922. @item PROGRESSIVE
  16923. The frame is progressive (not interlaced).
  16924. @item TOPFIRST
  16925. The frame is top-field-first.
  16926. @item BOTTOMFIRST
  16927. The frame is bottom-field-first.
  16928. @end table
  16929. @item consumed_sample_n @emph{(audio only)}
  16930. the number of selected samples before the current frame
  16931. @item samples_n @emph{(audio only)}
  16932. the number of samples in the current frame
  16933. @item sample_rate @emph{(audio only)}
  16934. the input sample rate
  16935. @item key
  16936. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16937. @item pos
  16938. the position in the file of the filtered frame, -1 if the information
  16939. is not available (e.g. for synthetic video)
  16940. @item scene @emph{(video only)}
  16941. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16942. probability for the current frame to introduce a new scene, while a higher
  16943. value means the current frame is more likely to be one (see the example below)
  16944. @item concatdec_select
  16945. The concat demuxer can select only part of a concat input file by setting an
  16946. inpoint and an outpoint, but the output packets may not be entirely contained
  16947. in the selected interval. By using this variable, it is possible to skip frames
  16948. generated by the concat demuxer which are not exactly contained in the selected
  16949. interval.
  16950. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16951. and the @var{lavf.concat.duration} packet metadata values which are also
  16952. present in the decoded frames.
  16953. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16954. start_time and either the duration metadata is missing or the frame pts is less
  16955. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16956. missing.
  16957. That basically means that an input frame is selected if its pts is within the
  16958. interval set by the concat demuxer.
  16959. @end table
  16960. The default value of the select expression is "1".
  16961. @subsection Examples
  16962. @itemize
  16963. @item
  16964. Select all frames in input:
  16965. @example
  16966. select
  16967. @end example
  16968. The example above is the same as:
  16969. @example
  16970. select=1
  16971. @end example
  16972. @item
  16973. Skip all frames:
  16974. @example
  16975. select=0
  16976. @end example
  16977. @item
  16978. Select only I-frames:
  16979. @example
  16980. select='eq(pict_type\,I)'
  16981. @end example
  16982. @item
  16983. Select one frame every 100:
  16984. @example
  16985. select='not(mod(n\,100))'
  16986. @end example
  16987. @item
  16988. Select only frames contained in the 10-20 time interval:
  16989. @example
  16990. select=between(t\,10\,20)
  16991. @end example
  16992. @item
  16993. Select only I-frames contained in the 10-20 time interval:
  16994. @example
  16995. select=between(t\,10\,20)*eq(pict_type\,I)
  16996. @end example
  16997. @item
  16998. Select frames with a minimum distance of 10 seconds:
  16999. @example
  17000. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  17001. @end example
  17002. @item
  17003. Use aselect to select only audio frames with samples number > 100:
  17004. @example
  17005. aselect='gt(samples_n\,100)'
  17006. @end example
  17007. @item
  17008. Create a mosaic of the first scenes:
  17009. @example
  17010. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  17011. @end example
  17012. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  17013. choice.
  17014. @item
  17015. Send even and odd frames to separate outputs, and compose them:
  17016. @example
  17017. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  17018. @end example
  17019. @item
  17020. Select useful frames from an ffconcat file which is using inpoints and
  17021. outpoints but where the source files are not intra frame only.
  17022. @example
  17023. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  17024. @end example
  17025. @end itemize
  17026. @section sendcmd, asendcmd
  17027. Send commands to filters in the filtergraph.
  17028. These filters read commands to be sent to other filters in the
  17029. filtergraph.
  17030. @code{sendcmd} must be inserted between two video filters,
  17031. @code{asendcmd} must be inserted between two audio filters, but apart
  17032. from that they act the same way.
  17033. The specification of commands can be provided in the filter arguments
  17034. with the @var{commands} option, or in a file specified by the
  17035. @var{filename} option.
  17036. These filters accept the following options:
  17037. @table @option
  17038. @item commands, c
  17039. Set the commands to be read and sent to the other filters.
  17040. @item filename, f
  17041. Set the filename of the commands to be read and sent to the other
  17042. filters.
  17043. @end table
  17044. @subsection Commands syntax
  17045. A commands description consists of a sequence of interval
  17046. specifications, comprising a list of commands to be executed when a
  17047. particular event related to that interval occurs. The occurring event
  17048. is typically the current frame time entering or leaving a given time
  17049. interval.
  17050. An interval is specified by the following syntax:
  17051. @example
  17052. @var{START}[-@var{END}] @var{COMMANDS};
  17053. @end example
  17054. The time interval is specified by the @var{START} and @var{END} times.
  17055. @var{END} is optional and defaults to the maximum time.
  17056. The current frame time is considered within the specified interval if
  17057. it is included in the interval [@var{START}, @var{END}), that is when
  17058. the time is greater or equal to @var{START} and is lesser than
  17059. @var{END}.
  17060. @var{COMMANDS} consists of a sequence of one or more command
  17061. specifications, separated by ",", relating to that interval. The
  17062. syntax of a command specification is given by:
  17063. @example
  17064. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  17065. @end example
  17066. @var{FLAGS} is optional and specifies the type of events relating to
  17067. the time interval which enable sending the specified command, and must
  17068. be a non-null sequence of identifier flags separated by "+" or "|" and
  17069. enclosed between "[" and "]".
  17070. The following flags are recognized:
  17071. @table @option
  17072. @item enter
  17073. The command is sent when the current frame timestamp enters the
  17074. specified interval. In other words, the command is sent when the
  17075. previous frame timestamp was not in the given interval, and the
  17076. current is.
  17077. @item leave
  17078. The command is sent when the current frame timestamp leaves the
  17079. specified interval. In other words, the command is sent when the
  17080. previous frame timestamp was in the given interval, and the
  17081. current is not.
  17082. @end table
  17083. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  17084. assumed.
  17085. @var{TARGET} specifies the target of the command, usually the name of
  17086. the filter class or a specific filter instance name.
  17087. @var{COMMAND} specifies the name of the command for the target filter.
  17088. @var{ARG} is optional and specifies the optional list of argument for
  17089. the given @var{COMMAND}.
  17090. Between one interval specification and another, whitespaces, or
  17091. sequences of characters starting with @code{#} until the end of line,
  17092. are ignored and can be used to annotate comments.
  17093. A simplified BNF description of the commands specification syntax
  17094. follows:
  17095. @example
  17096. @var{COMMAND_FLAG} ::= "enter" | "leave"
  17097. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  17098. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  17099. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  17100. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  17101. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  17102. @end example
  17103. @subsection Examples
  17104. @itemize
  17105. @item
  17106. Specify audio tempo change at second 4:
  17107. @example
  17108. asendcmd=c='4.0 atempo tempo 1.5',atempo
  17109. @end example
  17110. @item
  17111. Target a specific filter instance:
  17112. @example
  17113. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  17114. @end example
  17115. @item
  17116. Specify a list of drawtext and hue commands in a file.
  17117. @example
  17118. # show text in the interval 5-10
  17119. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  17120. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  17121. # desaturate the image in the interval 15-20
  17122. 15.0-20.0 [enter] hue s 0,
  17123. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  17124. [leave] hue s 1,
  17125. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  17126. # apply an exponential saturation fade-out effect, starting from time 25
  17127. 25 [enter] hue s exp(25-t)
  17128. @end example
  17129. A filtergraph allowing to read and process the above command list
  17130. stored in a file @file{test.cmd}, can be specified with:
  17131. @example
  17132. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  17133. @end example
  17134. @end itemize
  17135. @anchor{setpts}
  17136. @section setpts, asetpts
  17137. Change the PTS (presentation timestamp) of the input frames.
  17138. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  17139. This filter accepts the following options:
  17140. @table @option
  17141. @item expr
  17142. The expression which is evaluated for each frame to construct its timestamp.
  17143. @end table
  17144. The expression is evaluated through the eval API and can contain the following
  17145. constants:
  17146. @table @option
  17147. @item FRAME_RATE, FR
  17148. frame rate, only defined for constant frame-rate video
  17149. @item PTS
  17150. The presentation timestamp in input
  17151. @item N
  17152. The count of the input frame for video or the number of consumed samples,
  17153. not including the current frame for audio, starting from 0.
  17154. @item NB_CONSUMED_SAMPLES
  17155. The number of consumed samples, not including the current frame (only
  17156. audio)
  17157. @item NB_SAMPLES, S
  17158. The number of samples in the current frame (only audio)
  17159. @item SAMPLE_RATE, SR
  17160. The audio sample rate.
  17161. @item STARTPTS
  17162. The PTS of the first frame.
  17163. @item STARTT
  17164. the time in seconds of the first frame
  17165. @item INTERLACED
  17166. State whether the current frame is interlaced.
  17167. @item T
  17168. the time in seconds of the current frame
  17169. @item POS
  17170. original position in the file of the frame, or undefined if undefined
  17171. for the current frame
  17172. @item PREV_INPTS
  17173. The previous input PTS.
  17174. @item PREV_INT
  17175. previous input time in seconds
  17176. @item PREV_OUTPTS
  17177. The previous output PTS.
  17178. @item PREV_OUTT
  17179. previous output time in seconds
  17180. @item RTCTIME
  17181. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  17182. instead.
  17183. @item RTCSTART
  17184. The wallclock (RTC) time at the start of the movie in microseconds.
  17185. @item TB
  17186. The timebase of the input timestamps.
  17187. @end table
  17188. @subsection Examples
  17189. @itemize
  17190. @item
  17191. Start counting PTS from zero
  17192. @example
  17193. setpts=PTS-STARTPTS
  17194. @end example
  17195. @item
  17196. Apply fast motion effect:
  17197. @example
  17198. setpts=0.5*PTS
  17199. @end example
  17200. @item
  17201. Apply slow motion effect:
  17202. @example
  17203. setpts=2.0*PTS
  17204. @end example
  17205. @item
  17206. Set fixed rate of 25 frames per second:
  17207. @example
  17208. setpts=N/(25*TB)
  17209. @end example
  17210. @item
  17211. Set fixed rate 25 fps with some jitter:
  17212. @example
  17213. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  17214. @end example
  17215. @item
  17216. Apply an offset of 10 seconds to the input PTS:
  17217. @example
  17218. setpts=PTS+10/TB
  17219. @end example
  17220. @item
  17221. Generate timestamps from a "live source" and rebase onto the current timebase:
  17222. @example
  17223. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  17224. @end example
  17225. @item
  17226. Generate timestamps by counting samples:
  17227. @example
  17228. asetpts=N/SR/TB
  17229. @end example
  17230. @end itemize
  17231. @section setrange
  17232. Force color range for the output video frame.
  17233. The @code{setrange} filter marks the color range property for the
  17234. output frames. It does not change the input frame, but only sets the
  17235. corresponding property, which affects how the frame is treated by
  17236. following filters.
  17237. The filter accepts the following options:
  17238. @table @option
  17239. @item range
  17240. Available values are:
  17241. @table @samp
  17242. @item auto
  17243. Keep the same color range property.
  17244. @item unspecified, unknown
  17245. Set the color range as unspecified.
  17246. @item limited, tv, mpeg
  17247. Set the color range as limited.
  17248. @item full, pc, jpeg
  17249. Set the color range as full.
  17250. @end table
  17251. @end table
  17252. @section settb, asettb
  17253. Set the timebase to use for the output frames timestamps.
  17254. It is mainly useful for testing timebase configuration.
  17255. It accepts the following parameters:
  17256. @table @option
  17257. @item expr, tb
  17258. The expression which is evaluated into the output timebase.
  17259. @end table
  17260. The value for @option{tb} is an arithmetic expression representing a
  17261. rational. The expression can contain the constants "AVTB" (the default
  17262. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  17263. audio only). Default value is "intb".
  17264. @subsection Examples
  17265. @itemize
  17266. @item
  17267. Set the timebase to 1/25:
  17268. @example
  17269. settb=expr=1/25
  17270. @end example
  17271. @item
  17272. Set the timebase to 1/10:
  17273. @example
  17274. settb=expr=0.1
  17275. @end example
  17276. @item
  17277. Set the timebase to 1001/1000:
  17278. @example
  17279. settb=1+0.001
  17280. @end example
  17281. @item
  17282. Set the timebase to 2*intb:
  17283. @example
  17284. settb=2*intb
  17285. @end example
  17286. @item
  17287. Set the default timebase value:
  17288. @example
  17289. settb=AVTB
  17290. @end example
  17291. @end itemize
  17292. @section showcqt
  17293. Convert input audio to a video output representing frequency spectrum
  17294. logarithmically using Brown-Puckette constant Q transform algorithm with
  17295. direct frequency domain coefficient calculation (but the transform itself
  17296. is not really constant Q, instead the Q factor is actually variable/clamped),
  17297. with musical tone scale, from E0 to D#10.
  17298. The filter accepts the following options:
  17299. @table @option
  17300. @item size, s
  17301. Specify the video size for the output. It must be even. For the syntax of this option,
  17302. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17303. Default value is @code{1920x1080}.
  17304. @item fps, rate, r
  17305. Set the output frame rate. Default value is @code{25}.
  17306. @item bar_h
  17307. Set the bargraph height. It must be even. Default value is @code{-1} which
  17308. computes the bargraph height automatically.
  17309. @item axis_h
  17310. Set the axis height. It must be even. Default value is @code{-1} which computes
  17311. the axis height automatically.
  17312. @item sono_h
  17313. Set the sonogram height. It must be even. Default value is @code{-1} which
  17314. computes the sonogram height automatically.
  17315. @item fullhd
  17316. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  17317. instead. Default value is @code{1}.
  17318. @item sono_v, volume
  17319. Specify the sonogram volume expression. It can contain variables:
  17320. @table @option
  17321. @item bar_v
  17322. the @var{bar_v} evaluated expression
  17323. @item frequency, freq, f
  17324. the frequency where it is evaluated
  17325. @item timeclamp, tc
  17326. the value of @var{timeclamp} option
  17327. @end table
  17328. and functions:
  17329. @table @option
  17330. @item a_weighting(f)
  17331. A-weighting of equal loudness
  17332. @item b_weighting(f)
  17333. B-weighting of equal loudness
  17334. @item c_weighting(f)
  17335. C-weighting of equal loudness.
  17336. @end table
  17337. Default value is @code{16}.
  17338. @item bar_v, volume2
  17339. Specify the bargraph volume expression. It can contain variables:
  17340. @table @option
  17341. @item sono_v
  17342. the @var{sono_v} evaluated expression
  17343. @item frequency, freq, f
  17344. the frequency where it is evaluated
  17345. @item timeclamp, tc
  17346. the value of @var{timeclamp} option
  17347. @end table
  17348. and functions:
  17349. @table @option
  17350. @item a_weighting(f)
  17351. A-weighting of equal loudness
  17352. @item b_weighting(f)
  17353. B-weighting of equal loudness
  17354. @item c_weighting(f)
  17355. C-weighting of equal loudness.
  17356. @end table
  17357. Default value is @code{sono_v}.
  17358. @item sono_g, gamma
  17359. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  17360. higher gamma makes the spectrum having more range. Default value is @code{3}.
  17361. Acceptable range is @code{[1, 7]}.
  17362. @item bar_g, gamma2
  17363. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  17364. @code{[1, 7]}.
  17365. @item bar_t
  17366. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  17367. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  17368. @item timeclamp, tc
  17369. Specify the transform timeclamp. At low frequency, there is trade-off between
  17370. accuracy in time domain and frequency domain. If timeclamp is lower,
  17371. event in time domain is represented more accurately (such as fast bass drum),
  17372. otherwise event in frequency domain is represented more accurately
  17373. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  17374. @item attack
  17375. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  17376. limits future samples by applying asymmetric windowing in time domain, useful
  17377. when low latency is required. Accepted range is @code{[0, 1]}.
  17378. @item basefreq
  17379. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  17380. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  17381. @item endfreq
  17382. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  17383. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  17384. @item coeffclamp
  17385. This option is deprecated and ignored.
  17386. @item tlength
  17387. Specify the transform length in time domain. Use this option to control accuracy
  17388. trade-off between time domain and frequency domain at every frequency sample.
  17389. It can contain variables:
  17390. @table @option
  17391. @item frequency, freq, f
  17392. the frequency where it is evaluated
  17393. @item timeclamp, tc
  17394. the value of @var{timeclamp} option.
  17395. @end table
  17396. Default value is @code{384*tc/(384+tc*f)}.
  17397. @item count
  17398. Specify the transform count for every video frame. Default value is @code{6}.
  17399. Acceptable range is @code{[1, 30]}.
  17400. @item fcount
  17401. Specify the transform count for every single pixel. Default value is @code{0},
  17402. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  17403. @item fontfile
  17404. Specify font file for use with freetype to draw the axis. If not specified,
  17405. use embedded font. Note that drawing with font file or embedded font is not
  17406. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  17407. option instead.
  17408. @item font
  17409. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  17410. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  17411. escaping.
  17412. @item fontcolor
  17413. Specify font color expression. This is arithmetic expression that should return
  17414. integer value 0xRRGGBB. It can contain variables:
  17415. @table @option
  17416. @item frequency, freq, f
  17417. the frequency where it is evaluated
  17418. @item timeclamp, tc
  17419. the value of @var{timeclamp} option
  17420. @end table
  17421. and functions:
  17422. @table @option
  17423. @item midi(f)
  17424. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  17425. @item r(x), g(x), b(x)
  17426. red, green, and blue value of intensity x.
  17427. @end table
  17428. Default value is @code{st(0, (midi(f)-59.5)/12);
  17429. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  17430. r(1-ld(1)) + b(ld(1))}.
  17431. @item axisfile
  17432. Specify image file to draw the axis. This option override @var{fontfile} and
  17433. @var{fontcolor} option.
  17434. @item axis, text
  17435. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  17436. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  17437. Default value is @code{1}.
  17438. @item csp
  17439. Set colorspace. The accepted values are:
  17440. @table @samp
  17441. @item unspecified
  17442. Unspecified (default)
  17443. @item bt709
  17444. BT.709
  17445. @item fcc
  17446. FCC
  17447. @item bt470bg
  17448. BT.470BG or BT.601-6 625
  17449. @item smpte170m
  17450. SMPTE-170M or BT.601-6 525
  17451. @item smpte240m
  17452. SMPTE-240M
  17453. @item bt2020ncl
  17454. BT.2020 with non-constant luminance
  17455. @end table
  17456. @item cscheme
  17457. Set spectrogram color scheme. This is list of floating point values with format
  17458. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  17459. The default is @code{1|0.5|0|0|0.5|1}.
  17460. @end table
  17461. @subsection Examples
  17462. @itemize
  17463. @item
  17464. Playing audio while showing the spectrum:
  17465. @example
  17466. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  17467. @end example
  17468. @item
  17469. Same as above, but with frame rate 30 fps:
  17470. @example
  17471. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  17472. @end example
  17473. @item
  17474. Playing at 1280x720:
  17475. @example
  17476. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  17477. @end example
  17478. @item
  17479. Disable sonogram display:
  17480. @example
  17481. sono_h=0
  17482. @end example
  17483. @item
  17484. A1 and its harmonics: A1, A2, (near)E3, A3:
  17485. @example
  17486. 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),
  17487. asplit[a][out1]; [a] showcqt [out0]'
  17488. @end example
  17489. @item
  17490. Same as above, but with more accuracy in frequency domain:
  17491. @example
  17492. 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),
  17493. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  17494. @end example
  17495. @item
  17496. Custom volume:
  17497. @example
  17498. bar_v=10:sono_v=bar_v*a_weighting(f)
  17499. @end example
  17500. @item
  17501. Custom gamma, now spectrum is linear to the amplitude.
  17502. @example
  17503. bar_g=2:sono_g=2
  17504. @end example
  17505. @item
  17506. Custom tlength equation:
  17507. @example
  17508. 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)))'
  17509. @end example
  17510. @item
  17511. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  17512. @example
  17513. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  17514. @end example
  17515. @item
  17516. Custom font using fontconfig:
  17517. @example
  17518. font='Courier New,Monospace,mono|bold'
  17519. @end example
  17520. @item
  17521. Custom frequency range with custom axis using image file:
  17522. @example
  17523. axisfile=myaxis.png:basefreq=40:endfreq=10000
  17524. @end example
  17525. @end itemize
  17526. @section showfreqs
  17527. Convert input audio to video output representing the audio power spectrum.
  17528. Audio amplitude is on Y-axis while frequency is on X-axis.
  17529. The filter accepts the following options:
  17530. @table @option
  17531. @item size, s
  17532. Specify size of video. For the syntax of this option, check the
  17533. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17534. Default is @code{1024x512}.
  17535. @item mode
  17536. Set display mode.
  17537. This set how each frequency bin will be represented.
  17538. It accepts the following values:
  17539. @table @samp
  17540. @item line
  17541. @item bar
  17542. @item dot
  17543. @end table
  17544. Default is @code{bar}.
  17545. @item ascale
  17546. Set amplitude scale.
  17547. It accepts the following values:
  17548. @table @samp
  17549. @item lin
  17550. Linear scale.
  17551. @item sqrt
  17552. Square root scale.
  17553. @item cbrt
  17554. Cubic root scale.
  17555. @item log
  17556. Logarithmic scale.
  17557. @end table
  17558. Default is @code{log}.
  17559. @item fscale
  17560. Set frequency scale.
  17561. It accepts the following values:
  17562. @table @samp
  17563. @item lin
  17564. Linear scale.
  17565. @item log
  17566. Logarithmic scale.
  17567. @item rlog
  17568. Reverse logarithmic scale.
  17569. @end table
  17570. Default is @code{lin}.
  17571. @item win_size
  17572. Set window size. Allowed range is from 16 to 65536.
  17573. Default is @code{2048}
  17574. @item win_func
  17575. Set windowing function.
  17576. It accepts the following values:
  17577. @table @samp
  17578. @item rect
  17579. @item bartlett
  17580. @item hanning
  17581. @item hamming
  17582. @item blackman
  17583. @item welch
  17584. @item flattop
  17585. @item bharris
  17586. @item bnuttall
  17587. @item bhann
  17588. @item sine
  17589. @item nuttall
  17590. @item lanczos
  17591. @item gauss
  17592. @item tukey
  17593. @item dolph
  17594. @item cauchy
  17595. @item parzen
  17596. @item poisson
  17597. @item bohman
  17598. @end table
  17599. Default is @code{hanning}.
  17600. @item overlap
  17601. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17602. which means optimal overlap for selected window function will be picked.
  17603. @item averaging
  17604. Set time averaging. Setting this to 0 will display current maximal peaks.
  17605. Default is @code{1}, which means time averaging is disabled.
  17606. @item colors
  17607. Specify list of colors separated by space or by '|' which will be used to
  17608. draw channel frequencies. Unrecognized or missing colors will be replaced
  17609. by white color.
  17610. @item cmode
  17611. Set channel display mode.
  17612. It accepts the following values:
  17613. @table @samp
  17614. @item combined
  17615. @item separate
  17616. @end table
  17617. Default is @code{combined}.
  17618. @item minamp
  17619. Set minimum amplitude used in @code{log} amplitude scaler.
  17620. @end table
  17621. @section showspatial
  17622. Convert stereo input audio to a video output, representing the spatial relationship
  17623. between two channels.
  17624. The filter accepts the following options:
  17625. @table @option
  17626. @item size, s
  17627. Specify the video size for the output. For the syntax of this option, check the
  17628. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17629. Default value is @code{512x512}.
  17630. @item win_size
  17631. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  17632. @item win_func
  17633. Set window function.
  17634. It accepts the following values:
  17635. @table @samp
  17636. @item rect
  17637. @item bartlett
  17638. @item hann
  17639. @item hanning
  17640. @item hamming
  17641. @item blackman
  17642. @item welch
  17643. @item flattop
  17644. @item bharris
  17645. @item bnuttall
  17646. @item bhann
  17647. @item sine
  17648. @item nuttall
  17649. @item lanczos
  17650. @item gauss
  17651. @item tukey
  17652. @item dolph
  17653. @item cauchy
  17654. @item parzen
  17655. @item poisson
  17656. @item bohman
  17657. @end table
  17658. Default value is @code{hann}.
  17659. @item overlap
  17660. Set ratio of overlap window. Default value is @code{0.5}.
  17661. When value is @code{1} overlap is set to recommended size for specific
  17662. window function currently used.
  17663. @end table
  17664. @anchor{showspectrum}
  17665. @section showspectrum
  17666. Convert input audio to a video output, representing the audio frequency
  17667. spectrum.
  17668. The filter accepts the following options:
  17669. @table @option
  17670. @item size, s
  17671. Specify the video size for the output. For the syntax of this option, check the
  17672. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17673. Default value is @code{640x512}.
  17674. @item slide
  17675. Specify how the spectrum should slide along the window.
  17676. It accepts the following values:
  17677. @table @samp
  17678. @item replace
  17679. the samples start again on the left when they reach the right
  17680. @item scroll
  17681. the samples scroll from right to left
  17682. @item fullframe
  17683. frames are only produced when the samples reach the right
  17684. @item rscroll
  17685. the samples scroll from left to right
  17686. @end table
  17687. Default value is @code{replace}.
  17688. @item mode
  17689. Specify display mode.
  17690. It accepts the following values:
  17691. @table @samp
  17692. @item combined
  17693. all channels are displayed in the same row
  17694. @item separate
  17695. all channels are displayed in separate rows
  17696. @end table
  17697. Default value is @samp{combined}.
  17698. @item color
  17699. Specify display color mode.
  17700. It accepts the following values:
  17701. @table @samp
  17702. @item channel
  17703. each channel is displayed in a separate color
  17704. @item intensity
  17705. each channel is displayed using the same color scheme
  17706. @item rainbow
  17707. each channel is displayed using the rainbow color scheme
  17708. @item moreland
  17709. each channel is displayed using the moreland color scheme
  17710. @item nebulae
  17711. each channel is displayed using the nebulae color scheme
  17712. @item fire
  17713. each channel is displayed using the fire color scheme
  17714. @item fiery
  17715. each channel is displayed using the fiery color scheme
  17716. @item fruit
  17717. each channel is displayed using the fruit color scheme
  17718. @item cool
  17719. each channel is displayed using the cool color scheme
  17720. @item magma
  17721. each channel is displayed using the magma color scheme
  17722. @item green
  17723. each channel is displayed using the green color scheme
  17724. @item viridis
  17725. each channel is displayed using the viridis color scheme
  17726. @item plasma
  17727. each channel is displayed using the plasma color scheme
  17728. @item cividis
  17729. each channel is displayed using the cividis color scheme
  17730. @item terrain
  17731. each channel is displayed using the terrain color scheme
  17732. @end table
  17733. Default value is @samp{channel}.
  17734. @item scale
  17735. Specify scale used for calculating intensity color values.
  17736. It accepts the following values:
  17737. @table @samp
  17738. @item lin
  17739. linear
  17740. @item sqrt
  17741. square root, default
  17742. @item cbrt
  17743. cubic root
  17744. @item log
  17745. logarithmic
  17746. @item 4thrt
  17747. 4th root
  17748. @item 5thrt
  17749. 5th root
  17750. @end table
  17751. Default value is @samp{sqrt}.
  17752. @item fscale
  17753. Specify frequency scale.
  17754. It accepts the following values:
  17755. @table @samp
  17756. @item lin
  17757. linear
  17758. @item log
  17759. logarithmic
  17760. @end table
  17761. Default value is @samp{lin}.
  17762. @item saturation
  17763. Set saturation modifier for displayed colors. Negative values provide
  17764. alternative color scheme. @code{0} is no saturation at all.
  17765. Saturation must be in [-10.0, 10.0] range.
  17766. Default value is @code{1}.
  17767. @item win_func
  17768. Set window function.
  17769. It accepts the following values:
  17770. @table @samp
  17771. @item rect
  17772. @item bartlett
  17773. @item hann
  17774. @item hanning
  17775. @item hamming
  17776. @item blackman
  17777. @item welch
  17778. @item flattop
  17779. @item bharris
  17780. @item bnuttall
  17781. @item bhann
  17782. @item sine
  17783. @item nuttall
  17784. @item lanczos
  17785. @item gauss
  17786. @item tukey
  17787. @item dolph
  17788. @item cauchy
  17789. @item parzen
  17790. @item poisson
  17791. @item bohman
  17792. @end table
  17793. Default value is @code{hann}.
  17794. @item orientation
  17795. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17796. @code{horizontal}. Default is @code{vertical}.
  17797. @item overlap
  17798. Set ratio of overlap window. Default value is @code{0}.
  17799. When value is @code{1} overlap is set to recommended size for specific
  17800. window function currently used.
  17801. @item gain
  17802. Set scale gain for calculating intensity color values.
  17803. Default value is @code{1}.
  17804. @item data
  17805. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  17806. @item rotation
  17807. Set color rotation, must be in [-1.0, 1.0] range.
  17808. Default value is @code{0}.
  17809. @item start
  17810. Set start frequency from which to display spectrogram. Default is @code{0}.
  17811. @item stop
  17812. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17813. @item fps
  17814. Set upper frame rate limit. Default is @code{auto}, unlimited.
  17815. @item legend
  17816. Draw time and frequency axes and legends. Default is disabled.
  17817. @end table
  17818. The usage is very similar to the showwaves filter; see the examples in that
  17819. section.
  17820. @subsection Examples
  17821. @itemize
  17822. @item
  17823. Large window with logarithmic color scaling:
  17824. @example
  17825. showspectrum=s=1280x480:scale=log
  17826. @end example
  17827. @item
  17828. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  17829. @example
  17830. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17831. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  17832. @end example
  17833. @end itemize
  17834. @section showspectrumpic
  17835. Convert input audio to a single video frame, representing the audio frequency
  17836. spectrum.
  17837. The filter accepts the following options:
  17838. @table @option
  17839. @item size, s
  17840. Specify the video size for the output. For the syntax of this option, check the
  17841. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17842. Default value is @code{4096x2048}.
  17843. @item mode
  17844. Specify display mode.
  17845. It accepts the following values:
  17846. @table @samp
  17847. @item combined
  17848. all channels are displayed in the same row
  17849. @item separate
  17850. all channels are displayed in separate rows
  17851. @end table
  17852. Default value is @samp{combined}.
  17853. @item color
  17854. Specify display color mode.
  17855. It accepts the following values:
  17856. @table @samp
  17857. @item channel
  17858. each channel is displayed in a separate color
  17859. @item intensity
  17860. each channel is displayed using the same color scheme
  17861. @item rainbow
  17862. each channel is displayed using the rainbow color scheme
  17863. @item moreland
  17864. each channel is displayed using the moreland color scheme
  17865. @item nebulae
  17866. each channel is displayed using the nebulae color scheme
  17867. @item fire
  17868. each channel is displayed using the fire color scheme
  17869. @item fiery
  17870. each channel is displayed using the fiery color scheme
  17871. @item fruit
  17872. each channel is displayed using the fruit color scheme
  17873. @item cool
  17874. each channel is displayed using the cool color scheme
  17875. @item magma
  17876. each channel is displayed using the magma color scheme
  17877. @item green
  17878. each channel is displayed using the green color scheme
  17879. @item viridis
  17880. each channel is displayed using the viridis color scheme
  17881. @item plasma
  17882. each channel is displayed using the plasma color scheme
  17883. @item cividis
  17884. each channel is displayed using the cividis color scheme
  17885. @item terrain
  17886. each channel is displayed using the terrain color scheme
  17887. @end table
  17888. Default value is @samp{intensity}.
  17889. @item scale
  17890. Specify scale used for calculating intensity color values.
  17891. It accepts the following values:
  17892. @table @samp
  17893. @item lin
  17894. linear
  17895. @item sqrt
  17896. square root, default
  17897. @item cbrt
  17898. cubic root
  17899. @item log
  17900. logarithmic
  17901. @item 4thrt
  17902. 4th root
  17903. @item 5thrt
  17904. 5th root
  17905. @end table
  17906. Default value is @samp{log}.
  17907. @item fscale
  17908. Specify frequency scale.
  17909. It accepts the following values:
  17910. @table @samp
  17911. @item lin
  17912. linear
  17913. @item log
  17914. logarithmic
  17915. @end table
  17916. Default value is @samp{lin}.
  17917. @item saturation
  17918. Set saturation modifier for displayed colors. Negative values provide
  17919. alternative color scheme. @code{0} is no saturation at all.
  17920. Saturation must be in [-10.0, 10.0] range.
  17921. Default value is @code{1}.
  17922. @item win_func
  17923. Set window function.
  17924. It accepts the following values:
  17925. @table @samp
  17926. @item rect
  17927. @item bartlett
  17928. @item hann
  17929. @item hanning
  17930. @item hamming
  17931. @item blackman
  17932. @item welch
  17933. @item flattop
  17934. @item bharris
  17935. @item bnuttall
  17936. @item bhann
  17937. @item sine
  17938. @item nuttall
  17939. @item lanczos
  17940. @item gauss
  17941. @item tukey
  17942. @item dolph
  17943. @item cauchy
  17944. @item parzen
  17945. @item poisson
  17946. @item bohman
  17947. @end table
  17948. Default value is @code{hann}.
  17949. @item orientation
  17950. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17951. @code{horizontal}. Default is @code{vertical}.
  17952. @item gain
  17953. Set scale gain for calculating intensity color values.
  17954. Default value is @code{1}.
  17955. @item legend
  17956. Draw time and frequency axes and legends. Default is enabled.
  17957. @item rotation
  17958. Set color rotation, must be in [-1.0, 1.0] range.
  17959. Default value is @code{0}.
  17960. @item start
  17961. Set start frequency from which to display spectrogram. Default is @code{0}.
  17962. @item stop
  17963. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17964. @end table
  17965. @subsection Examples
  17966. @itemize
  17967. @item
  17968. Extract an audio spectrogram of a whole audio track
  17969. in a 1024x1024 picture using @command{ffmpeg}:
  17970. @example
  17971. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  17972. @end example
  17973. @end itemize
  17974. @section showvolume
  17975. Convert input audio volume to a video output.
  17976. The filter accepts the following options:
  17977. @table @option
  17978. @item rate, r
  17979. Set video rate.
  17980. @item b
  17981. Set border width, allowed range is [0, 5]. Default is 1.
  17982. @item w
  17983. Set channel width, allowed range is [80, 8192]. Default is 400.
  17984. @item h
  17985. Set channel height, allowed range is [1, 900]. Default is 20.
  17986. @item f
  17987. Set fade, allowed range is [0, 1]. Default is 0.95.
  17988. @item c
  17989. Set volume color expression.
  17990. The expression can use the following variables:
  17991. @table @option
  17992. @item VOLUME
  17993. Current max volume of channel in dB.
  17994. @item PEAK
  17995. Current peak.
  17996. @item CHANNEL
  17997. Current channel number, starting from 0.
  17998. @end table
  17999. @item t
  18000. If set, displays channel names. Default is enabled.
  18001. @item v
  18002. If set, displays volume values. Default is enabled.
  18003. @item o
  18004. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  18005. default is @code{h}.
  18006. @item s
  18007. Set step size, allowed range is [0, 5]. Default is 0, which means
  18008. step is disabled.
  18009. @item p
  18010. Set background opacity, allowed range is [0, 1]. Default is 0.
  18011. @item m
  18012. Set metering mode, can be peak: @code{p} or rms: @code{r},
  18013. default is @code{p}.
  18014. @item ds
  18015. Set display scale, can be linear: @code{lin} or log: @code{log},
  18016. default is @code{lin}.
  18017. @item dm
  18018. In second.
  18019. If set to > 0., display a line for the max level
  18020. in the previous seconds.
  18021. default is disabled: @code{0.}
  18022. @item dmc
  18023. The color of the max line. Use when @code{dm} option is set to > 0.
  18024. default is: @code{orange}
  18025. @end table
  18026. @section showwaves
  18027. Convert input audio to a video output, representing the samples waves.
  18028. The filter accepts the following options:
  18029. @table @option
  18030. @item size, s
  18031. Specify the video size for the output. For the syntax of this option, check the
  18032. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18033. Default value is @code{600x240}.
  18034. @item mode
  18035. Set display mode.
  18036. Available values are:
  18037. @table @samp
  18038. @item point
  18039. Draw a point for each sample.
  18040. @item line
  18041. Draw a vertical line for each sample.
  18042. @item p2p
  18043. Draw a point for each sample and a line between them.
  18044. @item cline
  18045. Draw a centered vertical line for each sample.
  18046. @end table
  18047. Default value is @code{point}.
  18048. @item n
  18049. Set the number of samples which are printed on the same column. A
  18050. larger value will decrease the frame rate. Must be a positive
  18051. integer. This option can be set only if the value for @var{rate}
  18052. is not explicitly specified.
  18053. @item rate, r
  18054. Set the (approximate) output frame rate. This is done by setting the
  18055. option @var{n}. Default value is "25".
  18056. @item split_channels
  18057. Set if channels should be drawn separately or overlap. Default value is 0.
  18058. @item colors
  18059. Set colors separated by '|' which are going to be used for drawing of each channel.
  18060. @item scale
  18061. Set amplitude scale.
  18062. Available values are:
  18063. @table @samp
  18064. @item lin
  18065. Linear.
  18066. @item log
  18067. Logarithmic.
  18068. @item sqrt
  18069. Square root.
  18070. @item cbrt
  18071. Cubic root.
  18072. @end table
  18073. Default is linear.
  18074. @item draw
  18075. Set the draw mode. This is mostly useful to set for high @var{n}.
  18076. Available values are:
  18077. @table @samp
  18078. @item scale
  18079. Scale pixel values for each drawn sample.
  18080. @item full
  18081. Draw every sample directly.
  18082. @end table
  18083. Default value is @code{scale}.
  18084. @end table
  18085. @subsection Examples
  18086. @itemize
  18087. @item
  18088. Output the input file audio and the corresponding video representation
  18089. at the same time:
  18090. @example
  18091. amovie=a.mp3,asplit[out0],showwaves[out1]
  18092. @end example
  18093. @item
  18094. Create a synthetic signal and show it with showwaves, forcing a
  18095. frame rate of 30 frames per second:
  18096. @example
  18097. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  18098. @end example
  18099. @end itemize
  18100. @section showwavespic
  18101. Convert input audio to a single video frame, representing the samples waves.
  18102. The filter accepts the following options:
  18103. @table @option
  18104. @item size, s
  18105. Specify the video size for the output. For the syntax of this option, check the
  18106. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18107. Default value is @code{600x240}.
  18108. @item split_channels
  18109. Set if channels should be drawn separately or overlap. Default value is 0.
  18110. @item colors
  18111. Set colors separated by '|' which are going to be used for drawing of each channel.
  18112. @item scale
  18113. Set amplitude scale.
  18114. Available values are:
  18115. @table @samp
  18116. @item lin
  18117. Linear.
  18118. @item log
  18119. Logarithmic.
  18120. @item sqrt
  18121. Square root.
  18122. @item cbrt
  18123. Cubic root.
  18124. @end table
  18125. Default is linear.
  18126. @item draw
  18127. Set the draw mode.
  18128. Available values are:
  18129. @table @samp
  18130. @item scale
  18131. Scale pixel values for each drawn sample.
  18132. @item full
  18133. Draw every sample directly.
  18134. @end table
  18135. Default value is @code{scale}.
  18136. @end table
  18137. @subsection Examples
  18138. @itemize
  18139. @item
  18140. Extract a channel split representation of the wave form of a whole audio track
  18141. in a 1024x800 picture using @command{ffmpeg}:
  18142. @example
  18143. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  18144. @end example
  18145. @end itemize
  18146. @section sidedata, asidedata
  18147. Delete frame side data, or select frames based on it.
  18148. This filter accepts the following options:
  18149. @table @option
  18150. @item mode
  18151. Set mode of operation of the filter.
  18152. Can be one of the following:
  18153. @table @samp
  18154. @item select
  18155. Select every frame with side data of @code{type}.
  18156. @item delete
  18157. Delete side data of @code{type}. If @code{type} is not set, delete all side
  18158. data in the frame.
  18159. @end table
  18160. @item type
  18161. Set side data type used with all modes. Must be set for @code{select} mode. For
  18162. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  18163. in @file{libavutil/frame.h}. For example, to choose
  18164. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  18165. @end table
  18166. @section spectrumsynth
  18167. Synthesize audio from 2 input video spectrums, first input stream represents
  18168. magnitude across time and second represents phase across time.
  18169. The filter will transform from frequency domain as displayed in videos back
  18170. to time domain as presented in audio output.
  18171. This filter is primarily created for reversing processed @ref{showspectrum}
  18172. filter outputs, but can synthesize sound from other spectrograms too.
  18173. But in such case results are going to be poor if the phase data is not
  18174. available, because in such cases phase data need to be recreated, usually
  18175. it's just recreated from random noise.
  18176. For best results use gray only output (@code{channel} color mode in
  18177. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  18178. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  18179. @code{data} option. Inputs videos should generally use @code{fullframe}
  18180. slide mode as that saves resources needed for decoding video.
  18181. The filter accepts the following options:
  18182. @table @option
  18183. @item sample_rate
  18184. Specify sample rate of output audio, the sample rate of audio from which
  18185. spectrum was generated may differ.
  18186. @item channels
  18187. Set number of channels represented in input video spectrums.
  18188. @item scale
  18189. Set scale which was used when generating magnitude input spectrum.
  18190. Can be @code{lin} or @code{log}. Default is @code{log}.
  18191. @item slide
  18192. Set slide which was used when generating inputs spectrums.
  18193. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  18194. Default is @code{fullframe}.
  18195. @item win_func
  18196. Set window function used for resynthesis.
  18197. @item overlap
  18198. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18199. which means optimal overlap for selected window function will be picked.
  18200. @item orientation
  18201. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  18202. Default is @code{vertical}.
  18203. @end table
  18204. @subsection Examples
  18205. @itemize
  18206. @item
  18207. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  18208. then resynthesize videos back to audio with spectrumsynth:
  18209. @example
  18210. 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
  18211. 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
  18212. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  18213. @end example
  18214. @end itemize
  18215. @section split, asplit
  18216. Split input into several identical outputs.
  18217. @code{asplit} works with audio input, @code{split} with video.
  18218. The filter accepts a single parameter which specifies the number of outputs. If
  18219. unspecified, it defaults to 2.
  18220. @subsection Examples
  18221. @itemize
  18222. @item
  18223. Create two separate outputs from the same input:
  18224. @example
  18225. [in] split [out0][out1]
  18226. @end example
  18227. @item
  18228. To create 3 or more outputs, you need to specify the number of
  18229. outputs, like in:
  18230. @example
  18231. [in] asplit=3 [out0][out1][out2]
  18232. @end example
  18233. @item
  18234. Create two separate outputs from the same input, one cropped and
  18235. one padded:
  18236. @example
  18237. [in] split [splitout1][splitout2];
  18238. [splitout1] crop=100:100:0:0 [cropout];
  18239. [splitout2] pad=200:200:100:100 [padout];
  18240. @end example
  18241. @item
  18242. Create 5 copies of the input audio with @command{ffmpeg}:
  18243. @example
  18244. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  18245. @end example
  18246. @end itemize
  18247. @section zmq, azmq
  18248. Receive commands sent through a libzmq client, and forward them to
  18249. filters in the filtergraph.
  18250. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  18251. must be inserted between two video filters, @code{azmq} between two
  18252. audio filters. Both are capable to send messages to any filter type.
  18253. To enable these filters you need to install the libzmq library and
  18254. headers and configure FFmpeg with @code{--enable-libzmq}.
  18255. For more information about libzmq see:
  18256. @url{http://www.zeromq.org/}
  18257. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  18258. receives messages sent through a network interface defined by the
  18259. @option{bind_address} (or the abbreviation "@option{b}") option.
  18260. Default value of this option is @file{tcp://localhost:5555}. You may
  18261. want to alter this value to your needs, but do not forget to escape any
  18262. ':' signs (see @ref{filtergraph escaping}).
  18263. The received message must be in the form:
  18264. @example
  18265. @var{TARGET} @var{COMMAND} [@var{ARG}]
  18266. @end example
  18267. @var{TARGET} specifies the target of the command, usually the name of
  18268. the filter class or a specific filter instance name. The default
  18269. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  18270. but you can override this by using the @samp{filter_name@@id} syntax
  18271. (see @ref{Filtergraph syntax}).
  18272. @var{COMMAND} specifies the name of the command for the target filter.
  18273. @var{ARG} is optional and specifies the optional argument list for the
  18274. given @var{COMMAND}.
  18275. Upon reception, the message is processed and the corresponding command
  18276. is injected into the filtergraph. Depending on the result, the filter
  18277. will send a reply to the client, adopting the format:
  18278. @example
  18279. @var{ERROR_CODE} @var{ERROR_REASON}
  18280. @var{MESSAGE}
  18281. @end example
  18282. @var{MESSAGE} is optional.
  18283. @subsection Examples
  18284. Look at @file{tools/zmqsend} for an example of a zmq client which can
  18285. be used to send commands processed by these filters.
  18286. Consider the following filtergraph generated by @command{ffplay}.
  18287. In this example the last overlay filter has an instance name. All other
  18288. filters will have default instance names.
  18289. @example
  18290. ffplay -dumpgraph 1 -f lavfi "
  18291. color=s=100x100:c=red [l];
  18292. color=s=100x100:c=blue [r];
  18293. nullsrc=s=200x100, zmq [bg];
  18294. [bg][l] overlay [bg+l];
  18295. [bg+l][r] overlay@@my=x=100 "
  18296. @end example
  18297. To change the color of the left side of the video, the following
  18298. command can be used:
  18299. @example
  18300. echo Parsed_color_0 c yellow | tools/zmqsend
  18301. @end example
  18302. To change the right side:
  18303. @example
  18304. echo Parsed_color_1 c pink | tools/zmqsend
  18305. @end example
  18306. To change the position of the right side:
  18307. @example
  18308. echo overlay@@my x 150 | tools/zmqsend
  18309. @end example
  18310. @c man end MULTIMEDIA FILTERS
  18311. @chapter Multimedia Sources
  18312. @c man begin MULTIMEDIA SOURCES
  18313. Below is a description of the currently available multimedia sources.
  18314. @section amovie
  18315. This is the same as @ref{movie} source, except it selects an audio
  18316. stream by default.
  18317. @anchor{movie}
  18318. @section movie
  18319. Read audio and/or video stream(s) from a movie container.
  18320. It accepts the following parameters:
  18321. @table @option
  18322. @item filename
  18323. The name of the resource to read (not necessarily a file; it can also be a
  18324. device or a stream accessed through some protocol).
  18325. @item format_name, f
  18326. Specifies the format assumed for the movie to read, and can be either
  18327. the name of a container or an input device. If not specified, the
  18328. format is guessed from @var{movie_name} or by probing.
  18329. @item seek_point, sp
  18330. Specifies the seek point in seconds. The frames will be output
  18331. starting from this seek point. The parameter is evaluated with
  18332. @code{av_strtod}, so the numerical value may be suffixed by an IS
  18333. postfix. The default value is "0".
  18334. @item streams, s
  18335. Specifies the streams to read. Several streams can be specified,
  18336. separated by "+". The source will then have as many outputs, in the
  18337. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  18338. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  18339. respectively the default (best suited) video and audio stream. Default
  18340. is "dv", or "da" if the filter is called as "amovie".
  18341. @item stream_index, si
  18342. Specifies the index of the video stream to read. If the value is -1,
  18343. the most suitable video stream will be automatically selected. The default
  18344. value is "-1". Deprecated. If the filter is called "amovie", it will select
  18345. audio instead of video.
  18346. @item loop
  18347. Specifies how many times to read the stream in sequence.
  18348. If the value is 0, the stream will be looped infinitely.
  18349. Default value is "1".
  18350. Note that when the movie is looped the source timestamps are not
  18351. changed, so it will generate non monotonically increasing timestamps.
  18352. @item discontinuity
  18353. Specifies the time difference between frames above which the point is
  18354. considered a timestamp discontinuity which is removed by adjusting the later
  18355. timestamps.
  18356. @end table
  18357. It allows overlaying a second video on top of the main input of
  18358. a filtergraph, as shown in this graph:
  18359. @example
  18360. input -----------> deltapts0 --> overlay --> output
  18361. ^
  18362. |
  18363. movie --> scale--> deltapts1 -------+
  18364. @end example
  18365. @subsection Examples
  18366. @itemize
  18367. @item
  18368. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  18369. on top of the input labelled "in":
  18370. @example
  18371. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18372. [in] setpts=PTS-STARTPTS [main];
  18373. [main][over] overlay=16:16 [out]
  18374. @end example
  18375. @item
  18376. Read from a video4linux2 device, and overlay it on top of the input
  18377. labelled "in":
  18378. @example
  18379. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18380. [in] setpts=PTS-STARTPTS [main];
  18381. [main][over] overlay=16:16 [out]
  18382. @end example
  18383. @item
  18384. Read the first video stream and the audio stream with id 0x81 from
  18385. dvd.vob; the video is connected to the pad named "video" and the audio is
  18386. connected to the pad named "audio":
  18387. @example
  18388. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  18389. @end example
  18390. @end itemize
  18391. @subsection Commands
  18392. Both movie and amovie support the following commands:
  18393. @table @option
  18394. @item seek
  18395. Perform seek using "av_seek_frame".
  18396. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  18397. @itemize
  18398. @item
  18399. @var{stream_index}: If stream_index is -1, a default
  18400. stream is selected, and @var{timestamp} is automatically converted
  18401. from AV_TIME_BASE units to the stream specific time_base.
  18402. @item
  18403. @var{timestamp}: Timestamp in AVStream.time_base units
  18404. or, if no stream is specified, in AV_TIME_BASE units.
  18405. @item
  18406. @var{flags}: Flags which select direction and seeking mode.
  18407. @end itemize
  18408. @item get_duration
  18409. Get movie duration in AV_TIME_BASE units.
  18410. @end table
  18411. @c man end MULTIMEDIA SOURCES