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.

22695 lines
604KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item threshold
  315. If a signal of stream rises above this level it will affect the gain
  316. reduction.
  317. By default it is 0.125. Range is between 0.00097563 and 1.
  318. @item ratio
  319. Set a ratio by which the signal is reduced. 1:2 means that if the level
  320. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  321. Default is 2. Range is between 1 and 20.
  322. @item attack
  323. Amount of milliseconds the signal has to rise above the threshold before gain
  324. reduction starts. Default is 20. Range is between 0.01 and 2000.
  325. @item release
  326. Amount of milliseconds the signal has to fall below the threshold before
  327. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  328. @item makeup
  329. Set the amount by how much signal will be amplified after processing.
  330. Default is 1. Range is from 1 to 64.
  331. @item knee
  332. Curve the sharp knee around the threshold to enter gain reduction more softly.
  333. Default is 2.82843. Range is between 1 and 8.
  334. @item link
  335. Choose if the @code{average} level between all channels of input stream
  336. or the louder(@code{maximum}) channel of input stream affects the
  337. reduction. Default is @code{average}.
  338. @item detection
  339. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  340. of @code{rms}. Default is @code{rms} which is mostly smoother.
  341. @item mix
  342. How much to use compressed signal in output. Default is 1.
  343. Range is between 0 and 1.
  344. @end table
  345. @section acontrast
  346. Simple audio dynamic range commpression/expansion filter.
  347. The filter accepts the following options:
  348. @table @option
  349. @item contrast
  350. Set contrast. Default is 33. Allowed range is between 0 and 100.
  351. @end table
  352. @section acopy
  353. Copy the input audio source unchanged to the output. This is mainly useful for
  354. testing purposes.
  355. @section acrossfade
  356. Apply cross fade from one input audio stream to another input audio stream.
  357. The cross fade is applied for specified duration near the end of first stream.
  358. The filter accepts the following options:
  359. @table @option
  360. @item nb_samples, ns
  361. Specify the number of samples for which the cross fade effect has to last.
  362. At the end of the cross fade effect the first input audio will be completely
  363. silent. Default is 44100.
  364. @item duration, d
  365. Specify the duration of the cross fade effect. See
  366. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  367. for the accepted syntax.
  368. By default the duration is determined by @var{nb_samples}.
  369. If set this option is used instead of @var{nb_samples}.
  370. @item overlap, o
  371. Should first stream end overlap with second stream start. Default is enabled.
  372. @item curve1
  373. Set curve for cross fade transition for first stream.
  374. @item curve2
  375. Set curve for cross fade transition for second stream.
  376. For description of available curve types see @ref{afade} filter description.
  377. @end table
  378. @subsection Examples
  379. @itemize
  380. @item
  381. Cross fade from one input to another:
  382. @example
  383. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  384. @end example
  385. @item
  386. Cross fade from one input to another but without overlapping:
  387. @example
  388. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  389. @end example
  390. @end itemize
  391. @section acrossover
  392. Split audio stream into several bands.
  393. This filter splits audio stream into two or more frequency ranges.
  394. Summing all streams back will give flat output.
  395. The filter accepts the following options:
  396. @table @option
  397. @item split
  398. Set split frequencies. Those must be positive and increasing.
  399. @item order
  400. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  401. Default is @var{4th}.
  402. @end table
  403. @section acrusher
  404. Reduce audio bit resolution.
  405. This filter is bit crusher with enhanced functionality. A bit crusher
  406. is used to audibly reduce number of bits an audio signal is sampled
  407. with. This doesn't change the bit depth at all, it just produces the
  408. effect. Material reduced in bit depth sounds more harsh and "digital".
  409. This filter is able to even round to continuous values instead of discrete
  410. bit depths.
  411. Additionally it has a D/C offset which results in different crushing of
  412. the lower and the upper half of the signal.
  413. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  414. Another feature of this filter is the logarithmic mode.
  415. This setting switches from linear distances between bits to logarithmic ones.
  416. The result is a much more "natural" sounding crusher which doesn't gate low
  417. signals for example. The human ear has a logarithmic perception,
  418. so this kind of crushing is much more pleasant.
  419. Logarithmic crushing is also able to get anti-aliased.
  420. The filter accepts the following options:
  421. @table @option
  422. @item level_in
  423. Set level in.
  424. @item level_out
  425. Set level out.
  426. @item bits
  427. Set bit reduction.
  428. @item mix
  429. Set mixing amount.
  430. @item mode
  431. Can be linear: @code{lin} or logarithmic: @code{log}.
  432. @item dc
  433. Set DC.
  434. @item aa
  435. Set anti-aliasing.
  436. @item samples
  437. Set sample reduction.
  438. @item lfo
  439. Enable LFO. By default disabled.
  440. @item lforange
  441. Set LFO range.
  442. @item lforate
  443. Set LFO rate.
  444. @end table
  445. @section acue
  446. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  447. filter.
  448. @section adeclick
  449. Remove impulsive noise from input audio.
  450. Samples detected as impulsive noise are replaced by interpolated samples using
  451. autoregressive modelling.
  452. @table @option
  453. @item w
  454. Set window size, in milliseconds. Allowed range is from @code{10} to
  455. @code{100}. Default value is @code{55} milliseconds.
  456. This sets size of window which will be processed at once.
  457. @item o
  458. Set window overlap, in percentage of window size. Allowed range is from
  459. @code{50} to @code{95}. Default value is @code{75} percent.
  460. Setting this to a very high value increases impulsive noise removal but makes
  461. whole process much slower.
  462. @item a
  463. Set autoregression order, in percentage of window size. Allowed range is from
  464. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  465. controls quality of interpolated samples using neighbour good samples.
  466. @item t
  467. Set threshold value. Allowed range is from @code{1} to @code{100}.
  468. Default value is @code{2}.
  469. This controls the strength of impulsive noise which is going to be removed.
  470. The lower value, the more samples will be detected as impulsive noise.
  471. @item b
  472. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  473. @code{10}. Default value is @code{2}.
  474. If any two samples deteced as noise are spaced less than this value then any
  475. sample inbetween those two samples will be also detected as noise.
  476. @item m
  477. Set overlap method.
  478. It accepts the following values:
  479. @table @option
  480. @item a
  481. Select overlap-add method. Even not interpolated samples are slightly
  482. changed with this method.
  483. @item s
  484. Select overlap-save method. Not interpolated samples remain unchanged.
  485. @end table
  486. Default value is @code{a}.
  487. @end table
  488. @section adeclip
  489. Remove clipped samples from input audio.
  490. Samples detected as clipped are replaced by interpolated samples using
  491. autoregressive modelling.
  492. @table @option
  493. @item w
  494. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  495. Default value is @code{55} milliseconds.
  496. This sets size of window which will be processed at once.
  497. @item o
  498. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  499. to @code{95}. Default value is @code{75} percent.
  500. @item a
  501. Set autoregression order, in percentage of window size. Allowed range is from
  502. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  503. quality of interpolated samples using neighbour good samples.
  504. @item t
  505. Set threshold value. Allowed range is from @code{1} to @code{100}.
  506. Default value is @code{10}. Higher values make clip detection less aggressive.
  507. @item n
  508. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  509. Default value is @code{1000}. Higher values make clip detection less aggressive.
  510. @item m
  511. Set overlap method.
  512. It accepts the following values:
  513. @table @option
  514. @item a
  515. Select overlap-add method. Even not interpolated samples are slightly changed
  516. with this method.
  517. @item s
  518. Select overlap-save method. Not interpolated samples remain unchanged.
  519. @end table
  520. Default value is @code{a}.
  521. @end table
  522. @section adelay
  523. Delay one or more audio channels.
  524. Samples in delayed channel are filled with silence.
  525. The filter accepts the following option:
  526. @table @option
  527. @item delays
  528. Set list of delays in milliseconds for each channel separated by '|'.
  529. Unused delays will be silently ignored. If number of given delays is
  530. smaller than number of channels all remaining channels will not be delayed.
  531. If you want to delay exact number of samples, append 'S' to number.
  532. @end table
  533. @subsection Examples
  534. @itemize
  535. @item
  536. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  537. the second channel (and any other channels that may be present) unchanged.
  538. @example
  539. adelay=1500|0|500
  540. @end example
  541. @item
  542. Delay second channel by 500 samples, the third channel by 700 samples and leave
  543. the first channel (and any other channels that may be present) unchanged.
  544. @example
  545. adelay=0|500S|700S
  546. @end example
  547. @end itemize
  548. @section aderivative, aintegral
  549. Compute derivative/integral of audio stream.
  550. Applying both filters one after another produces original audio.
  551. @section aecho
  552. Apply echoing to the input audio.
  553. Echoes are reflected sound and can occur naturally amongst mountains
  554. (and sometimes large buildings) when talking or shouting; digital echo
  555. effects emulate this behaviour and are often used to help fill out the
  556. sound of a single instrument or vocal. The time difference between the
  557. original signal and the reflection is the @code{delay}, and the
  558. loudness of the reflected signal is the @code{decay}.
  559. Multiple echoes can have different delays and decays.
  560. A description of the accepted parameters follows.
  561. @table @option
  562. @item in_gain
  563. Set input gain of reflected signal. Default is @code{0.6}.
  564. @item out_gain
  565. Set output gain of reflected signal. Default is @code{0.3}.
  566. @item delays
  567. Set list of time intervals in milliseconds between original signal and reflections
  568. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  569. Default is @code{1000}.
  570. @item decays
  571. Set list of loudness of reflected signals separated by '|'.
  572. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  573. Default is @code{0.5}.
  574. @end table
  575. @subsection Examples
  576. @itemize
  577. @item
  578. Make it sound as if there are twice as many instruments as are actually playing:
  579. @example
  580. aecho=0.8:0.88:60:0.4
  581. @end example
  582. @item
  583. If delay is very short, then it sound like a (metallic) robot playing music:
  584. @example
  585. aecho=0.8:0.88:6:0.4
  586. @end example
  587. @item
  588. A longer delay will sound like an open air concert in the mountains:
  589. @example
  590. aecho=0.8:0.9:1000:0.3
  591. @end example
  592. @item
  593. Same as above but with one more mountain:
  594. @example
  595. aecho=0.8:0.9:1000|1800:0.3|0.25
  596. @end example
  597. @end itemize
  598. @section aemphasis
  599. Audio emphasis filter creates or restores material directly taken from LPs or
  600. emphased CDs with different filter curves. E.g. to store music on vinyl the
  601. signal has to be altered by a filter first to even out the disadvantages of
  602. this recording medium.
  603. Once the material is played back the inverse filter has to be applied to
  604. restore the distortion of the frequency response.
  605. The filter accepts the following options:
  606. @table @option
  607. @item level_in
  608. Set input gain.
  609. @item level_out
  610. Set output gain.
  611. @item mode
  612. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  613. use @code{production} mode. Default is @code{reproduction} mode.
  614. @item type
  615. Set filter type. Selects medium. Can be one of the following:
  616. @table @option
  617. @item col
  618. select Columbia.
  619. @item emi
  620. select EMI.
  621. @item bsi
  622. select BSI (78RPM).
  623. @item riaa
  624. select RIAA.
  625. @item cd
  626. select Compact Disc (CD).
  627. @item 50fm
  628. select 50µs (FM).
  629. @item 75fm
  630. select 75µs (FM).
  631. @item 50kf
  632. select 50µs (FM-KF).
  633. @item 75kf
  634. select 75µs (FM-KF).
  635. @end table
  636. @end table
  637. @section aeval
  638. Modify an audio signal according to the specified expressions.
  639. This filter accepts one or more expressions (one for each channel),
  640. which are evaluated and used to modify a corresponding audio signal.
  641. It accepts the following parameters:
  642. @table @option
  643. @item exprs
  644. Set the '|'-separated expressions list for each separate channel. If
  645. the number of input channels is greater than the number of
  646. expressions, the last specified expression is used for the remaining
  647. output channels.
  648. @item channel_layout, c
  649. Set output channel layout. If not specified, the channel layout is
  650. specified by the number of expressions. If set to @samp{same}, it will
  651. use by default the same input channel layout.
  652. @end table
  653. Each expression in @var{exprs} can contain the following constants and functions:
  654. @table @option
  655. @item ch
  656. channel number of the current expression
  657. @item n
  658. number of the evaluated sample, starting from 0
  659. @item s
  660. sample rate
  661. @item t
  662. time of the evaluated sample expressed in seconds
  663. @item nb_in_channels
  664. @item nb_out_channels
  665. input and output number of channels
  666. @item val(CH)
  667. the value of input channel with number @var{CH}
  668. @end table
  669. Note: this filter is slow. For faster processing you should use a
  670. dedicated filter.
  671. @subsection Examples
  672. @itemize
  673. @item
  674. Half volume:
  675. @example
  676. aeval=val(ch)/2:c=same
  677. @end example
  678. @item
  679. Invert phase of the second channel:
  680. @example
  681. aeval=val(0)|-val(1)
  682. @end example
  683. @end itemize
  684. @anchor{afade}
  685. @section afade
  686. Apply fade-in/out effect to input audio.
  687. A description of the accepted parameters follows.
  688. @table @option
  689. @item type, t
  690. Specify the effect type, can be either @code{in} for fade-in, or
  691. @code{out} for a fade-out effect. Default is @code{in}.
  692. @item start_sample, ss
  693. Specify the number of the start sample for starting to apply the fade
  694. effect. Default is 0.
  695. @item nb_samples, ns
  696. Specify the number of samples for which the fade effect has to last. At
  697. the end of the fade-in effect the output audio will have the same
  698. volume as the input audio, at the end of the fade-out transition
  699. the output audio will be silence. Default is 44100.
  700. @item start_time, st
  701. Specify the start time of the fade effect. Default is 0.
  702. The value must be specified as a time duration; see
  703. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  704. for the accepted syntax.
  705. If set this option is used instead of @var{start_sample}.
  706. @item duration, d
  707. Specify the duration of the fade effect. See
  708. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  709. for the accepted syntax.
  710. At the end of the fade-in effect the output audio will have the same
  711. volume as the input audio, at the end of the fade-out transition
  712. the output audio will be silence.
  713. By default the duration is determined by @var{nb_samples}.
  714. If set this option is used instead of @var{nb_samples}.
  715. @item curve
  716. Set curve for fade transition.
  717. It accepts the following values:
  718. @table @option
  719. @item tri
  720. select triangular, linear slope (default)
  721. @item qsin
  722. select quarter of sine wave
  723. @item hsin
  724. select half of sine wave
  725. @item esin
  726. select exponential sine wave
  727. @item log
  728. select logarithmic
  729. @item ipar
  730. select inverted parabola
  731. @item qua
  732. select quadratic
  733. @item cub
  734. select cubic
  735. @item squ
  736. select square root
  737. @item cbr
  738. select cubic root
  739. @item par
  740. select parabola
  741. @item exp
  742. select exponential
  743. @item iqsin
  744. select inverted quarter of sine wave
  745. @item ihsin
  746. select inverted half of sine wave
  747. @item dese
  748. select double-exponential seat
  749. @item desi
  750. select double-exponential sigmoid
  751. @item losi
  752. select logistic sigmoid
  753. @end table
  754. @end table
  755. @subsection Examples
  756. @itemize
  757. @item
  758. Fade in first 15 seconds of audio:
  759. @example
  760. afade=t=in:ss=0:d=15
  761. @end example
  762. @item
  763. Fade out last 25 seconds of a 900 seconds audio:
  764. @example
  765. afade=t=out:st=875:d=25
  766. @end example
  767. @end itemize
  768. @section afftdn
  769. Denoise audio samples with FFT.
  770. A description of the accepted parameters follows.
  771. @table @option
  772. @item nr
  773. Set the noise reduction in dB, allowed range is 0.01 to 97.
  774. Default value is 12 dB.
  775. @item nf
  776. Set the noise floor in dB, allowed range is -80 to -20.
  777. Default value is -50 dB.
  778. @item nt
  779. Set the noise type.
  780. It accepts the following values:
  781. @table @option
  782. @item w
  783. Select white noise.
  784. @item v
  785. Select vinyl noise.
  786. @item s
  787. Select shellac noise.
  788. @item c
  789. Select custom noise, defined in @code{bn} option.
  790. Default value is white noise.
  791. @end table
  792. @item bn
  793. Set custom band noise for every one of 15 bands.
  794. Bands are separated by ' ' or '|'.
  795. @item rf
  796. Set the residual floor in dB, allowed range is -80 to -20.
  797. Default value is -38 dB.
  798. @item tn
  799. Enable noise tracking. By default is disabled.
  800. With this enabled, noise floor is automatically adjusted.
  801. @item tr
  802. Enable residual tracking. By default is disabled.
  803. @item om
  804. Set the output mode.
  805. It accepts the following values:
  806. @table @option
  807. @item i
  808. Pass input unchanged.
  809. @item o
  810. Pass noise filtered out.
  811. @item n
  812. Pass only noise.
  813. Default value is @var{o}.
  814. @end table
  815. @end table
  816. @subsection Commands
  817. This filter supports the following commands:
  818. @table @option
  819. @item sample_noise, sn
  820. Start or stop measuring noise profile.
  821. Syntax for the command is : "start" or "stop" string.
  822. After measuring noise profile is stopped it will be
  823. automatically applied in filtering.
  824. @item noise_reduction, nr
  825. Change noise reduction. Argument is single float number.
  826. Syntax for the command is : "@var{noise_reduction}"
  827. @item noise_floor, nf
  828. Change noise floor. Argument is single float number.
  829. Syntax for the command is : "@var{noise_floor}"
  830. @item output_mode, om
  831. Change output mode operation.
  832. Syntax for the command is : "i", "o" or "n" string.
  833. @end table
  834. @section afftfilt
  835. Apply arbitrary expressions to samples in frequency domain.
  836. @table @option
  837. @item real
  838. Set frequency domain real expression for each separate channel separated
  839. by '|'. Default is "re".
  840. If the number of input channels is greater than the number of
  841. expressions, the last specified expression is used for the remaining
  842. output channels.
  843. @item imag
  844. Set frequency domain imaginary expression for each separate channel
  845. separated by '|'. Default is "im".
  846. Each expression in @var{real} and @var{imag} can contain the following
  847. constants and functions:
  848. @table @option
  849. @item sr
  850. sample rate
  851. @item b
  852. current frequency bin number
  853. @item nb
  854. number of available bins
  855. @item ch
  856. channel number of the current expression
  857. @item chs
  858. number of channels
  859. @item pts
  860. current frame pts
  861. @item re
  862. current real part of frequency bin of current channel
  863. @item im
  864. current imaginary part of frequency bin of current channel
  865. @item real(b, ch)
  866. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  867. @item imag(b, ch)
  868. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  869. @end table
  870. @item win_size
  871. Set window size.
  872. It accepts the following values:
  873. @table @samp
  874. @item w16
  875. @item w32
  876. @item w64
  877. @item w128
  878. @item w256
  879. @item w512
  880. @item w1024
  881. @item w2048
  882. @item w4096
  883. @item w8192
  884. @item w16384
  885. @item w32768
  886. @item w65536
  887. @end table
  888. Default is @code{w4096}
  889. @item win_func
  890. Set window function. Default is @code{hann}.
  891. @item overlap
  892. Set window overlap. If set to 1, the recommended overlap for selected
  893. window function will be picked. Default is @code{0.75}.
  894. @end table
  895. @subsection Examples
  896. @itemize
  897. @item
  898. Leave almost only low frequencies in audio:
  899. @example
  900. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  901. @end example
  902. @end itemize
  903. @anchor{afir}
  904. @section afir
  905. Apply an arbitrary Frequency Impulse Response filter.
  906. This filter is designed for applying long FIR filters,
  907. up to 60 seconds long.
  908. It can be used as component for digital crossover filters,
  909. room equalization, cross talk cancellation, wavefield synthesis,
  910. auralization, ambiophonics and ambisonics.
  911. This filter uses second stream as FIR coefficients.
  912. If second stream holds single channel, it will be used
  913. for all input channels in first stream, otherwise
  914. number of channels in second stream must be same as
  915. number of channels in first stream.
  916. It accepts the following parameters:
  917. @table @option
  918. @item dry
  919. Set dry gain. This sets input gain.
  920. @item wet
  921. Set wet gain. This sets final output gain.
  922. @item length
  923. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  924. @item gtype
  925. Enable applying gain measured from power of IR.
  926. Set which approach to use for auto gain measurement.
  927. @table @option
  928. @item none
  929. Do not apply any gain.
  930. @item peak
  931. select peak gain, very conservative approach. This is default value.
  932. @item dc
  933. select DC gain, limited application.
  934. @item gn
  935. select gain to noise approach, this is most popular one.
  936. @end table
  937. @item irgain
  938. Set gain to be applied to IR coefficients before filtering.
  939. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  940. @item irfmt
  941. Set format of IR stream. Can be @code{mono} or @code{input}.
  942. Default is @code{input}.
  943. @item maxir
  944. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  945. Allowed range is 0.1 to 60 seconds.
  946. @item response
  947. Show IR frequency reponse, magnitude(magenta) and phase(green) and group delay(yellow) in additional video stream.
  948. By default it is disabled.
  949. @item channel
  950. Set for which IR channel to display frequency response. By default is first channel
  951. displayed. This option is used only when @var{response} is enabled.
  952. @item size
  953. Set video stream size. This option is used only when @var{response} is enabled.
  954. @item rate
  955. Set video stream frame rate. This option is used only when @var{response} is enabled.
  956. @item minp
  957. Set minimal partition size used for convolution. Default is @var{16}.
  958. Allowed range is from @var{16} to @var{65536}.
  959. Lower values decreases latency at cost of higher CPU usage.
  960. @item maxp
  961. Set maximal partition size used for convolution. Default is @var{65536}.
  962. Allowed range is from @var{16} to @var{65536}.
  963. Lower values decreases latency at cost of higher CPU usage.
  964. @end table
  965. @subsection Examples
  966. @itemize
  967. @item
  968. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  969. @example
  970. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  971. @end example
  972. @end itemize
  973. @anchor{aformat}
  974. @section aformat
  975. Set output format constraints for the input audio. The framework will
  976. negotiate the most appropriate format to minimize conversions.
  977. It accepts the following parameters:
  978. @table @option
  979. @item sample_fmts
  980. A '|'-separated list of requested sample formats.
  981. @item sample_rates
  982. A '|'-separated list of requested sample rates.
  983. @item channel_layouts
  984. A '|'-separated list of requested channel layouts.
  985. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  986. for the required syntax.
  987. @end table
  988. If a parameter is omitted, all values are allowed.
  989. Force the output to either unsigned 8-bit or signed 16-bit stereo
  990. @example
  991. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  992. @end example
  993. @section agate
  994. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  995. processing reduces disturbing noise between useful signals.
  996. Gating is done by detecting the volume below a chosen level @var{threshold}
  997. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  998. floor is set via @var{range}. Because an exact manipulation of the signal
  999. would cause distortion of the waveform the reduction can be levelled over
  1000. time. This is done by setting @var{attack} and @var{release}.
  1001. @var{attack} determines how long the signal has to fall below the threshold
  1002. before any reduction will occur and @var{release} sets the time the signal
  1003. has to rise above the threshold to reduce the reduction again.
  1004. Shorter signals than the chosen attack time will be left untouched.
  1005. @table @option
  1006. @item level_in
  1007. Set input level before filtering.
  1008. Default is 1. Allowed range is from 0.015625 to 64.
  1009. @item range
  1010. Set the level of gain reduction when the signal is below the threshold.
  1011. Default is 0.06125. Allowed range is from 0 to 1.
  1012. @item threshold
  1013. If a signal rises above this level the gain reduction is released.
  1014. Default is 0.125. Allowed range is from 0 to 1.
  1015. @item ratio
  1016. Set a ratio by which the signal is reduced.
  1017. Default is 2. Allowed range is from 1 to 9000.
  1018. @item attack
  1019. Amount of milliseconds the signal has to rise above the threshold before gain
  1020. reduction stops.
  1021. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1022. @item release
  1023. Amount of milliseconds the signal has to fall below the threshold before the
  1024. reduction is increased again. Default is 250 milliseconds.
  1025. Allowed range is from 0.01 to 9000.
  1026. @item makeup
  1027. Set amount of amplification of signal after processing.
  1028. Default is 1. Allowed range is from 1 to 64.
  1029. @item knee
  1030. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1031. Default is 2.828427125. Allowed range is from 1 to 8.
  1032. @item detection
  1033. Choose if exact signal should be taken for detection or an RMS like one.
  1034. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1035. @item link
  1036. Choose if the average level between all channels or the louder channel affects
  1037. the reduction.
  1038. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1039. @end table
  1040. @section aiir
  1041. Apply an arbitrary Infinite Impulse Response filter.
  1042. It accepts the following parameters:
  1043. @table @option
  1044. @item z
  1045. Set numerator/zeros coefficients.
  1046. @item p
  1047. Set denominator/poles coefficients.
  1048. @item k
  1049. Set channels gains.
  1050. @item dry_gain
  1051. Set input gain.
  1052. @item wet_gain
  1053. Set output gain.
  1054. @item f
  1055. Set coefficients format.
  1056. @table @samp
  1057. @item tf
  1058. transfer function
  1059. @item zp
  1060. Z-plane zeros/poles, cartesian (default)
  1061. @item pr
  1062. Z-plane zeros/poles, polar radians
  1063. @item pd
  1064. Z-plane zeros/poles, polar degrees
  1065. @end table
  1066. @item r
  1067. Set kind of processing.
  1068. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  1069. @item e
  1070. Set filtering precision.
  1071. @table @samp
  1072. @item dbl
  1073. double-precision floating-point (default)
  1074. @item flt
  1075. single-precision floating-point
  1076. @item i32
  1077. 32-bit integers
  1078. @item i16
  1079. 16-bit integers
  1080. @end table
  1081. @item response
  1082. Show IR frequency reponse, magnitude and phase in additional video stream.
  1083. By default it is disabled.
  1084. @item channel
  1085. Set for which IR channel to display frequency response. By default is first channel
  1086. displayed. This option is used only when @var{response} is enabled.
  1087. @item size
  1088. Set video stream size. This option is used only when @var{response} is enabled.
  1089. @end table
  1090. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1091. order.
  1092. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1093. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1094. imaginary unit.
  1095. Different coefficients and gains can be provided for every channel, in such case
  1096. use '|' to separate coefficients or gains. Last provided coefficients will be
  1097. used for all remaining channels.
  1098. @subsection Examples
  1099. @itemize
  1100. @item
  1101. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  1102. @example
  1103. aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
  1104. @end example
  1105. @item
  1106. Same as above but in @code{zp} format:
  1107. @example
  1108. aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
  1109. @end example
  1110. @end itemize
  1111. @section alimiter
  1112. The limiter prevents an input signal from rising over a desired threshold.
  1113. This limiter uses lookahead technology to prevent your signal from distorting.
  1114. It means that there is a small delay after the signal is processed. Keep in mind
  1115. that the delay it produces is the attack time you set.
  1116. The filter accepts the following options:
  1117. @table @option
  1118. @item level_in
  1119. Set input gain. Default is 1.
  1120. @item level_out
  1121. Set output gain. Default is 1.
  1122. @item limit
  1123. Don't let signals above this level pass the limiter. Default is 1.
  1124. @item attack
  1125. The limiter will reach its attenuation level in this amount of time in
  1126. milliseconds. Default is 5 milliseconds.
  1127. @item release
  1128. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1129. Default is 50 milliseconds.
  1130. @item asc
  1131. When gain reduction is always needed ASC takes care of releasing to an
  1132. average reduction level rather than reaching a reduction of 0 in the release
  1133. time.
  1134. @item asc_level
  1135. Select how much the release time is affected by ASC, 0 means nearly no changes
  1136. in release time while 1 produces higher release times.
  1137. @item level
  1138. Auto level output signal. Default is enabled.
  1139. This normalizes audio back to 0dB if enabled.
  1140. @end table
  1141. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1142. with @ref{aresample} before applying this filter.
  1143. @section allpass
  1144. Apply a two-pole all-pass filter with central frequency (in Hz)
  1145. @var{frequency}, and filter-width @var{width}.
  1146. An all-pass filter changes the audio's frequency to phase relationship
  1147. without changing its frequency to amplitude relationship.
  1148. The filter accepts the following options:
  1149. @table @option
  1150. @item frequency, f
  1151. Set frequency in Hz.
  1152. @item width_type, t
  1153. Set method to specify band-width of filter.
  1154. @table @option
  1155. @item h
  1156. Hz
  1157. @item q
  1158. Q-Factor
  1159. @item o
  1160. octave
  1161. @item s
  1162. slope
  1163. @item k
  1164. kHz
  1165. @end table
  1166. @item width, w
  1167. Specify the band-width of a filter in width_type units.
  1168. @item channels, c
  1169. Specify which channels to filter, by default all available are filtered.
  1170. @end table
  1171. @subsection Commands
  1172. This filter supports the following commands:
  1173. @table @option
  1174. @item frequency, f
  1175. Change allpass frequency.
  1176. Syntax for the command is : "@var{frequency}"
  1177. @item width_type, t
  1178. Change allpass width_type.
  1179. Syntax for the command is : "@var{width_type}"
  1180. @item width, w
  1181. Change allpass width.
  1182. Syntax for the command is : "@var{width}"
  1183. @end table
  1184. @section aloop
  1185. Loop audio samples.
  1186. The filter accepts the following options:
  1187. @table @option
  1188. @item loop
  1189. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1190. Default is 0.
  1191. @item size
  1192. Set maximal number of samples. Default is 0.
  1193. @item start
  1194. Set first sample of loop. Default is 0.
  1195. @end table
  1196. @anchor{amerge}
  1197. @section amerge
  1198. Merge two or more audio streams into a single multi-channel stream.
  1199. The filter accepts the following options:
  1200. @table @option
  1201. @item inputs
  1202. Set the number of inputs. Default is 2.
  1203. @end table
  1204. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1205. the channel layout of the output will be set accordingly and the channels
  1206. will be reordered as necessary. If the channel layouts of the inputs are not
  1207. disjoint, the output will have all the channels of the first input then all
  1208. the channels of the second input, in that order, and the channel layout of
  1209. the output will be the default value corresponding to the total number of
  1210. channels.
  1211. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1212. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1213. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1214. first input, b1 is the first channel of the second input).
  1215. On the other hand, if both input are in stereo, the output channels will be
  1216. in the default order: a1, a2, b1, b2, and the channel layout will be
  1217. arbitrarily set to 4.0, which may or may not be the expected value.
  1218. All inputs must have the same sample rate, and format.
  1219. If inputs do not have the same duration, the output will stop with the
  1220. shortest.
  1221. @subsection Examples
  1222. @itemize
  1223. @item
  1224. Merge two mono files into a stereo stream:
  1225. @example
  1226. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1227. @end example
  1228. @item
  1229. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1230. @example
  1231. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  1232. @end example
  1233. @end itemize
  1234. @section amix
  1235. Mixes multiple audio inputs into a single output.
  1236. Note that this filter only supports float samples (the @var{amerge}
  1237. and @var{pan} audio filters support many formats). If the @var{amix}
  1238. input has integer samples then @ref{aresample} will be automatically
  1239. inserted to perform the conversion to float samples.
  1240. For example
  1241. @example
  1242. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1243. @end example
  1244. will mix 3 input audio streams to a single output with the same duration as the
  1245. first input and a dropout transition time of 3 seconds.
  1246. It accepts the following parameters:
  1247. @table @option
  1248. @item inputs
  1249. The number of inputs. If unspecified, it defaults to 2.
  1250. @item duration
  1251. How to determine the end-of-stream.
  1252. @table @option
  1253. @item longest
  1254. The duration of the longest input. (default)
  1255. @item shortest
  1256. The duration of the shortest input.
  1257. @item first
  1258. The duration of the first input.
  1259. @end table
  1260. @item dropout_transition
  1261. The transition time, in seconds, for volume renormalization when an input
  1262. stream ends. The default value is 2 seconds.
  1263. @item weights
  1264. Specify weight of each input audio stream as sequence.
  1265. Each weight is separated by space. By default all inputs have same weight.
  1266. @end table
  1267. @section amultiply
  1268. Multiply first audio stream with second audio stream and store result
  1269. in output audio stream. Multiplication is done by multiplying each
  1270. sample from first stream with sample at same position from second stream.
  1271. With this element-wise multiplication one can create amplitude fades and
  1272. amplitude modulations.
  1273. @section anequalizer
  1274. High-order parametric multiband equalizer for each channel.
  1275. It accepts the following parameters:
  1276. @table @option
  1277. @item params
  1278. This option string is in format:
  1279. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1280. Each equalizer band is separated by '|'.
  1281. @table @option
  1282. @item chn
  1283. Set channel number to which equalization will be applied.
  1284. If input doesn't have that channel the entry is ignored.
  1285. @item f
  1286. Set central frequency for band.
  1287. If input doesn't have that frequency the entry is ignored.
  1288. @item w
  1289. Set band width in hertz.
  1290. @item g
  1291. Set band gain in dB.
  1292. @item t
  1293. Set filter type for band, optional, can be:
  1294. @table @samp
  1295. @item 0
  1296. Butterworth, this is default.
  1297. @item 1
  1298. Chebyshev type 1.
  1299. @item 2
  1300. Chebyshev type 2.
  1301. @end table
  1302. @end table
  1303. @item curves
  1304. With this option activated frequency response of anequalizer is displayed
  1305. in video stream.
  1306. @item size
  1307. Set video stream size. Only useful if curves option is activated.
  1308. @item mgain
  1309. Set max gain that will be displayed. Only useful if curves option is activated.
  1310. Setting this to a reasonable value makes it possible to display gain which is derived from
  1311. neighbour bands which are too close to each other and thus produce higher gain
  1312. when both are activated.
  1313. @item fscale
  1314. Set frequency scale used to draw frequency response in video output.
  1315. Can be linear or logarithmic. Default is logarithmic.
  1316. @item colors
  1317. Set color for each channel curve which is going to be displayed in video stream.
  1318. This is list of color names separated by space or by '|'.
  1319. Unrecognised or missing colors will be replaced by white color.
  1320. @end table
  1321. @subsection Examples
  1322. @itemize
  1323. @item
  1324. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1325. for first 2 channels using Chebyshev type 1 filter:
  1326. @example
  1327. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1328. @end example
  1329. @end itemize
  1330. @subsection Commands
  1331. This filter supports the following commands:
  1332. @table @option
  1333. @item change
  1334. Alter existing filter parameters.
  1335. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1336. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1337. error is returned.
  1338. @var{freq} set new frequency parameter.
  1339. @var{width} set new width parameter in herz.
  1340. @var{gain} set new gain parameter in dB.
  1341. Full filter invocation with asendcmd may look like this:
  1342. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1343. @end table
  1344. @section anull
  1345. Pass the audio source unchanged to the output.
  1346. @section apad
  1347. Pad the end of an audio stream with silence.
  1348. This can be used together with @command{ffmpeg} @option{-shortest} to
  1349. extend audio streams to the same length as the video stream.
  1350. A description of the accepted options follows.
  1351. @table @option
  1352. @item packet_size
  1353. Set silence packet size. Default value is 4096.
  1354. @item pad_len
  1355. Set the number of samples of silence to add to the end. After the
  1356. value is reached, the stream is terminated. This option is mutually
  1357. exclusive with @option{whole_len}.
  1358. @item whole_len
  1359. Set the minimum total number of samples in the output audio stream. If
  1360. the value is longer than the input audio length, silence is added to
  1361. the end, until the value is reached. This option is mutually exclusive
  1362. with @option{pad_len}.
  1363. @end table
  1364. If neither the @option{pad_len} nor the @option{whole_len} option is
  1365. set, the filter will add silence to the end of the input stream
  1366. indefinitely.
  1367. @subsection Examples
  1368. @itemize
  1369. @item
  1370. Add 1024 samples of silence to the end of the input:
  1371. @example
  1372. apad=pad_len=1024
  1373. @end example
  1374. @item
  1375. Make sure the audio output will contain at least 10000 samples, pad
  1376. the input with silence if required:
  1377. @example
  1378. apad=whole_len=10000
  1379. @end example
  1380. @item
  1381. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1382. video stream will always result the shortest and will be converted
  1383. until the end in the output file when using the @option{shortest}
  1384. option:
  1385. @example
  1386. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1387. @end example
  1388. @end itemize
  1389. @section aphaser
  1390. Add a phasing effect to the input audio.
  1391. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1392. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1393. A description of the accepted parameters follows.
  1394. @table @option
  1395. @item in_gain
  1396. Set input gain. Default is 0.4.
  1397. @item out_gain
  1398. Set output gain. Default is 0.74
  1399. @item delay
  1400. Set delay in milliseconds. Default is 3.0.
  1401. @item decay
  1402. Set decay. Default is 0.4.
  1403. @item speed
  1404. Set modulation speed in Hz. Default is 0.5.
  1405. @item type
  1406. Set modulation type. Default is triangular.
  1407. It accepts the following values:
  1408. @table @samp
  1409. @item triangular, t
  1410. @item sinusoidal, s
  1411. @end table
  1412. @end table
  1413. @section apulsator
  1414. Audio pulsator is something between an autopanner and a tremolo.
  1415. But it can produce funny stereo effects as well. Pulsator changes the volume
  1416. of the left and right channel based on a LFO (low frequency oscillator) with
  1417. different waveforms and shifted phases.
  1418. This filter have the ability to define an offset between left and right
  1419. channel. An offset of 0 means that both LFO shapes match each other.
  1420. The left and right channel are altered equally - a conventional tremolo.
  1421. An offset of 50% means that the shape of the right channel is exactly shifted
  1422. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1423. an autopanner. At 1 both curves match again. Every setting in between moves the
  1424. phase shift gapless between all stages and produces some "bypassing" sounds with
  1425. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1426. the 0.5) the faster the signal passes from the left to the right speaker.
  1427. The filter accepts the following options:
  1428. @table @option
  1429. @item level_in
  1430. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1431. @item level_out
  1432. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1433. @item mode
  1434. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1435. sawup or sawdown. Default is sine.
  1436. @item amount
  1437. Set modulation. Define how much of original signal is affected by the LFO.
  1438. @item offset_l
  1439. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1440. @item offset_r
  1441. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1442. @item width
  1443. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1444. @item timing
  1445. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1446. @item bpm
  1447. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1448. is set to bpm.
  1449. @item ms
  1450. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1451. is set to ms.
  1452. @item hz
  1453. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1454. if timing is set to hz.
  1455. @end table
  1456. @anchor{aresample}
  1457. @section aresample
  1458. Resample the input audio to the specified parameters, using the
  1459. libswresample library. If none are specified then the filter will
  1460. automatically convert between its input and output.
  1461. This filter is also able to stretch/squeeze the audio data to make it match
  1462. the timestamps or to inject silence / cut out audio to make it match the
  1463. timestamps, do a combination of both or do neither.
  1464. The filter accepts the syntax
  1465. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1466. expresses a sample rate and @var{resampler_options} is a list of
  1467. @var{key}=@var{value} pairs, separated by ":". See the
  1468. @ref{Resampler Options,,"Resampler Options" section in the
  1469. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1470. for the complete list of supported options.
  1471. @subsection Examples
  1472. @itemize
  1473. @item
  1474. Resample the input audio to 44100Hz:
  1475. @example
  1476. aresample=44100
  1477. @end example
  1478. @item
  1479. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1480. samples per second compensation:
  1481. @example
  1482. aresample=async=1000
  1483. @end example
  1484. @end itemize
  1485. @section areverse
  1486. Reverse an audio clip.
  1487. Warning: This filter requires memory to buffer the entire clip, so trimming
  1488. is suggested.
  1489. @subsection Examples
  1490. @itemize
  1491. @item
  1492. Take the first 5 seconds of a clip, and reverse it.
  1493. @example
  1494. atrim=end=5,areverse
  1495. @end example
  1496. @end itemize
  1497. @section asetnsamples
  1498. Set the number of samples per each output audio frame.
  1499. The last output packet may contain a different number of samples, as
  1500. the filter will flush all the remaining samples when the input audio
  1501. signals its end.
  1502. The filter accepts the following options:
  1503. @table @option
  1504. @item nb_out_samples, n
  1505. Set the number of frames per each output audio frame. The number is
  1506. intended as the number of samples @emph{per each channel}.
  1507. Default value is 1024.
  1508. @item pad, p
  1509. If set to 1, the filter will pad the last audio frame with zeroes, so
  1510. that the last frame will contain the same number of samples as the
  1511. previous ones. Default value is 1.
  1512. @end table
  1513. For example, to set the number of per-frame samples to 1234 and
  1514. disable padding for the last frame, use:
  1515. @example
  1516. asetnsamples=n=1234:p=0
  1517. @end example
  1518. @section asetrate
  1519. Set the sample rate without altering the PCM data.
  1520. This will result in a change of speed and pitch.
  1521. The filter accepts the following options:
  1522. @table @option
  1523. @item sample_rate, r
  1524. Set the output sample rate. Default is 44100 Hz.
  1525. @end table
  1526. @section ashowinfo
  1527. Show a line containing various information for each input audio frame.
  1528. The input audio is not modified.
  1529. The shown line contains a sequence of key/value pairs of the form
  1530. @var{key}:@var{value}.
  1531. The following values are shown in the output:
  1532. @table @option
  1533. @item n
  1534. The (sequential) number of the input frame, starting from 0.
  1535. @item pts
  1536. The presentation timestamp of the input frame, in time base units; the time base
  1537. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1538. @item pts_time
  1539. The presentation timestamp of the input frame in seconds.
  1540. @item pos
  1541. position of the frame in the input stream, -1 if this information in
  1542. unavailable and/or meaningless (for example in case of synthetic audio)
  1543. @item fmt
  1544. The sample format.
  1545. @item chlayout
  1546. The channel layout.
  1547. @item rate
  1548. The sample rate for the audio frame.
  1549. @item nb_samples
  1550. The number of samples (per channel) in the frame.
  1551. @item checksum
  1552. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1553. audio, the data is treated as if all the planes were concatenated.
  1554. @item plane_checksums
  1555. A list of Adler-32 checksums for each data plane.
  1556. @end table
  1557. @anchor{astats}
  1558. @section astats
  1559. Display time domain statistical information about the audio channels.
  1560. Statistics are calculated and displayed for each audio channel and,
  1561. where applicable, an overall figure is also given.
  1562. It accepts the following option:
  1563. @table @option
  1564. @item length
  1565. Short window length in seconds, used for peak and trough RMS measurement.
  1566. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1567. @item metadata
  1568. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1569. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1570. disabled.
  1571. Available keys for each channel are:
  1572. DC_offset
  1573. Min_level
  1574. Max_level
  1575. Min_difference
  1576. Max_difference
  1577. Mean_difference
  1578. RMS_difference
  1579. Peak_level
  1580. RMS_peak
  1581. RMS_trough
  1582. Crest_factor
  1583. Flat_factor
  1584. Peak_count
  1585. Bit_depth
  1586. Dynamic_range
  1587. Zero_crossings
  1588. Zero_crossings_rate
  1589. and for Overall:
  1590. DC_offset
  1591. Min_level
  1592. Max_level
  1593. Min_difference
  1594. Max_difference
  1595. Mean_difference
  1596. RMS_difference
  1597. Peak_level
  1598. RMS_level
  1599. RMS_peak
  1600. RMS_trough
  1601. Flat_factor
  1602. Peak_count
  1603. Bit_depth
  1604. Number_of_samples
  1605. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1606. this @code{lavfi.astats.Overall.Peak_count}.
  1607. For description what each key means read below.
  1608. @item reset
  1609. Set number of frame after which stats are going to be recalculated.
  1610. Default is disabled.
  1611. @end table
  1612. A description of each shown parameter follows:
  1613. @table @option
  1614. @item DC offset
  1615. Mean amplitude displacement from zero.
  1616. @item Min level
  1617. Minimal sample level.
  1618. @item Max level
  1619. Maximal sample level.
  1620. @item Min difference
  1621. Minimal difference between two consecutive samples.
  1622. @item Max difference
  1623. Maximal difference between two consecutive samples.
  1624. @item Mean difference
  1625. Mean difference between two consecutive samples.
  1626. The average of each difference between two consecutive samples.
  1627. @item RMS difference
  1628. Root Mean Square difference between two consecutive samples.
  1629. @item Peak level dB
  1630. @item RMS level dB
  1631. Standard peak and RMS level measured in dBFS.
  1632. @item RMS peak dB
  1633. @item RMS trough dB
  1634. Peak and trough values for RMS level measured over a short window.
  1635. @item Crest factor
  1636. Standard ratio of peak to RMS level (note: not in dB).
  1637. @item Flat factor
  1638. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1639. (i.e. either @var{Min level} or @var{Max level}).
  1640. @item Peak count
  1641. Number of occasions (not the number of samples) that the signal attained either
  1642. @var{Min level} or @var{Max level}.
  1643. @item Bit depth
  1644. Overall bit depth of audio. Number of bits used for each sample.
  1645. @item Dynamic range
  1646. Measured dynamic range of audio in dB.
  1647. @item Zero crossings
  1648. Number of points where the waveform crosses the zero level axis.
  1649. @item Zero crossings rate
  1650. Rate of Zero crossings and number of audio samples.
  1651. @end table
  1652. @section atempo
  1653. Adjust audio tempo.
  1654. The filter accepts exactly one parameter, the audio tempo. If not
  1655. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1656. be in the [0.5, 100.0] range.
  1657. Note that tempo greater than 2 will skip some samples rather than
  1658. blend them in. If for any reason this is a concern it is always
  1659. possible to daisy-chain several instances of atempo to achieve the
  1660. desired product tempo.
  1661. @subsection Examples
  1662. @itemize
  1663. @item
  1664. Slow down audio to 80% tempo:
  1665. @example
  1666. atempo=0.8
  1667. @end example
  1668. @item
  1669. To speed up audio to 300% tempo:
  1670. @example
  1671. atempo=3
  1672. @end example
  1673. @item
  1674. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1675. @example
  1676. atempo=sqrt(3),atempo=sqrt(3)
  1677. @end example
  1678. @end itemize
  1679. @section atrim
  1680. Trim the input so that the output contains one continuous subpart of the input.
  1681. It accepts the following parameters:
  1682. @table @option
  1683. @item start
  1684. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1685. sample with the timestamp @var{start} will be the first sample in the output.
  1686. @item end
  1687. Specify time of the first audio sample that will be dropped, i.e. the
  1688. audio sample immediately preceding the one with the timestamp @var{end} will be
  1689. the last sample in the output.
  1690. @item start_pts
  1691. Same as @var{start}, except this option sets the start timestamp in samples
  1692. instead of seconds.
  1693. @item end_pts
  1694. Same as @var{end}, except this option sets the end timestamp in samples instead
  1695. of seconds.
  1696. @item duration
  1697. The maximum duration of the output in seconds.
  1698. @item start_sample
  1699. The number of the first sample that should be output.
  1700. @item end_sample
  1701. The number of the first sample that should be dropped.
  1702. @end table
  1703. @option{start}, @option{end}, and @option{duration} are expressed as time
  1704. duration specifications; see
  1705. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1706. Note that the first two sets of the start/end options and the @option{duration}
  1707. option look at the frame timestamp, while the _sample options simply count the
  1708. samples that pass through the filter. So start/end_pts and start/end_sample will
  1709. give different results when the timestamps are wrong, inexact or do not start at
  1710. zero. Also note that this filter does not modify the timestamps. If you wish
  1711. to have the output timestamps start at zero, insert the asetpts filter after the
  1712. atrim filter.
  1713. If multiple start or end options are set, this filter tries to be greedy and
  1714. keep all samples that match at least one of the specified constraints. To keep
  1715. only the part that matches all the constraints at once, chain multiple atrim
  1716. filters.
  1717. The defaults are such that all the input is kept. So it is possible to set e.g.
  1718. just the end values to keep everything before the specified time.
  1719. Examples:
  1720. @itemize
  1721. @item
  1722. Drop everything except the second minute of input:
  1723. @example
  1724. ffmpeg -i INPUT -af atrim=60:120
  1725. @end example
  1726. @item
  1727. Keep only the first 1000 samples:
  1728. @example
  1729. ffmpeg -i INPUT -af atrim=end_sample=1000
  1730. @end example
  1731. @end itemize
  1732. @section bandpass
  1733. Apply a two-pole Butterworth band-pass filter with central
  1734. frequency @var{frequency}, and (3dB-point) band-width width.
  1735. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1736. instead of the default: constant 0dB peak gain.
  1737. The filter roll off at 6dB per octave (20dB per decade).
  1738. The filter accepts the following options:
  1739. @table @option
  1740. @item frequency, f
  1741. Set the filter's central frequency. Default is @code{3000}.
  1742. @item csg
  1743. Constant skirt gain if set to 1. Defaults to 0.
  1744. @item width_type, t
  1745. Set method to specify band-width of filter.
  1746. @table @option
  1747. @item h
  1748. Hz
  1749. @item q
  1750. Q-Factor
  1751. @item o
  1752. octave
  1753. @item s
  1754. slope
  1755. @item k
  1756. kHz
  1757. @end table
  1758. @item width, w
  1759. Specify the band-width of a filter in width_type units.
  1760. @item channels, c
  1761. Specify which channels to filter, by default all available are filtered.
  1762. @end table
  1763. @subsection Commands
  1764. This filter supports the following commands:
  1765. @table @option
  1766. @item frequency, f
  1767. Change bandpass frequency.
  1768. Syntax for the command is : "@var{frequency}"
  1769. @item width_type, t
  1770. Change bandpass width_type.
  1771. Syntax for the command is : "@var{width_type}"
  1772. @item width, w
  1773. Change bandpass width.
  1774. Syntax for the command is : "@var{width}"
  1775. @end table
  1776. @section bandreject
  1777. Apply a two-pole Butterworth band-reject filter with central
  1778. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1779. The filter roll off at 6dB per octave (20dB per decade).
  1780. The filter accepts the following options:
  1781. @table @option
  1782. @item frequency, f
  1783. Set the filter's central frequency. Default is @code{3000}.
  1784. @item width_type, t
  1785. Set method to specify band-width of filter.
  1786. @table @option
  1787. @item h
  1788. Hz
  1789. @item q
  1790. Q-Factor
  1791. @item o
  1792. octave
  1793. @item s
  1794. slope
  1795. @item k
  1796. kHz
  1797. @end table
  1798. @item width, w
  1799. Specify the band-width of a filter in width_type units.
  1800. @item channels, c
  1801. Specify which channels to filter, by default all available are filtered.
  1802. @end table
  1803. @subsection Commands
  1804. This filter supports the following commands:
  1805. @table @option
  1806. @item frequency, f
  1807. Change bandreject frequency.
  1808. Syntax for the command is : "@var{frequency}"
  1809. @item width_type, t
  1810. Change bandreject width_type.
  1811. Syntax for the command is : "@var{width_type}"
  1812. @item width, w
  1813. Change bandreject width.
  1814. Syntax for the command is : "@var{width}"
  1815. @end table
  1816. @section bass, lowshelf
  1817. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1818. shelving filter with a response similar to that of a standard
  1819. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1820. The filter accepts the following options:
  1821. @table @option
  1822. @item gain, g
  1823. Give the gain at 0 Hz. Its useful range is about -20
  1824. (for a large cut) to +20 (for a large boost).
  1825. Beware of clipping when using a positive gain.
  1826. @item frequency, f
  1827. Set the filter's central frequency and so can be used
  1828. to extend or reduce the frequency range to be boosted or cut.
  1829. The default value is @code{100} Hz.
  1830. @item width_type, t
  1831. Set method to specify band-width of filter.
  1832. @table @option
  1833. @item h
  1834. Hz
  1835. @item q
  1836. Q-Factor
  1837. @item o
  1838. octave
  1839. @item s
  1840. slope
  1841. @item k
  1842. kHz
  1843. @end table
  1844. @item width, w
  1845. Determine how steep is the filter's shelf transition.
  1846. @item channels, c
  1847. Specify which channels to filter, by default all available are filtered.
  1848. @end table
  1849. @subsection Commands
  1850. This filter supports the following commands:
  1851. @table @option
  1852. @item frequency, f
  1853. Change bass frequency.
  1854. Syntax for the command is : "@var{frequency}"
  1855. @item width_type, t
  1856. Change bass width_type.
  1857. Syntax for the command is : "@var{width_type}"
  1858. @item width, w
  1859. Change bass width.
  1860. Syntax for the command is : "@var{width}"
  1861. @item gain, g
  1862. Change bass gain.
  1863. Syntax for the command is : "@var{gain}"
  1864. @end table
  1865. @section biquad
  1866. Apply a biquad IIR filter with the given coefficients.
  1867. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1868. are the numerator and denominator coefficients respectively.
  1869. and @var{channels}, @var{c} specify which channels to filter, by default all
  1870. available are filtered.
  1871. @subsection Commands
  1872. This filter supports the following commands:
  1873. @table @option
  1874. @item a0
  1875. @item a1
  1876. @item a2
  1877. @item b0
  1878. @item b1
  1879. @item b2
  1880. Change biquad parameter.
  1881. Syntax for the command is : "@var{value}"
  1882. @end table
  1883. @section bs2b
  1884. Bauer stereo to binaural transformation, which improves headphone listening of
  1885. stereo audio records.
  1886. To enable compilation of this filter you need to configure FFmpeg with
  1887. @code{--enable-libbs2b}.
  1888. It accepts the following parameters:
  1889. @table @option
  1890. @item profile
  1891. Pre-defined crossfeed level.
  1892. @table @option
  1893. @item default
  1894. Default level (fcut=700, feed=50).
  1895. @item cmoy
  1896. Chu Moy circuit (fcut=700, feed=60).
  1897. @item jmeier
  1898. Jan Meier circuit (fcut=650, feed=95).
  1899. @end table
  1900. @item fcut
  1901. Cut frequency (in Hz).
  1902. @item feed
  1903. Feed level (in Hz).
  1904. @end table
  1905. @section channelmap
  1906. Remap input channels to new locations.
  1907. It accepts the following parameters:
  1908. @table @option
  1909. @item map
  1910. Map channels from input to output. The argument is a '|'-separated list of
  1911. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1912. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1913. channel (e.g. FL for front left) or its index in the input channel layout.
  1914. @var{out_channel} is the name of the output channel or its index in the output
  1915. channel layout. If @var{out_channel} is not given then it is implicitly an
  1916. index, starting with zero and increasing by one for each mapping.
  1917. @item channel_layout
  1918. The channel layout of the output stream.
  1919. @end table
  1920. If no mapping is present, the filter will implicitly map input channels to
  1921. output channels, preserving indices.
  1922. @subsection Examples
  1923. @itemize
  1924. @item
  1925. For example, assuming a 5.1+downmix input MOV file,
  1926. @example
  1927. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1928. @end example
  1929. will create an output WAV file tagged as stereo from the downmix channels of
  1930. the input.
  1931. @item
  1932. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1933. @example
  1934. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1935. @end example
  1936. @end itemize
  1937. @section channelsplit
  1938. Split each channel from an input audio stream into a separate output stream.
  1939. It accepts the following parameters:
  1940. @table @option
  1941. @item channel_layout
  1942. The channel layout of the input stream. The default is "stereo".
  1943. @item channels
  1944. A channel layout describing the channels to be extracted as separate output streams
  1945. or "all" to extract each input channel as a separate stream. The default is "all".
  1946. Choosing channels not present in channel layout in the input will result in an error.
  1947. @end table
  1948. @subsection Examples
  1949. @itemize
  1950. @item
  1951. For example, assuming a stereo input MP3 file,
  1952. @example
  1953. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1954. @end example
  1955. will create an output Matroska file with two audio streams, one containing only
  1956. the left channel and the other the right channel.
  1957. @item
  1958. Split a 5.1 WAV file into per-channel files:
  1959. @example
  1960. ffmpeg -i in.wav -filter_complex
  1961. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1962. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1963. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1964. side_right.wav
  1965. @end example
  1966. @item
  1967. Extract only LFE from a 5.1 WAV file:
  1968. @example
  1969. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1970. -map '[LFE]' lfe.wav
  1971. @end example
  1972. @end itemize
  1973. @section chorus
  1974. Add a chorus effect to the audio.
  1975. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1976. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1977. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1978. The modulation depth defines the range the modulated delay is played before or after
  1979. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1980. sound tuned around the original one, like in a chorus where some vocals are slightly
  1981. off key.
  1982. It accepts the following parameters:
  1983. @table @option
  1984. @item in_gain
  1985. Set input gain. Default is 0.4.
  1986. @item out_gain
  1987. Set output gain. Default is 0.4.
  1988. @item delays
  1989. Set delays. A typical delay is around 40ms to 60ms.
  1990. @item decays
  1991. Set decays.
  1992. @item speeds
  1993. Set speeds.
  1994. @item depths
  1995. Set depths.
  1996. @end table
  1997. @subsection Examples
  1998. @itemize
  1999. @item
  2000. A single delay:
  2001. @example
  2002. chorus=0.7:0.9:55:0.4:0.25:2
  2003. @end example
  2004. @item
  2005. Two delays:
  2006. @example
  2007. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2008. @end example
  2009. @item
  2010. Fuller sounding chorus with three delays:
  2011. @example
  2012. 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
  2013. @end example
  2014. @end itemize
  2015. @section compand
  2016. Compress or expand the audio's dynamic range.
  2017. It accepts the following parameters:
  2018. @table @option
  2019. @item attacks
  2020. @item decays
  2021. A list of times in seconds for each channel over which the instantaneous level
  2022. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2023. increase of volume and @var{decays} refers to decrease of volume. For most
  2024. situations, the attack time (response to the audio getting louder) should be
  2025. shorter than the decay time, because the human ear is more sensitive to sudden
  2026. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2027. a typical value for decay is 0.8 seconds.
  2028. If specified number of attacks & decays is lower than number of channels, the last
  2029. set attack/decay will be used for all remaining channels.
  2030. @item points
  2031. A list of points for the transfer function, specified in dB relative to the
  2032. maximum possible signal amplitude. Each key points list must be defined using
  2033. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2034. @code{x0/y0 x1/y1 x2/y2 ....}
  2035. The input values must be in strictly increasing order but the transfer function
  2036. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2037. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2038. function are @code{-70/-70|-60/-20|1/0}.
  2039. @item soft-knee
  2040. Set the curve radius in dB for all joints. It defaults to 0.01.
  2041. @item gain
  2042. Set the additional gain in dB to be applied at all points on the transfer
  2043. function. This allows for easy adjustment of the overall gain.
  2044. It defaults to 0.
  2045. @item volume
  2046. Set an initial volume, in dB, to be assumed for each channel when filtering
  2047. starts. This permits the user to supply a nominal level initially, so that, for
  2048. example, a very large gain is not applied to initial signal levels before the
  2049. companding has begun to operate. A typical value for audio which is initially
  2050. quiet is -90 dB. It defaults to 0.
  2051. @item delay
  2052. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2053. delayed before being fed to the volume adjuster. Specifying a delay
  2054. approximately equal to the attack/decay times allows the filter to effectively
  2055. operate in predictive rather than reactive mode. It defaults to 0.
  2056. @end table
  2057. @subsection Examples
  2058. @itemize
  2059. @item
  2060. Make music with both quiet and loud passages suitable for listening to in a
  2061. noisy environment:
  2062. @example
  2063. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2064. @end example
  2065. Another example for audio with whisper and explosion parts:
  2066. @example
  2067. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2068. @end example
  2069. @item
  2070. A noise gate for when the noise is at a lower level than the signal:
  2071. @example
  2072. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2073. @end example
  2074. @item
  2075. Here is another noise gate, this time for when the noise is at a higher level
  2076. than the signal (making it, in some ways, similar to squelch):
  2077. @example
  2078. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2079. @end example
  2080. @item
  2081. 2:1 compression starting at -6dB:
  2082. @example
  2083. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2084. @end example
  2085. @item
  2086. 2:1 compression starting at -9dB:
  2087. @example
  2088. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2089. @end example
  2090. @item
  2091. 2:1 compression starting at -12dB:
  2092. @example
  2093. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2094. @end example
  2095. @item
  2096. 2:1 compression starting at -18dB:
  2097. @example
  2098. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2099. @end example
  2100. @item
  2101. 3:1 compression starting at -15dB:
  2102. @example
  2103. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2104. @end example
  2105. @item
  2106. Compressor/Gate:
  2107. @example
  2108. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2109. @end example
  2110. @item
  2111. Expander:
  2112. @example
  2113. 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
  2114. @end example
  2115. @item
  2116. Hard limiter at -6dB:
  2117. @example
  2118. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2119. @end example
  2120. @item
  2121. Hard limiter at -12dB:
  2122. @example
  2123. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2124. @end example
  2125. @item
  2126. Hard noise gate at -35 dB:
  2127. @example
  2128. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2129. @end example
  2130. @item
  2131. Soft limiter:
  2132. @example
  2133. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2134. @end example
  2135. @end itemize
  2136. @section compensationdelay
  2137. Compensation Delay Line is a metric based delay to compensate differing
  2138. positions of microphones or speakers.
  2139. For example, you have recorded guitar with two microphones placed in
  2140. different location. Because the front of sound wave has fixed speed in
  2141. normal conditions, the phasing of microphones can vary and depends on
  2142. their location and interposition. The best sound mix can be achieved when
  2143. these microphones are in phase (synchronized). Note that distance of
  2144. ~30 cm between microphones makes one microphone to capture signal in
  2145. antiphase to another microphone. That makes the final mix sounding moody.
  2146. This filter helps to solve phasing problems by adding different delays
  2147. to each microphone track and make them synchronized.
  2148. The best result can be reached when you take one track as base and
  2149. synchronize other tracks one by one with it.
  2150. Remember that synchronization/delay tolerance depends on sample rate, too.
  2151. Higher sample rates will give more tolerance.
  2152. It accepts the following parameters:
  2153. @table @option
  2154. @item mm
  2155. Set millimeters distance. This is compensation distance for fine tuning.
  2156. Default is 0.
  2157. @item cm
  2158. Set cm distance. This is compensation distance for tightening distance setup.
  2159. Default is 0.
  2160. @item m
  2161. Set meters distance. This is compensation distance for hard distance setup.
  2162. Default is 0.
  2163. @item dry
  2164. Set dry amount. Amount of unprocessed (dry) signal.
  2165. Default is 0.
  2166. @item wet
  2167. Set wet amount. Amount of processed (wet) signal.
  2168. Default is 1.
  2169. @item temp
  2170. Set temperature degree in Celsius. This is the temperature of the environment.
  2171. Default is 20.
  2172. @end table
  2173. @section crossfeed
  2174. Apply headphone crossfeed filter.
  2175. Crossfeed is the process of blending the left and right channels of stereo
  2176. audio recording.
  2177. It is mainly used to reduce extreme stereo separation of low frequencies.
  2178. The intent is to produce more speaker like sound to the listener.
  2179. The filter accepts the following options:
  2180. @table @option
  2181. @item strength
  2182. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2183. This sets gain of low shelf filter for side part of stereo image.
  2184. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2185. @item range
  2186. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2187. This sets cut off frequency of low shelf filter. Default is cut off near
  2188. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2189. @item level_in
  2190. Set input gain. Default is 0.9.
  2191. @item level_out
  2192. Set output gain. Default is 1.
  2193. @end table
  2194. @section crystalizer
  2195. Simple algorithm to expand audio dynamic range.
  2196. The filter accepts the following options:
  2197. @table @option
  2198. @item i
  2199. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2200. (unchanged sound) to 10.0 (maximum effect).
  2201. @item c
  2202. Enable clipping. By default is enabled.
  2203. @end table
  2204. @section dcshift
  2205. Apply a DC shift to the audio.
  2206. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2207. in the recording chain) from the audio. The effect of a DC offset is reduced
  2208. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2209. a signal has a DC offset.
  2210. @table @option
  2211. @item shift
  2212. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2213. the audio.
  2214. @item limitergain
  2215. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2216. used to prevent clipping.
  2217. @end table
  2218. @section drmeter
  2219. Measure audio dynamic range.
  2220. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2221. is found in transition material. And anything less that 8 have very poor dynamics
  2222. and is very compressed.
  2223. The filter accepts the following options:
  2224. @table @option
  2225. @item length
  2226. Set window length in seconds used to split audio into segments of equal length.
  2227. Default is 3 seconds.
  2228. @end table
  2229. @section dynaudnorm
  2230. Dynamic Audio Normalizer.
  2231. This filter applies a certain amount of gain to the input audio in order
  2232. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2233. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2234. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2235. This allows for applying extra gain to the "quiet" sections of the audio
  2236. while avoiding distortions or clipping the "loud" sections. In other words:
  2237. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2238. sections, in the sense that the volume of each section is brought to the
  2239. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2240. this goal *without* applying "dynamic range compressing". It will retain 100%
  2241. of the dynamic range *within* each section of the audio file.
  2242. @table @option
  2243. @item f
  2244. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2245. Default is 500 milliseconds.
  2246. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2247. referred to as frames. This is required, because a peak magnitude has no
  2248. meaning for just a single sample value. Instead, we need to determine the
  2249. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2250. normalizer would simply use the peak magnitude of the complete file, the
  2251. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2252. frame. The length of a frame is specified in milliseconds. By default, the
  2253. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2254. been found to give good results with most files.
  2255. Note that the exact frame length, in number of samples, will be determined
  2256. automatically, based on the sampling rate of the individual input audio file.
  2257. @item g
  2258. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2259. number. Default is 31.
  2260. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2261. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2262. is specified in frames, centered around the current frame. For the sake of
  2263. simplicity, this must be an odd number. Consequently, the default value of 31
  2264. takes into account the current frame, as well as the 15 preceding frames and
  2265. the 15 subsequent frames. Using a larger window results in a stronger
  2266. smoothing effect and thus in less gain variation, i.e. slower gain
  2267. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2268. effect and thus in more gain variation, i.e. faster gain adaptation.
  2269. In other words, the more you increase this value, the more the Dynamic Audio
  2270. Normalizer will behave like a "traditional" normalization filter. On the
  2271. contrary, the more you decrease this value, the more the Dynamic Audio
  2272. Normalizer will behave like a dynamic range compressor.
  2273. @item p
  2274. Set the target peak value. This specifies the highest permissible magnitude
  2275. level for the normalized audio input. This filter will try to approach the
  2276. target peak magnitude as closely as possible, but at the same time it also
  2277. makes sure that the normalized signal will never exceed the peak magnitude.
  2278. A frame's maximum local gain factor is imposed directly by the target peak
  2279. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2280. It is not recommended to go above this value.
  2281. @item m
  2282. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2283. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2284. factor for each input frame, i.e. the maximum gain factor that does not
  2285. result in clipping or distortion. The maximum gain factor is determined by
  2286. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2287. additionally bounds the frame's maximum gain factor by a predetermined
  2288. (global) maximum gain factor. This is done in order to avoid excessive gain
  2289. factors in "silent" or almost silent frames. By default, the maximum gain
  2290. factor is 10.0, For most inputs the default value should be sufficient and
  2291. it usually is not recommended to increase this value. Though, for input
  2292. with an extremely low overall volume level, it may be necessary to allow even
  2293. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2294. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2295. Instead, a "sigmoid" threshold function will be applied. This way, the
  2296. gain factors will smoothly approach the threshold value, but never exceed that
  2297. value.
  2298. @item r
  2299. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2300. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2301. This means that the maximum local gain factor for each frame is defined
  2302. (only) by the frame's highest magnitude sample. This way, the samples can
  2303. be amplified as much as possible without exceeding the maximum signal
  2304. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2305. Normalizer can also take into account the frame's root mean square,
  2306. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2307. determine the power of a time-varying signal. It is therefore considered
  2308. that the RMS is a better approximation of the "perceived loudness" than
  2309. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2310. frames to a constant RMS value, a uniform "perceived loudness" can be
  2311. established. If a target RMS value has been specified, a frame's local gain
  2312. factor is defined as the factor that would result in exactly that RMS value.
  2313. Note, however, that the maximum local gain factor is still restricted by the
  2314. frame's highest magnitude sample, in order to prevent clipping.
  2315. @item n
  2316. Enable channels coupling. By default is enabled.
  2317. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2318. amount. This means the same gain factor will be applied to all channels, i.e.
  2319. the maximum possible gain factor is determined by the "loudest" channel.
  2320. However, in some recordings, it may happen that the volume of the different
  2321. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2322. In this case, this option can be used to disable the channel coupling. This way,
  2323. the gain factor will be determined independently for each channel, depending
  2324. only on the individual channel's highest magnitude sample. This allows for
  2325. harmonizing the volume of the different channels.
  2326. @item c
  2327. Enable DC bias correction. By default is disabled.
  2328. An audio signal (in the time domain) is a sequence of sample values.
  2329. In the Dynamic Audio Normalizer these sample values are represented in the
  2330. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2331. audio signal, or "waveform", should be centered around the zero point.
  2332. That means if we calculate the mean value of all samples in a file, or in a
  2333. single frame, then the result should be 0.0 or at least very close to that
  2334. value. If, however, there is a significant deviation of the mean value from
  2335. 0.0, in either positive or negative direction, this is referred to as a
  2336. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2337. Audio Normalizer provides optional DC bias correction.
  2338. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2339. the mean value, or "DC correction" offset, of each input frame and subtract
  2340. that value from all of the frame's sample values which ensures those samples
  2341. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2342. boundaries, the DC correction offset values will be interpolated smoothly
  2343. between neighbouring frames.
  2344. @item b
  2345. Enable alternative boundary mode. By default is disabled.
  2346. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2347. around each frame. This includes the preceding frames as well as the
  2348. subsequent frames. However, for the "boundary" frames, located at the very
  2349. beginning and at the very end of the audio file, not all neighbouring
  2350. frames are available. In particular, for the first few frames in the audio
  2351. file, the preceding frames are not known. And, similarly, for the last few
  2352. frames in the audio file, the subsequent frames are not known. Thus, the
  2353. question arises which gain factors should be assumed for the missing frames
  2354. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2355. to deal with this situation. The default boundary mode assumes a gain factor
  2356. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2357. "fade out" at the beginning and at the end of the input, respectively.
  2358. @item s
  2359. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2360. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2361. compression. This means that signal peaks will not be pruned and thus the
  2362. full dynamic range will be retained within each local neighbourhood. However,
  2363. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2364. normalization algorithm with a more "traditional" compression.
  2365. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2366. (thresholding) function. If (and only if) the compression feature is enabled,
  2367. all input frames will be processed by a soft knee thresholding function prior
  2368. to the actual normalization process. Put simply, the thresholding function is
  2369. going to prune all samples whose magnitude exceeds a certain threshold value.
  2370. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2371. value. Instead, the threshold value will be adjusted for each individual
  2372. frame.
  2373. In general, smaller parameters result in stronger compression, and vice versa.
  2374. Values below 3.0 are not recommended, because audible distortion may appear.
  2375. @end table
  2376. @section earwax
  2377. Make audio easier to listen to on headphones.
  2378. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2379. so that when listened to on headphones the stereo image is moved from
  2380. inside your head (standard for headphones) to outside and in front of
  2381. the listener (standard for speakers).
  2382. Ported from SoX.
  2383. @section equalizer
  2384. Apply a two-pole peaking equalisation (EQ) filter. With this
  2385. filter, the signal-level at and around a selected frequency can
  2386. be increased or decreased, whilst (unlike bandpass and bandreject
  2387. filters) that at all other frequencies is unchanged.
  2388. In order to produce complex equalisation curves, this filter can
  2389. be given several times, each with a different central frequency.
  2390. The filter accepts the following options:
  2391. @table @option
  2392. @item frequency, f
  2393. Set the filter's central frequency in Hz.
  2394. @item width_type, t
  2395. Set method to specify band-width of filter.
  2396. @table @option
  2397. @item h
  2398. Hz
  2399. @item q
  2400. Q-Factor
  2401. @item o
  2402. octave
  2403. @item s
  2404. slope
  2405. @item k
  2406. kHz
  2407. @end table
  2408. @item width, w
  2409. Specify the band-width of a filter in width_type units.
  2410. @item gain, g
  2411. Set the required gain or attenuation in dB.
  2412. Beware of clipping when using a positive gain.
  2413. @item channels, c
  2414. Specify which channels to filter, by default all available are filtered.
  2415. @end table
  2416. @subsection Examples
  2417. @itemize
  2418. @item
  2419. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2420. @example
  2421. equalizer=f=1000:t=h:width=200:g=-10
  2422. @end example
  2423. @item
  2424. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2425. @example
  2426. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2427. @end example
  2428. @end itemize
  2429. @subsection Commands
  2430. This filter supports the following commands:
  2431. @table @option
  2432. @item frequency, f
  2433. Change equalizer frequency.
  2434. Syntax for the command is : "@var{frequency}"
  2435. @item width_type, t
  2436. Change equalizer width_type.
  2437. Syntax for the command is : "@var{width_type}"
  2438. @item width, w
  2439. Change equalizer width.
  2440. Syntax for the command is : "@var{width}"
  2441. @item gain, g
  2442. Change equalizer gain.
  2443. Syntax for the command is : "@var{gain}"
  2444. @end table
  2445. @section extrastereo
  2446. Linearly increases the difference between left and right channels which
  2447. adds some sort of "live" effect to playback.
  2448. The filter accepts the following options:
  2449. @table @option
  2450. @item m
  2451. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2452. (average of both channels), with 1.0 sound will be unchanged, with
  2453. -1.0 left and right channels will be swapped.
  2454. @item c
  2455. Enable clipping. By default is enabled.
  2456. @end table
  2457. @section firequalizer
  2458. Apply FIR Equalization using arbitrary frequency response.
  2459. The filter accepts the following option:
  2460. @table @option
  2461. @item gain
  2462. Set gain curve equation (in dB). The expression can contain variables:
  2463. @table @option
  2464. @item f
  2465. the evaluated frequency
  2466. @item sr
  2467. sample rate
  2468. @item ch
  2469. channel number, set to 0 when multichannels evaluation is disabled
  2470. @item chid
  2471. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2472. multichannels evaluation is disabled
  2473. @item chs
  2474. number of channels
  2475. @item chlayout
  2476. channel_layout, see libavutil/channel_layout.h
  2477. @end table
  2478. and functions:
  2479. @table @option
  2480. @item gain_interpolate(f)
  2481. interpolate gain on frequency f based on gain_entry
  2482. @item cubic_interpolate(f)
  2483. same as gain_interpolate, but smoother
  2484. @end table
  2485. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2486. @item gain_entry
  2487. Set gain entry for gain_interpolate function. The expression can
  2488. contain functions:
  2489. @table @option
  2490. @item entry(f, g)
  2491. store gain entry at frequency f with value g
  2492. @end table
  2493. This option is also available as command.
  2494. @item delay
  2495. Set filter delay in seconds. Higher value means more accurate.
  2496. Default is @code{0.01}.
  2497. @item accuracy
  2498. Set filter accuracy in Hz. Lower value means more accurate.
  2499. Default is @code{5}.
  2500. @item wfunc
  2501. Set window function. Acceptable values are:
  2502. @table @option
  2503. @item rectangular
  2504. rectangular window, useful when gain curve is already smooth
  2505. @item hann
  2506. hann window (default)
  2507. @item hamming
  2508. hamming window
  2509. @item blackman
  2510. blackman window
  2511. @item nuttall3
  2512. 3-terms continuous 1st derivative nuttall window
  2513. @item mnuttall3
  2514. minimum 3-terms discontinuous nuttall window
  2515. @item nuttall
  2516. 4-terms continuous 1st derivative nuttall window
  2517. @item bnuttall
  2518. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2519. @item bharris
  2520. blackman-harris window
  2521. @item tukey
  2522. tukey window
  2523. @end table
  2524. @item fixed
  2525. If enabled, use fixed number of audio samples. This improves speed when
  2526. filtering with large delay. Default is disabled.
  2527. @item multi
  2528. Enable multichannels evaluation on gain. Default is disabled.
  2529. @item zero_phase
  2530. Enable zero phase mode by subtracting timestamp to compensate delay.
  2531. Default is disabled.
  2532. @item scale
  2533. Set scale used by gain. Acceptable values are:
  2534. @table @option
  2535. @item linlin
  2536. linear frequency, linear gain
  2537. @item linlog
  2538. linear frequency, logarithmic (in dB) gain (default)
  2539. @item loglin
  2540. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2541. @item loglog
  2542. logarithmic frequency, logarithmic gain
  2543. @end table
  2544. @item dumpfile
  2545. Set file for dumping, suitable for gnuplot.
  2546. @item dumpscale
  2547. Set scale for dumpfile. Acceptable values are same with scale option.
  2548. Default is linlog.
  2549. @item fft2
  2550. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2551. Default is disabled.
  2552. @item min_phase
  2553. Enable minimum phase impulse response. Default is disabled.
  2554. @end table
  2555. @subsection Examples
  2556. @itemize
  2557. @item
  2558. lowpass at 1000 Hz:
  2559. @example
  2560. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2561. @end example
  2562. @item
  2563. lowpass at 1000 Hz with gain_entry:
  2564. @example
  2565. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2566. @end example
  2567. @item
  2568. custom equalization:
  2569. @example
  2570. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2571. @end example
  2572. @item
  2573. higher delay with zero phase to compensate delay:
  2574. @example
  2575. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2576. @end example
  2577. @item
  2578. lowpass on left channel, highpass on right channel:
  2579. @example
  2580. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2581. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2582. @end example
  2583. @end itemize
  2584. @section flanger
  2585. Apply a flanging effect to the audio.
  2586. The filter accepts the following options:
  2587. @table @option
  2588. @item delay
  2589. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2590. @item depth
  2591. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2592. @item regen
  2593. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2594. Default value is 0.
  2595. @item width
  2596. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2597. Default value is 71.
  2598. @item speed
  2599. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2600. @item shape
  2601. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2602. Default value is @var{sinusoidal}.
  2603. @item phase
  2604. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2605. Default value is 25.
  2606. @item interp
  2607. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2608. Default is @var{linear}.
  2609. @end table
  2610. @section haas
  2611. Apply Haas effect to audio.
  2612. Note that this makes most sense to apply on mono signals.
  2613. With this filter applied to mono signals it give some directionality and
  2614. stretches its stereo image.
  2615. The filter accepts the following options:
  2616. @table @option
  2617. @item level_in
  2618. Set input level. By default is @var{1}, or 0dB
  2619. @item level_out
  2620. Set output level. By default is @var{1}, or 0dB.
  2621. @item side_gain
  2622. Set gain applied to side part of signal. By default is @var{1}.
  2623. @item middle_source
  2624. Set kind of middle source. Can be one of the following:
  2625. @table @samp
  2626. @item left
  2627. Pick left channel.
  2628. @item right
  2629. Pick right channel.
  2630. @item mid
  2631. Pick middle part signal of stereo image.
  2632. @item side
  2633. Pick side part signal of stereo image.
  2634. @end table
  2635. @item middle_phase
  2636. Change middle phase. By default is disabled.
  2637. @item left_delay
  2638. Set left channel delay. By default is @var{2.05} milliseconds.
  2639. @item left_balance
  2640. Set left channel balance. By default is @var{-1}.
  2641. @item left_gain
  2642. Set left channel gain. By default is @var{1}.
  2643. @item left_phase
  2644. Change left phase. By default is disabled.
  2645. @item right_delay
  2646. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2647. @item right_balance
  2648. Set right channel balance. By default is @var{1}.
  2649. @item right_gain
  2650. Set right channel gain. By default is @var{1}.
  2651. @item right_phase
  2652. Change right phase. By default is enabled.
  2653. @end table
  2654. @section hdcd
  2655. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2656. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2657. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2658. of HDCD, and detects the Transient Filter flag.
  2659. @example
  2660. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2661. @end example
  2662. When using the filter with wav, note the default encoding for wav is 16-bit,
  2663. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2664. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2665. @example
  2666. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2667. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2668. @end example
  2669. The filter accepts the following options:
  2670. @table @option
  2671. @item disable_autoconvert
  2672. Disable any automatic format conversion or resampling in the filter graph.
  2673. @item process_stereo
  2674. Process the stereo channels together. If target_gain does not match between
  2675. channels, consider it invalid and use the last valid target_gain.
  2676. @item cdt_ms
  2677. Set the code detect timer period in ms.
  2678. @item force_pe
  2679. Always extend peaks above -3dBFS even if PE isn't signaled.
  2680. @item analyze_mode
  2681. Replace audio with a solid tone and adjust the amplitude to signal some
  2682. specific aspect of the decoding process. The output file can be loaded in
  2683. an audio editor alongside the original to aid analysis.
  2684. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2685. Modes are:
  2686. @table @samp
  2687. @item 0, off
  2688. Disabled
  2689. @item 1, lle
  2690. Gain adjustment level at each sample
  2691. @item 2, pe
  2692. Samples where peak extend occurs
  2693. @item 3, cdt
  2694. Samples where the code detect timer is active
  2695. @item 4, tgm
  2696. Samples where the target gain does not match between channels
  2697. @end table
  2698. @end table
  2699. @section headphone
  2700. Apply head-related transfer functions (HRTFs) to create virtual
  2701. loudspeakers around the user for binaural listening via headphones.
  2702. The HRIRs are provided via additional streams, for each channel
  2703. one stereo input stream is needed.
  2704. The filter accepts the following options:
  2705. @table @option
  2706. @item map
  2707. Set mapping of input streams for convolution.
  2708. The argument is a '|'-separated list of channel names in order as they
  2709. are given as additional stream inputs for filter.
  2710. This also specify number of input streams. Number of input streams
  2711. must be not less than number of channels in first stream plus one.
  2712. @item gain
  2713. Set gain applied to audio. Value is in dB. Default is 0.
  2714. @item type
  2715. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2716. processing audio in time domain which is slow.
  2717. @var{freq} is processing audio in frequency domain which is fast.
  2718. Default is @var{freq}.
  2719. @item lfe
  2720. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2721. @item size
  2722. Set size of frame in number of samples which will be processed at once.
  2723. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2724. @item hrir
  2725. Set format of hrir stream.
  2726. Default value is @var{stereo}. Alternative value is @var{multich}.
  2727. If value is set to @var{stereo}, number of additional streams should
  2728. be greater or equal to number of input channels in first input stream.
  2729. Also each additional stream should have stereo number of channels.
  2730. If value is set to @var{multich}, number of additional streams should
  2731. be exactly one. Also number of input channels of additional stream
  2732. should be equal or greater than twice number of channels of first input
  2733. stream.
  2734. @end table
  2735. @subsection Examples
  2736. @itemize
  2737. @item
  2738. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2739. each amovie filter use stereo file with IR coefficients as input.
  2740. The files give coefficients for each position of virtual loudspeaker:
  2741. @example
  2742. ffmpeg -i input.wav -lavfi-complex "amovie=azi_270_ele_0_DFC.wav[sr],amovie=azi_90_ele_0_DFC.wav[sl],amovie=azi_225_ele_0_DFC.wav[br],amovie=azi_135_ele_0_DFC.wav[bl],amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe],amovie=azi_35_ele_0_DFC.wav[fl],amovie=azi_325_ele_0_DFC.wav[fr],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2743. output.wav
  2744. @end example
  2745. @item
  2746. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2747. but now in @var{multich} @var{hrir} format.
  2748. @example
  2749. ffmpeg -i input.wav -lavfi-complex "amovie=minp.wav[hrirs],[a:0][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  2750. output.wav
  2751. @end example
  2752. @end itemize
  2753. @section highpass
  2754. Apply a high-pass filter with 3dB point frequency.
  2755. The filter can be either single-pole, or double-pole (the default).
  2756. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2757. The filter accepts the following options:
  2758. @table @option
  2759. @item frequency, f
  2760. Set frequency in Hz. Default is 3000.
  2761. @item poles, p
  2762. Set number of poles. Default is 2.
  2763. @item width_type, t
  2764. Set method to specify band-width of filter.
  2765. @table @option
  2766. @item h
  2767. Hz
  2768. @item q
  2769. Q-Factor
  2770. @item o
  2771. octave
  2772. @item s
  2773. slope
  2774. @item k
  2775. kHz
  2776. @end table
  2777. @item width, w
  2778. Specify the band-width of a filter in width_type units.
  2779. Applies only to double-pole filter.
  2780. The default is 0.707q and gives a Butterworth response.
  2781. @item channels, c
  2782. Specify which channels to filter, by default all available are filtered.
  2783. @end table
  2784. @subsection Commands
  2785. This filter supports the following commands:
  2786. @table @option
  2787. @item frequency, f
  2788. Change highpass frequency.
  2789. Syntax for the command is : "@var{frequency}"
  2790. @item width_type, t
  2791. Change highpass width_type.
  2792. Syntax for the command is : "@var{width_type}"
  2793. @item width, w
  2794. Change highpass width.
  2795. Syntax for the command is : "@var{width}"
  2796. @end table
  2797. @section join
  2798. Join multiple input streams into one multi-channel stream.
  2799. It accepts the following parameters:
  2800. @table @option
  2801. @item inputs
  2802. The number of input streams. It defaults to 2.
  2803. @item channel_layout
  2804. The desired output channel layout. It defaults to stereo.
  2805. @item map
  2806. Map channels from inputs to output. The argument is a '|'-separated list of
  2807. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2808. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2809. can be either the name of the input channel (e.g. FL for front left) or its
  2810. index in the specified input stream. @var{out_channel} is the name of the output
  2811. channel.
  2812. @end table
  2813. The filter will attempt to guess the mappings when they are not specified
  2814. explicitly. It does so by first trying to find an unused matching input channel
  2815. and if that fails it picks the first unused input channel.
  2816. Join 3 inputs (with properly set channel layouts):
  2817. @example
  2818. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2819. @end example
  2820. Build a 5.1 output from 6 single-channel streams:
  2821. @example
  2822. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2823. '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'
  2824. out
  2825. @end example
  2826. @section ladspa
  2827. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2828. To enable compilation of this filter you need to configure FFmpeg with
  2829. @code{--enable-ladspa}.
  2830. @table @option
  2831. @item file, f
  2832. Specifies the name of LADSPA plugin library to load. If the environment
  2833. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2834. each one of the directories specified by the colon separated list in
  2835. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2836. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2837. @file{/usr/lib/ladspa/}.
  2838. @item plugin, p
  2839. Specifies the plugin within the library. Some libraries contain only
  2840. one plugin, but others contain many of them. If this is not set filter
  2841. will list all available plugins within the specified library.
  2842. @item controls, c
  2843. Set the '|' separated list of controls which are zero or more floating point
  2844. values that determine the behavior of the loaded plugin (for example delay,
  2845. threshold or gain).
  2846. Controls need to be defined using the following syntax:
  2847. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2848. @var{valuei} is the value set on the @var{i}-th control.
  2849. Alternatively they can be also defined using the following syntax:
  2850. @var{value0}|@var{value1}|@var{value2}|..., where
  2851. @var{valuei} is the value set on the @var{i}-th control.
  2852. If @option{controls} is set to @code{help}, all available controls and
  2853. their valid ranges are printed.
  2854. @item sample_rate, s
  2855. Specify the sample rate, default to 44100. Only used if plugin have
  2856. zero inputs.
  2857. @item nb_samples, n
  2858. Set the number of samples per channel per each output frame, default
  2859. is 1024. Only used if plugin have zero inputs.
  2860. @item duration, d
  2861. Set the minimum duration of the sourced audio. See
  2862. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2863. for the accepted syntax.
  2864. Note that the resulting duration may be greater than the specified duration,
  2865. as the generated audio is always cut at the end of a complete frame.
  2866. If not specified, or the expressed duration is negative, the audio is
  2867. supposed to be generated forever.
  2868. Only used if plugin have zero inputs.
  2869. @end table
  2870. @subsection Examples
  2871. @itemize
  2872. @item
  2873. List all available plugins within amp (LADSPA example plugin) library:
  2874. @example
  2875. ladspa=file=amp
  2876. @end example
  2877. @item
  2878. List all available controls and their valid ranges for @code{vcf_notch}
  2879. plugin from @code{VCF} library:
  2880. @example
  2881. ladspa=f=vcf:p=vcf_notch:c=help
  2882. @end example
  2883. @item
  2884. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2885. plugin library:
  2886. @example
  2887. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2888. @end example
  2889. @item
  2890. Add reverberation to the audio using TAP-plugins
  2891. (Tom's Audio Processing plugins):
  2892. @example
  2893. ladspa=file=tap_reverb:tap_reverb
  2894. @end example
  2895. @item
  2896. Generate white noise, with 0.2 amplitude:
  2897. @example
  2898. ladspa=file=cmt:noise_source_white:c=c0=.2
  2899. @end example
  2900. @item
  2901. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2902. @code{C* Audio Plugin Suite} (CAPS) library:
  2903. @example
  2904. ladspa=file=caps:Click:c=c1=20'
  2905. @end example
  2906. @item
  2907. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2908. @example
  2909. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2910. @end example
  2911. @item
  2912. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2913. @code{SWH Plugins} collection:
  2914. @example
  2915. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2916. @end example
  2917. @item
  2918. Attenuate low frequencies using Multiband EQ from Steve Harris
  2919. @code{SWH Plugins} collection:
  2920. @example
  2921. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2922. @end example
  2923. @item
  2924. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2925. (CAPS) library:
  2926. @example
  2927. ladspa=caps:Narrower
  2928. @end example
  2929. @item
  2930. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2931. @example
  2932. ladspa=caps:White:.2
  2933. @end example
  2934. @item
  2935. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2936. @example
  2937. ladspa=caps:Fractal:c=c1=1
  2938. @end example
  2939. @item
  2940. Dynamic volume normalization using @code{VLevel} plugin:
  2941. @example
  2942. ladspa=vlevel-ladspa:vlevel_mono
  2943. @end example
  2944. @end itemize
  2945. @subsection Commands
  2946. This filter supports the following commands:
  2947. @table @option
  2948. @item cN
  2949. Modify the @var{N}-th control value.
  2950. If the specified value is not valid, it is ignored and prior one is kept.
  2951. @end table
  2952. @section loudnorm
  2953. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2954. Support for both single pass (livestreams, files) and double pass (files) modes.
  2955. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2956. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2957. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2958. The filter accepts the following options:
  2959. @table @option
  2960. @item I, i
  2961. Set integrated loudness target.
  2962. Range is -70.0 - -5.0. Default value is -24.0.
  2963. @item LRA, lra
  2964. Set loudness range target.
  2965. Range is 1.0 - 20.0. Default value is 7.0.
  2966. @item TP, tp
  2967. Set maximum true peak.
  2968. Range is -9.0 - +0.0. Default value is -2.0.
  2969. @item measured_I, measured_i
  2970. Measured IL of input file.
  2971. Range is -99.0 - +0.0.
  2972. @item measured_LRA, measured_lra
  2973. Measured LRA of input file.
  2974. Range is 0.0 - 99.0.
  2975. @item measured_TP, measured_tp
  2976. Measured true peak of input file.
  2977. Range is -99.0 - +99.0.
  2978. @item measured_thresh
  2979. Measured threshold of input file.
  2980. Range is -99.0 - +0.0.
  2981. @item offset
  2982. Set offset gain. Gain is applied before the true-peak limiter.
  2983. Range is -99.0 - +99.0. Default is +0.0.
  2984. @item linear
  2985. Normalize linearly if possible.
  2986. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2987. to be specified in order to use this mode.
  2988. Options are true or false. Default is true.
  2989. @item dual_mono
  2990. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2991. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2992. If set to @code{true}, this option will compensate for this effect.
  2993. Multi-channel input files are not affected by this option.
  2994. Options are true or false. Default is false.
  2995. @item print_format
  2996. Set print format for stats. Options are summary, json, or none.
  2997. Default value is none.
  2998. @end table
  2999. @section lowpass
  3000. Apply a low-pass filter with 3dB point frequency.
  3001. The filter can be either single-pole or double-pole (the default).
  3002. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3003. The filter accepts the following options:
  3004. @table @option
  3005. @item frequency, f
  3006. Set frequency in Hz. Default is 500.
  3007. @item poles, p
  3008. Set number of poles. Default is 2.
  3009. @item width_type, t
  3010. Set method to specify band-width of filter.
  3011. @table @option
  3012. @item h
  3013. Hz
  3014. @item q
  3015. Q-Factor
  3016. @item o
  3017. octave
  3018. @item s
  3019. slope
  3020. @item k
  3021. kHz
  3022. @end table
  3023. @item width, w
  3024. Specify the band-width of a filter in width_type units.
  3025. Applies only to double-pole filter.
  3026. The default is 0.707q and gives a Butterworth response.
  3027. @item channels, c
  3028. Specify which channels to filter, by default all available are filtered.
  3029. @end table
  3030. @subsection Examples
  3031. @itemize
  3032. @item
  3033. Lowpass only LFE channel, it LFE is not present it does nothing:
  3034. @example
  3035. lowpass=c=LFE
  3036. @end example
  3037. @end itemize
  3038. @subsection Commands
  3039. This filter supports the following commands:
  3040. @table @option
  3041. @item frequency, f
  3042. Change lowpass frequency.
  3043. Syntax for the command is : "@var{frequency}"
  3044. @item width_type, t
  3045. Change lowpass width_type.
  3046. Syntax for the command is : "@var{width_type}"
  3047. @item width, w
  3048. Change lowpass width.
  3049. Syntax for the command is : "@var{width}"
  3050. @end table
  3051. @section lv2
  3052. Load a LV2 (LADSPA Version 2) plugin.
  3053. To enable compilation of this filter you need to configure FFmpeg with
  3054. @code{--enable-lv2}.
  3055. @table @option
  3056. @item plugin, p
  3057. Specifies the plugin URI. You may need to escape ':'.
  3058. @item controls, c
  3059. Set the '|' separated list of controls which are zero or more floating point
  3060. values that determine the behavior of the loaded plugin (for example delay,
  3061. threshold or gain).
  3062. If @option{controls} is set to @code{help}, all available controls and
  3063. their valid ranges are printed.
  3064. @item sample_rate, s
  3065. Specify the sample rate, default to 44100. Only used if plugin have
  3066. zero inputs.
  3067. @item nb_samples, n
  3068. Set the number of samples per channel per each output frame, default
  3069. is 1024. Only used if plugin have zero inputs.
  3070. @item duration, d
  3071. Set the minimum duration of the sourced audio. See
  3072. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3073. for the accepted syntax.
  3074. Note that the resulting duration may be greater than the specified duration,
  3075. as the generated audio is always cut at the end of a complete frame.
  3076. If not specified, or the expressed duration is negative, the audio is
  3077. supposed to be generated forever.
  3078. Only used if plugin have zero inputs.
  3079. @end table
  3080. @subsection Examples
  3081. @itemize
  3082. @item
  3083. Apply bass enhancer plugin from Calf:
  3084. @example
  3085. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3086. @end example
  3087. @item
  3088. Apply vinyl plugin from Calf:
  3089. @example
  3090. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3091. @end example
  3092. @item
  3093. Apply bit crusher plugin from ArtyFX:
  3094. @example
  3095. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3096. @end example
  3097. @end itemize
  3098. @section mcompand
  3099. Multiband Compress or expand the audio's dynamic range.
  3100. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3101. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3102. response when absent compander action.
  3103. It accepts the following parameters:
  3104. @table @option
  3105. @item args
  3106. This option syntax is:
  3107. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3108. For explanation of each item refer to compand filter documentation.
  3109. @end table
  3110. @anchor{pan}
  3111. @section pan
  3112. Mix channels with specific gain levels. The filter accepts the output
  3113. channel layout followed by a set of channels definitions.
  3114. This filter is also designed to efficiently remap the channels of an audio
  3115. stream.
  3116. The filter accepts parameters of the form:
  3117. "@var{l}|@var{outdef}|@var{outdef}|..."
  3118. @table @option
  3119. @item l
  3120. output channel layout or number of channels
  3121. @item outdef
  3122. output channel specification, of the form:
  3123. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3124. @item out_name
  3125. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3126. number (c0, c1, etc.)
  3127. @item gain
  3128. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3129. @item in_name
  3130. input channel to use, see out_name for details; it is not possible to mix
  3131. named and numbered input channels
  3132. @end table
  3133. If the `=' in a channel specification is replaced by `<', then the gains for
  3134. that specification will be renormalized so that the total is 1, thus
  3135. avoiding clipping noise.
  3136. @subsection Mixing examples
  3137. For example, if you want to down-mix from stereo to mono, but with a bigger
  3138. factor for the left channel:
  3139. @example
  3140. pan=1c|c0=0.9*c0+0.1*c1
  3141. @end example
  3142. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3143. 7-channels surround:
  3144. @example
  3145. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3146. @end example
  3147. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3148. that should be preferred (see "-ac" option) unless you have very specific
  3149. needs.
  3150. @subsection Remapping examples
  3151. The channel remapping will be effective if, and only if:
  3152. @itemize
  3153. @item gain coefficients are zeroes or ones,
  3154. @item only one input per channel output,
  3155. @end itemize
  3156. If all these conditions are satisfied, the filter will notify the user ("Pure
  3157. channel mapping detected"), and use an optimized and lossless method to do the
  3158. remapping.
  3159. For example, if you have a 5.1 source and want a stereo audio stream by
  3160. dropping the extra channels:
  3161. @example
  3162. pan="stereo| c0=FL | c1=FR"
  3163. @end example
  3164. Given the same source, you can also switch front left and front right channels
  3165. and keep the input channel layout:
  3166. @example
  3167. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3168. @end example
  3169. If the input is a stereo audio stream, you can mute the front left channel (and
  3170. still keep the stereo channel layout) with:
  3171. @example
  3172. pan="stereo|c1=c1"
  3173. @end example
  3174. Still with a stereo audio stream input, you can copy the right channel in both
  3175. front left and right:
  3176. @example
  3177. pan="stereo| c0=FR | c1=FR"
  3178. @end example
  3179. @section replaygain
  3180. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3181. outputs it unchanged.
  3182. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3183. @section resample
  3184. Convert the audio sample format, sample rate and channel layout. It is
  3185. not meant to be used directly.
  3186. @section rubberband
  3187. Apply time-stretching and pitch-shifting with librubberband.
  3188. To enable compilation of this filter, you need to configure FFmpeg with
  3189. @code{--enable-librubberband}.
  3190. The filter accepts the following options:
  3191. @table @option
  3192. @item tempo
  3193. Set tempo scale factor.
  3194. @item pitch
  3195. Set pitch scale factor.
  3196. @item transients
  3197. Set transients detector.
  3198. Possible values are:
  3199. @table @var
  3200. @item crisp
  3201. @item mixed
  3202. @item smooth
  3203. @end table
  3204. @item detector
  3205. Set detector.
  3206. Possible values are:
  3207. @table @var
  3208. @item compound
  3209. @item percussive
  3210. @item soft
  3211. @end table
  3212. @item phase
  3213. Set phase.
  3214. Possible values are:
  3215. @table @var
  3216. @item laminar
  3217. @item independent
  3218. @end table
  3219. @item window
  3220. Set processing window size.
  3221. Possible values are:
  3222. @table @var
  3223. @item standard
  3224. @item short
  3225. @item long
  3226. @end table
  3227. @item smoothing
  3228. Set smoothing.
  3229. Possible values are:
  3230. @table @var
  3231. @item off
  3232. @item on
  3233. @end table
  3234. @item formant
  3235. Enable formant preservation when shift pitching.
  3236. Possible values are:
  3237. @table @var
  3238. @item shifted
  3239. @item preserved
  3240. @end table
  3241. @item pitchq
  3242. Set pitch quality.
  3243. Possible values are:
  3244. @table @var
  3245. @item quality
  3246. @item speed
  3247. @item consistency
  3248. @end table
  3249. @item channels
  3250. Set channels.
  3251. Possible values are:
  3252. @table @var
  3253. @item apart
  3254. @item together
  3255. @end table
  3256. @end table
  3257. @section sidechaincompress
  3258. This filter acts like normal compressor but has the ability to compress
  3259. detected signal using second input signal.
  3260. It needs two input streams and returns one output stream.
  3261. First input stream will be processed depending on second stream signal.
  3262. The filtered signal then can be filtered with other filters in later stages of
  3263. processing. See @ref{pan} and @ref{amerge} filter.
  3264. The filter accepts the following options:
  3265. @table @option
  3266. @item level_in
  3267. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3268. @item threshold
  3269. If a signal of second stream raises above this level it will affect the gain
  3270. reduction of first stream.
  3271. By default is 0.125. Range is between 0.00097563 and 1.
  3272. @item ratio
  3273. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3274. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3275. Default is 2. Range is between 1 and 20.
  3276. @item attack
  3277. Amount of milliseconds the signal has to rise above the threshold before gain
  3278. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3279. @item release
  3280. Amount of milliseconds the signal has to fall below the threshold before
  3281. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3282. @item makeup
  3283. Set the amount by how much signal will be amplified after processing.
  3284. Default is 1. Range is from 1 to 64.
  3285. @item knee
  3286. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3287. Default is 2.82843. Range is between 1 and 8.
  3288. @item link
  3289. Choose if the @code{average} level between all channels of side-chain stream
  3290. or the louder(@code{maximum}) channel of side-chain stream affects the
  3291. reduction. Default is @code{average}.
  3292. @item detection
  3293. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3294. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3295. @item level_sc
  3296. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3297. @item mix
  3298. How much to use compressed signal in output. Default is 1.
  3299. Range is between 0 and 1.
  3300. @end table
  3301. @subsection Examples
  3302. @itemize
  3303. @item
  3304. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3305. depending on the signal of 2nd input and later compressed signal to be
  3306. merged with 2nd input:
  3307. @example
  3308. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3309. @end example
  3310. @end itemize
  3311. @section sidechaingate
  3312. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3313. filter the detected signal before sending it to the gain reduction stage.
  3314. Normally a gate uses the full range signal to detect a level above the
  3315. threshold.
  3316. For example: If you cut all lower frequencies from your sidechain signal
  3317. the gate will decrease the volume of your track only if not enough highs
  3318. appear. With this technique you are able to reduce the resonation of a
  3319. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3320. guitar.
  3321. It needs two input streams and returns one output stream.
  3322. First input stream will be processed depending on second stream signal.
  3323. The filter accepts the following options:
  3324. @table @option
  3325. @item level_in
  3326. Set input level before filtering.
  3327. Default is 1. Allowed range is from 0.015625 to 64.
  3328. @item range
  3329. Set the level of gain reduction when the signal is below the threshold.
  3330. Default is 0.06125. Allowed range is from 0 to 1.
  3331. @item threshold
  3332. If a signal rises above this level the gain reduction is released.
  3333. Default is 0.125. Allowed range is from 0 to 1.
  3334. @item ratio
  3335. Set a ratio about which the signal is reduced.
  3336. Default is 2. Allowed range is from 1 to 9000.
  3337. @item attack
  3338. Amount of milliseconds the signal has to rise above the threshold before gain
  3339. reduction stops.
  3340. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3341. @item release
  3342. Amount of milliseconds the signal has to fall below the threshold before the
  3343. reduction is increased again. Default is 250 milliseconds.
  3344. Allowed range is from 0.01 to 9000.
  3345. @item makeup
  3346. Set amount of amplification of signal after processing.
  3347. Default is 1. Allowed range is from 1 to 64.
  3348. @item knee
  3349. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3350. Default is 2.828427125. Allowed range is from 1 to 8.
  3351. @item detection
  3352. Choose if exact signal should be taken for detection or an RMS like one.
  3353. Default is rms. Can be peak or rms.
  3354. @item link
  3355. Choose if the average level between all channels or the louder channel affects
  3356. the reduction.
  3357. Default is average. Can be average or maximum.
  3358. @item level_sc
  3359. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3360. @end table
  3361. @section silencedetect
  3362. Detect silence in an audio stream.
  3363. This filter logs a message when it detects that the input audio volume is less
  3364. or equal to a noise tolerance value for a duration greater or equal to the
  3365. minimum detected noise duration.
  3366. The printed times and duration are expressed in seconds.
  3367. The filter accepts the following options:
  3368. @table @option
  3369. @item noise, n
  3370. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3371. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3372. @item duration, d
  3373. Set silence duration until notification (default is 2 seconds).
  3374. @item mono, m
  3375. Process each channel separately, instead of combined. By default is disabled.
  3376. @end table
  3377. @subsection Examples
  3378. @itemize
  3379. @item
  3380. Detect 5 seconds of silence with -50dB noise tolerance:
  3381. @example
  3382. silencedetect=n=-50dB:d=5
  3383. @end example
  3384. @item
  3385. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3386. tolerance in @file{silence.mp3}:
  3387. @example
  3388. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3389. @end example
  3390. @end itemize
  3391. @section silenceremove
  3392. Remove silence from the beginning, middle or end of the audio.
  3393. The filter accepts the following options:
  3394. @table @option
  3395. @item start_periods
  3396. This value is used to indicate if audio should be trimmed at beginning of
  3397. the audio. A value of zero indicates no silence should be trimmed from the
  3398. beginning. When specifying a non-zero value, it trims audio up until it
  3399. finds non-silence. Normally, when trimming silence from beginning of audio
  3400. the @var{start_periods} will be @code{1} but it can be increased to higher
  3401. values to trim all audio up to specific count of non-silence periods.
  3402. Default value is @code{0}.
  3403. @item start_duration
  3404. Specify the amount of time that non-silence must be detected before it stops
  3405. trimming audio. By increasing the duration, bursts of noises can be treated
  3406. as silence and trimmed off. Default value is @code{0}.
  3407. @item start_threshold
  3408. This indicates what sample value should be treated as silence. For digital
  3409. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3410. you may wish to increase the value to account for background noise.
  3411. Can be specified in dB (in case "dB" is appended to the specified value)
  3412. or amplitude ratio. Default value is @code{0}.
  3413. @item start_silence
  3414. Specify max duration of silence at beginning that will be kept after
  3415. trimming. Default is 0, which is equal to trimming all samples detected
  3416. as silence.
  3417. @item start_mode
  3418. Specify mode of detection of silence end in start of multi-channel audio.
  3419. Can be @var{any} or @var{all}. Default is @var{any}.
  3420. With @var{any}, any sample that is detected as non-silence will cause
  3421. stopped trimming of silence.
  3422. With @var{all}, only if all channels are detected as non-silence will cause
  3423. stopped trimming of silence.
  3424. @item stop_periods
  3425. Set the count for trimming silence from the end of audio.
  3426. To remove silence from the middle of a file, specify a @var{stop_periods}
  3427. that is negative. This value is then treated as a positive value and is
  3428. used to indicate the effect should restart processing as specified by
  3429. @var{start_periods}, making it suitable for removing periods of silence
  3430. in the middle of the audio.
  3431. Default value is @code{0}.
  3432. @item stop_duration
  3433. Specify a duration of silence that must exist before audio is not copied any
  3434. more. By specifying a higher duration, silence that is wanted can be left in
  3435. the audio.
  3436. Default value is @code{0}.
  3437. @item stop_threshold
  3438. This is the same as @option{start_threshold} but for trimming silence from
  3439. the end of audio.
  3440. Can be specified in dB (in case "dB" is appended to the specified value)
  3441. or amplitude ratio. Default value is @code{0}.
  3442. @item stop_silence
  3443. Specify max duration of silence at end that will be kept after
  3444. trimming. Default is 0, which is equal to trimming all samples detected
  3445. as silence.
  3446. @item stop_mode
  3447. Specify mode of detection of silence start in end of multi-channel audio.
  3448. Can be @var{any} or @var{all}. Default is @var{any}.
  3449. With @var{any}, any sample that is detected as non-silence will cause
  3450. stopped trimming of silence.
  3451. With @var{all}, only if all channels are detected as non-silence will cause
  3452. stopped trimming of silence.
  3453. @item detection
  3454. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3455. and works better with digital silence which is exactly 0.
  3456. Default value is @code{rms}.
  3457. @item window
  3458. Set duration in number of seconds used to calculate size of window in number
  3459. of samples for detecting silence.
  3460. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3461. @end table
  3462. @subsection Examples
  3463. @itemize
  3464. @item
  3465. The following example shows how this filter can be used to start a recording
  3466. that does not contain the delay at the start which usually occurs between
  3467. pressing the record button and the start of the performance:
  3468. @example
  3469. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3470. @end example
  3471. @item
  3472. Trim all silence encountered from beginning to end where there is more than 1
  3473. second of silence in audio:
  3474. @example
  3475. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3476. @end example
  3477. @end itemize
  3478. @section sofalizer
  3479. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3480. loudspeakers around the user for binaural listening via headphones (audio
  3481. formats up to 9 channels supported).
  3482. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3483. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3484. Austrian Academy of Sciences.
  3485. To enable compilation of this filter you need to configure FFmpeg with
  3486. @code{--enable-libmysofa}.
  3487. The filter accepts the following options:
  3488. @table @option
  3489. @item sofa
  3490. Set the SOFA file used for rendering.
  3491. @item gain
  3492. Set gain applied to audio. Value is in dB. Default is 0.
  3493. @item rotation
  3494. Set rotation of virtual loudspeakers in deg. Default is 0.
  3495. @item elevation
  3496. Set elevation of virtual speakers in deg. Default is 0.
  3497. @item radius
  3498. Set distance in meters between loudspeakers and the listener with near-field
  3499. HRTFs. Default is 1.
  3500. @item type
  3501. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3502. processing audio in time domain which is slow.
  3503. @var{freq} is processing audio in frequency domain which is fast.
  3504. Default is @var{freq}.
  3505. @item speakers
  3506. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3507. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3508. Each virtual loudspeaker is described with short channel name following with
  3509. azimuth and elevation in degrees.
  3510. Each virtual loudspeaker description is separated by '|'.
  3511. For example to override front left and front right channel positions use:
  3512. 'speakers=FL 45 15|FR 345 15'.
  3513. Descriptions with unrecognised channel names are ignored.
  3514. @item lfegain
  3515. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3516. @end table
  3517. @subsection Examples
  3518. @itemize
  3519. @item
  3520. Using ClubFritz6 sofa file:
  3521. @example
  3522. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3523. @end example
  3524. @item
  3525. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3526. @example
  3527. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3528. @end example
  3529. @item
  3530. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3531. and also with custom gain:
  3532. @example
  3533. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3534. @end example
  3535. @end itemize
  3536. @section stereotools
  3537. This filter has some handy utilities to manage stereo signals, for converting
  3538. M/S stereo recordings to L/R signal while having control over the parameters
  3539. or spreading the stereo image of master track.
  3540. The filter accepts the following options:
  3541. @table @option
  3542. @item level_in
  3543. Set input level before filtering for both channels. Defaults is 1.
  3544. Allowed range is from 0.015625 to 64.
  3545. @item level_out
  3546. Set output level after filtering for both channels. Defaults is 1.
  3547. Allowed range is from 0.015625 to 64.
  3548. @item balance_in
  3549. Set input balance between both channels. Default is 0.
  3550. Allowed range is from -1 to 1.
  3551. @item balance_out
  3552. Set output balance between both channels. Default is 0.
  3553. Allowed range is from -1 to 1.
  3554. @item softclip
  3555. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3556. clipping. Disabled by default.
  3557. @item mutel
  3558. Mute the left channel. Disabled by default.
  3559. @item muter
  3560. Mute the right channel. Disabled by default.
  3561. @item phasel
  3562. Change the phase of the left channel. Disabled by default.
  3563. @item phaser
  3564. Change the phase of the right channel. Disabled by default.
  3565. @item mode
  3566. Set stereo mode. Available values are:
  3567. @table @samp
  3568. @item lr>lr
  3569. Left/Right to Left/Right, this is default.
  3570. @item lr>ms
  3571. Left/Right to Mid/Side.
  3572. @item ms>lr
  3573. Mid/Side to Left/Right.
  3574. @item lr>ll
  3575. Left/Right to Left/Left.
  3576. @item lr>rr
  3577. Left/Right to Right/Right.
  3578. @item lr>l+r
  3579. Left/Right to Left + Right.
  3580. @item lr>rl
  3581. Left/Right to Right/Left.
  3582. @item ms>ll
  3583. Mid/Side to Left/Left.
  3584. @item ms>rr
  3585. Mid/Side to Right/Right.
  3586. @end table
  3587. @item slev
  3588. Set level of side signal. Default is 1.
  3589. Allowed range is from 0.015625 to 64.
  3590. @item sbal
  3591. Set balance of side signal. Default is 0.
  3592. Allowed range is from -1 to 1.
  3593. @item mlev
  3594. Set level of the middle signal. Default is 1.
  3595. Allowed range is from 0.015625 to 64.
  3596. @item mpan
  3597. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3598. @item base
  3599. Set stereo base between mono and inversed channels. Default is 0.
  3600. Allowed range is from -1 to 1.
  3601. @item delay
  3602. Set delay in milliseconds how much to delay left from right channel and
  3603. vice versa. Default is 0. Allowed range is from -20 to 20.
  3604. @item sclevel
  3605. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3606. @item phase
  3607. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3608. @item bmode_in, bmode_out
  3609. Set balance mode for balance_in/balance_out option.
  3610. Can be one of the following:
  3611. @table @samp
  3612. @item balance
  3613. Classic balance mode. Attenuate one channel at time.
  3614. Gain is raised up to 1.
  3615. @item amplitude
  3616. Similar as classic mode above but gain is raised up to 2.
  3617. @item power
  3618. Equal power distribution, from -6dB to +6dB range.
  3619. @end table
  3620. @end table
  3621. @subsection Examples
  3622. @itemize
  3623. @item
  3624. Apply karaoke like effect:
  3625. @example
  3626. stereotools=mlev=0.015625
  3627. @end example
  3628. @item
  3629. Convert M/S signal to L/R:
  3630. @example
  3631. "stereotools=mode=ms>lr"
  3632. @end example
  3633. @end itemize
  3634. @section stereowiden
  3635. This filter enhance the stereo effect by suppressing signal common to both
  3636. channels and by delaying the signal of left into right and vice versa,
  3637. thereby widening the stereo effect.
  3638. The filter accepts the following options:
  3639. @table @option
  3640. @item delay
  3641. Time in milliseconds of the delay of left signal into right and vice versa.
  3642. Default is 20 milliseconds.
  3643. @item feedback
  3644. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3645. effect of left signal in right output and vice versa which gives widening
  3646. effect. Default is 0.3.
  3647. @item crossfeed
  3648. Cross feed of left into right with inverted phase. This helps in suppressing
  3649. the mono. If the value is 1 it will cancel all the signal common to both
  3650. channels. Default is 0.3.
  3651. @item drymix
  3652. Set level of input signal of original channel. Default is 0.8.
  3653. @end table
  3654. @section superequalizer
  3655. Apply 18 band equalizer.
  3656. The filter accepts the following options:
  3657. @table @option
  3658. @item 1b
  3659. Set 65Hz band gain.
  3660. @item 2b
  3661. Set 92Hz band gain.
  3662. @item 3b
  3663. Set 131Hz band gain.
  3664. @item 4b
  3665. Set 185Hz band gain.
  3666. @item 5b
  3667. Set 262Hz band gain.
  3668. @item 6b
  3669. Set 370Hz band gain.
  3670. @item 7b
  3671. Set 523Hz band gain.
  3672. @item 8b
  3673. Set 740Hz band gain.
  3674. @item 9b
  3675. Set 1047Hz band gain.
  3676. @item 10b
  3677. Set 1480Hz band gain.
  3678. @item 11b
  3679. Set 2093Hz band gain.
  3680. @item 12b
  3681. Set 2960Hz band gain.
  3682. @item 13b
  3683. Set 4186Hz band gain.
  3684. @item 14b
  3685. Set 5920Hz band gain.
  3686. @item 15b
  3687. Set 8372Hz band gain.
  3688. @item 16b
  3689. Set 11840Hz band gain.
  3690. @item 17b
  3691. Set 16744Hz band gain.
  3692. @item 18b
  3693. Set 20000Hz band gain.
  3694. @end table
  3695. @section surround
  3696. Apply audio surround upmix filter.
  3697. This filter allows to produce multichannel output from audio stream.
  3698. The filter accepts the following options:
  3699. @table @option
  3700. @item chl_out
  3701. Set output channel layout. By default, this is @var{5.1}.
  3702. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3703. for the required syntax.
  3704. @item chl_in
  3705. Set input channel layout. By default, this is @var{stereo}.
  3706. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3707. for the required syntax.
  3708. @item level_in
  3709. Set input volume level. By default, this is @var{1}.
  3710. @item level_out
  3711. Set output volume level. By default, this is @var{1}.
  3712. @item lfe
  3713. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3714. @item lfe_low
  3715. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3716. @item lfe_high
  3717. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3718. @item fc_in
  3719. Set front center input volume. By default, this is @var{1}.
  3720. @item fc_out
  3721. Set front center output volume. By default, this is @var{1}.
  3722. @item lfe_in
  3723. Set LFE input volume. By default, this is @var{1}.
  3724. @item lfe_out
  3725. Set LFE output volume. By default, this is @var{1}.
  3726. @end table
  3727. @section treble, highshelf
  3728. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3729. shelving filter with a response similar to that of a standard
  3730. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3731. The filter accepts the following options:
  3732. @table @option
  3733. @item gain, g
  3734. Give the gain at whichever is the lower of ~22 kHz and the
  3735. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3736. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3737. @item frequency, f
  3738. Set the filter's central frequency and so can be used
  3739. to extend or reduce the frequency range to be boosted or cut.
  3740. The default value is @code{3000} Hz.
  3741. @item width_type, t
  3742. Set method to specify band-width of filter.
  3743. @table @option
  3744. @item h
  3745. Hz
  3746. @item q
  3747. Q-Factor
  3748. @item o
  3749. octave
  3750. @item s
  3751. slope
  3752. @item k
  3753. kHz
  3754. @end table
  3755. @item width, w
  3756. Determine how steep is the filter's shelf transition.
  3757. @item channels, c
  3758. Specify which channels to filter, by default all available are filtered.
  3759. @end table
  3760. @subsection Commands
  3761. This filter supports the following commands:
  3762. @table @option
  3763. @item frequency, f
  3764. Change treble frequency.
  3765. Syntax for the command is : "@var{frequency}"
  3766. @item width_type, t
  3767. Change treble width_type.
  3768. Syntax for the command is : "@var{width_type}"
  3769. @item width, w
  3770. Change treble width.
  3771. Syntax for the command is : "@var{width}"
  3772. @item gain, g
  3773. Change treble gain.
  3774. Syntax for the command is : "@var{gain}"
  3775. @end table
  3776. @section tremolo
  3777. Sinusoidal amplitude modulation.
  3778. The filter accepts the following options:
  3779. @table @option
  3780. @item f
  3781. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3782. (20 Hz or lower) will result in a tremolo effect.
  3783. This filter may also be used as a ring modulator by specifying
  3784. a modulation frequency higher than 20 Hz.
  3785. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3786. @item d
  3787. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3788. Default value is 0.5.
  3789. @end table
  3790. @section vibrato
  3791. Sinusoidal phase modulation.
  3792. The filter accepts the following options:
  3793. @table @option
  3794. @item f
  3795. Modulation frequency in Hertz.
  3796. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3797. @item d
  3798. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3799. Default value is 0.5.
  3800. @end table
  3801. @section volume
  3802. Adjust the input audio volume.
  3803. It accepts the following parameters:
  3804. @table @option
  3805. @item volume
  3806. Set audio volume expression.
  3807. Output values are clipped to the maximum value.
  3808. The output audio volume is given by the relation:
  3809. @example
  3810. @var{output_volume} = @var{volume} * @var{input_volume}
  3811. @end example
  3812. The default value for @var{volume} is "1.0".
  3813. @item precision
  3814. This parameter represents the mathematical precision.
  3815. It determines which input sample formats will be allowed, which affects the
  3816. precision of the volume scaling.
  3817. @table @option
  3818. @item fixed
  3819. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3820. @item float
  3821. 32-bit floating-point; this limits input sample format to FLT. (default)
  3822. @item double
  3823. 64-bit floating-point; this limits input sample format to DBL.
  3824. @end table
  3825. @item replaygain
  3826. Choose the behaviour on encountering ReplayGain side data in input frames.
  3827. @table @option
  3828. @item drop
  3829. Remove ReplayGain side data, ignoring its contents (the default).
  3830. @item ignore
  3831. Ignore ReplayGain side data, but leave it in the frame.
  3832. @item track
  3833. Prefer the track gain, if present.
  3834. @item album
  3835. Prefer the album gain, if present.
  3836. @end table
  3837. @item replaygain_preamp
  3838. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3839. Default value for @var{replaygain_preamp} is 0.0.
  3840. @item eval
  3841. Set when the volume expression is evaluated.
  3842. It accepts the following values:
  3843. @table @samp
  3844. @item once
  3845. only evaluate expression once during the filter initialization, or
  3846. when the @samp{volume} command is sent
  3847. @item frame
  3848. evaluate expression for each incoming frame
  3849. @end table
  3850. Default value is @samp{once}.
  3851. @end table
  3852. The volume expression can contain the following parameters.
  3853. @table @option
  3854. @item n
  3855. frame number (starting at zero)
  3856. @item nb_channels
  3857. number of channels
  3858. @item nb_consumed_samples
  3859. number of samples consumed by the filter
  3860. @item nb_samples
  3861. number of samples in the current frame
  3862. @item pos
  3863. original frame position in the file
  3864. @item pts
  3865. frame PTS
  3866. @item sample_rate
  3867. sample rate
  3868. @item startpts
  3869. PTS at start of stream
  3870. @item startt
  3871. time at start of stream
  3872. @item t
  3873. frame time
  3874. @item tb
  3875. timestamp timebase
  3876. @item volume
  3877. last set volume value
  3878. @end table
  3879. Note that when @option{eval} is set to @samp{once} only the
  3880. @var{sample_rate} and @var{tb} variables are available, all other
  3881. variables will evaluate to NAN.
  3882. @subsection Commands
  3883. This filter supports the following commands:
  3884. @table @option
  3885. @item volume
  3886. Modify the volume expression.
  3887. The command accepts the same syntax of the corresponding option.
  3888. If the specified expression is not valid, it is kept at its current
  3889. value.
  3890. @item replaygain_noclip
  3891. Prevent clipping by limiting the gain applied.
  3892. Default value for @var{replaygain_noclip} is 1.
  3893. @end table
  3894. @subsection Examples
  3895. @itemize
  3896. @item
  3897. Halve the input audio volume:
  3898. @example
  3899. volume=volume=0.5
  3900. volume=volume=1/2
  3901. volume=volume=-6.0206dB
  3902. @end example
  3903. In all the above example the named key for @option{volume} can be
  3904. omitted, for example like in:
  3905. @example
  3906. volume=0.5
  3907. @end example
  3908. @item
  3909. Increase input audio power by 6 decibels using fixed-point precision:
  3910. @example
  3911. volume=volume=6dB:precision=fixed
  3912. @end example
  3913. @item
  3914. Fade volume after time 10 with an annihilation period of 5 seconds:
  3915. @example
  3916. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3917. @end example
  3918. @end itemize
  3919. @section volumedetect
  3920. Detect the volume of the input video.
  3921. The filter has no parameters. The input is not modified. Statistics about
  3922. the volume will be printed in the log when the input stream end is reached.
  3923. In particular it will show the mean volume (root mean square), maximum
  3924. volume (on a per-sample basis), and the beginning of a histogram of the
  3925. registered volume values (from the maximum value to a cumulated 1/1000 of
  3926. the samples).
  3927. All volumes are in decibels relative to the maximum PCM value.
  3928. @subsection Examples
  3929. Here is an excerpt of the output:
  3930. @example
  3931. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3932. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3933. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3934. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3935. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3936. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3937. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3938. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3939. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3940. @end example
  3941. It means that:
  3942. @itemize
  3943. @item
  3944. The mean square energy is approximately -27 dB, or 10^-2.7.
  3945. @item
  3946. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3947. @item
  3948. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3949. @end itemize
  3950. In other words, raising the volume by +4 dB does not cause any clipping,
  3951. raising it by +5 dB causes clipping for 6 samples, etc.
  3952. @c man end AUDIO FILTERS
  3953. @chapter Audio Sources
  3954. @c man begin AUDIO SOURCES
  3955. Below is a description of the currently available audio sources.
  3956. @section abuffer
  3957. Buffer audio frames, and make them available to the filter chain.
  3958. This source is mainly intended for a programmatic use, in particular
  3959. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3960. It accepts the following parameters:
  3961. @table @option
  3962. @item time_base
  3963. The timebase which will be used for timestamps of submitted frames. It must be
  3964. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3965. @item sample_rate
  3966. The sample rate of the incoming audio buffers.
  3967. @item sample_fmt
  3968. The sample format of the incoming audio buffers.
  3969. Either a sample format name or its corresponding integer representation from
  3970. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3971. @item channel_layout
  3972. The channel layout of the incoming audio buffers.
  3973. Either a channel layout name from channel_layout_map in
  3974. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3975. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3976. @item channels
  3977. The number of channels of the incoming audio buffers.
  3978. If both @var{channels} and @var{channel_layout} are specified, then they
  3979. must be consistent.
  3980. @end table
  3981. @subsection Examples
  3982. @example
  3983. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3984. @end example
  3985. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3986. Since the sample format with name "s16p" corresponds to the number
  3987. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3988. equivalent to:
  3989. @example
  3990. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3991. @end example
  3992. @section aevalsrc
  3993. Generate an audio signal specified by an expression.
  3994. This source accepts in input one or more expressions (one for each
  3995. channel), which are evaluated and used to generate a corresponding
  3996. audio signal.
  3997. This source accepts the following options:
  3998. @table @option
  3999. @item exprs
  4000. Set the '|'-separated expressions list for each separate channel. In case the
  4001. @option{channel_layout} option is not specified, the selected channel layout
  4002. depends on the number of provided expressions. Otherwise the last
  4003. specified expression is applied to the remaining output channels.
  4004. @item channel_layout, c
  4005. Set the channel layout. The number of channels in the specified layout
  4006. must be equal to the number of specified expressions.
  4007. @item duration, d
  4008. Set the minimum duration of the sourced audio. See
  4009. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4010. for the accepted syntax.
  4011. Note that the resulting duration may be greater than the specified
  4012. duration, as the generated audio is always cut at the end of a
  4013. complete frame.
  4014. If not specified, or the expressed duration is negative, the audio is
  4015. supposed to be generated forever.
  4016. @item nb_samples, n
  4017. Set the number of samples per channel per each output frame,
  4018. default to 1024.
  4019. @item sample_rate, s
  4020. Specify the sample rate, default to 44100.
  4021. @end table
  4022. Each expression in @var{exprs} can contain the following constants:
  4023. @table @option
  4024. @item n
  4025. number of the evaluated sample, starting from 0
  4026. @item t
  4027. time of the evaluated sample expressed in seconds, starting from 0
  4028. @item s
  4029. sample rate
  4030. @end table
  4031. @subsection Examples
  4032. @itemize
  4033. @item
  4034. Generate silence:
  4035. @example
  4036. aevalsrc=0
  4037. @end example
  4038. @item
  4039. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4040. 8000 Hz:
  4041. @example
  4042. aevalsrc="sin(440*2*PI*t):s=8000"
  4043. @end example
  4044. @item
  4045. Generate a two channels signal, specify the channel layout (Front
  4046. Center + Back Center) explicitly:
  4047. @example
  4048. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4049. @end example
  4050. @item
  4051. Generate white noise:
  4052. @example
  4053. aevalsrc="-2+random(0)"
  4054. @end example
  4055. @item
  4056. Generate an amplitude modulated signal:
  4057. @example
  4058. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4059. @end example
  4060. @item
  4061. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4062. @example
  4063. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4064. @end example
  4065. @end itemize
  4066. @section anullsrc
  4067. The null audio source, return unprocessed audio frames. It is mainly useful
  4068. as a template and to be employed in analysis / debugging tools, or as
  4069. the source for filters which ignore the input data (for example the sox
  4070. synth filter).
  4071. This source accepts the following options:
  4072. @table @option
  4073. @item channel_layout, cl
  4074. Specifies the channel layout, and can be either an integer or a string
  4075. representing a channel layout. The default value of @var{channel_layout}
  4076. is "stereo".
  4077. Check the channel_layout_map definition in
  4078. @file{libavutil/channel_layout.c} for the mapping between strings and
  4079. channel layout values.
  4080. @item sample_rate, r
  4081. Specifies the sample rate, and defaults to 44100.
  4082. @item nb_samples, n
  4083. Set the number of samples per requested frames.
  4084. @end table
  4085. @subsection Examples
  4086. @itemize
  4087. @item
  4088. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4089. @example
  4090. anullsrc=r=48000:cl=4
  4091. @end example
  4092. @item
  4093. Do the same operation with a more obvious syntax:
  4094. @example
  4095. anullsrc=r=48000:cl=mono
  4096. @end example
  4097. @end itemize
  4098. All the parameters need to be explicitly defined.
  4099. @section flite
  4100. Synthesize a voice utterance using the libflite library.
  4101. To enable compilation of this filter you need to configure FFmpeg with
  4102. @code{--enable-libflite}.
  4103. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4104. The filter accepts the following options:
  4105. @table @option
  4106. @item list_voices
  4107. If set to 1, list the names of the available voices and exit
  4108. immediately. Default value is 0.
  4109. @item nb_samples, n
  4110. Set the maximum number of samples per frame. Default value is 512.
  4111. @item textfile
  4112. Set the filename containing the text to speak.
  4113. @item text
  4114. Set the text to speak.
  4115. @item voice, v
  4116. Set the voice to use for the speech synthesis. Default value is
  4117. @code{kal}. See also the @var{list_voices} option.
  4118. @end table
  4119. @subsection Examples
  4120. @itemize
  4121. @item
  4122. Read from file @file{speech.txt}, and synthesize the text using the
  4123. standard flite voice:
  4124. @example
  4125. flite=textfile=speech.txt
  4126. @end example
  4127. @item
  4128. Read the specified text selecting the @code{slt} voice:
  4129. @example
  4130. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4131. @end example
  4132. @item
  4133. Input text to ffmpeg:
  4134. @example
  4135. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4136. @end example
  4137. @item
  4138. Make @file{ffplay} speak the specified text, using @code{flite} and
  4139. the @code{lavfi} device:
  4140. @example
  4141. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4142. @end example
  4143. @end itemize
  4144. For more information about libflite, check:
  4145. @url{http://www.festvox.org/flite/}
  4146. @section anoisesrc
  4147. Generate a noise audio signal.
  4148. The filter accepts the following options:
  4149. @table @option
  4150. @item sample_rate, r
  4151. Specify the sample rate. Default value is 48000 Hz.
  4152. @item amplitude, a
  4153. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4154. is 1.0.
  4155. @item duration, d
  4156. Specify the duration of the generated audio stream. Not specifying this option
  4157. results in noise with an infinite length.
  4158. @item color, colour, c
  4159. Specify the color of noise. Available noise colors are white, pink, brown,
  4160. blue and violet. Default color is white.
  4161. @item seed, s
  4162. Specify a value used to seed the PRNG.
  4163. @item nb_samples, n
  4164. Set the number of samples per each output frame, default is 1024.
  4165. @end table
  4166. @subsection Examples
  4167. @itemize
  4168. @item
  4169. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4170. @example
  4171. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4172. @end example
  4173. @end itemize
  4174. @section hilbert
  4175. Generate odd-tap Hilbert transform FIR coefficients.
  4176. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4177. the signal by 90 degrees.
  4178. This is used in many matrix coding schemes and for analytic signal generation.
  4179. The process is often written as a multiplication by i (or j), the imaginary unit.
  4180. The filter accepts the following options:
  4181. @table @option
  4182. @item sample_rate, s
  4183. Set sample rate, default is 44100.
  4184. @item taps, t
  4185. Set length of FIR filter, default is 22051.
  4186. @item nb_samples, n
  4187. Set number of samples per each frame.
  4188. @item win_func, w
  4189. Set window function to be used when generating FIR coefficients.
  4190. @end table
  4191. @section sinc
  4192. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4193. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4194. The filter accepts the following options:
  4195. @table @option
  4196. @item sample_rate, r
  4197. Set sample rate, default is 44100.
  4198. @item nb_samples, n
  4199. Set number of samples per each frame. Default is 1024.
  4200. @item hp
  4201. Set high-pass frequency. Default is 0.
  4202. @item lp
  4203. Set low-pass frequency. Default is 0.
  4204. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4205. is higher than 0 then filter will create band-pass filter coefficients,
  4206. otherwise band-reject filter coefficients.
  4207. @item phase
  4208. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4209. @item beta
  4210. Set Kaiser window beta.
  4211. @item att
  4212. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4213. @item round
  4214. Enable rounding, by default is disabled.
  4215. @item hptaps
  4216. Set number of taps for high-pass filter.
  4217. @item lptaps
  4218. Set number of taps for low-pass filter.
  4219. @end table
  4220. @section sine
  4221. Generate an audio signal made of a sine wave with amplitude 1/8.
  4222. The audio signal is bit-exact.
  4223. The filter accepts the following options:
  4224. @table @option
  4225. @item frequency, f
  4226. Set the carrier frequency. Default is 440 Hz.
  4227. @item beep_factor, b
  4228. Enable a periodic beep every second with frequency @var{beep_factor} times
  4229. the carrier frequency. Default is 0, meaning the beep is disabled.
  4230. @item sample_rate, r
  4231. Specify the sample rate, default is 44100.
  4232. @item duration, d
  4233. Specify the duration of the generated audio stream.
  4234. @item samples_per_frame
  4235. Set the number of samples per output frame.
  4236. The expression can contain the following constants:
  4237. @table @option
  4238. @item n
  4239. The (sequential) number of the output audio frame, starting from 0.
  4240. @item pts
  4241. The PTS (Presentation TimeStamp) of the output audio frame,
  4242. expressed in @var{TB} units.
  4243. @item t
  4244. The PTS of the output audio frame, expressed in seconds.
  4245. @item TB
  4246. The timebase of the output audio frames.
  4247. @end table
  4248. Default is @code{1024}.
  4249. @end table
  4250. @subsection Examples
  4251. @itemize
  4252. @item
  4253. Generate a simple 440 Hz sine wave:
  4254. @example
  4255. sine
  4256. @end example
  4257. @item
  4258. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4259. @example
  4260. sine=220:4:d=5
  4261. sine=f=220:b=4:d=5
  4262. sine=frequency=220:beep_factor=4:duration=5
  4263. @end example
  4264. @item
  4265. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4266. pattern:
  4267. @example
  4268. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4269. @end example
  4270. @end itemize
  4271. @c man end AUDIO SOURCES
  4272. @chapter Audio Sinks
  4273. @c man begin AUDIO SINKS
  4274. Below is a description of the currently available audio sinks.
  4275. @section abuffersink
  4276. Buffer audio frames, and make them available to the end of filter chain.
  4277. This sink is mainly intended for programmatic use, in particular
  4278. through the interface defined in @file{libavfilter/buffersink.h}
  4279. or the options system.
  4280. It accepts a pointer to an AVABufferSinkContext structure, which
  4281. defines the incoming buffers' formats, to be passed as the opaque
  4282. parameter to @code{avfilter_init_filter} for initialization.
  4283. @section anullsink
  4284. Null audio sink; do absolutely nothing with the input audio. It is
  4285. mainly useful as a template and for use in analysis / debugging
  4286. tools.
  4287. @c man end AUDIO SINKS
  4288. @chapter Video Filters
  4289. @c man begin VIDEO FILTERS
  4290. When you configure your FFmpeg build, you can disable any of the
  4291. existing filters using @code{--disable-filters}.
  4292. The configure output will show the video filters included in your
  4293. build.
  4294. Below is a description of the currently available video filters.
  4295. @section alphaextract
  4296. Extract the alpha component from the input as a grayscale video. This
  4297. is especially useful with the @var{alphamerge} filter.
  4298. @section alphamerge
  4299. Add or replace the alpha component of the primary input with the
  4300. grayscale value of a second input. This is intended for use with
  4301. @var{alphaextract} to allow the transmission or storage of frame
  4302. sequences that have alpha in a format that doesn't support an alpha
  4303. channel.
  4304. For example, to reconstruct full frames from a normal YUV-encoded video
  4305. and a separate video created with @var{alphaextract}, you might use:
  4306. @example
  4307. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4308. @end example
  4309. Since this filter is designed for reconstruction, it operates on frame
  4310. sequences without considering timestamps, and terminates when either
  4311. input reaches end of stream. This will cause problems if your encoding
  4312. pipeline drops frames. If you're trying to apply an image as an
  4313. overlay to a video stream, consider the @var{overlay} filter instead.
  4314. @section amplify
  4315. Amplify differences between current pixel and pixels of adjacent frames in
  4316. same pixel location.
  4317. This filter accepts the following options:
  4318. @table @option
  4319. @item radius
  4320. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4321. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4322. @item factor
  4323. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4324. @item threshold
  4325. Set threshold for difference amplification. Any differrence greater or equal to
  4326. this value will not alter source pixel. Default is 10.
  4327. Allowed range is from 0 to 65535.
  4328. @item low
  4329. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4330. This option controls maximum possible value that will decrease source pixel value.
  4331. @item high
  4332. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4333. This option controls maximum possible value that will increase source pixel value.
  4334. @item planes
  4335. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4336. @end table
  4337. @section ass
  4338. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4339. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4340. Substation Alpha) subtitles files.
  4341. This filter accepts the following option in addition to the common options from
  4342. the @ref{subtitles} filter:
  4343. @table @option
  4344. @item shaping
  4345. Set the shaping engine
  4346. Available values are:
  4347. @table @samp
  4348. @item auto
  4349. The default libass shaping engine, which is the best available.
  4350. @item simple
  4351. Fast, font-agnostic shaper that can do only substitutions
  4352. @item complex
  4353. Slower shaper using OpenType for substitutions and positioning
  4354. @end table
  4355. The default is @code{auto}.
  4356. @end table
  4357. @section atadenoise
  4358. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4359. The filter accepts the following options:
  4360. @table @option
  4361. @item 0a
  4362. Set threshold A for 1st plane. Default is 0.02.
  4363. Valid range is 0 to 0.3.
  4364. @item 0b
  4365. Set threshold B for 1st plane. Default is 0.04.
  4366. Valid range is 0 to 5.
  4367. @item 1a
  4368. Set threshold A for 2nd plane. Default is 0.02.
  4369. Valid range is 0 to 0.3.
  4370. @item 1b
  4371. Set threshold B for 2nd plane. Default is 0.04.
  4372. Valid range is 0 to 5.
  4373. @item 2a
  4374. Set threshold A for 3rd plane. Default is 0.02.
  4375. Valid range is 0 to 0.3.
  4376. @item 2b
  4377. Set threshold B for 3rd plane. Default is 0.04.
  4378. Valid range is 0 to 5.
  4379. Threshold A is designed to react on abrupt changes in the input signal and
  4380. threshold B is designed to react on continuous changes in the input signal.
  4381. @item s
  4382. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4383. number in range [5, 129].
  4384. @item p
  4385. Set what planes of frame filter will use for averaging. Default is all.
  4386. @end table
  4387. @section avgblur
  4388. Apply average blur filter.
  4389. The filter accepts the following options:
  4390. @table @option
  4391. @item sizeX
  4392. Set horizontal radius size.
  4393. @item planes
  4394. Set which planes to filter. By default all planes are filtered.
  4395. @item sizeY
  4396. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4397. Default is @code{0}.
  4398. @end table
  4399. @section bbox
  4400. Compute the bounding box for the non-black pixels in the input frame
  4401. luminance plane.
  4402. This filter computes the bounding box containing all the pixels with a
  4403. luminance value greater than the minimum allowed value.
  4404. The parameters describing the bounding box are printed on the filter
  4405. log.
  4406. The filter accepts the following option:
  4407. @table @option
  4408. @item min_val
  4409. Set the minimal luminance value. Default is @code{16}.
  4410. @end table
  4411. @section bitplanenoise
  4412. Show and measure bit plane noise.
  4413. The filter accepts the following options:
  4414. @table @option
  4415. @item bitplane
  4416. Set which plane to analyze. Default is @code{1}.
  4417. @item filter
  4418. Filter out noisy pixels from @code{bitplane} set above.
  4419. Default is disabled.
  4420. @end table
  4421. @section blackdetect
  4422. Detect video intervals that are (almost) completely black. Can be
  4423. useful to detect chapter transitions, commercials, or invalid
  4424. recordings. Output lines contains the time for the start, end and
  4425. duration of the detected black interval expressed in seconds.
  4426. In order to display the output lines, you need to set the loglevel at
  4427. least to the AV_LOG_INFO value.
  4428. The filter accepts the following options:
  4429. @table @option
  4430. @item black_min_duration, d
  4431. Set the minimum detected black duration expressed in seconds. It must
  4432. be a non-negative floating point number.
  4433. Default value is 2.0.
  4434. @item picture_black_ratio_th, pic_th
  4435. Set the threshold for considering a picture "black".
  4436. Express the minimum value for the ratio:
  4437. @example
  4438. @var{nb_black_pixels} / @var{nb_pixels}
  4439. @end example
  4440. for which a picture is considered black.
  4441. Default value is 0.98.
  4442. @item pixel_black_th, pix_th
  4443. Set the threshold for considering a pixel "black".
  4444. The threshold expresses the maximum pixel luminance value for which a
  4445. pixel is considered "black". The provided value is scaled according to
  4446. the following equation:
  4447. @example
  4448. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4449. @end example
  4450. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4451. the input video format, the range is [0-255] for YUV full-range
  4452. formats and [16-235] for YUV non full-range formats.
  4453. Default value is 0.10.
  4454. @end table
  4455. The following example sets the maximum pixel threshold to the minimum
  4456. value, and detects only black intervals of 2 or more seconds:
  4457. @example
  4458. blackdetect=d=2:pix_th=0.00
  4459. @end example
  4460. @section blackframe
  4461. Detect frames that are (almost) completely black. Can be useful to
  4462. detect chapter transitions or commercials. Output lines consist of
  4463. the frame number of the detected frame, the percentage of blackness,
  4464. the position in the file if known or -1 and the timestamp in seconds.
  4465. In order to display the output lines, you need to set the loglevel at
  4466. least to the AV_LOG_INFO value.
  4467. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4468. The value represents the percentage of pixels in the picture that
  4469. are below the threshold value.
  4470. It accepts the following parameters:
  4471. @table @option
  4472. @item amount
  4473. The percentage of the pixels that have to be below the threshold; it defaults to
  4474. @code{98}.
  4475. @item threshold, thresh
  4476. The threshold below which a pixel value is considered black; it defaults to
  4477. @code{32}.
  4478. @end table
  4479. @section blend, tblend
  4480. Blend two video frames into each other.
  4481. The @code{blend} filter takes two input streams and outputs one
  4482. stream, the first input is the "top" layer and second input is
  4483. "bottom" layer. By default, the output terminates when the longest input terminates.
  4484. The @code{tblend} (time blend) filter takes two consecutive frames
  4485. from one single stream, and outputs the result obtained by blending
  4486. the new frame on top of the old frame.
  4487. A description of the accepted options follows.
  4488. @table @option
  4489. @item c0_mode
  4490. @item c1_mode
  4491. @item c2_mode
  4492. @item c3_mode
  4493. @item all_mode
  4494. Set blend mode for specific pixel component or all pixel components in case
  4495. of @var{all_mode}. Default value is @code{normal}.
  4496. Available values for component modes are:
  4497. @table @samp
  4498. @item addition
  4499. @item grainmerge
  4500. @item and
  4501. @item average
  4502. @item burn
  4503. @item darken
  4504. @item difference
  4505. @item grainextract
  4506. @item divide
  4507. @item dodge
  4508. @item freeze
  4509. @item exclusion
  4510. @item extremity
  4511. @item glow
  4512. @item hardlight
  4513. @item hardmix
  4514. @item heat
  4515. @item lighten
  4516. @item linearlight
  4517. @item multiply
  4518. @item multiply128
  4519. @item negation
  4520. @item normal
  4521. @item or
  4522. @item overlay
  4523. @item phoenix
  4524. @item pinlight
  4525. @item reflect
  4526. @item screen
  4527. @item softlight
  4528. @item subtract
  4529. @item vividlight
  4530. @item xor
  4531. @end table
  4532. @item c0_opacity
  4533. @item c1_opacity
  4534. @item c2_opacity
  4535. @item c3_opacity
  4536. @item all_opacity
  4537. Set blend opacity for specific pixel component or all pixel components in case
  4538. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4539. @item c0_expr
  4540. @item c1_expr
  4541. @item c2_expr
  4542. @item c3_expr
  4543. @item all_expr
  4544. Set blend expression for specific pixel component or all pixel components in case
  4545. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4546. The expressions can use the following variables:
  4547. @table @option
  4548. @item N
  4549. The sequential number of the filtered frame, starting from @code{0}.
  4550. @item X
  4551. @item Y
  4552. the coordinates of the current sample
  4553. @item W
  4554. @item H
  4555. the width and height of currently filtered plane
  4556. @item SW
  4557. @item SH
  4558. Width and height scale for the plane being filtered. It is the
  4559. ratio between the dimensions of the current plane to the luma plane,
  4560. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4561. the luma plane and @code{0.5,0.5} for the chroma planes.
  4562. @item T
  4563. Time of the current frame, expressed in seconds.
  4564. @item TOP, A
  4565. Value of pixel component at current location for first video frame (top layer).
  4566. @item BOTTOM, B
  4567. Value of pixel component at current location for second video frame (bottom layer).
  4568. @end table
  4569. @end table
  4570. The @code{blend} filter also supports the @ref{framesync} options.
  4571. @subsection Examples
  4572. @itemize
  4573. @item
  4574. Apply transition from bottom layer to top layer in first 10 seconds:
  4575. @example
  4576. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4577. @end example
  4578. @item
  4579. Apply linear horizontal transition from top layer to bottom layer:
  4580. @example
  4581. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4582. @end example
  4583. @item
  4584. Apply 1x1 checkerboard effect:
  4585. @example
  4586. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4587. @end example
  4588. @item
  4589. Apply uncover left effect:
  4590. @example
  4591. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4592. @end example
  4593. @item
  4594. Apply uncover down effect:
  4595. @example
  4596. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4597. @end example
  4598. @item
  4599. Apply uncover up-left effect:
  4600. @example
  4601. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4602. @end example
  4603. @item
  4604. Split diagonally video and shows top and bottom layer on each side:
  4605. @example
  4606. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4607. @end example
  4608. @item
  4609. Display differences between the current and the previous frame:
  4610. @example
  4611. tblend=all_mode=grainextract
  4612. @end example
  4613. @end itemize
  4614. @section bm3d
  4615. Denoise frames using Block-Matching 3D algorithm.
  4616. The filter accepts the following options.
  4617. @table @option
  4618. @item sigma
  4619. Set denoising strength. Default value is 1.
  4620. Allowed range is from 0 to 999.9.
  4621. The denoising algorith is very sensitive to sigma, so adjust it
  4622. according to the source.
  4623. @item block
  4624. Set local patch size. This sets dimensions in 2D.
  4625. @item bstep
  4626. Set sliding step for processing blocks. Default value is 4.
  4627. Allowed range is from 1 to 64.
  4628. Smaller values allows processing more reference blocks and is slower.
  4629. @item group
  4630. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4631. When set to 1, no block matching is done. Larger values allows more blocks
  4632. in single group.
  4633. Allowed range is from 1 to 256.
  4634. @item range
  4635. Set radius for search block matching. Default is 9.
  4636. Allowed range is from 1 to INT32_MAX.
  4637. @item mstep
  4638. Set step between two search locations for block matching. Default is 1.
  4639. Allowed range is from 1 to 64. Smaller is slower.
  4640. @item thmse
  4641. Set threshold of mean square error for block matching. Valid range is 0 to
  4642. INT32_MAX.
  4643. @item hdthr
  4644. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4645. Larger values results in stronger hard-thresholding filtering in frequency
  4646. domain.
  4647. @item estim
  4648. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4649. Default is @code{basic}.
  4650. @item ref
  4651. If enabled, filter will use 2nd stream for block matching.
  4652. Default is disabled for @code{basic} value of @var{estim} option,
  4653. and always enabled if value of @var{estim} is @code{final}.
  4654. @item planes
  4655. Set planes to filter. Default is all available except alpha.
  4656. @end table
  4657. @subsection Examples
  4658. @itemize
  4659. @item
  4660. Basic filtering with bm3d:
  4661. @example
  4662. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4663. @end example
  4664. @item
  4665. Same as above, but filtering only luma:
  4666. @example
  4667. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4668. @end example
  4669. @item
  4670. Same as above, but with both estimation modes:
  4671. @example
  4672. 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
  4673. @end example
  4674. @item
  4675. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4676. @example
  4677. 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
  4678. @end example
  4679. @end itemize
  4680. @section boxblur
  4681. Apply a boxblur algorithm to the input video.
  4682. It accepts the following parameters:
  4683. @table @option
  4684. @item luma_radius, lr
  4685. @item luma_power, lp
  4686. @item chroma_radius, cr
  4687. @item chroma_power, cp
  4688. @item alpha_radius, ar
  4689. @item alpha_power, ap
  4690. @end table
  4691. A description of the accepted options follows.
  4692. @table @option
  4693. @item luma_radius, lr
  4694. @item chroma_radius, cr
  4695. @item alpha_radius, ar
  4696. Set an expression for the box radius in pixels used for blurring the
  4697. corresponding input plane.
  4698. The radius value must be a non-negative number, and must not be
  4699. greater than the value of the expression @code{min(w,h)/2} for the
  4700. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4701. planes.
  4702. Default value for @option{luma_radius} is "2". If not specified,
  4703. @option{chroma_radius} and @option{alpha_radius} default to the
  4704. corresponding value set for @option{luma_radius}.
  4705. The expressions can contain the following constants:
  4706. @table @option
  4707. @item w
  4708. @item h
  4709. The input width and height in pixels.
  4710. @item cw
  4711. @item ch
  4712. The input chroma image width and height in pixels.
  4713. @item hsub
  4714. @item vsub
  4715. The horizontal and vertical chroma subsample values. For example, for the
  4716. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4717. @end table
  4718. @item luma_power, lp
  4719. @item chroma_power, cp
  4720. @item alpha_power, ap
  4721. Specify how many times the boxblur filter is applied to the
  4722. corresponding plane.
  4723. Default value for @option{luma_power} is 2. If not specified,
  4724. @option{chroma_power} and @option{alpha_power} default to the
  4725. corresponding value set for @option{luma_power}.
  4726. A value of 0 will disable the effect.
  4727. @end table
  4728. @subsection Examples
  4729. @itemize
  4730. @item
  4731. Apply a boxblur filter with the luma, chroma, and alpha radii
  4732. set to 2:
  4733. @example
  4734. boxblur=luma_radius=2:luma_power=1
  4735. boxblur=2:1
  4736. @end example
  4737. @item
  4738. Set the luma radius to 2, and alpha and chroma radius to 0:
  4739. @example
  4740. boxblur=2:1:cr=0:ar=0
  4741. @end example
  4742. @item
  4743. Set the luma and chroma radii to a fraction of the video dimension:
  4744. @example
  4745. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4746. @end example
  4747. @end itemize
  4748. @section bwdif
  4749. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4750. Deinterlacing Filter").
  4751. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4752. interpolation algorithms.
  4753. It accepts the following parameters:
  4754. @table @option
  4755. @item mode
  4756. The interlacing mode to adopt. It accepts one of the following values:
  4757. @table @option
  4758. @item 0, send_frame
  4759. Output one frame for each frame.
  4760. @item 1, send_field
  4761. Output one frame for each field.
  4762. @end table
  4763. The default value is @code{send_field}.
  4764. @item parity
  4765. The picture field parity assumed for the input interlaced video. It accepts one
  4766. of the following values:
  4767. @table @option
  4768. @item 0, tff
  4769. Assume the top field is first.
  4770. @item 1, bff
  4771. Assume the bottom field is first.
  4772. @item -1, auto
  4773. Enable automatic detection of field parity.
  4774. @end table
  4775. The default value is @code{auto}.
  4776. If the interlacing is unknown or the decoder does not export this information,
  4777. top field first will be assumed.
  4778. @item deint
  4779. Specify which frames to deinterlace. Accept one of the following
  4780. values:
  4781. @table @option
  4782. @item 0, all
  4783. Deinterlace all frames.
  4784. @item 1, interlaced
  4785. Only deinterlace frames marked as interlaced.
  4786. @end table
  4787. The default value is @code{all}.
  4788. @end table
  4789. @section chromahold
  4790. Remove all color information for all colors except for certain one.
  4791. The filter accepts the following options:
  4792. @table @option
  4793. @item color
  4794. The color which will not be replaced with neutral chroma.
  4795. @item similarity
  4796. Similarity percentage with the above color.
  4797. 0.01 matches only the exact key color, while 1.0 matches everything.
  4798. @item yuv
  4799. Signals that the color passed is already in YUV instead of RGB.
  4800. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4801. This can be used to pass exact YUV values as hexadecimal numbers.
  4802. @end table
  4803. @section chromakey
  4804. YUV colorspace color/chroma keying.
  4805. The filter accepts the following options:
  4806. @table @option
  4807. @item color
  4808. The color which will be replaced with transparency.
  4809. @item similarity
  4810. Similarity percentage with the key color.
  4811. 0.01 matches only the exact key color, while 1.0 matches everything.
  4812. @item blend
  4813. Blend percentage.
  4814. 0.0 makes pixels either fully transparent, or not transparent at all.
  4815. Higher values result in semi-transparent pixels, with a higher transparency
  4816. the more similar the pixels color is to the key color.
  4817. @item yuv
  4818. Signals that the color passed is already in YUV instead of RGB.
  4819. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4820. This can be used to pass exact YUV values as hexadecimal numbers.
  4821. @end table
  4822. @subsection Examples
  4823. @itemize
  4824. @item
  4825. Make every green pixel in the input image transparent:
  4826. @example
  4827. ffmpeg -i input.png -vf chromakey=green out.png
  4828. @end example
  4829. @item
  4830. Overlay a greenscreen-video on top of a static black background.
  4831. @example
  4832. 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
  4833. @end example
  4834. @end itemize
  4835. @section chromashift
  4836. Shift chroma pixels horizontally and/or vertically.
  4837. The filter accepts the following options:
  4838. @table @option
  4839. @item cbh
  4840. Set amount to shift chroma-blue horizontally.
  4841. @item cbv
  4842. Set amount to shift chroma-blue vertically.
  4843. @item crh
  4844. Set amount to shift chroma-red horizontally.
  4845. @item crv
  4846. Set amount to shift chroma-red vertically.
  4847. @item edge
  4848. Set edge mode, can be @var{smear}, default, or @var{warp}.
  4849. @end table
  4850. @section ciescope
  4851. Display CIE color diagram with pixels overlaid onto it.
  4852. The filter accepts the following options:
  4853. @table @option
  4854. @item system
  4855. Set color system.
  4856. @table @samp
  4857. @item ntsc, 470m
  4858. @item ebu, 470bg
  4859. @item smpte
  4860. @item 240m
  4861. @item apple
  4862. @item widergb
  4863. @item cie1931
  4864. @item rec709, hdtv
  4865. @item uhdtv, rec2020
  4866. @end table
  4867. @item cie
  4868. Set CIE system.
  4869. @table @samp
  4870. @item xyy
  4871. @item ucs
  4872. @item luv
  4873. @end table
  4874. @item gamuts
  4875. Set what gamuts to draw.
  4876. See @code{system} option for available values.
  4877. @item size, s
  4878. Set ciescope size, by default set to 512.
  4879. @item intensity, i
  4880. Set intensity used to map input pixel values to CIE diagram.
  4881. @item contrast
  4882. Set contrast used to draw tongue colors that are out of active color system gamut.
  4883. @item corrgamma
  4884. Correct gamma displayed on scope, by default enabled.
  4885. @item showwhite
  4886. Show white point on CIE diagram, by default disabled.
  4887. @item gamma
  4888. Set input gamma. Used only with XYZ input color space.
  4889. @end table
  4890. @section codecview
  4891. Visualize information exported by some codecs.
  4892. Some codecs can export information through frames using side-data or other
  4893. means. For example, some MPEG based codecs export motion vectors through the
  4894. @var{export_mvs} flag in the codec @option{flags2} option.
  4895. The filter accepts the following option:
  4896. @table @option
  4897. @item mv
  4898. Set motion vectors to visualize.
  4899. Available flags for @var{mv} are:
  4900. @table @samp
  4901. @item pf
  4902. forward predicted MVs of P-frames
  4903. @item bf
  4904. forward predicted MVs of B-frames
  4905. @item bb
  4906. backward predicted MVs of B-frames
  4907. @end table
  4908. @item qp
  4909. Display quantization parameters using the chroma planes.
  4910. @item mv_type, mvt
  4911. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4912. Available flags for @var{mv_type} are:
  4913. @table @samp
  4914. @item fp
  4915. forward predicted MVs
  4916. @item bp
  4917. backward predicted MVs
  4918. @end table
  4919. @item frame_type, ft
  4920. Set frame type to visualize motion vectors of.
  4921. Available flags for @var{frame_type} are:
  4922. @table @samp
  4923. @item if
  4924. intra-coded frames (I-frames)
  4925. @item pf
  4926. predicted frames (P-frames)
  4927. @item bf
  4928. bi-directionally predicted frames (B-frames)
  4929. @end table
  4930. @end table
  4931. @subsection Examples
  4932. @itemize
  4933. @item
  4934. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4935. @example
  4936. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4937. @end example
  4938. @item
  4939. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4940. @example
  4941. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4942. @end example
  4943. @end itemize
  4944. @section colorbalance
  4945. Modify intensity of primary colors (red, green and blue) of input frames.
  4946. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4947. regions for the red-cyan, green-magenta or blue-yellow balance.
  4948. A positive adjustment value shifts the balance towards the primary color, a negative
  4949. value towards the complementary color.
  4950. The filter accepts the following options:
  4951. @table @option
  4952. @item rs
  4953. @item gs
  4954. @item bs
  4955. Adjust red, green and blue shadows (darkest pixels).
  4956. @item rm
  4957. @item gm
  4958. @item bm
  4959. Adjust red, green and blue midtones (medium pixels).
  4960. @item rh
  4961. @item gh
  4962. @item bh
  4963. Adjust red, green and blue highlights (brightest pixels).
  4964. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4965. @end table
  4966. @subsection Examples
  4967. @itemize
  4968. @item
  4969. Add red color cast to shadows:
  4970. @example
  4971. colorbalance=rs=.3
  4972. @end example
  4973. @end itemize
  4974. @section colorkey
  4975. RGB colorspace color keying.
  4976. The filter accepts the following options:
  4977. @table @option
  4978. @item color
  4979. The color which will be replaced with transparency.
  4980. @item similarity
  4981. Similarity percentage with the key color.
  4982. 0.01 matches only the exact key color, while 1.0 matches everything.
  4983. @item blend
  4984. Blend percentage.
  4985. 0.0 makes pixels either fully transparent, or not transparent at all.
  4986. Higher values result in semi-transparent pixels, with a higher transparency
  4987. the more similar the pixels color is to the key color.
  4988. @end table
  4989. @subsection Examples
  4990. @itemize
  4991. @item
  4992. Make every green pixel in the input image transparent:
  4993. @example
  4994. ffmpeg -i input.png -vf colorkey=green out.png
  4995. @end example
  4996. @item
  4997. Overlay a greenscreen-video on top of a static background image.
  4998. @example
  4999. 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
  5000. @end example
  5001. @end itemize
  5002. @section colorlevels
  5003. Adjust video input frames using levels.
  5004. The filter accepts the following options:
  5005. @table @option
  5006. @item rimin
  5007. @item gimin
  5008. @item bimin
  5009. @item aimin
  5010. Adjust red, green, blue and alpha input black point.
  5011. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5012. @item rimax
  5013. @item gimax
  5014. @item bimax
  5015. @item aimax
  5016. Adjust red, green, blue and alpha input white point.
  5017. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5018. Input levels are used to lighten highlights (bright tones), darken shadows
  5019. (dark tones), change the balance of bright and dark tones.
  5020. @item romin
  5021. @item gomin
  5022. @item bomin
  5023. @item aomin
  5024. Adjust red, green, blue and alpha output black point.
  5025. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5026. @item romax
  5027. @item gomax
  5028. @item bomax
  5029. @item aomax
  5030. Adjust red, green, blue and alpha output white point.
  5031. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5032. Output levels allows manual selection of a constrained output level range.
  5033. @end table
  5034. @subsection Examples
  5035. @itemize
  5036. @item
  5037. Make video output darker:
  5038. @example
  5039. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5040. @end example
  5041. @item
  5042. Increase contrast:
  5043. @example
  5044. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5045. @end example
  5046. @item
  5047. Make video output lighter:
  5048. @example
  5049. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5050. @end example
  5051. @item
  5052. Increase brightness:
  5053. @example
  5054. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5055. @end example
  5056. @end itemize
  5057. @section colorchannelmixer
  5058. Adjust video input frames by re-mixing color channels.
  5059. This filter modifies a color channel by adding the values associated to
  5060. the other channels of the same pixels. For example if the value to
  5061. modify is red, the output value will be:
  5062. @example
  5063. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5064. @end example
  5065. The filter accepts the following options:
  5066. @table @option
  5067. @item rr
  5068. @item rg
  5069. @item rb
  5070. @item ra
  5071. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5072. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5073. @item gr
  5074. @item gg
  5075. @item gb
  5076. @item ga
  5077. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5078. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5079. @item br
  5080. @item bg
  5081. @item bb
  5082. @item ba
  5083. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5084. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5085. @item ar
  5086. @item ag
  5087. @item ab
  5088. @item aa
  5089. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5090. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5091. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5092. @end table
  5093. @subsection Examples
  5094. @itemize
  5095. @item
  5096. Convert source to grayscale:
  5097. @example
  5098. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5099. @end example
  5100. @item
  5101. Simulate sepia tones:
  5102. @example
  5103. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5104. @end example
  5105. @end itemize
  5106. @section colormatrix
  5107. Convert color matrix.
  5108. The filter accepts the following options:
  5109. @table @option
  5110. @item src
  5111. @item dst
  5112. Specify the source and destination color matrix. Both values must be
  5113. specified.
  5114. The accepted values are:
  5115. @table @samp
  5116. @item bt709
  5117. BT.709
  5118. @item fcc
  5119. FCC
  5120. @item bt601
  5121. BT.601
  5122. @item bt470
  5123. BT.470
  5124. @item bt470bg
  5125. BT.470BG
  5126. @item smpte170m
  5127. SMPTE-170M
  5128. @item smpte240m
  5129. SMPTE-240M
  5130. @item bt2020
  5131. BT.2020
  5132. @end table
  5133. @end table
  5134. For example to convert from BT.601 to SMPTE-240M, use the command:
  5135. @example
  5136. colormatrix=bt601:smpte240m
  5137. @end example
  5138. @section colorspace
  5139. Convert colorspace, transfer characteristics or color primaries.
  5140. Input video needs to have an even size.
  5141. The filter accepts the following options:
  5142. @table @option
  5143. @anchor{all}
  5144. @item all
  5145. Specify all color properties at once.
  5146. The accepted values are:
  5147. @table @samp
  5148. @item bt470m
  5149. BT.470M
  5150. @item bt470bg
  5151. BT.470BG
  5152. @item bt601-6-525
  5153. BT.601-6 525
  5154. @item bt601-6-625
  5155. BT.601-6 625
  5156. @item bt709
  5157. BT.709
  5158. @item smpte170m
  5159. SMPTE-170M
  5160. @item smpte240m
  5161. SMPTE-240M
  5162. @item bt2020
  5163. BT.2020
  5164. @end table
  5165. @anchor{space}
  5166. @item space
  5167. Specify output colorspace.
  5168. The accepted values are:
  5169. @table @samp
  5170. @item bt709
  5171. BT.709
  5172. @item fcc
  5173. FCC
  5174. @item bt470bg
  5175. BT.470BG or BT.601-6 625
  5176. @item smpte170m
  5177. SMPTE-170M or BT.601-6 525
  5178. @item smpte240m
  5179. SMPTE-240M
  5180. @item ycgco
  5181. YCgCo
  5182. @item bt2020ncl
  5183. BT.2020 with non-constant luminance
  5184. @end table
  5185. @anchor{trc}
  5186. @item trc
  5187. Specify output transfer characteristics.
  5188. The accepted values are:
  5189. @table @samp
  5190. @item bt709
  5191. BT.709
  5192. @item bt470m
  5193. BT.470M
  5194. @item bt470bg
  5195. BT.470BG
  5196. @item gamma22
  5197. Constant gamma of 2.2
  5198. @item gamma28
  5199. Constant gamma of 2.8
  5200. @item smpte170m
  5201. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5202. @item smpte240m
  5203. SMPTE-240M
  5204. @item srgb
  5205. SRGB
  5206. @item iec61966-2-1
  5207. iec61966-2-1
  5208. @item iec61966-2-4
  5209. iec61966-2-4
  5210. @item xvycc
  5211. xvycc
  5212. @item bt2020-10
  5213. BT.2020 for 10-bits content
  5214. @item bt2020-12
  5215. BT.2020 for 12-bits content
  5216. @end table
  5217. @anchor{primaries}
  5218. @item primaries
  5219. Specify output color primaries.
  5220. The accepted values are:
  5221. @table @samp
  5222. @item bt709
  5223. BT.709
  5224. @item bt470m
  5225. BT.470M
  5226. @item bt470bg
  5227. BT.470BG or BT.601-6 625
  5228. @item smpte170m
  5229. SMPTE-170M or BT.601-6 525
  5230. @item smpte240m
  5231. SMPTE-240M
  5232. @item film
  5233. film
  5234. @item smpte431
  5235. SMPTE-431
  5236. @item smpte432
  5237. SMPTE-432
  5238. @item bt2020
  5239. BT.2020
  5240. @item jedec-p22
  5241. JEDEC P22 phosphors
  5242. @end table
  5243. @anchor{range}
  5244. @item range
  5245. Specify output color range.
  5246. The accepted values are:
  5247. @table @samp
  5248. @item tv
  5249. TV (restricted) range
  5250. @item mpeg
  5251. MPEG (restricted) range
  5252. @item pc
  5253. PC (full) range
  5254. @item jpeg
  5255. JPEG (full) range
  5256. @end table
  5257. @item format
  5258. Specify output color format.
  5259. The accepted values are:
  5260. @table @samp
  5261. @item yuv420p
  5262. YUV 4:2:0 planar 8-bits
  5263. @item yuv420p10
  5264. YUV 4:2:0 planar 10-bits
  5265. @item yuv420p12
  5266. YUV 4:2:0 planar 12-bits
  5267. @item yuv422p
  5268. YUV 4:2:2 planar 8-bits
  5269. @item yuv422p10
  5270. YUV 4:2:2 planar 10-bits
  5271. @item yuv422p12
  5272. YUV 4:2:2 planar 12-bits
  5273. @item yuv444p
  5274. YUV 4:4:4 planar 8-bits
  5275. @item yuv444p10
  5276. YUV 4:4:4 planar 10-bits
  5277. @item yuv444p12
  5278. YUV 4:4:4 planar 12-bits
  5279. @end table
  5280. @item fast
  5281. Do a fast conversion, which skips gamma/primary correction. This will take
  5282. significantly less CPU, but will be mathematically incorrect. To get output
  5283. compatible with that produced by the colormatrix filter, use fast=1.
  5284. @item dither
  5285. Specify dithering mode.
  5286. The accepted values are:
  5287. @table @samp
  5288. @item none
  5289. No dithering
  5290. @item fsb
  5291. Floyd-Steinberg dithering
  5292. @end table
  5293. @item wpadapt
  5294. Whitepoint adaptation mode.
  5295. The accepted values are:
  5296. @table @samp
  5297. @item bradford
  5298. Bradford whitepoint adaptation
  5299. @item vonkries
  5300. von Kries whitepoint adaptation
  5301. @item identity
  5302. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5303. @end table
  5304. @item iall
  5305. Override all input properties at once. Same accepted values as @ref{all}.
  5306. @item ispace
  5307. Override input colorspace. Same accepted values as @ref{space}.
  5308. @item iprimaries
  5309. Override input color primaries. Same accepted values as @ref{primaries}.
  5310. @item itrc
  5311. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5312. @item irange
  5313. Override input color range. Same accepted values as @ref{range}.
  5314. @end table
  5315. The filter converts the transfer characteristics, color space and color
  5316. primaries to the specified user values. The output value, if not specified,
  5317. is set to a default value based on the "all" property. If that property is
  5318. also not specified, the filter will log an error. The output color range and
  5319. format default to the same value as the input color range and format. The
  5320. input transfer characteristics, color space, color primaries and color range
  5321. should be set on the input data. If any of these are missing, the filter will
  5322. log an error and no conversion will take place.
  5323. For example to convert the input to SMPTE-240M, use the command:
  5324. @example
  5325. colorspace=smpte240m
  5326. @end example
  5327. @section convolution
  5328. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5329. The filter accepts the following options:
  5330. @table @option
  5331. @item 0m
  5332. @item 1m
  5333. @item 2m
  5334. @item 3m
  5335. Set matrix for each plane.
  5336. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5337. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5338. @item 0rdiv
  5339. @item 1rdiv
  5340. @item 2rdiv
  5341. @item 3rdiv
  5342. Set multiplier for calculated value for each plane.
  5343. If unset or 0, it will be sum of all matrix elements.
  5344. @item 0bias
  5345. @item 1bias
  5346. @item 2bias
  5347. @item 3bias
  5348. Set bias for each plane. This value is added to the result of the multiplication.
  5349. Useful for making the overall image brighter or darker. Default is 0.0.
  5350. @item 0mode
  5351. @item 1mode
  5352. @item 2mode
  5353. @item 3mode
  5354. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5355. Default is @var{square}.
  5356. @end table
  5357. @subsection Examples
  5358. @itemize
  5359. @item
  5360. Apply sharpen:
  5361. @example
  5362. 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"
  5363. @end example
  5364. @item
  5365. Apply blur:
  5366. @example
  5367. 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"
  5368. @end example
  5369. @item
  5370. Apply edge enhance:
  5371. @example
  5372. 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"
  5373. @end example
  5374. @item
  5375. Apply edge detect:
  5376. @example
  5377. 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"
  5378. @end example
  5379. @item
  5380. Apply laplacian edge detector which includes diagonals:
  5381. @example
  5382. 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"
  5383. @end example
  5384. @item
  5385. Apply emboss:
  5386. @example
  5387. 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"
  5388. @end example
  5389. @end itemize
  5390. @section convolve
  5391. Apply 2D convolution of video stream in frequency domain using second stream
  5392. as impulse.
  5393. The filter accepts the following options:
  5394. @table @option
  5395. @item planes
  5396. Set which planes to process.
  5397. @item impulse
  5398. Set which impulse video frames will be processed, can be @var{first}
  5399. or @var{all}. Default is @var{all}.
  5400. @end table
  5401. The @code{convolve} filter also supports the @ref{framesync} options.
  5402. @section copy
  5403. Copy the input video source unchanged to the output. This is mainly useful for
  5404. testing purposes.
  5405. @anchor{coreimage}
  5406. @section coreimage
  5407. Video filtering on GPU using Apple's CoreImage API on OSX.
  5408. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5409. processed by video hardware. However, software-based OpenGL implementations
  5410. exist which means there is no guarantee for hardware processing. It depends on
  5411. the respective OSX.
  5412. There are many filters and image generators provided by Apple that come with a
  5413. large variety of options. The filter has to be referenced by its name along
  5414. with its options.
  5415. The coreimage filter accepts the following options:
  5416. @table @option
  5417. @item list_filters
  5418. List all available filters and generators along with all their respective
  5419. options as well as possible minimum and maximum values along with the default
  5420. values.
  5421. @example
  5422. list_filters=true
  5423. @end example
  5424. @item filter
  5425. Specify all filters by their respective name and options.
  5426. Use @var{list_filters} to determine all valid filter names and options.
  5427. Numerical options are specified by a float value and are automatically clamped
  5428. to their respective value range. Vector and color options have to be specified
  5429. by a list of space separated float values. Character escaping has to be done.
  5430. A special option name @code{default} is available to use default options for a
  5431. filter.
  5432. It is required to specify either @code{default} or at least one of the filter options.
  5433. All omitted options are used with their default values.
  5434. The syntax of the filter string is as follows:
  5435. @example
  5436. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5437. @end example
  5438. @item output_rect
  5439. Specify a rectangle where the output of the filter chain is copied into the
  5440. input image. It is given by a list of space separated float values:
  5441. @example
  5442. output_rect=x\ y\ width\ height
  5443. @end example
  5444. If not given, the output rectangle equals the dimensions of the input image.
  5445. The output rectangle is automatically cropped at the borders of the input
  5446. image. Negative values are valid for each component.
  5447. @example
  5448. output_rect=25\ 25\ 100\ 100
  5449. @end example
  5450. @end table
  5451. Several filters can be chained for successive processing without GPU-HOST
  5452. transfers allowing for fast processing of complex filter chains.
  5453. Currently, only filters with zero (generators) or exactly one (filters) input
  5454. image and one output image are supported. Also, transition filters are not yet
  5455. usable as intended.
  5456. Some filters generate output images with additional padding depending on the
  5457. respective filter kernel. The padding is automatically removed to ensure the
  5458. filter output has the same size as the input image.
  5459. For image generators, the size of the output image is determined by the
  5460. previous output image of the filter chain or the input image of the whole
  5461. filterchain, respectively. The generators do not use the pixel information of
  5462. this image to generate their output. However, the generated output is
  5463. blended onto this image, resulting in partial or complete coverage of the
  5464. output image.
  5465. The @ref{coreimagesrc} video source can be used for generating input images
  5466. which are directly fed into the filter chain. By using it, providing input
  5467. images by another video source or an input video is not required.
  5468. @subsection Examples
  5469. @itemize
  5470. @item
  5471. List all filters available:
  5472. @example
  5473. coreimage=list_filters=true
  5474. @end example
  5475. @item
  5476. Use the CIBoxBlur filter with default options to blur an image:
  5477. @example
  5478. coreimage=filter=CIBoxBlur@@default
  5479. @end example
  5480. @item
  5481. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5482. its center at 100x100 and a radius of 50 pixels:
  5483. @example
  5484. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5485. @end example
  5486. @item
  5487. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5488. given as complete and escaped command-line for Apple's standard bash shell:
  5489. @example
  5490. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5491. @end example
  5492. @end itemize
  5493. @section crop
  5494. Crop the input video to given dimensions.
  5495. It accepts the following parameters:
  5496. @table @option
  5497. @item w, out_w
  5498. The width of the output video. It defaults to @code{iw}.
  5499. This expression is evaluated only once during the filter
  5500. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5501. @item h, out_h
  5502. The height of the output video. It defaults to @code{ih}.
  5503. This expression is evaluated only once during the filter
  5504. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5505. @item x
  5506. The horizontal position, in the input video, of the left edge of the output
  5507. video. It defaults to @code{(in_w-out_w)/2}.
  5508. This expression is evaluated per-frame.
  5509. @item y
  5510. The vertical position, in the input video, of the top edge of the output video.
  5511. It defaults to @code{(in_h-out_h)/2}.
  5512. This expression is evaluated per-frame.
  5513. @item keep_aspect
  5514. If set to 1 will force the output display aspect ratio
  5515. to be the same of the input, by changing the output sample aspect
  5516. ratio. It defaults to 0.
  5517. @item exact
  5518. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5519. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5520. It defaults to 0.
  5521. @end table
  5522. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5523. expressions containing the following constants:
  5524. @table @option
  5525. @item x
  5526. @item y
  5527. The computed values for @var{x} and @var{y}. They are evaluated for
  5528. each new frame.
  5529. @item in_w
  5530. @item in_h
  5531. The input width and height.
  5532. @item iw
  5533. @item ih
  5534. These are the same as @var{in_w} and @var{in_h}.
  5535. @item out_w
  5536. @item out_h
  5537. The output (cropped) width and height.
  5538. @item ow
  5539. @item oh
  5540. These are the same as @var{out_w} and @var{out_h}.
  5541. @item a
  5542. same as @var{iw} / @var{ih}
  5543. @item sar
  5544. input sample aspect ratio
  5545. @item dar
  5546. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5547. @item hsub
  5548. @item vsub
  5549. horizontal and vertical chroma subsample values. For example for the
  5550. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5551. @item n
  5552. The number of the input frame, starting from 0.
  5553. @item pos
  5554. the position in the file of the input frame, NAN if unknown
  5555. @item t
  5556. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5557. @end table
  5558. The expression for @var{out_w} may depend on the value of @var{out_h},
  5559. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5560. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5561. evaluated after @var{out_w} and @var{out_h}.
  5562. The @var{x} and @var{y} parameters specify the expressions for the
  5563. position of the top-left corner of the output (non-cropped) area. They
  5564. are evaluated for each frame. If the evaluated value is not valid, it
  5565. is approximated to the nearest valid value.
  5566. The expression for @var{x} may depend on @var{y}, and the expression
  5567. for @var{y} may depend on @var{x}.
  5568. @subsection Examples
  5569. @itemize
  5570. @item
  5571. Crop area with size 100x100 at position (12,34).
  5572. @example
  5573. crop=100:100:12:34
  5574. @end example
  5575. Using named options, the example above becomes:
  5576. @example
  5577. crop=w=100:h=100:x=12:y=34
  5578. @end example
  5579. @item
  5580. Crop the central input area with size 100x100:
  5581. @example
  5582. crop=100:100
  5583. @end example
  5584. @item
  5585. Crop the central input area with size 2/3 of the input video:
  5586. @example
  5587. crop=2/3*in_w:2/3*in_h
  5588. @end example
  5589. @item
  5590. Crop the input video central square:
  5591. @example
  5592. crop=out_w=in_h
  5593. crop=in_h
  5594. @end example
  5595. @item
  5596. Delimit the rectangle with the top-left corner placed at position
  5597. 100:100 and the right-bottom corner corresponding to the right-bottom
  5598. corner of the input image.
  5599. @example
  5600. crop=in_w-100:in_h-100:100:100
  5601. @end example
  5602. @item
  5603. Crop 10 pixels from the left and right borders, and 20 pixels from
  5604. the top and bottom borders
  5605. @example
  5606. crop=in_w-2*10:in_h-2*20
  5607. @end example
  5608. @item
  5609. Keep only the bottom right quarter of the input image:
  5610. @example
  5611. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5612. @end example
  5613. @item
  5614. Crop height for getting Greek harmony:
  5615. @example
  5616. crop=in_w:1/PHI*in_w
  5617. @end example
  5618. @item
  5619. Apply trembling effect:
  5620. @example
  5621. 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)
  5622. @end example
  5623. @item
  5624. Apply erratic camera effect depending on timestamp:
  5625. @example
  5626. 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)"
  5627. @end example
  5628. @item
  5629. Set x depending on the value of y:
  5630. @example
  5631. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5632. @end example
  5633. @end itemize
  5634. @subsection Commands
  5635. This filter supports the following commands:
  5636. @table @option
  5637. @item w, out_w
  5638. @item h, out_h
  5639. @item x
  5640. @item y
  5641. Set width/height of the output video and the horizontal/vertical position
  5642. in the input video.
  5643. The command accepts the same syntax of the corresponding option.
  5644. If the specified expression is not valid, it is kept at its current
  5645. value.
  5646. @end table
  5647. @section cropdetect
  5648. Auto-detect the crop size.
  5649. It calculates the necessary cropping parameters and prints the
  5650. recommended parameters via the logging system. The detected dimensions
  5651. correspond to the non-black area of the input video.
  5652. It accepts the following parameters:
  5653. @table @option
  5654. @item limit
  5655. Set higher black value threshold, which can be optionally specified
  5656. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5657. value greater to the set value is considered non-black. It defaults to 24.
  5658. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5659. on the bitdepth of the pixel format.
  5660. @item round
  5661. The value which the width/height should be divisible by. It defaults to
  5662. 16. The offset is automatically adjusted to center the video. Use 2 to
  5663. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5664. encoding to most video codecs.
  5665. @item reset_count, reset
  5666. Set the counter that determines after how many frames cropdetect will
  5667. reset the previously detected largest video area and start over to
  5668. detect the current optimal crop area. Default value is 0.
  5669. This can be useful when channel logos distort the video area. 0
  5670. indicates 'never reset', and returns the largest area encountered during
  5671. playback.
  5672. @end table
  5673. @anchor{cue}
  5674. @section cue
  5675. Delay video filtering until a given wallclock timestamp. The filter first
  5676. passes on @option{preroll} amount of frames, then it buffers at most
  5677. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5678. it forwards the buffered frames and also any subsequent frames coming in its
  5679. input.
  5680. The filter can be used synchronize the output of multiple ffmpeg processes for
  5681. realtime output devices like decklink. By putting the delay in the filtering
  5682. chain and pre-buffering frames the process can pass on data to output almost
  5683. immediately after the target wallclock timestamp is reached.
  5684. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5685. some use cases.
  5686. @table @option
  5687. @item cue
  5688. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5689. @item preroll
  5690. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5691. @item buffer
  5692. The maximum duration of content to buffer before waiting for the cue expressed
  5693. in seconds. Default is 0.
  5694. @end table
  5695. @anchor{curves}
  5696. @section curves
  5697. Apply color adjustments using curves.
  5698. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5699. component (red, green and blue) has its values defined by @var{N} key points
  5700. tied from each other using a smooth curve. The x-axis represents the pixel
  5701. values from the input frame, and the y-axis the new pixel values to be set for
  5702. the output frame.
  5703. By default, a component curve is defined by the two points @var{(0;0)} and
  5704. @var{(1;1)}. This creates a straight line where each original pixel value is
  5705. "adjusted" to its own value, which means no change to the image.
  5706. The filter allows you to redefine these two points and add some more. A new
  5707. curve (using a natural cubic spline interpolation) will be define to pass
  5708. smoothly through all these new coordinates. The new defined points needs to be
  5709. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5710. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5711. the vector spaces, the values will be clipped accordingly.
  5712. The filter accepts the following options:
  5713. @table @option
  5714. @item preset
  5715. Select one of the available color presets. This option can be used in addition
  5716. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5717. options takes priority on the preset values.
  5718. Available presets are:
  5719. @table @samp
  5720. @item none
  5721. @item color_negative
  5722. @item cross_process
  5723. @item darker
  5724. @item increase_contrast
  5725. @item lighter
  5726. @item linear_contrast
  5727. @item medium_contrast
  5728. @item negative
  5729. @item strong_contrast
  5730. @item vintage
  5731. @end table
  5732. Default is @code{none}.
  5733. @item master, m
  5734. Set the master key points. These points will define a second pass mapping. It
  5735. is sometimes called a "luminance" or "value" mapping. It can be used with
  5736. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5737. post-processing LUT.
  5738. @item red, r
  5739. Set the key points for the red component.
  5740. @item green, g
  5741. Set the key points for the green component.
  5742. @item blue, b
  5743. Set the key points for the blue component.
  5744. @item all
  5745. Set the key points for all components (not including master).
  5746. Can be used in addition to the other key points component
  5747. options. In this case, the unset component(s) will fallback on this
  5748. @option{all} setting.
  5749. @item psfile
  5750. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5751. @item plot
  5752. Save Gnuplot script of the curves in specified file.
  5753. @end table
  5754. To avoid some filtergraph syntax conflicts, each key points list need to be
  5755. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5756. @subsection Examples
  5757. @itemize
  5758. @item
  5759. Increase slightly the middle level of blue:
  5760. @example
  5761. curves=blue='0/0 0.5/0.58 1/1'
  5762. @end example
  5763. @item
  5764. Vintage effect:
  5765. @example
  5766. 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'
  5767. @end example
  5768. Here we obtain the following coordinates for each components:
  5769. @table @var
  5770. @item red
  5771. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5772. @item green
  5773. @code{(0;0) (0.50;0.48) (1;1)}
  5774. @item blue
  5775. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5776. @end table
  5777. @item
  5778. The previous example can also be achieved with the associated built-in preset:
  5779. @example
  5780. curves=preset=vintage
  5781. @end example
  5782. @item
  5783. Or simply:
  5784. @example
  5785. curves=vintage
  5786. @end example
  5787. @item
  5788. Use a Photoshop preset and redefine the points of the green component:
  5789. @example
  5790. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5791. @end example
  5792. @item
  5793. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5794. and @command{gnuplot}:
  5795. @example
  5796. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5797. gnuplot -p /tmp/curves.plt
  5798. @end example
  5799. @end itemize
  5800. @section datascope
  5801. Video data analysis filter.
  5802. This filter shows hexadecimal pixel values of part of video.
  5803. The filter accepts the following options:
  5804. @table @option
  5805. @item size, s
  5806. Set output video size.
  5807. @item x
  5808. Set x offset from where to pick pixels.
  5809. @item y
  5810. Set y offset from where to pick pixels.
  5811. @item mode
  5812. Set scope mode, can be one of the following:
  5813. @table @samp
  5814. @item mono
  5815. Draw hexadecimal pixel values with white color on black background.
  5816. @item color
  5817. Draw hexadecimal pixel values with input video pixel color on black
  5818. background.
  5819. @item color2
  5820. Draw hexadecimal pixel values on color background picked from input video,
  5821. the text color is picked in such way so its always visible.
  5822. @end table
  5823. @item axis
  5824. Draw rows and columns numbers on left and top of video.
  5825. @item opacity
  5826. Set background opacity.
  5827. @end table
  5828. @section dctdnoiz
  5829. Denoise frames using 2D DCT (frequency domain filtering).
  5830. This filter is not designed for real time.
  5831. The filter accepts the following options:
  5832. @table @option
  5833. @item sigma, s
  5834. Set the noise sigma constant.
  5835. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5836. coefficient (absolute value) below this threshold with be dropped.
  5837. If you need a more advanced filtering, see @option{expr}.
  5838. Default is @code{0}.
  5839. @item overlap
  5840. Set number overlapping pixels for each block. Since the filter can be slow, you
  5841. may want to reduce this value, at the cost of a less effective filter and the
  5842. risk of various artefacts.
  5843. If the overlapping value doesn't permit processing the whole input width or
  5844. height, a warning will be displayed and according borders won't be denoised.
  5845. Default value is @var{blocksize}-1, which is the best possible setting.
  5846. @item expr, e
  5847. Set the coefficient factor expression.
  5848. For each coefficient of a DCT block, this expression will be evaluated as a
  5849. multiplier value for the coefficient.
  5850. If this is option is set, the @option{sigma} option will be ignored.
  5851. The absolute value of the coefficient can be accessed through the @var{c}
  5852. variable.
  5853. @item n
  5854. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5855. @var{blocksize}, which is the width and height of the processed blocks.
  5856. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5857. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5858. on the speed processing. Also, a larger block size does not necessarily means a
  5859. better de-noising.
  5860. @end table
  5861. @subsection Examples
  5862. Apply a denoise with a @option{sigma} of @code{4.5}:
  5863. @example
  5864. dctdnoiz=4.5
  5865. @end example
  5866. The same operation can be achieved using the expression system:
  5867. @example
  5868. dctdnoiz=e='gte(c, 4.5*3)'
  5869. @end example
  5870. Violent denoise using a block size of @code{16x16}:
  5871. @example
  5872. dctdnoiz=15:n=4
  5873. @end example
  5874. @section deband
  5875. Remove banding artifacts from input video.
  5876. It works by replacing banded pixels with average value of referenced pixels.
  5877. The filter accepts the following options:
  5878. @table @option
  5879. @item 1thr
  5880. @item 2thr
  5881. @item 3thr
  5882. @item 4thr
  5883. Set banding detection threshold for each plane. Default is 0.02.
  5884. Valid range is 0.00003 to 0.5.
  5885. If difference between current pixel and reference pixel is less than threshold,
  5886. it will be considered as banded.
  5887. @item range, r
  5888. Banding detection range in pixels. Default is 16. If positive, random number
  5889. in range 0 to set value will be used. If negative, exact absolute value
  5890. will be used.
  5891. The range defines square of four pixels around current pixel.
  5892. @item direction, d
  5893. Set direction in radians from which four pixel will be compared. If positive,
  5894. random direction from 0 to set direction will be picked. If negative, exact of
  5895. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5896. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5897. column.
  5898. @item blur, b
  5899. If enabled, current pixel is compared with average value of all four
  5900. surrounding pixels. The default is enabled. If disabled current pixel is
  5901. compared with all four surrounding pixels. The pixel is considered banded
  5902. if only all four differences with surrounding pixels are less than threshold.
  5903. @item coupling, c
  5904. If enabled, current pixel is changed if and only if all pixel components are banded,
  5905. e.g. banding detection threshold is triggered for all color components.
  5906. The default is disabled.
  5907. @end table
  5908. @section deblock
  5909. Remove blocking artifacts from input video.
  5910. The filter accepts the following options:
  5911. @table @option
  5912. @item filter
  5913. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  5914. This controls what kind of deblocking is applied.
  5915. @item block
  5916. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  5917. @item alpha
  5918. @item beta
  5919. @item gamma
  5920. @item delta
  5921. Set blocking detection thresholds. Allowed range is 0 to 1.
  5922. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  5923. Using higher threshold gives more deblocking strength.
  5924. Setting @var{alpha} controls threshold detection at exact edge of block.
  5925. Remaining options controls threshold detection near the edge. Each one for
  5926. below/above or left/right. Setting any of those to @var{0} disables
  5927. deblocking.
  5928. @item planes
  5929. Set planes to filter. Default is to filter all available planes.
  5930. @end table
  5931. @subsection Examples
  5932. @itemize
  5933. @item
  5934. Deblock using weak filter and block size of 4 pixels.
  5935. @example
  5936. deblock=filter=weak:block=4
  5937. @end example
  5938. @item
  5939. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  5940. deblocking more edges.
  5941. @example
  5942. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  5943. @end example
  5944. @item
  5945. Similar as above, but filter only first plane.
  5946. @example
  5947. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  5948. @end example
  5949. @item
  5950. Similar as above, but filter only second and third plane.
  5951. @example
  5952. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  5953. @end example
  5954. @end itemize
  5955. @anchor{decimate}
  5956. @section decimate
  5957. Drop duplicated frames at regular intervals.
  5958. The filter accepts the following options:
  5959. @table @option
  5960. @item cycle
  5961. Set the number of frames from which one will be dropped. Setting this to
  5962. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5963. Default is @code{5}.
  5964. @item dupthresh
  5965. Set the threshold for duplicate detection. If the difference metric for a frame
  5966. is less than or equal to this value, then it is declared as duplicate. Default
  5967. is @code{1.1}
  5968. @item scthresh
  5969. Set scene change threshold. Default is @code{15}.
  5970. @item blockx
  5971. @item blocky
  5972. Set the size of the x and y-axis blocks used during metric calculations.
  5973. Larger blocks give better noise suppression, but also give worse detection of
  5974. small movements. Must be a power of two. Default is @code{32}.
  5975. @item ppsrc
  5976. Mark main input as a pre-processed input and activate clean source input
  5977. stream. This allows the input to be pre-processed with various filters to help
  5978. the metrics calculation while keeping the frame selection lossless. When set to
  5979. @code{1}, the first stream is for the pre-processed input, and the second
  5980. stream is the clean source from where the kept frames are chosen. Default is
  5981. @code{0}.
  5982. @item chroma
  5983. Set whether or not chroma is considered in the metric calculations. Default is
  5984. @code{1}.
  5985. @end table
  5986. @section deconvolve
  5987. Apply 2D deconvolution of video stream in frequency domain using second stream
  5988. as impulse.
  5989. The filter accepts the following options:
  5990. @table @option
  5991. @item planes
  5992. Set which planes to process.
  5993. @item impulse
  5994. Set which impulse video frames will be processed, can be @var{first}
  5995. or @var{all}. Default is @var{all}.
  5996. @item noise
  5997. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5998. and height are not same and not power of 2 or if stream prior to convolving
  5999. had noise.
  6000. @end table
  6001. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6002. @section dedot
  6003. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6004. It accepts the following options:
  6005. @table @option
  6006. @item m
  6007. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6008. @var{rainbows} for cross-color reduction.
  6009. @item lt
  6010. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6011. @item tl
  6012. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6013. @item tc
  6014. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6015. @item ct
  6016. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6017. @end table
  6018. @section deflate
  6019. Apply deflate effect to the video.
  6020. This filter replaces the pixel by the local(3x3) average by taking into account
  6021. only values lower than the pixel.
  6022. It accepts the following options:
  6023. @table @option
  6024. @item threshold0
  6025. @item threshold1
  6026. @item threshold2
  6027. @item threshold3
  6028. Limit the maximum change for each plane, default is 65535.
  6029. If 0, plane will remain unchanged.
  6030. @end table
  6031. @section deflicker
  6032. Remove temporal frame luminance variations.
  6033. It accepts the following options:
  6034. @table @option
  6035. @item size, s
  6036. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6037. @item mode, m
  6038. Set averaging mode to smooth temporal luminance variations.
  6039. Available values are:
  6040. @table @samp
  6041. @item am
  6042. Arithmetic mean
  6043. @item gm
  6044. Geometric mean
  6045. @item hm
  6046. Harmonic mean
  6047. @item qm
  6048. Quadratic mean
  6049. @item cm
  6050. Cubic mean
  6051. @item pm
  6052. Power mean
  6053. @item median
  6054. Median
  6055. @end table
  6056. @item bypass
  6057. Do not actually modify frame. Useful when one only wants metadata.
  6058. @end table
  6059. @section dejudder
  6060. Remove judder produced by partially interlaced telecined content.
  6061. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6062. source was partially telecined content then the output of @code{pullup,dejudder}
  6063. will have a variable frame rate. May change the recorded frame rate of the
  6064. container. Aside from that change, this filter will not affect constant frame
  6065. rate video.
  6066. The option available in this filter is:
  6067. @table @option
  6068. @item cycle
  6069. Specify the length of the window over which the judder repeats.
  6070. Accepts any integer greater than 1. Useful values are:
  6071. @table @samp
  6072. @item 4
  6073. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6074. @item 5
  6075. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6076. @item 20
  6077. If a mixture of the two.
  6078. @end table
  6079. The default is @samp{4}.
  6080. @end table
  6081. @section delogo
  6082. Suppress a TV station logo by a simple interpolation of the surrounding
  6083. pixels. Just set a rectangle covering the logo and watch it disappear
  6084. (and sometimes something even uglier appear - your mileage may vary).
  6085. It accepts the following parameters:
  6086. @table @option
  6087. @item x
  6088. @item y
  6089. Specify the top left corner coordinates of the logo. They must be
  6090. specified.
  6091. @item w
  6092. @item h
  6093. Specify the width and height of the logo to clear. They must be
  6094. specified.
  6095. @item band, t
  6096. Specify the thickness of the fuzzy edge of the rectangle (added to
  6097. @var{w} and @var{h}). The default value is 1. This option is
  6098. deprecated, setting higher values should no longer be necessary and
  6099. is not recommended.
  6100. @item show
  6101. When set to 1, a green rectangle is drawn on the screen to simplify
  6102. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6103. The default value is 0.
  6104. The rectangle is drawn on the outermost pixels which will be (partly)
  6105. replaced with interpolated values. The values of the next pixels
  6106. immediately outside this rectangle in each direction will be used to
  6107. compute the interpolated pixel values inside the rectangle.
  6108. @end table
  6109. @subsection Examples
  6110. @itemize
  6111. @item
  6112. Set a rectangle covering the area with top left corner coordinates 0,0
  6113. and size 100x77, and a band of size 10:
  6114. @example
  6115. delogo=x=0:y=0:w=100:h=77:band=10
  6116. @end example
  6117. @end itemize
  6118. @section deshake
  6119. Attempt to fix small changes in horizontal and/or vertical shift. This
  6120. filter helps remove camera shake from hand-holding a camera, bumping a
  6121. tripod, moving on a vehicle, etc.
  6122. The filter accepts the following options:
  6123. @table @option
  6124. @item x
  6125. @item y
  6126. @item w
  6127. @item h
  6128. Specify a rectangular area where to limit the search for motion
  6129. vectors.
  6130. If desired the search for motion vectors can be limited to a
  6131. rectangular area of the frame defined by its top left corner, width
  6132. and height. These parameters have the same meaning as the drawbox
  6133. filter which can be used to visualise the position of the bounding
  6134. box.
  6135. This is useful when simultaneous movement of subjects within the frame
  6136. might be confused for camera motion by the motion vector search.
  6137. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6138. then the full frame is used. This allows later options to be set
  6139. without specifying the bounding box for the motion vector search.
  6140. Default - search the whole frame.
  6141. @item rx
  6142. @item ry
  6143. Specify the maximum extent of movement in x and y directions in the
  6144. range 0-64 pixels. Default 16.
  6145. @item edge
  6146. Specify how to generate pixels to fill blanks at the edge of the
  6147. frame. Available values are:
  6148. @table @samp
  6149. @item blank, 0
  6150. Fill zeroes at blank locations
  6151. @item original, 1
  6152. Original image at blank locations
  6153. @item clamp, 2
  6154. Extruded edge value at blank locations
  6155. @item mirror, 3
  6156. Mirrored edge at blank locations
  6157. @end table
  6158. Default value is @samp{mirror}.
  6159. @item blocksize
  6160. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6161. default 8.
  6162. @item contrast
  6163. Specify the contrast threshold for blocks. Only blocks with more than
  6164. the specified contrast (difference between darkest and lightest
  6165. pixels) will be considered. Range 1-255, default 125.
  6166. @item search
  6167. Specify the search strategy. Available values are:
  6168. @table @samp
  6169. @item exhaustive, 0
  6170. Set exhaustive search
  6171. @item less, 1
  6172. Set less exhaustive search.
  6173. @end table
  6174. Default value is @samp{exhaustive}.
  6175. @item filename
  6176. If set then a detailed log of the motion search is written to the
  6177. specified file.
  6178. @end table
  6179. @section despill
  6180. Remove unwanted contamination of foreground colors, caused by reflected color of
  6181. greenscreen or bluescreen.
  6182. This filter accepts the following options:
  6183. @table @option
  6184. @item type
  6185. Set what type of despill to use.
  6186. @item mix
  6187. Set how spillmap will be generated.
  6188. @item expand
  6189. Set how much to get rid of still remaining spill.
  6190. @item red
  6191. Controls amount of red in spill area.
  6192. @item green
  6193. Controls amount of green in spill area.
  6194. Should be -1 for greenscreen.
  6195. @item blue
  6196. Controls amount of blue in spill area.
  6197. Should be -1 for bluescreen.
  6198. @item brightness
  6199. Controls brightness of spill area, preserving colors.
  6200. @item alpha
  6201. Modify alpha from generated spillmap.
  6202. @end table
  6203. @section detelecine
  6204. Apply an exact inverse of the telecine operation. It requires a predefined
  6205. pattern specified using the pattern option which must be the same as that passed
  6206. to the telecine filter.
  6207. This filter accepts the following options:
  6208. @table @option
  6209. @item first_field
  6210. @table @samp
  6211. @item top, t
  6212. top field first
  6213. @item bottom, b
  6214. bottom field first
  6215. The default value is @code{top}.
  6216. @end table
  6217. @item pattern
  6218. A string of numbers representing the pulldown pattern you wish to apply.
  6219. The default value is @code{23}.
  6220. @item start_frame
  6221. A number representing position of the first frame with respect to the telecine
  6222. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6223. @end table
  6224. @section dilation
  6225. Apply dilation effect to the video.
  6226. This filter replaces the pixel by the local(3x3) maximum.
  6227. It accepts the following options:
  6228. @table @option
  6229. @item threshold0
  6230. @item threshold1
  6231. @item threshold2
  6232. @item threshold3
  6233. Limit the maximum change for each plane, default is 65535.
  6234. If 0, plane will remain unchanged.
  6235. @item coordinates
  6236. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6237. pixels are used.
  6238. Flags to local 3x3 coordinates maps like this:
  6239. 1 2 3
  6240. 4 5
  6241. 6 7 8
  6242. @end table
  6243. @section displace
  6244. Displace pixels as indicated by second and third input stream.
  6245. It takes three input streams and outputs one stream, the first input is the
  6246. source, and second and third input are displacement maps.
  6247. The second input specifies how much to displace pixels along the
  6248. x-axis, while the third input specifies how much to displace pixels
  6249. along the y-axis.
  6250. If one of displacement map streams terminates, last frame from that
  6251. displacement map will be used.
  6252. Note that once generated, displacements maps can be reused over and over again.
  6253. A description of the accepted options follows.
  6254. @table @option
  6255. @item edge
  6256. Set displace behavior for pixels that are out of range.
  6257. Available values are:
  6258. @table @samp
  6259. @item blank
  6260. Missing pixels are replaced by black pixels.
  6261. @item smear
  6262. Adjacent pixels will spread out to replace missing pixels.
  6263. @item wrap
  6264. Out of range pixels are wrapped so they point to pixels of other side.
  6265. @item mirror
  6266. Out of range pixels will be replaced with mirrored pixels.
  6267. @end table
  6268. Default is @samp{smear}.
  6269. @end table
  6270. @subsection Examples
  6271. @itemize
  6272. @item
  6273. Add ripple effect to rgb input of video size hd720:
  6274. @example
  6275. 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
  6276. @end example
  6277. @item
  6278. Add wave effect to rgb input of video size hd720:
  6279. @example
  6280. 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
  6281. @end example
  6282. @end itemize
  6283. @section drawbox
  6284. Draw a colored box on the input image.
  6285. It accepts the following parameters:
  6286. @table @option
  6287. @item x
  6288. @item y
  6289. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6290. @item width, w
  6291. @item height, h
  6292. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6293. the input width and height. It defaults to 0.
  6294. @item color, c
  6295. Specify the color of the box to write. For the general syntax of this option,
  6296. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6297. value @code{invert} is used, the box edge color is the same as the
  6298. video with inverted luma.
  6299. @item thickness, t
  6300. The expression which sets the thickness of the box edge.
  6301. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6302. See below for the list of accepted constants.
  6303. @item replace
  6304. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6305. will overwrite the video's color and alpha pixels.
  6306. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6307. @end table
  6308. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6309. following constants:
  6310. @table @option
  6311. @item dar
  6312. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6313. @item hsub
  6314. @item vsub
  6315. horizontal and vertical chroma subsample values. For example for the
  6316. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6317. @item in_h, ih
  6318. @item in_w, iw
  6319. The input width and height.
  6320. @item sar
  6321. The input sample aspect ratio.
  6322. @item x
  6323. @item y
  6324. The x and y offset coordinates where the box is drawn.
  6325. @item w
  6326. @item h
  6327. The width and height of the drawn box.
  6328. @item t
  6329. The thickness of the drawn box.
  6330. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6331. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6332. @end table
  6333. @subsection Examples
  6334. @itemize
  6335. @item
  6336. Draw a black box around the edge of the input image:
  6337. @example
  6338. drawbox
  6339. @end example
  6340. @item
  6341. Draw a box with color red and an opacity of 50%:
  6342. @example
  6343. drawbox=10:20:200:60:red@@0.5
  6344. @end example
  6345. The previous example can be specified as:
  6346. @example
  6347. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6348. @end example
  6349. @item
  6350. Fill the box with pink color:
  6351. @example
  6352. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6353. @end example
  6354. @item
  6355. Draw a 2-pixel red 2.40:1 mask:
  6356. @example
  6357. 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
  6358. @end example
  6359. @end itemize
  6360. @section drawgrid
  6361. Draw a grid on the input image.
  6362. It accepts the following parameters:
  6363. @table @option
  6364. @item x
  6365. @item y
  6366. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6367. @item width, w
  6368. @item height, h
  6369. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6370. input width and height, respectively, minus @code{thickness}, so image gets
  6371. framed. Default to 0.
  6372. @item color, c
  6373. Specify the color of the grid. For the general syntax of this option,
  6374. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6375. value @code{invert} is used, the grid color is the same as the
  6376. video with inverted luma.
  6377. @item thickness, t
  6378. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6379. See below for the list of accepted constants.
  6380. @item replace
  6381. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6382. will overwrite the video's color and alpha pixels.
  6383. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6384. @end table
  6385. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6386. following constants:
  6387. @table @option
  6388. @item dar
  6389. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6390. @item hsub
  6391. @item vsub
  6392. horizontal and vertical chroma subsample values. For example for the
  6393. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6394. @item in_h, ih
  6395. @item in_w, iw
  6396. The input grid cell width and height.
  6397. @item sar
  6398. The input sample aspect ratio.
  6399. @item x
  6400. @item y
  6401. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6402. @item w
  6403. @item h
  6404. The width and height of the drawn cell.
  6405. @item t
  6406. The thickness of the drawn cell.
  6407. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6408. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6409. @end table
  6410. @subsection Examples
  6411. @itemize
  6412. @item
  6413. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6414. @example
  6415. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6416. @end example
  6417. @item
  6418. Draw a white 3x3 grid with an opacity of 50%:
  6419. @example
  6420. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6421. @end example
  6422. @end itemize
  6423. @anchor{drawtext}
  6424. @section drawtext
  6425. Draw a text string or text from a specified file on top of a video, using the
  6426. libfreetype library.
  6427. To enable compilation of this filter, you need to configure FFmpeg with
  6428. @code{--enable-libfreetype}.
  6429. To enable default font fallback and the @var{font} option you need to
  6430. configure FFmpeg with @code{--enable-libfontconfig}.
  6431. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6432. @code{--enable-libfribidi}.
  6433. @subsection Syntax
  6434. It accepts the following parameters:
  6435. @table @option
  6436. @item box
  6437. Used to draw a box around text using the background color.
  6438. The value must be either 1 (enable) or 0 (disable).
  6439. The default value of @var{box} is 0.
  6440. @item boxborderw
  6441. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6442. The default value of @var{boxborderw} is 0.
  6443. @item boxcolor
  6444. The color to be used for drawing box around text. For the syntax of this
  6445. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6446. The default value of @var{boxcolor} is "white".
  6447. @item line_spacing
  6448. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6449. The default value of @var{line_spacing} is 0.
  6450. @item borderw
  6451. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6452. The default value of @var{borderw} is 0.
  6453. @item bordercolor
  6454. Set the color to be used for drawing border around text. For the syntax of this
  6455. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6456. The default value of @var{bordercolor} is "black".
  6457. @item expansion
  6458. Select how the @var{text} is expanded. Can be either @code{none},
  6459. @code{strftime} (deprecated) or
  6460. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6461. below for details.
  6462. @item basetime
  6463. Set a start time for the count. Value is in microseconds. Only applied
  6464. in the deprecated strftime expansion mode. To emulate in normal expansion
  6465. mode use the @code{pts} function, supplying the start time (in seconds)
  6466. as the second argument.
  6467. @item fix_bounds
  6468. If true, check and fix text coords to avoid clipping.
  6469. @item fontcolor
  6470. The color to be used for drawing fonts. For the syntax of this option, check
  6471. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6472. The default value of @var{fontcolor} is "black".
  6473. @item fontcolor_expr
  6474. String which is expanded the same way as @var{text} to obtain dynamic
  6475. @var{fontcolor} value. By default this option has empty value and is not
  6476. processed. When this option is set, it overrides @var{fontcolor} option.
  6477. @item font
  6478. The font family to be used for drawing text. By default Sans.
  6479. @item fontfile
  6480. The font file to be used for drawing text. The path must be included.
  6481. This parameter is mandatory if the fontconfig support is disabled.
  6482. @item alpha
  6483. Draw the text applying alpha blending. The value can
  6484. be a number between 0.0 and 1.0.
  6485. The expression accepts the same variables @var{x, y} as well.
  6486. The default value is 1.
  6487. Please see @var{fontcolor_expr}.
  6488. @item fontsize
  6489. The font size to be used for drawing text.
  6490. The default value of @var{fontsize} is 16.
  6491. @item text_shaping
  6492. If set to 1, attempt to shape the text (for example, reverse the order of
  6493. right-to-left text and join Arabic characters) before drawing it.
  6494. Otherwise, just draw the text exactly as given.
  6495. By default 1 (if supported).
  6496. @item ft_load_flags
  6497. The flags to be used for loading the fonts.
  6498. The flags map the corresponding flags supported by libfreetype, and are
  6499. a combination of the following values:
  6500. @table @var
  6501. @item default
  6502. @item no_scale
  6503. @item no_hinting
  6504. @item render
  6505. @item no_bitmap
  6506. @item vertical_layout
  6507. @item force_autohint
  6508. @item crop_bitmap
  6509. @item pedantic
  6510. @item ignore_global_advance_width
  6511. @item no_recurse
  6512. @item ignore_transform
  6513. @item monochrome
  6514. @item linear_design
  6515. @item no_autohint
  6516. @end table
  6517. Default value is "default".
  6518. For more information consult the documentation for the FT_LOAD_*
  6519. libfreetype flags.
  6520. @item shadowcolor
  6521. The color to be used for drawing a shadow behind the drawn text. For the
  6522. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6523. ffmpeg-utils manual,ffmpeg-utils}.
  6524. The default value of @var{shadowcolor} is "black".
  6525. @item shadowx
  6526. @item shadowy
  6527. The x and y offsets for the text shadow position with respect to the
  6528. position of the text. They can be either positive or negative
  6529. values. The default value for both is "0".
  6530. @item start_number
  6531. The starting frame number for the n/frame_num variable. The default value
  6532. is "0".
  6533. @item tabsize
  6534. The size in number of spaces to use for rendering the tab.
  6535. Default value is 4.
  6536. @item timecode
  6537. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6538. format. It can be used with or without text parameter. @var{timecode_rate}
  6539. option must be specified.
  6540. @item timecode_rate, rate, r
  6541. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6542. integer. Minimum value is "1".
  6543. Drop-frame timecode is supported for frame rates 30 & 60.
  6544. @item tc24hmax
  6545. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6546. Default is 0 (disabled).
  6547. @item text
  6548. The text string to be drawn. The text must be a sequence of UTF-8
  6549. encoded characters.
  6550. This parameter is mandatory if no file is specified with the parameter
  6551. @var{textfile}.
  6552. @item textfile
  6553. A text file containing text to be drawn. The text must be a sequence
  6554. of UTF-8 encoded characters.
  6555. This parameter is mandatory if no text string is specified with the
  6556. parameter @var{text}.
  6557. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6558. @item reload
  6559. If set to 1, the @var{textfile} will be reloaded before each frame.
  6560. Be sure to update it atomically, or it may be read partially, or even fail.
  6561. @item x
  6562. @item y
  6563. The expressions which specify the offsets where text will be drawn
  6564. within the video frame. They are relative to the top/left border of the
  6565. output image.
  6566. The default value of @var{x} and @var{y} is "0".
  6567. See below for the list of accepted constants and functions.
  6568. @end table
  6569. The parameters for @var{x} and @var{y} are expressions containing the
  6570. following constants and functions:
  6571. @table @option
  6572. @item dar
  6573. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6574. @item hsub
  6575. @item vsub
  6576. horizontal and vertical chroma subsample values. For example for the
  6577. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6578. @item line_h, lh
  6579. the height of each text line
  6580. @item main_h, h, H
  6581. the input height
  6582. @item main_w, w, W
  6583. the input width
  6584. @item max_glyph_a, ascent
  6585. the maximum distance from the baseline to the highest/upper grid
  6586. coordinate used to place a glyph outline point, for all the rendered
  6587. glyphs.
  6588. It is a positive value, due to the grid's orientation with the Y axis
  6589. upwards.
  6590. @item max_glyph_d, descent
  6591. the maximum distance from the baseline to the lowest grid coordinate
  6592. used to place a glyph outline point, for all the rendered glyphs.
  6593. This is a negative value, due to the grid's orientation, with the Y axis
  6594. upwards.
  6595. @item max_glyph_h
  6596. maximum glyph height, that is the maximum height for all the glyphs
  6597. contained in the rendered text, it is equivalent to @var{ascent} -
  6598. @var{descent}.
  6599. @item max_glyph_w
  6600. maximum glyph width, that is the maximum width for all the glyphs
  6601. contained in the rendered text
  6602. @item n
  6603. the number of input frame, starting from 0
  6604. @item rand(min, max)
  6605. return a random number included between @var{min} and @var{max}
  6606. @item sar
  6607. The input sample aspect ratio.
  6608. @item t
  6609. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6610. @item text_h, th
  6611. the height of the rendered text
  6612. @item text_w, tw
  6613. the width of the rendered text
  6614. @item x
  6615. @item y
  6616. the x and y offset coordinates where the text is drawn.
  6617. These parameters allow the @var{x} and @var{y} expressions to refer
  6618. each other, so you can for example specify @code{y=x/dar}.
  6619. @end table
  6620. @anchor{drawtext_expansion}
  6621. @subsection Text expansion
  6622. If @option{expansion} is set to @code{strftime},
  6623. the filter recognizes strftime() sequences in the provided text and
  6624. expands them accordingly. Check the documentation of strftime(). This
  6625. feature is deprecated.
  6626. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6627. If @option{expansion} is set to @code{normal} (which is the default),
  6628. the following expansion mechanism is used.
  6629. The backslash character @samp{\}, followed by any character, always expands to
  6630. the second character.
  6631. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6632. braces is a function name, possibly followed by arguments separated by ':'.
  6633. If the arguments contain special characters or delimiters (':' or '@}'),
  6634. they should be escaped.
  6635. Note that they probably must also be escaped as the value for the
  6636. @option{text} option in the filter argument string and as the filter
  6637. argument in the filtergraph description, and possibly also for the shell,
  6638. that makes up to four levels of escaping; using a text file avoids these
  6639. problems.
  6640. The following functions are available:
  6641. @table @command
  6642. @item expr, e
  6643. The expression evaluation result.
  6644. It must take one argument specifying the expression to be evaluated,
  6645. which accepts the same constants and functions as the @var{x} and
  6646. @var{y} values. Note that not all constants should be used, for
  6647. example the text size is not known when evaluating the expression, so
  6648. the constants @var{text_w} and @var{text_h} will have an undefined
  6649. value.
  6650. @item expr_int_format, eif
  6651. Evaluate the expression's value and output as formatted integer.
  6652. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6653. The second argument specifies the output format. Allowed values are @samp{x},
  6654. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6655. @code{printf} function.
  6656. The third parameter is optional and sets the number of positions taken by the output.
  6657. It can be used to add padding with zeros from the left.
  6658. @item gmtime
  6659. The time at which the filter is running, expressed in UTC.
  6660. It can accept an argument: a strftime() format string.
  6661. @item localtime
  6662. The time at which the filter is running, expressed in the local time zone.
  6663. It can accept an argument: a strftime() format string.
  6664. @item metadata
  6665. Frame metadata. Takes one or two arguments.
  6666. The first argument is mandatory and specifies the metadata key.
  6667. The second argument is optional and specifies a default value, used when the
  6668. metadata key is not found or empty.
  6669. @item n, frame_num
  6670. The frame number, starting from 0.
  6671. @item pict_type
  6672. A 1 character description of the current picture type.
  6673. @item pts
  6674. The timestamp of the current frame.
  6675. It can take up to three arguments.
  6676. The first argument is the format of the timestamp; it defaults to @code{flt}
  6677. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6678. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6679. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6680. @code{localtime} stands for the timestamp of the frame formatted as
  6681. local time zone time.
  6682. The second argument is an offset added to the timestamp.
  6683. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6684. supplied to present the hour part of the formatted timestamp in 24h format
  6685. (00-23).
  6686. If the format is set to @code{localtime} or @code{gmtime},
  6687. a third argument may be supplied: a strftime() format string.
  6688. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6689. @end table
  6690. @subsection Examples
  6691. @itemize
  6692. @item
  6693. Draw "Test Text" with font FreeSerif, using the default values for the
  6694. optional parameters.
  6695. @example
  6696. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6697. @end example
  6698. @item
  6699. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6700. and y=50 (counting from the top-left corner of the screen), text is
  6701. yellow with a red box around it. Both the text and the box have an
  6702. opacity of 20%.
  6703. @example
  6704. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6705. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6706. @end example
  6707. Note that the double quotes are not necessary if spaces are not used
  6708. within the parameter list.
  6709. @item
  6710. Show the text at the center of the video frame:
  6711. @example
  6712. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6713. @end example
  6714. @item
  6715. Show the text at a random position, switching to a new position every 30 seconds:
  6716. @example
  6717. 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)"
  6718. @end example
  6719. @item
  6720. Show a text line sliding from right to left in the last row of the video
  6721. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6722. with no newlines.
  6723. @example
  6724. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6725. @end example
  6726. @item
  6727. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6728. @example
  6729. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6730. @end example
  6731. @item
  6732. Draw a single green letter "g", at the center of the input video.
  6733. The glyph baseline is placed at half screen height.
  6734. @example
  6735. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6736. @end example
  6737. @item
  6738. Show text for 1 second every 3 seconds:
  6739. @example
  6740. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6741. @end example
  6742. @item
  6743. Use fontconfig to set the font. Note that the colons need to be escaped.
  6744. @example
  6745. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6746. @end example
  6747. @item
  6748. Print the date of a real-time encoding (see strftime(3)):
  6749. @example
  6750. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6751. @end example
  6752. @item
  6753. Show text fading in and out (appearing/disappearing):
  6754. @example
  6755. #!/bin/sh
  6756. DS=1.0 # display start
  6757. DE=10.0 # display end
  6758. FID=1.5 # fade in duration
  6759. FOD=5 # fade out duration
  6760. 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 @}"
  6761. @end example
  6762. @item
  6763. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6764. and the @option{fontsize} value are included in the @option{y} offset.
  6765. @example
  6766. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6767. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6768. @end example
  6769. @end itemize
  6770. For more information about libfreetype, check:
  6771. @url{http://www.freetype.org/}.
  6772. For more information about fontconfig, check:
  6773. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6774. For more information about libfribidi, check:
  6775. @url{http://fribidi.org/}.
  6776. @section edgedetect
  6777. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6778. The filter accepts the following options:
  6779. @table @option
  6780. @item low
  6781. @item high
  6782. Set low and high threshold values used by the Canny thresholding
  6783. algorithm.
  6784. The high threshold selects the "strong" edge pixels, which are then
  6785. connected through 8-connectivity with the "weak" edge pixels selected
  6786. by the low threshold.
  6787. @var{low} and @var{high} threshold values must be chosen in the range
  6788. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6789. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6790. is @code{50/255}.
  6791. @item mode
  6792. Define the drawing mode.
  6793. @table @samp
  6794. @item wires
  6795. Draw white/gray wires on black background.
  6796. @item colormix
  6797. Mix the colors to create a paint/cartoon effect.
  6798. @item canny
  6799. Apply Canny edge detector on all selected planes.
  6800. @end table
  6801. Default value is @var{wires}.
  6802. @item planes
  6803. Select planes for filtering. By default all available planes are filtered.
  6804. @end table
  6805. @subsection Examples
  6806. @itemize
  6807. @item
  6808. Standard edge detection with custom values for the hysteresis thresholding:
  6809. @example
  6810. edgedetect=low=0.1:high=0.4
  6811. @end example
  6812. @item
  6813. Painting effect without thresholding:
  6814. @example
  6815. edgedetect=mode=colormix:high=0
  6816. @end example
  6817. @end itemize
  6818. @section eq
  6819. Set brightness, contrast, saturation and approximate gamma adjustment.
  6820. The filter accepts the following options:
  6821. @table @option
  6822. @item contrast
  6823. Set the contrast expression. The value must be a float value in range
  6824. @code{-2.0} to @code{2.0}. The default value is "1".
  6825. @item brightness
  6826. Set the brightness expression. The value must be a float value in
  6827. range @code{-1.0} to @code{1.0}. The default value is "0".
  6828. @item saturation
  6829. Set the saturation expression. The value must be a float in
  6830. range @code{0.0} to @code{3.0}. The default value is "1".
  6831. @item gamma
  6832. Set the gamma expression. The value must be a float in range
  6833. @code{0.1} to @code{10.0}. The default value is "1".
  6834. @item gamma_r
  6835. Set the gamma expression for red. The value must be a float in
  6836. range @code{0.1} to @code{10.0}. The default value is "1".
  6837. @item gamma_g
  6838. Set the gamma expression for green. The value must be a float in range
  6839. @code{0.1} to @code{10.0}. The default value is "1".
  6840. @item gamma_b
  6841. Set the gamma expression for blue. The value must be a float in range
  6842. @code{0.1} to @code{10.0}. The default value is "1".
  6843. @item gamma_weight
  6844. Set the gamma weight expression. It can be used to reduce the effect
  6845. of a high gamma value on bright image areas, e.g. keep them from
  6846. getting overamplified and just plain white. The value must be a float
  6847. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6848. gamma correction all the way down while @code{1.0} leaves it at its
  6849. full strength. Default is "1".
  6850. @item eval
  6851. Set when the expressions for brightness, contrast, saturation and
  6852. gamma expressions are evaluated.
  6853. It accepts the following values:
  6854. @table @samp
  6855. @item init
  6856. only evaluate expressions once during the filter initialization or
  6857. when a command is processed
  6858. @item frame
  6859. evaluate expressions for each incoming frame
  6860. @end table
  6861. Default value is @samp{init}.
  6862. @end table
  6863. The expressions accept the following parameters:
  6864. @table @option
  6865. @item n
  6866. frame count of the input frame starting from 0
  6867. @item pos
  6868. byte position of the corresponding packet in the input file, NAN if
  6869. unspecified
  6870. @item r
  6871. frame rate of the input video, NAN if the input frame rate is unknown
  6872. @item t
  6873. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6874. @end table
  6875. @subsection Commands
  6876. The filter supports the following commands:
  6877. @table @option
  6878. @item contrast
  6879. Set the contrast expression.
  6880. @item brightness
  6881. Set the brightness expression.
  6882. @item saturation
  6883. Set the saturation expression.
  6884. @item gamma
  6885. Set the gamma expression.
  6886. @item gamma_r
  6887. Set the gamma_r expression.
  6888. @item gamma_g
  6889. Set gamma_g expression.
  6890. @item gamma_b
  6891. Set gamma_b expression.
  6892. @item gamma_weight
  6893. Set gamma_weight expression.
  6894. The command accepts the same syntax of the corresponding option.
  6895. If the specified expression is not valid, it is kept at its current
  6896. value.
  6897. @end table
  6898. @section erosion
  6899. Apply erosion effect to the video.
  6900. This filter replaces the pixel by the local(3x3) minimum.
  6901. It accepts the following options:
  6902. @table @option
  6903. @item threshold0
  6904. @item threshold1
  6905. @item threshold2
  6906. @item threshold3
  6907. Limit the maximum change for each plane, default is 65535.
  6908. If 0, plane will remain unchanged.
  6909. @item coordinates
  6910. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6911. pixels are used.
  6912. Flags to local 3x3 coordinates maps like this:
  6913. 1 2 3
  6914. 4 5
  6915. 6 7 8
  6916. @end table
  6917. @section extractplanes
  6918. Extract color channel components from input video stream into
  6919. separate grayscale video streams.
  6920. The filter accepts the following option:
  6921. @table @option
  6922. @item planes
  6923. Set plane(s) to extract.
  6924. Available values for planes are:
  6925. @table @samp
  6926. @item y
  6927. @item u
  6928. @item v
  6929. @item a
  6930. @item r
  6931. @item g
  6932. @item b
  6933. @end table
  6934. Choosing planes not available in the input will result in an error.
  6935. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6936. with @code{y}, @code{u}, @code{v} planes at same time.
  6937. @end table
  6938. @subsection Examples
  6939. @itemize
  6940. @item
  6941. Extract luma, u and v color channel component from input video frame
  6942. into 3 grayscale outputs:
  6943. @example
  6944. 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
  6945. @end example
  6946. @end itemize
  6947. @section elbg
  6948. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6949. For each input image, the filter will compute the optimal mapping from
  6950. the input to the output given the codebook length, that is the number
  6951. of distinct output colors.
  6952. This filter accepts the following options.
  6953. @table @option
  6954. @item codebook_length, l
  6955. Set codebook length. The value must be a positive integer, and
  6956. represents the number of distinct output colors. Default value is 256.
  6957. @item nb_steps, n
  6958. Set the maximum number of iterations to apply for computing the optimal
  6959. mapping. The higher the value the better the result and the higher the
  6960. computation time. Default value is 1.
  6961. @item seed, s
  6962. Set a random seed, must be an integer included between 0 and
  6963. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6964. will try to use a good random seed on a best effort basis.
  6965. @item pal8
  6966. Set pal8 output pixel format. This option does not work with codebook
  6967. length greater than 256.
  6968. @end table
  6969. @section entropy
  6970. Measure graylevel entropy in histogram of color channels of video frames.
  6971. It accepts the following parameters:
  6972. @table @option
  6973. @item mode
  6974. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6975. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6976. between neighbour histogram values.
  6977. @end table
  6978. @section fade
  6979. Apply a fade-in/out effect to the input video.
  6980. It accepts the following parameters:
  6981. @table @option
  6982. @item type, t
  6983. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6984. effect.
  6985. Default is @code{in}.
  6986. @item start_frame, s
  6987. Specify the number of the frame to start applying the fade
  6988. effect at. Default is 0.
  6989. @item nb_frames, n
  6990. The number of frames that the fade effect lasts. At the end of the
  6991. fade-in effect, the output video will have the same intensity as the input video.
  6992. At the end of the fade-out transition, the output video will be filled with the
  6993. selected @option{color}.
  6994. Default is 25.
  6995. @item alpha
  6996. If set to 1, fade only alpha channel, if one exists on the input.
  6997. Default value is 0.
  6998. @item start_time, st
  6999. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7000. effect. If both start_frame and start_time are specified, the fade will start at
  7001. whichever comes last. Default is 0.
  7002. @item duration, d
  7003. The number of seconds for which the fade effect has to last. At the end of the
  7004. fade-in effect the output video will have the same intensity as the input video,
  7005. at the end of the fade-out transition the output video will be filled with the
  7006. selected @option{color}.
  7007. If both duration and nb_frames are specified, duration is used. Default is 0
  7008. (nb_frames is used by default).
  7009. @item color, c
  7010. Specify the color of the fade. Default is "black".
  7011. @end table
  7012. @subsection Examples
  7013. @itemize
  7014. @item
  7015. Fade in the first 30 frames of video:
  7016. @example
  7017. fade=in:0:30
  7018. @end example
  7019. The command above is equivalent to:
  7020. @example
  7021. fade=t=in:s=0:n=30
  7022. @end example
  7023. @item
  7024. Fade out the last 45 frames of a 200-frame video:
  7025. @example
  7026. fade=out:155:45
  7027. fade=type=out:start_frame=155:nb_frames=45
  7028. @end example
  7029. @item
  7030. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7031. @example
  7032. fade=in:0:25, fade=out:975:25
  7033. @end example
  7034. @item
  7035. Make the first 5 frames yellow, then fade in from frame 5-24:
  7036. @example
  7037. fade=in:5:20:color=yellow
  7038. @end example
  7039. @item
  7040. Fade in alpha over first 25 frames of video:
  7041. @example
  7042. fade=in:0:25:alpha=1
  7043. @end example
  7044. @item
  7045. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7046. @example
  7047. fade=t=in:st=5.5:d=0.5
  7048. @end example
  7049. @end itemize
  7050. @section fftfilt
  7051. Apply arbitrary expressions to samples in frequency domain
  7052. @table @option
  7053. @item dc_Y
  7054. Adjust the dc value (gain) of the luma plane of the image. The filter
  7055. accepts an integer value in range @code{0} to @code{1000}. The default
  7056. value is set to @code{0}.
  7057. @item dc_U
  7058. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7059. filter accepts an integer value in range @code{0} to @code{1000}. The
  7060. default value is set to @code{0}.
  7061. @item dc_V
  7062. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7063. filter accepts an integer value in range @code{0} to @code{1000}. The
  7064. default value is set to @code{0}.
  7065. @item weight_Y
  7066. Set the frequency domain weight expression for the luma plane.
  7067. @item weight_U
  7068. Set the frequency domain weight expression for the 1st chroma plane.
  7069. @item weight_V
  7070. Set the frequency domain weight expression for the 2nd chroma plane.
  7071. @item eval
  7072. Set when the expressions are evaluated.
  7073. It accepts the following values:
  7074. @table @samp
  7075. @item init
  7076. Only evaluate expressions once during the filter initialization.
  7077. @item frame
  7078. Evaluate expressions for each incoming frame.
  7079. @end table
  7080. Default value is @samp{init}.
  7081. The filter accepts the following variables:
  7082. @item X
  7083. @item Y
  7084. The coordinates of the current sample.
  7085. @item W
  7086. @item H
  7087. The width and height of the image.
  7088. @item N
  7089. The number of input frame, starting from 0.
  7090. @end table
  7091. @subsection Examples
  7092. @itemize
  7093. @item
  7094. High-pass:
  7095. @example
  7096. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7097. @end example
  7098. @item
  7099. Low-pass:
  7100. @example
  7101. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7102. @end example
  7103. @item
  7104. Sharpen:
  7105. @example
  7106. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7107. @end example
  7108. @item
  7109. Blur:
  7110. @example
  7111. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7112. @end example
  7113. @end itemize
  7114. @section fftdnoiz
  7115. Denoise frames using 3D FFT (frequency domain filtering).
  7116. The filter accepts the following options:
  7117. @table @option
  7118. @item sigma
  7119. Set the noise sigma constant. This sets denoising strength.
  7120. Default value is 1. Allowed range is from 0 to 30.
  7121. Using very high sigma with low overlap may give blocking artifacts.
  7122. @item amount
  7123. Set amount of denoising. By default all detected noise is reduced.
  7124. Default value is 1. Allowed range is from 0 to 1.
  7125. @item block
  7126. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7127. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7128. block size in pixels is 2^4 which is 16.
  7129. @item overlap
  7130. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7131. @item prev
  7132. Set number of previous frames to use for denoising. By default is set to 0.
  7133. @item next
  7134. Set number of next frames to to use for denoising. By default is set to 0.
  7135. @item planes
  7136. Set planes which will be filtered, by default are all available filtered
  7137. except alpha.
  7138. @end table
  7139. @section field
  7140. Extract a single field from an interlaced image using stride
  7141. arithmetic to avoid wasting CPU time. The output frames are marked as
  7142. non-interlaced.
  7143. The filter accepts the following options:
  7144. @table @option
  7145. @item type
  7146. Specify whether to extract the top (if the value is @code{0} or
  7147. @code{top}) or the bottom field (if the value is @code{1} or
  7148. @code{bottom}).
  7149. @end table
  7150. @section fieldhint
  7151. Create new frames by copying the top and bottom fields from surrounding frames
  7152. supplied as numbers by the hint file.
  7153. @table @option
  7154. @item hint
  7155. Set file containing hints: absolute/relative frame numbers.
  7156. There must be one line for each frame in a clip. Each line must contain two
  7157. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7158. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7159. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7160. for @code{relative} mode. First number tells from which frame to pick up top
  7161. field and second number tells from which frame to pick up bottom field.
  7162. If optionally followed by @code{+} output frame will be marked as interlaced,
  7163. else if followed by @code{-} output frame will be marked as progressive, else
  7164. it will be marked same as input frame.
  7165. If line starts with @code{#} or @code{;} that line is skipped.
  7166. @item mode
  7167. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7168. @end table
  7169. Example of first several lines of @code{hint} file for @code{relative} mode:
  7170. @example
  7171. 0,0 - # first frame
  7172. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7173. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7174. 1,0 -
  7175. 0,0 -
  7176. 0,0 -
  7177. 1,0 -
  7178. 1,0 -
  7179. 1,0 -
  7180. 0,0 -
  7181. 0,0 -
  7182. 1,0 -
  7183. 1,0 -
  7184. 1,0 -
  7185. 0,0 -
  7186. @end example
  7187. @section fieldmatch
  7188. Field matching filter for inverse telecine. It is meant to reconstruct the
  7189. progressive frames from a telecined stream. The filter does not drop duplicated
  7190. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7191. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7192. The separation of the field matching and the decimation is notably motivated by
  7193. the possibility of inserting a de-interlacing filter fallback between the two.
  7194. If the source has mixed telecined and real interlaced content,
  7195. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7196. But these remaining combed frames will be marked as interlaced, and thus can be
  7197. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7198. In addition to the various configuration options, @code{fieldmatch} can take an
  7199. optional second stream, activated through the @option{ppsrc} option. If
  7200. enabled, the frames reconstruction will be based on the fields and frames from
  7201. this second stream. This allows the first input to be pre-processed in order to
  7202. help the various algorithms of the filter, while keeping the output lossless
  7203. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7204. or brightness/contrast adjustments can help.
  7205. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7206. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7207. which @code{fieldmatch} is based on. While the semantic and usage are very
  7208. close, some behaviour and options names can differ.
  7209. The @ref{decimate} filter currently only works for constant frame rate input.
  7210. If your input has mixed telecined (30fps) and progressive content with a lower
  7211. framerate like 24fps use the following filterchain to produce the necessary cfr
  7212. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7213. The filter accepts the following options:
  7214. @table @option
  7215. @item order
  7216. Specify the assumed field order of the input stream. Available values are:
  7217. @table @samp
  7218. @item auto
  7219. Auto detect parity (use FFmpeg's internal parity value).
  7220. @item bff
  7221. Assume bottom field first.
  7222. @item tff
  7223. Assume top field first.
  7224. @end table
  7225. Note that it is sometimes recommended not to trust the parity announced by the
  7226. stream.
  7227. Default value is @var{auto}.
  7228. @item mode
  7229. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7230. sense that it won't risk creating jerkiness due to duplicate frames when
  7231. possible, but if there are bad edits or blended fields it will end up
  7232. outputting combed frames when a good match might actually exist. On the other
  7233. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7234. but will almost always find a good frame if there is one. The other values are
  7235. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7236. jerkiness and creating duplicate frames versus finding good matches in sections
  7237. with bad edits, orphaned fields, blended fields, etc.
  7238. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7239. Available values are:
  7240. @table @samp
  7241. @item pc
  7242. 2-way matching (p/c)
  7243. @item pc_n
  7244. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7245. @item pc_u
  7246. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7247. @item pc_n_ub
  7248. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7249. still combed (p/c + n + u/b)
  7250. @item pcn
  7251. 3-way matching (p/c/n)
  7252. @item pcn_ub
  7253. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7254. detected as combed (p/c/n + u/b)
  7255. @end table
  7256. The parenthesis at the end indicate the matches that would be used for that
  7257. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7258. @var{top}).
  7259. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7260. the slowest.
  7261. Default value is @var{pc_n}.
  7262. @item ppsrc
  7263. Mark the main input stream as a pre-processed input, and enable the secondary
  7264. input stream as the clean source to pick the fields from. See the filter
  7265. introduction for more details. It is similar to the @option{clip2} feature from
  7266. VFM/TFM.
  7267. Default value is @code{0} (disabled).
  7268. @item field
  7269. Set the field to match from. It is recommended to set this to the same value as
  7270. @option{order} unless you experience matching failures with that setting. In
  7271. certain circumstances changing the field that is used to match from can have a
  7272. large impact on matching performance. Available values are:
  7273. @table @samp
  7274. @item auto
  7275. Automatic (same value as @option{order}).
  7276. @item bottom
  7277. Match from the bottom field.
  7278. @item top
  7279. Match from the top field.
  7280. @end table
  7281. Default value is @var{auto}.
  7282. @item mchroma
  7283. Set whether or not chroma is included during the match comparisons. In most
  7284. cases it is recommended to leave this enabled. You should set this to @code{0}
  7285. only if your clip has bad chroma problems such as heavy rainbowing or other
  7286. artifacts. Setting this to @code{0} could also be used to speed things up at
  7287. the cost of some accuracy.
  7288. Default value is @code{1}.
  7289. @item y0
  7290. @item y1
  7291. These define an exclusion band which excludes the lines between @option{y0} and
  7292. @option{y1} from being included in the field matching decision. An exclusion
  7293. band can be used to ignore subtitles, a logo, or other things that may
  7294. interfere with the matching. @option{y0} sets the starting scan line and
  7295. @option{y1} sets the ending line; all lines in between @option{y0} and
  7296. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7297. @option{y0} and @option{y1} to the same value will disable the feature.
  7298. @option{y0} and @option{y1} defaults to @code{0}.
  7299. @item scthresh
  7300. Set the scene change detection threshold as a percentage of maximum change on
  7301. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7302. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7303. @option{scthresh} is @code{[0.0, 100.0]}.
  7304. Default value is @code{12.0}.
  7305. @item combmatch
  7306. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7307. account the combed scores of matches when deciding what match to use as the
  7308. final match. Available values are:
  7309. @table @samp
  7310. @item none
  7311. No final matching based on combed scores.
  7312. @item sc
  7313. Combed scores are only used when a scene change is detected.
  7314. @item full
  7315. Use combed scores all the time.
  7316. @end table
  7317. Default is @var{sc}.
  7318. @item combdbg
  7319. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7320. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7321. Available values are:
  7322. @table @samp
  7323. @item none
  7324. No forced calculation.
  7325. @item pcn
  7326. Force p/c/n calculations.
  7327. @item pcnub
  7328. Force p/c/n/u/b calculations.
  7329. @end table
  7330. Default value is @var{none}.
  7331. @item cthresh
  7332. This is the area combing threshold used for combed frame detection. This
  7333. essentially controls how "strong" or "visible" combing must be to be detected.
  7334. Larger values mean combing must be more visible and smaller values mean combing
  7335. can be less visible or strong and still be detected. Valid settings are from
  7336. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7337. be detected as combed). This is basically a pixel difference value. A good
  7338. range is @code{[8, 12]}.
  7339. Default value is @code{9}.
  7340. @item chroma
  7341. Sets whether or not chroma is considered in the combed frame decision. Only
  7342. disable this if your source has chroma problems (rainbowing, etc.) that are
  7343. causing problems for the combed frame detection with chroma enabled. Actually,
  7344. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7345. where there is chroma only combing in the source.
  7346. Default value is @code{0}.
  7347. @item blockx
  7348. @item blocky
  7349. Respectively set the x-axis and y-axis size of the window used during combed
  7350. frame detection. This has to do with the size of the area in which
  7351. @option{combpel} pixels are required to be detected as combed for a frame to be
  7352. declared combed. See the @option{combpel} parameter description for more info.
  7353. Possible values are any number that is a power of 2 starting at 4 and going up
  7354. to 512.
  7355. Default value is @code{16}.
  7356. @item combpel
  7357. The number of combed pixels inside any of the @option{blocky} by
  7358. @option{blockx} size blocks on the frame for the frame to be detected as
  7359. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7360. setting controls "how much" combing there must be in any localized area (a
  7361. window defined by the @option{blockx} and @option{blocky} settings) on the
  7362. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7363. which point no frames will ever be detected as combed). This setting is known
  7364. as @option{MI} in TFM/VFM vocabulary.
  7365. Default value is @code{80}.
  7366. @end table
  7367. @anchor{p/c/n/u/b meaning}
  7368. @subsection p/c/n/u/b meaning
  7369. @subsubsection p/c/n
  7370. We assume the following telecined stream:
  7371. @example
  7372. Top fields: 1 2 2 3 4
  7373. Bottom fields: 1 2 3 4 4
  7374. @end example
  7375. The numbers correspond to the progressive frame the fields relate to. Here, the
  7376. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7377. When @code{fieldmatch} is configured to run a matching from bottom
  7378. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7379. @example
  7380. Input stream:
  7381. T 1 2 2 3 4
  7382. B 1 2 3 4 4 <-- matching reference
  7383. Matches: c c n n c
  7384. Output stream:
  7385. T 1 2 3 4 4
  7386. B 1 2 3 4 4
  7387. @end example
  7388. As a result of the field matching, we can see that some frames get duplicated.
  7389. To perform a complete inverse telecine, you need to rely on a decimation filter
  7390. after this operation. See for instance the @ref{decimate} filter.
  7391. The same operation now matching from top fields (@option{field}=@var{top})
  7392. looks like this:
  7393. @example
  7394. Input stream:
  7395. T 1 2 2 3 4 <-- matching reference
  7396. B 1 2 3 4 4
  7397. Matches: c c p p c
  7398. Output stream:
  7399. T 1 2 2 3 4
  7400. B 1 2 2 3 4
  7401. @end example
  7402. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7403. basically, they refer to the frame and field of the opposite parity:
  7404. @itemize
  7405. @item @var{p} matches the field of the opposite parity in the previous frame
  7406. @item @var{c} matches the field of the opposite parity in the current frame
  7407. @item @var{n} matches the field of the opposite parity in the next frame
  7408. @end itemize
  7409. @subsubsection u/b
  7410. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7411. from the opposite parity flag. In the following examples, we assume that we are
  7412. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7413. 'x' is placed above and below each matched fields.
  7414. With bottom matching (@option{field}=@var{bottom}):
  7415. @example
  7416. Match: c p n b u
  7417. x x x x x
  7418. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7419. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7420. x x x x x
  7421. Output frames:
  7422. 2 1 2 2 2
  7423. 2 2 2 1 3
  7424. @end example
  7425. With top matching (@option{field}=@var{top}):
  7426. @example
  7427. Match: c p n b u
  7428. x x x x x
  7429. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7430. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7431. x x x x x
  7432. Output frames:
  7433. 2 2 2 1 2
  7434. 2 1 3 2 2
  7435. @end example
  7436. @subsection Examples
  7437. Simple IVTC of a top field first telecined stream:
  7438. @example
  7439. fieldmatch=order=tff:combmatch=none, decimate
  7440. @end example
  7441. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7442. @example
  7443. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7444. @end example
  7445. @section fieldorder
  7446. Transform the field order of the input video.
  7447. It accepts the following parameters:
  7448. @table @option
  7449. @item order
  7450. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7451. for bottom field first.
  7452. @end table
  7453. The default value is @samp{tff}.
  7454. The transformation is done by shifting the picture content up or down
  7455. by one line, and filling the remaining line with appropriate picture content.
  7456. This method is consistent with most broadcast field order converters.
  7457. If the input video is not flagged as being interlaced, or it is already
  7458. flagged as being of the required output field order, then this filter does
  7459. not alter the incoming video.
  7460. It is very useful when converting to or from PAL DV material,
  7461. which is bottom field first.
  7462. For example:
  7463. @example
  7464. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7465. @end example
  7466. @section fifo, afifo
  7467. Buffer input images and send them when they are requested.
  7468. It is mainly useful when auto-inserted by the libavfilter
  7469. framework.
  7470. It does not take parameters.
  7471. @section fillborders
  7472. Fill borders of the input video, without changing video stream dimensions.
  7473. Sometimes video can have garbage at the four edges and you may not want to
  7474. crop video input to keep size multiple of some number.
  7475. This filter accepts the following options:
  7476. @table @option
  7477. @item left
  7478. Number of pixels to fill from left border.
  7479. @item right
  7480. Number of pixels to fill from right border.
  7481. @item top
  7482. Number of pixels to fill from top border.
  7483. @item bottom
  7484. Number of pixels to fill from bottom border.
  7485. @item mode
  7486. Set fill mode.
  7487. It accepts the following values:
  7488. @table @samp
  7489. @item smear
  7490. fill pixels using outermost pixels
  7491. @item mirror
  7492. fill pixels using mirroring
  7493. @item fixed
  7494. fill pixels with constant value
  7495. @end table
  7496. Default is @var{smear}.
  7497. @item color
  7498. Set color for pixels in fixed mode. Default is @var{black}.
  7499. @end table
  7500. @section find_rect
  7501. Find a rectangular object
  7502. It accepts the following options:
  7503. @table @option
  7504. @item object
  7505. Filepath of the object image, needs to be in gray8.
  7506. @item threshold
  7507. Detection threshold, default is 0.5.
  7508. @item mipmaps
  7509. Number of mipmaps, default is 3.
  7510. @item xmin, ymin, xmax, ymax
  7511. Specifies the rectangle in which to search.
  7512. @end table
  7513. @subsection Examples
  7514. @itemize
  7515. @item
  7516. Generate a representative palette of a given video using @command{ffmpeg}:
  7517. @example
  7518. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7519. @end example
  7520. @end itemize
  7521. @section cover_rect
  7522. Cover a rectangular object
  7523. It accepts the following options:
  7524. @table @option
  7525. @item cover
  7526. Filepath of the optional cover image, needs to be in yuv420.
  7527. @item mode
  7528. Set covering mode.
  7529. It accepts the following values:
  7530. @table @samp
  7531. @item cover
  7532. cover it by the supplied image
  7533. @item blur
  7534. cover it by interpolating the surrounding pixels
  7535. @end table
  7536. Default value is @var{blur}.
  7537. @end table
  7538. @subsection Examples
  7539. @itemize
  7540. @item
  7541. Generate a representative palette of a given video using @command{ffmpeg}:
  7542. @example
  7543. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7544. @end example
  7545. @end itemize
  7546. @section floodfill
  7547. Flood area with values of same pixel components with another values.
  7548. It accepts the following options:
  7549. @table @option
  7550. @item x
  7551. Set pixel x coordinate.
  7552. @item y
  7553. Set pixel y coordinate.
  7554. @item s0
  7555. Set source #0 component value.
  7556. @item s1
  7557. Set source #1 component value.
  7558. @item s2
  7559. Set source #2 component value.
  7560. @item s3
  7561. Set source #3 component value.
  7562. @item d0
  7563. Set destination #0 component value.
  7564. @item d1
  7565. Set destination #1 component value.
  7566. @item d2
  7567. Set destination #2 component value.
  7568. @item d3
  7569. Set destination #3 component value.
  7570. @end table
  7571. @anchor{format}
  7572. @section format
  7573. Convert the input video to one of the specified pixel formats.
  7574. Libavfilter will try to pick one that is suitable as input to
  7575. the next filter.
  7576. It accepts the following parameters:
  7577. @table @option
  7578. @item pix_fmts
  7579. A '|'-separated list of pixel format names, such as
  7580. "pix_fmts=yuv420p|monow|rgb24".
  7581. @end table
  7582. @subsection Examples
  7583. @itemize
  7584. @item
  7585. Convert the input video to the @var{yuv420p} format
  7586. @example
  7587. format=pix_fmts=yuv420p
  7588. @end example
  7589. Convert the input video to any of the formats in the list
  7590. @example
  7591. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7592. @end example
  7593. @end itemize
  7594. @anchor{fps}
  7595. @section fps
  7596. Convert the video to specified constant frame rate by duplicating or dropping
  7597. frames as necessary.
  7598. It accepts the following parameters:
  7599. @table @option
  7600. @item fps
  7601. The desired output frame rate. The default is @code{25}.
  7602. @item start_time
  7603. Assume the first PTS should be the given value, in seconds. This allows for
  7604. padding/trimming at the start of stream. By default, no assumption is made
  7605. about the first frame's expected PTS, so no padding or trimming is done.
  7606. For example, this could be set to 0 to pad the beginning with duplicates of
  7607. the first frame if a video stream starts after the audio stream or to trim any
  7608. frames with a negative PTS.
  7609. @item round
  7610. Timestamp (PTS) rounding method.
  7611. Possible values are:
  7612. @table @option
  7613. @item zero
  7614. round towards 0
  7615. @item inf
  7616. round away from 0
  7617. @item down
  7618. round towards -infinity
  7619. @item up
  7620. round towards +infinity
  7621. @item near
  7622. round to nearest
  7623. @end table
  7624. The default is @code{near}.
  7625. @item eof_action
  7626. Action performed when reading the last frame.
  7627. Possible values are:
  7628. @table @option
  7629. @item round
  7630. Use same timestamp rounding method as used for other frames.
  7631. @item pass
  7632. Pass through last frame if input duration has not been reached yet.
  7633. @end table
  7634. The default is @code{round}.
  7635. @end table
  7636. Alternatively, the options can be specified as a flat string:
  7637. @var{fps}[:@var{start_time}[:@var{round}]].
  7638. See also the @ref{setpts} filter.
  7639. @subsection Examples
  7640. @itemize
  7641. @item
  7642. A typical usage in order to set the fps to 25:
  7643. @example
  7644. fps=fps=25
  7645. @end example
  7646. @item
  7647. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7648. @example
  7649. fps=fps=film:round=near
  7650. @end example
  7651. @end itemize
  7652. @section framepack
  7653. Pack two different video streams into a stereoscopic video, setting proper
  7654. metadata on supported codecs. The two views should have the same size and
  7655. framerate and processing will stop when the shorter video ends. Please note
  7656. that you may conveniently adjust view properties with the @ref{scale} and
  7657. @ref{fps} filters.
  7658. It accepts the following parameters:
  7659. @table @option
  7660. @item format
  7661. The desired packing format. Supported values are:
  7662. @table @option
  7663. @item sbs
  7664. The views are next to each other (default).
  7665. @item tab
  7666. The views are on top of each other.
  7667. @item lines
  7668. The views are packed by line.
  7669. @item columns
  7670. The views are packed by column.
  7671. @item frameseq
  7672. The views are temporally interleaved.
  7673. @end table
  7674. @end table
  7675. Some examples:
  7676. @example
  7677. # Convert left and right views into a frame-sequential video
  7678. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7679. # Convert views into a side-by-side video with the same output resolution as the input
  7680. 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
  7681. @end example
  7682. @section framerate
  7683. Change the frame rate by interpolating new video output frames from the source
  7684. frames.
  7685. This filter is not designed to function correctly with interlaced media. If
  7686. you wish to change the frame rate of interlaced media then you are required
  7687. to deinterlace before this filter and re-interlace after this filter.
  7688. A description of the accepted options follows.
  7689. @table @option
  7690. @item fps
  7691. Specify the output frames per second. This option can also be specified
  7692. as a value alone. The default is @code{50}.
  7693. @item interp_start
  7694. Specify the start of a range where the output frame will be created as a
  7695. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7696. the default is @code{15}.
  7697. @item interp_end
  7698. Specify the end of a range where the output frame will be created as a
  7699. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7700. the default is @code{240}.
  7701. @item scene
  7702. Specify the level at which a scene change is detected as a value between
  7703. 0 and 100 to indicate a new scene; a low value reflects a low
  7704. probability for the current frame to introduce a new scene, while a higher
  7705. value means the current frame is more likely to be one.
  7706. The default is @code{8.2}.
  7707. @item flags
  7708. Specify flags influencing the filter process.
  7709. Available value for @var{flags} is:
  7710. @table @option
  7711. @item scene_change_detect, scd
  7712. Enable scene change detection using the value of the option @var{scene}.
  7713. This flag is enabled by default.
  7714. @end table
  7715. @end table
  7716. @section framestep
  7717. Select one frame every N-th frame.
  7718. This filter accepts the following option:
  7719. @table @option
  7720. @item step
  7721. Select frame after every @code{step} frames.
  7722. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7723. @end table
  7724. @section freezedetect
  7725. Detect frozen video.
  7726. This filter logs a message and sets frame metadata when it detects that the
  7727. input video has no significant change in content during a specified duration.
  7728. Video freeze detection calculates the mean average absolute difference of all
  7729. the components of video frames and compares it to a noise floor.
  7730. The printed times and duration are expressed in seconds. The
  7731. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  7732. whose timestamp equals or exceeds the detection duration and it contains the
  7733. timestamp of the first frame of the freeze. The
  7734. @code{lavfi.freezedetect.freeze_duration} and
  7735. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  7736. after the freeze.
  7737. The filter accepts the following options:
  7738. @table @option
  7739. @item noise, n
  7740. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  7741. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  7742. 0.001.
  7743. @item duration, d
  7744. Set freeze duration until notification (default is 2 seconds).
  7745. @end table
  7746. @anchor{frei0r}
  7747. @section frei0r
  7748. Apply a frei0r effect to the input video.
  7749. To enable the compilation of this filter, you need to install the frei0r
  7750. header and configure FFmpeg with @code{--enable-frei0r}.
  7751. It accepts the following parameters:
  7752. @table @option
  7753. @item filter_name
  7754. The name of the frei0r effect to load. If the environment variable
  7755. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7756. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7757. Otherwise, the standard frei0r paths are searched, in this order:
  7758. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7759. @file{/usr/lib/frei0r-1/}.
  7760. @item filter_params
  7761. A '|'-separated list of parameters to pass to the frei0r effect.
  7762. @end table
  7763. A frei0r effect parameter can be a boolean (its value is either
  7764. "y" or "n"), a double, a color (specified as
  7765. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7766. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7767. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7768. a position (specified as @var{X}/@var{Y}, where
  7769. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7770. The number and types of parameters depend on the loaded effect. If an
  7771. effect parameter is not specified, the default value is set.
  7772. @subsection Examples
  7773. @itemize
  7774. @item
  7775. Apply the distort0r effect, setting the first two double parameters:
  7776. @example
  7777. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7778. @end example
  7779. @item
  7780. Apply the colordistance effect, taking a color as the first parameter:
  7781. @example
  7782. frei0r=colordistance:0.2/0.3/0.4
  7783. frei0r=colordistance:violet
  7784. frei0r=colordistance:0x112233
  7785. @end example
  7786. @item
  7787. Apply the perspective effect, specifying the top left and top right image
  7788. positions:
  7789. @example
  7790. frei0r=perspective:0.2/0.2|0.8/0.2
  7791. @end example
  7792. @end itemize
  7793. For more information, see
  7794. @url{http://frei0r.dyne.org}
  7795. @section fspp
  7796. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7797. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7798. processing filter, one of them is performed once per block, not per pixel.
  7799. This allows for much higher speed.
  7800. The filter accepts the following options:
  7801. @table @option
  7802. @item quality
  7803. Set quality. This option defines the number of levels for averaging. It accepts
  7804. an integer in the range 4-5. Default value is @code{4}.
  7805. @item qp
  7806. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7807. If not set, the filter will use the QP from the video stream (if available).
  7808. @item strength
  7809. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7810. more details but also more artifacts, while higher values make the image smoother
  7811. but also blurrier. Default value is @code{0} − PSNR optimal.
  7812. @item use_bframe_qp
  7813. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7814. option may cause flicker since the B-Frames have often larger QP. Default is
  7815. @code{0} (not enabled).
  7816. @end table
  7817. @section gblur
  7818. Apply Gaussian blur filter.
  7819. The filter accepts the following options:
  7820. @table @option
  7821. @item sigma
  7822. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7823. @item steps
  7824. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7825. @item planes
  7826. Set which planes to filter. By default all planes are filtered.
  7827. @item sigmaV
  7828. Set vertical sigma, if negative it will be same as @code{sigma}.
  7829. Default is @code{-1}.
  7830. @end table
  7831. @section geq
  7832. Apply generic equation to each pixel.
  7833. The filter accepts the following options:
  7834. @table @option
  7835. @item lum_expr, lum
  7836. Set the luminance expression.
  7837. @item cb_expr, cb
  7838. Set the chrominance blue expression.
  7839. @item cr_expr, cr
  7840. Set the chrominance red expression.
  7841. @item alpha_expr, a
  7842. Set the alpha expression.
  7843. @item red_expr, r
  7844. Set the red expression.
  7845. @item green_expr, g
  7846. Set the green expression.
  7847. @item blue_expr, b
  7848. Set the blue expression.
  7849. @end table
  7850. The colorspace is selected according to the specified options. If one
  7851. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7852. options is specified, the filter will automatically select a YCbCr
  7853. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7854. @option{blue_expr} options is specified, it will select an RGB
  7855. colorspace.
  7856. If one of the chrominance expression is not defined, it falls back on the other
  7857. one. If no alpha expression is specified it will evaluate to opaque value.
  7858. If none of chrominance expressions are specified, they will evaluate
  7859. to the luminance expression.
  7860. The expressions can use the following variables and functions:
  7861. @table @option
  7862. @item N
  7863. The sequential number of the filtered frame, starting from @code{0}.
  7864. @item X
  7865. @item Y
  7866. The coordinates of the current sample.
  7867. @item W
  7868. @item H
  7869. The width and height of the image.
  7870. @item SW
  7871. @item SH
  7872. Width and height scale depending on the currently filtered plane. It is the
  7873. ratio between the corresponding luma plane number of pixels and the current
  7874. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7875. @code{0.5,0.5} for chroma planes.
  7876. @item T
  7877. Time of the current frame, expressed in seconds.
  7878. @item p(x, y)
  7879. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7880. plane.
  7881. @item lum(x, y)
  7882. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7883. plane.
  7884. @item cb(x, y)
  7885. Return the value of the pixel at location (@var{x},@var{y}) of the
  7886. blue-difference chroma plane. Return 0 if there is no such plane.
  7887. @item cr(x, y)
  7888. Return the value of the pixel at location (@var{x},@var{y}) of the
  7889. red-difference chroma plane. Return 0 if there is no such plane.
  7890. @item r(x, y)
  7891. @item g(x, y)
  7892. @item b(x, y)
  7893. Return the value of the pixel at location (@var{x},@var{y}) of the
  7894. red/green/blue component. Return 0 if there is no such component.
  7895. @item alpha(x, y)
  7896. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7897. plane. Return 0 if there is no such plane.
  7898. @end table
  7899. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7900. automatically clipped to the closer edge.
  7901. @subsection Examples
  7902. @itemize
  7903. @item
  7904. Flip the image horizontally:
  7905. @example
  7906. geq=p(W-X\,Y)
  7907. @end example
  7908. @item
  7909. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7910. wavelength of 100 pixels:
  7911. @example
  7912. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7913. @end example
  7914. @item
  7915. Generate a fancy enigmatic moving light:
  7916. @example
  7917. 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
  7918. @end example
  7919. @item
  7920. Generate a quick emboss effect:
  7921. @example
  7922. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7923. @end example
  7924. @item
  7925. Modify RGB components depending on pixel position:
  7926. @example
  7927. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7928. @end example
  7929. @item
  7930. Create a radial gradient that is the same size as the input (also see
  7931. the @ref{vignette} filter):
  7932. @example
  7933. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7934. @end example
  7935. @end itemize
  7936. @section gradfun
  7937. Fix the banding artifacts that are sometimes introduced into nearly flat
  7938. regions by truncation to 8-bit color depth.
  7939. Interpolate the gradients that should go where the bands are, and
  7940. dither them.
  7941. It is designed for playback only. Do not use it prior to
  7942. lossy compression, because compression tends to lose the dither and
  7943. bring back the bands.
  7944. It accepts the following parameters:
  7945. @table @option
  7946. @item strength
  7947. The maximum amount by which the filter will change any one pixel. This is also
  7948. the threshold for detecting nearly flat regions. Acceptable values range from
  7949. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7950. valid range.
  7951. @item radius
  7952. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7953. gradients, but also prevents the filter from modifying the pixels near detailed
  7954. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7955. values will be clipped to the valid range.
  7956. @end table
  7957. Alternatively, the options can be specified as a flat string:
  7958. @var{strength}[:@var{radius}]
  7959. @subsection Examples
  7960. @itemize
  7961. @item
  7962. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7963. @example
  7964. gradfun=3.5:8
  7965. @end example
  7966. @item
  7967. Specify radius, omitting the strength (which will fall-back to the default
  7968. value):
  7969. @example
  7970. gradfun=radius=8
  7971. @end example
  7972. @end itemize
  7973. @section graphmonitor, agraphmonitor
  7974. Show various filtergraph stats.
  7975. With this filter one can debug complete filtergraph.
  7976. Especially issues with links filling with queued frames.
  7977. The filter accepts the following options:
  7978. @table @option
  7979. @item size, s
  7980. Set video output size. Default is @var{hd720}.
  7981. @item opacity, o
  7982. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  7983. @item mode, m
  7984. Set output mode, can be @var{fulll} or @var{compact}.
  7985. In @var{compact} mode only filters with some queued frames have displayed stats.
  7986. @item flags, f
  7987. Set flags which enable which stats are shown in video.
  7988. Available values for flags are:
  7989. @table @samp
  7990. @item queue
  7991. Display number of queued frames in each link.
  7992. @item frame_count_in
  7993. Display number of frames taken from filter.
  7994. @item frame_count_out
  7995. Display number of frames given out from filter.
  7996. @item pts
  7997. Display current filtered frame pts.
  7998. @item time
  7999. Display current filtered frame time.
  8000. @item timebase
  8001. Display time base for filter link.
  8002. @item format
  8003. Display used format for filter link.
  8004. @item size
  8005. Display video size or number of audio channels in case of audio used by filter link.
  8006. @item rate
  8007. Display video frame rate or sample rate in case of audio used by filter link.
  8008. @end table
  8009. @item rate, r
  8010. Set upper limit for video rate of output stream, Default value is @var{25}.
  8011. This guarantee that output video frame rate will not be higher than this value.
  8012. @end table
  8013. @section greyedge
  8014. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8015. and corrects the scene colors accordingly.
  8016. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8017. The filter accepts the following options:
  8018. @table @option
  8019. @item difford
  8020. The order of differentiation to be applied on the scene. Must be chosen in the range
  8021. [0,2] and default value is 1.
  8022. @item minknorm
  8023. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8024. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8025. max value instead of calculating Minkowski distance.
  8026. @item sigma
  8027. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8028. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8029. can't be euqal to 0 if @var{difford} is greater than 0.
  8030. @end table
  8031. @subsection Examples
  8032. @itemize
  8033. @item
  8034. Grey Edge:
  8035. @example
  8036. greyedge=difford=1:minknorm=5:sigma=2
  8037. @end example
  8038. @item
  8039. Max Edge:
  8040. @example
  8041. greyedge=difford=1:minknorm=0:sigma=2
  8042. @end example
  8043. @end itemize
  8044. @anchor{haldclut}
  8045. @section haldclut
  8046. Apply a Hald CLUT to a video stream.
  8047. First input is the video stream to process, and second one is the Hald CLUT.
  8048. The Hald CLUT input can be a simple picture or a complete video stream.
  8049. The filter accepts the following options:
  8050. @table @option
  8051. @item shortest
  8052. Force termination when the shortest input terminates. Default is @code{0}.
  8053. @item repeatlast
  8054. Continue applying the last CLUT after the end of the stream. A value of
  8055. @code{0} disable the filter after the last frame of the CLUT is reached.
  8056. Default is @code{1}.
  8057. @end table
  8058. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8059. filters share the same internals).
  8060. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8061. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8062. @subsection Workflow examples
  8063. @subsubsection Hald CLUT video stream
  8064. Generate an identity Hald CLUT stream altered with various effects:
  8065. @example
  8066. 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
  8067. @end example
  8068. Note: make sure you use a lossless codec.
  8069. Then use it with @code{haldclut} to apply it on some random stream:
  8070. @example
  8071. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8072. @end example
  8073. The Hald CLUT will be applied to the 10 first seconds (duration of
  8074. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8075. to the remaining frames of the @code{mandelbrot} stream.
  8076. @subsubsection Hald CLUT with preview
  8077. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8078. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8079. biggest possible square starting at the top left of the picture. The remaining
  8080. padding pixels (bottom or right) will be ignored. This area can be used to add
  8081. a preview of the Hald CLUT.
  8082. Typically, the following generated Hald CLUT will be supported by the
  8083. @code{haldclut} filter:
  8084. @example
  8085. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8086. pad=iw+320 [padded_clut];
  8087. smptebars=s=320x256, split [a][b];
  8088. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8089. [main][b] overlay=W-320" -frames:v 1 clut.png
  8090. @end example
  8091. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8092. bars are displayed on the right-top, and below the same color bars processed by
  8093. the color changes.
  8094. Then, the effect of this Hald CLUT can be visualized with:
  8095. @example
  8096. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8097. @end example
  8098. @section hflip
  8099. Flip the input video horizontally.
  8100. For example, to horizontally flip the input video with @command{ffmpeg}:
  8101. @example
  8102. ffmpeg -i in.avi -vf "hflip" out.avi
  8103. @end example
  8104. @section histeq
  8105. This filter applies a global color histogram equalization on a
  8106. per-frame basis.
  8107. It can be used to correct video that has a compressed range of pixel
  8108. intensities. The filter redistributes the pixel intensities to
  8109. equalize their distribution across the intensity range. It may be
  8110. viewed as an "automatically adjusting contrast filter". This filter is
  8111. useful only for correcting degraded or poorly captured source
  8112. video.
  8113. The filter accepts the following options:
  8114. @table @option
  8115. @item strength
  8116. Determine the amount of equalization to be applied. As the strength
  8117. is reduced, the distribution of pixel intensities more-and-more
  8118. approaches that of the input frame. The value must be a float number
  8119. in the range [0,1] and defaults to 0.200.
  8120. @item intensity
  8121. Set the maximum intensity that can generated and scale the output
  8122. values appropriately. The strength should be set as desired and then
  8123. the intensity can be limited if needed to avoid washing-out. The value
  8124. must be a float number in the range [0,1] and defaults to 0.210.
  8125. @item antibanding
  8126. Set the antibanding level. If enabled the filter will randomly vary
  8127. the luminance of output pixels by a small amount to avoid banding of
  8128. the histogram. Possible values are @code{none}, @code{weak} or
  8129. @code{strong}. It defaults to @code{none}.
  8130. @end table
  8131. @section histogram
  8132. Compute and draw a color distribution histogram for the input video.
  8133. The computed histogram is a representation of the color component
  8134. distribution in an image.
  8135. Standard histogram displays the color components distribution in an image.
  8136. Displays color graph for each color component. Shows distribution of
  8137. the Y, U, V, A or R, G, B components, depending on input format, in the
  8138. current frame. Below each graph a color component scale meter is shown.
  8139. The filter accepts the following options:
  8140. @table @option
  8141. @item level_height
  8142. Set height of level. Default value is @code{200}.
  8143. Allowed range is [50, 2048].
  8144. @item scale_height
  8145. Set height of color scale. Default value is @code{12}.
  8146. Allowed range is [0, 40].
  8147. @item display_mode
  8148. Set display mode.
  8149. It accepts the following values:
  8150. @table @samp
  8151. @item stack
  8152. Per color component graphs are placed below each other.
  8153. @item parade
  8154. Per color component graphs are placed side by side.
  8155. @item overlay
  8156. Presents information identical to that in the @code{parade}, except
  8157. that the graphs representing color components are superimposed directly
  8158. over one another.
  8159. @end table
  8160. Default is @code{stack}.
  8161. @item levels_mode
  8162. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8163. Default is @code{linear}.
  8164. @item components
  8165. Set what color components to display.
  8166. Default is @code{7}.
  8167. @item fgopacity
  8168. Set foreground opacity. Default is @code{0.7}.
  8169. @item bgopacity
  8170. Set background opacity. Default is @code{0.5}.
  8171. @end table
  8172. @subsection Examples
  8173. @itemize
  8174. @item
  8175. Calculate and draw histogram:
  8176. @example
  8177. ffplay -i input -vf histogram
  8178. @end example
  8179. @end itemize
  8180. @anchor{hqdn3d}
  8181. @section hqdn3d
  8182. This is a high precision/quality 3d denoise filter. It aims to reduce
  8183. image noise, producing smooth images and making still images really
  8184. still. It should enhance compressibility.
  8185. It accepts the following optional parameters:
  8186. @table @option
  8187. @item luma_spatial
  8188. A non-negative floating point number which specifies spatial luma strength.
  8189. It defaults to 4.0.
  8190. @item chroma_spatial
  8191. A non-negative floating point number which specifies spatial chroma strength.
  8192. It defaults to 3.0*@var{luma_spatial}/4.0.
  8193. @item luma_tmp
  8194. A floating point number which specifies luma temporal strength. It defaults to
  8195. 6.0*@var{luma_spatial}/4.0.
  8196. @item chroma_tmp
  8197. A floating point number which specifies chroma temporal strength. It defaults to
  8198. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8199. @end table
  8200. @anchor{hwdownload}
  8201. @section hwdownload
  8202. Download hardware frames to system memory.
  8203. The input must be in hardware frames, and the output a non-hardware format.
  8204. Not all formats will be supported on the output - it may be necessary to insert
  8205. an additional @option{format} filter immediately following in the graph to get
  8206. the output in a supported format.
  8207. @section hwmap
  8208. Map hardware frames to system memory or to another device.
  8209. This filter has several different modes of operation; which one is used depends
  8210. on the input and output formats:
  8211. @itemize
  8212. @item
  8213. Hardware frame input, normal frame output
  8214. Map the input frames to system memory and pass them to the output. If the
  8215. original hardware frame is later required (for example, after overlaying
  8216. something else on part of it), the @option{hwmap} filter can be used again
  8217. in the next mode to retrieve it.
  8218. @item
  8219. Normal frame input, hardware frame output
  8220. If the input is actually a software-mapped hardware frame, then unmap it -
  8221. that is, return the original hardware frame.
  8222. Otherwise, a device must be provided. Create new hardware surfaces on that
  8223. device for the output, then map them back to the software format at the input
  8224. and give those frames to the preceding filter. This will then act like the
  8225. @option{hwupload} filter, but may be able to avoid an additional copy when
  8226. the input is already in a compatible format.
  8227. @item
  8228. Hardware frame input and output
  8229. A device must be supplied for the output, either directly or with the
  8230. @option{derive_device} option. The input and output devices must be of
  8231. different types and compatible - the exact meaning of this is
  8232. system-dependent, but typically it means that they must refer to the same
  8233. underlying hardware context (for example, refer to the same graphics card).
  8234. If the input frames were originally created on the output device, then unmap
  8235. to retrieve the original frames.
  8236. Otherwise, map the frames to the output device - create new hardware frames
  8237. on the output corresponding to the frames on the input.
  8238. @end itemize
  8239. The following additional parameters are accepted:
  8240. @table @option
  8241. @item mode
  8242. Set the frame mapping mode. Some combination of:
  8243. @table @var
  8244. @item read
  8245. The mapped frame should be readable.
  8246. @item write
  8247. The mapped frame should be writeable.
  8248. @item overwrite
  8249. The mapping will always overwrite the entire frame.
  8250. This may improve performance in some cases, as the original contents of the
  8251. frame need not be loaded.
  8252. @item direct
  8253. The mapping must not involve any copying.
  8254. Indirect mappings to copies of frames are created in some cases where either
  8255. direct mapping is not possible or it would have unexpected properties.
  8256. Setting this flag ensures that the mapping is direct and will fail if that is
  8257. not possible.
  8258. @end table
  8259. Defaults to @var{read+write} if not specified.
  8260. @item derive_device @var{type}
  8261. Rather than using the device supplied at initialisation, instead derive a new
  8262. device of type @var{type} from the device the input frames exist on.
  8263. @item reverse
  8264. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8265. and map them back to the source. This may be necessary in some cases where
  8266. a mapping in one direction is required but only the opposite direction is
  8267. supported by the devices being used.
  8268. This option is dangerous - it may break the preceding filter in undefined
  8269. ways if there are any additional constraints on that filter's output.
  8270. Do not use it without fully understanding the implications of its use.
  8271. @end table
  8272. @anchor{hwupload}
  8273. @section hwupload
  8274. Upload system memory frames to hardware surfaces.
  8275. The device to upload to must be supplied when the filter is initialised. If
  8276. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8277. option.
  8278. @anchor{hwupload_cuda}
  8279. @section hwupload_cuda
  8280. Upload system memory frames to a CUDA device.
  8281. It accepts the following optional parameters:
  8282. @table @option
  8283. @item device
  8284. The number of the CUDA device to use
  8285. @end table
  8286. @section hqx
  8287. Apply a high-quality magnification filter designed for pixel art. This filter
  8288. was originally created by Maxim Stepin.
  8289. It accepts the following option:
  8290. @table @option
  8291. @item n
  8292. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8293. @code{hq3x} and @code{4} for @code{hq4x}.
  8294. Default is @code{3}.
  8295. @end table
  8296. @section hstack
  8297. Stack input videos horizontally.
  8298. All streams must be of same pixel format and of same height.
  8299. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8300. to create same output.
  8301. The filter accept the following option:
  8302. @table @option
  8303. @item inputs
  8304. Set number of input streams. Default is 2.
  8305. @item shortest
  8306. If set to 1, force the output to terminate when the shortest input
  8307. terminates. Default value is 0.
  8308. @end table
  8309. @section hue
  8310. Modify the hue and/or the saturation of the input.
  8311. It accepts the following parameters:
  8312. @table @option
  8313. @item h
  8314. Specify the hue angle as a number of degrees. It accepts an expression,
  8315. and defaults to "0".
  8316. @item s
  8317. Specify the saturation in the [-10,10] range. It accepts an expression and
  8318. defaults to "1".
  8319. @item H
  8320. Specify the hue angle as a number of radians. It accepts an
  8321. expression, and defaults to "0".
  8322. @item b
  8323. Specify the brightness in the [-10,10] range. It accepts an expression and
  8324. defaults to "0".
  8325. @end table
  8326. @option{h} and @option{H} are mutually exclusive, and can't be
  8327. specified at the same time.
  8328. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8329. expressions containing the following constants:
  8330. @table @option
  8331. @item n
  8332. frame count of the input frame starting from 0
  8333. @item pts
  8334. presentation timestamp of the input frame expressed in time base units
  8335. @item r
  8336. frame rate of the input video, NAN if the input frame rate is unknown
  8337. @item t
  8338. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8339. @item tb
  8340. time base of the input video
  8341. @end table
  8342. @subsection Examples
  8343. @itemize
  8344. @item
  8345. Set the hue to 90 degrees and the saturation to 1.0:
  8346. @example
  8347. hue=h=90:s=1
  8348. @end example
  8349. @item
  8350. Same command but expressing the hue in radians:
  8351. @example
  8352. hue=H=PI/2:s=1
  8353. @end example
  8354. @item
  8355. Rotate hue and make the saturation swing between 0
  8356. and 2 over a period of 1 second:
  8357. @example
  8358. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8359. @end example
  8360. @item
  8361. Apply a 3 seconds saturation fade-in effect starting at 0:
  8362. @example
  8363. hue="s=min(t/3\,1)"
  8364. @end example
  8365. The general fade-in expression can be written as:
  8366. @example
  8367. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8368. @end example
  8369. @item
  8370. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8371. @example
  8372. hue="s=max(0\, min(1\, (8-t)/3))"
  8373. @end example
  8374. The general fade-out expression can be written as:
  8375. @example
  8376. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8377. @end example
  8378. @end itemize
  8379. @subsection Commands
  8380. This filter supports the following commands:
  8381. @table @option
  8382. @item b
  8383. @item s
  8384. @item h
  8385. @item H
  8386. Modify the hue and/or the saturation and/or brightness of the input video.
  8387. The command accepts the same syntax of the corresponding option.
  8388. If the specified expression is not valid, it is kept at its current
  8389. value.
  8390. @end table
  8391. @section hysteresis
  8392. Grow first stream into second stream by connecting components.
  8393. This makes it possible to build more robust edge masks.
  8394. This filter accepts the following options:
  8395. @table @option
  8396. @item planes
  8397. Set which planes will be processed as bitmap, unprocessed planes will be
  8398. copied from first stream.
  8399. By default value 0xf, all planes will be processed.
  8400. @item threshold
  8401. Set threshold which is used in filtering. If pixel component value is higher than
  8402. this value filter algorithm for connecting components is activated.
  8403. By default value is 0.
  8404. @end table
  8405. @section idet
  8406. Detect video interlacing type.
  8407. This filter tries to detect if the input frames are interlaced, progressive,
  8408. top or bottom field first. It will also try to detect fields that are
  8409. repeated between adjacent frames (a sign of telecine).
  8410. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8411. Multiple frame detection incorporates the classification history of previous frames.
  8412. The filter will log these metadata values:
  8413. @table @option
  8414. @item single.current_frame
  8415. Detected type of current frame using single-frame detection. One of:
  8416. ``tff'' (top field first), ``bff'' (bottom field first),
  8417. ``progressive'', or ``undetermined''
  8418. @item single.tff
  8419. Cumulative number of frames detected as top field first using single-frame detection.
  8420. @item multiple.tff
  8421. Cumulative number of frames detected as top field first using multiple-frame detection.
  8422. @item single.bff
  8423. Cumulative number of frames detected as bottom field first using single-frame detection.
  8424. @item multiple.current_frame
  8425. Detected type of current frame using multiple-frame detection. One of:
  8426. ``tff'' (top field first), ``bff'' (bottom field first),
  8427. ``progressive'', or ``undetermined''
  8428. @item multiple.bff
  8429. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8430. @item single.progressive
  8431. Cumulative number of frames detected as progressive using single-frame detection.
  8432. @item multiple.progressive
  8433. Cumulative number of frames detected as progressive using multiple-frame detection.
  8434. @item single.undetermined
  8435. Cumulative number of frames that could not be classified using single-frame detection.
  8436. @item multiple.undetermined
  8437. Cumulative number of frames that could not be classified using multiple-frame detection.
  8438. @item repeated.current_frame
  8439. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8440. @item repeated.neither
  8441. Cumulative number of frames with no repeated field.
  8442. @item repeated.top
  8443. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8444. @item repeated.bottom
  8445. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8446. @end table
  8447. The filter accepts the following options:
  8448. @table @option
  8449. @item intl_thres
  8450. Set interlacing threshold.
  8451. @item prog_thres
  8452. Set progressive threshold.
  8453. @item rep_thres
  8454. Threshold for repeated field detection.
  8455. @item half_life
  8456. Number of frames after which a given frame's contribution to the
  8457. statistics is halved (i.e., it contributes only 0.5 to its
  8458. classification). The default of 0 means that all frames seen are given
  8459. full weight of 1.0 forever.
  8460. @item analyze_interlaced_flag
  8461. When this is not 0 then idet will use the specified number of frames to determine
  8462. if the interlaced flag is accurate, it will not count undetermined frames.
  8463. If the flag is found to be accurate it will be used without any further
  8464. computations, if it is found to be inaccurate it will be cleared without any
  8465. further computations. This allows inserting the idet filter as a low computational
  8466. method to clean up the interlaced flag
  8467. @end table
  8468. @section il
  8469. Deinterleave or interleave fields.
  8470. This filter allows one to process interlaced images fields without
  8471. deinterlacing them. Deinterleaving splits the input frame into 2
  8472. fields (so called half pictures). Odd lines are moved to the top
  8473. half of the output image, even lines to the bottom half.
  8474. You can process (filter) them independently and then re-interleave them.
  8475. The filter accepts the following options:
  8476. @table @option
  8477. @item luma_mode, l
  8478. @item chroma_mode, c
  8479. @item alpha_mode, a
  8480. Available values for @var{luma_mode}, @var{chroma_mode} and
  8481. @var{alpha_mode} are:
  8482. @table @samp
  8483. @item none
  8484. Do nothing.
  8485. @item deinterleave, d
  8486. Deinterleave fields, placing one above the other.
  8487. @item interleave, i
  8488. Interleave fields. Reverse the effect of deinterleaving.
  8489. @end table
  8490. Default value is @code{none}.
  8491. @item luma_swap, ls
  8492. @item chroma_swap, cs
  8493. @item alpha_swap, as
  8494. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8495. @end table
  8496. @section inflate
  8497. Apply inflate effect to the video.
  8498. This filter replaces the pixel by the local(3x3) average by taking into account
  8499. only values higher than the pixel.
  8500. It accepts the following options:
  8501. @table @option
  8502. @item threshold0
  8503. @item threshold1
  8504. @item threshold2
  8505. @item threshold3
  8506. Limit the maximum change for each plane, default is 65535.
  8507. If 0, plane will remain unchanged.
  8508. @end table
  8509. @section interlace
  8510. Simple interlacing filter from progressive contents. This interleaves upper (or
  8511. lower) lines from odd frames with lower (or upper) lines from even frames,
  8512. halving the frame rate and preserving image height.
  8513. @example
  8514. Original Original New Frame
  8515. Frame 'j' Frame 'j+1' (tff)
  8516. ========== =========== ==================
  8517. Line 0 --------------------> Frame 'j' Line 0
  8518. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8519. Line 2 ---------------------> Frame 'j' Line 2
  8520. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8521. ... ... ...
  8522. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8523. @end example
  8524. It accepts the following optional parameters:
  8525. @table @option
  8526. @item scan
  8527. This determines whether the interlaced frame is taken from the even
  8528. (tff - default) or odd (bff) lines of the progressive frame.
  8529. @item lowpass
  8530. Vertical lowpass filter to avoid twitter interlacing and
  8531. reduce moire patterns.
  8532. @table @samp
  8533. @item 0, off
  8534. Disable vertical lowpass filter
  8535. @item 1, linear
  8536. Enable linear filter (default)
  8537. @item 2, complex
  8538. Enable complex filter. This will slightly less reduce twitter and moire
  8539. but better retain detail and subjective sharpness impression.
  8540. @end table
  8541. @end table
  8542. @section kerndeint
  8543. Deinterlace input video by applying Donald Graft's adaptive kernel
  8544. deinterling. Work on interlaced parts of a video to produce
  8545. progressive frames.
  8546. The description of the accepted parameters follows.
  8547. @table @option
  8548. @item thresh
  8549. Set the threshold which affects the filter's tolerance when
  8550. determining if a pixel line must be processed. It must be an integer
  8551. in the range [0,255] and defaults to 10. A value of 0 will result in
  8552. applying the process on every pixels.
  8553. @item map
  8554. Paint pixels exceeding the threshold value to white if set to 1.
  8555. Default is 0.
  8556. @item order
  8557. Set the fields order. Swap fields if set to 1, leave fields alone if
  8558. 0. Default is 0.
  8559. @item sharp
  8560. Enable additional sharpening if set to 1. Default is 0.
  8561. @item twoway
  8562. Enable twoway sharpening if set to 1. Default is 0.
  8563. @end table
  8564. @subsection Examples
  8565. @itemize
  8566. @item
  8567. Apply default values:
  8568. @example
  8569. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8570. @end example
  8571. @item
  8572. Enable additional sharpening:
  8573. @example
  8574. kerndeint=sharp=1
  8575. @end example
  8576. @item
  8577. Paint processed pixels in white:
  8578. @example
  8579. kerndeint=map=1
  8580. @end example
  8581. @end itemize
  8582. @section lenscorrection
  8583. Correct radial lens distortion
  8584. This filter can be used to correct for radial distortion as can result from the use
  8585. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8586. one can use tools available for example as part of opencv or simply trial-and-error.
  8587. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8588. and extract the k1 and k2 coefficients from the resulting matrix.
  8589. Note that effectively the same filter is available in the open-source tools Krita and
  8590. Digikam from the KDE project.
  8591. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8592. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8593. brightness distribution, so you may want to use both filters together in certain
  8594. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8595. be applied before or after lens correction.
  8596. @subsection Options
  8597. The filter accepts the following options:
  8598. @table @option
  8599. @item cx
  8600. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8601. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8602. width. Default is 0.5.
  8603. @item cy
  8604. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8605. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8606. height. Default is 0.5.
  8607. @item k1
  8608. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8609. no correction. Default is 0.
  8610. @item k2
  8611. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8612. 0 means no correction. Default is 0.
  8613. @end table
  8614. The formula that generates the correction is:
  8615. @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)
  8616. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8617. distances from the focal point in the source and target images, respectively.
  8618. @section lensfun
  8619. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8620. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8621. to apply the lens correction. The filter will load the lensfun database and
  8622. query it to find the corresponding camera and lens entries in the database. As
  8623. long as these entries can be found with the given options, the filter can
  8624. perform corrections on frames. Note that incomplete strings will result in the
  8625. filter choosing the best match with the given options, and the filter will
  8626. output the chosen camera and lens models (logged with level "info"). You must
  8627. provide the make, camera model, and lens model as they are required.
  8628. The filter accepts the following options:
  8629. @table @option
  8630. @item make
  8631. The make of the camera (for example, "Canon"). This option is required.
  8632. @item model
  8633. The model of the camera (for example, "Canon EOS 100D"). This option is
  8634. required.
  8635. @item lens_model
  8636. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8637. option is required.
  8638. @item mode
  8639. The type of correction to apply. The following values are valid options:
  8640. @table @samp
  8641. @item vignetting
  8642. Enables fixing lens vignetting.
  8643. @item geometry
  8644. Enables fixing lens geometry. This is the default.
  8645. @item subpixel
  8646. Enables fixing chromatic aberrations.
  8647. @item vig_geo
  8648. Enables fixing lens vignetting and lens geometry.
  8649. @item vig_subpixel
  8650. Enables fixing lens vignetting and chromatic aberrations.
  8651. @item distortion
  8652. Enables fixing both lens geometry and chromatic aberrations.
  8653. @item all
  8654. Enables all possible corrections.
  8655. @end table
  8656. @item focal_length
  8657. The focal length of the image/video (zoom; expected constant for video). For
  8658. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8659. range should be chosen when using that lens. Default 18.
  8660. @item aperture
  8661. The aperture of the image/video (expected constant for video). Note that
  8662. aperture is only used for vignetting correction. Default 3.5.
  8663. @item focus_distance
  8664. The focus distance of the image/video (expected constant for video). Note that
  8665. focus distance is only used for vignetting and only slightly affects the
  8666. vignetting correction process. If unknown, leave it at the default value (which
  8667. is 1000).
  8668. @item target_geometry
  8669. The target geometry of the output image/video. The following values are valid
  8670. options:
  8671. @table @samp
  8672. @item rectilinear (default)
  8673. @item fisheye
  8674. @item panoramic
  8675. @item equirectangular
  8676. @item fisheye_orthographic
  8677. @item fisheye_stereographic
  8678. @item fisheye_equisolid
  8679. @item fisheye_thoby
  8680. @end table
  8681. @item reverse
  8682. Apply the reverse of image correction (instead of correcting distortion, apply
  8683. it).
  8684. @item interpolation
  8685. The type of interpolation used when correcting distortion. The following values
  8686. are valid options:
  8687. @table @samp
  8688. @item nearest
  8689. @item linear (default)
  8690. @item lanczos
  8691. @end table
  8692. @end table
  8693. @subsection Examples
  8694. @itemize
  8695. @item
  8696. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  8697. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  8698. aperture of "8.0".
  8699. @example
  8700. 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
  8701. @end example
  8702. @item
  8703. Apply the same as before, but only for the first 5 seconds of video.
  8704. @example
  8705. 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
  8706. @end example
  8707. @end itemize
  8708. @section libvmaf
  8709. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8710. score between two input videos.
  8711. The obtained VMAF score is printed through the logging system.
  8712. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8713. After installing the library it can be enabled using:
  8714. @code{./configure --enable-libvmaf --enable-version3}.
  8715. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8716. The filter has following options:
  8717. @table @option
  8718. @item model_path
  8719. Set the model path which is to be used for SVM.
  8720. Default value: @code{"vmaf_v0.6.1.pkl"}
  8721. @item log_path
  8722. Set the file path to be used to store logs.
  8723. @item log_fmt
  8724. Set the format of the log file (xml or json).
  8725. @item enable_transform
  8726. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  8727. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  8728. Default value: @code{false}
  8729. @item phone_model
  8730. Invokes the phone model which will generate VMAF scores higher than in the
  8731. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8732. @item psnr
  8733. Enables computing psnr along with vmaf.
  8734. @item ssim
  8735. Enables computing ssim along with vmaf.
  8736. @item ms_ssim
  8737. Enables computing ms_ssim along with vmaf.
  8738. @item pool
  8739. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8740. @item n_threads
  8741. Set number of threads to be used when computing vmaf.
  8742. @item n_subsample
  8743. Set interval for frame subsampling used when computing vmaf.
  8744. @item enable_conf_interval
  8745. Enables confidence interval.
  8746. @end table
  8747. This filter also supports the @ref{framesync} options.
  8748. On the below examples the input file @file{main.mpg} being processed is
  8749. compared with the reference file @file{ref.mpg}.
  8750. @example
  8751. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8752. @end example
  8753. Example with options:
  8754. @example
  8755. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  8756. @end example
  8757. @section limiter
  8758. Limits the pixel components values to the specified range [min, max].
  8759. The filter accepts the following options:
  8760. @table @option
  8761. @item min
  8762. Lower bound. Defaults to the lowest allowed value for the input.
  8763. @item max
  8764. Upper bound. Defaults to the highest allowed value for the input.
  8765. @item planes
  8766. Specify which planes will be processed. Defaults to all available.
  8767. @end table
  8768. @section loop
  8769. Loop video frames.
  8770. The filter accepts the following options:
  8771. @table @option
  8772. @item loop
  8773. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8774. Default is 0.
  8775. @item size
  8776. Set maximal size in number of frames. Default is 0.
  8777. @item start
  8778. Set first frame of loop. Default is 0.
  8779. @end table
  8780. @subsection Examples
  8781. @itemize
  8782. @item
  8783. Loop single first frame infinitely:
  8784. @example
  8785. loop=loop=-1:size=1:start=0
  8786. @end example
  8787. @item
  8788. Loop single first frame 10 times:
  8789. @example
  8790. loop=loop=10:size=1:start=0
  8791. @end example
  8792. @item
  8793. Loop 10 first frames 5 times:
  8794. @example
  8795. loop=loop=5:size=10:start=0
  8796. @end example
  8797. @end itemize
  8798. @section lut1d
  8799. Apply a 1D LUT to an input video.
  8800. The filter accepts the following options:
  8801. @table @option
  8802. @item file
  8803. Set the 1D LUT file name.
  8804. Currently supported formats:
  8805. @table @samp
  8806. @item cube
  8807. Iridas
  8808. @end table
  8809. @item interp
  8810. Select interpolation mode.
  8811. Available values are:
  8812. @table @samp
  8813. @item nearest
  8814. Use values from the nearest defined point.
  8815. @item linear
  8816. Interpolate values using the linear interpolation.
  8817. @item cosine
  8818. Interpolate values using the cosine interpolation.
  8819. @item cubic
  8820. Interpolate values using the cubic interpolation.
  8821. @item spline
  8822. Interpolate values using the spline interpolation.
  8823. @end table
  8824. @end table
  8825. @anchor{lut3d}
  8826. @section lut3d
  8827. Apply a 3D LUT to an input video.
  8828. The filter accepts the following options:
  8829. @table @option
  8830. @item file
  8831. Set the 3D LUT file name.
  8832. Currently supported formats:
  8833. @table @samp
  8834. @item 3dl
  8835. AfterEffects
  8836. @item cube
  8837. Iridas
  8838. @item dat
  8839. DaVinci
  8840. @item m3d
  8841. Pandora
  8842. @end table
  8843. @item interp
  8844. Select interpolation mode.
  8845. Available values are:
  8846. @table @samp
  8847. @item nearest
  8848. Use values from the nearest defined point.
  8849. @item trilinear
  8850. Interpolate values using the 8 points defining a cube.
  8851. @item tetrahedral
  8852. Interpolate values using a tetrahedron.
  8853. @end table
  8854. @end table
  8855. This filter also supports the @ref{framesync} options.
  8856. @section lumakey
  8857. Turn certain luma values into transparency.
  8858. The filter accepts the following options:
  8859. @table @option
  8860. @item threshold
  8861. Set the luma which will be used as base for transparency.
  8862. Default value is @code{0}.
  8863. @item tolerance
  8864. Set the range of luma values to be keyed out.
  8865. Default value is @code{0}.
  8866. @item softness
  8867. Set the range of softness. Default value is @code{0}.
  8868. Use this to control gradual transition from zero to full transparency.
  8869. @end table
  8870. @section lut, lutrgb, lutyuv
  8871. Compute a look-up table for binding each pixel component input value
  8872. to an output value, and apply it to the input video.
  8873. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8874. to an RGB input video.
  8875. These filters accept the following parameters:
  8876. @table @option
  8877. @item c0
  8878. set first pixel component expression
  8879. @item c1
  8880. set second pixel component expression
  8881. @item c2
  8882. set third pixel component expression
  8883. @item c3
  8884. set fourth pixel component expression, corresponds to the alpha component
  8885. @item r
  8886. set red component expression
  8887. @item g
  8888. set green component expression
  8889. @item b
  8890. set blue component expression
  8891. @item a
  8892. alpha component expression
  8893. @item y
  8894. set Y/luminance component expression
  8895. @item u
  8896. set U/Cb component expression
  8897. @item v
  8898. set V/Cr component expression
  8899. @end table
  8900. Each of them specifies the expression to use for computing the lookup table for
  8901. the corresponding pixel component values.
  8902. The exact component associated to each of the @var{c*} options depends on the
  8903. format in input.
  8904. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8905. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8906. The expressions can contain the following constants and functions:
  8907. @table @option
  8908. @item w
  8909. @item h
  8910. The input width and height.
  8911. @item val
  8912. The input value for the pixel component.
  8913. @item clipval
  8914. The input value, clipped to the @var{minval}-@var{maxval} range.
  8915. @item maxval
  8916. The maximum value for the pixel component.
  8917. @item minval
  8918. The minimum value for the pixel component.
  8919. @item negval
  8920. The negated value for the pixel component value, clipped to the
  8921. @var{minval}-@var{maxval} range; it corresponds to the expression
  8922. "maxval-clipval+minval".
  8923. @item clip(val)
  8924. The computed value in @var{val}, clipped to the
  8925. @var{minval}-@var{maxval} range.
  8926. @item gammaval(gamma)
  8927. The computed gamma correction value of the pixel component value,
  8928. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8929. expression
  8930. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8931. @end table
  8932. All expressions default to "val".
  8933. @subsection Examples
  8934. @itemize
  8935. @item
  8936. Negate input video:
  8937. @example
  8938. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8939. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8940. @end example
  8941. The above is the same as:
  8942. @example
  8943. lutrgb="r=negval:g=negval:b=negval"
  8944. lutyuv="y=negval:u=negval:v=negval"
  8945. @end example
  8946. @item
  8947. Negate luminance:
  8948. @example
  8949. lutyuv=y=negval
  8950. @end example
  8951. @item
  8952. Remove chroma components, turning the video into a graytone image:
  8953. @example
  8954. lutyuv="u=128:v=128"
  8955. @end example
  8956. @item
  8957. Apply a luma burning effect:
  8958. @example
  8959. lutyuv="y=2*val"
  8960. @end example
  8961. @item
  8962. Remove green and blue components:
  8963. @example
  8964. lutrgb="g=0:b=0"
  8965. @end example
  8966. @item
  8967. Set a constant alpha channel value on input:
  8968. @example
  8969. format=rgba,lutrgb=a="maxval-minval/2"
  8970. @end example
  8971. @item
  8972. Correct luminance gamma by a factor of 0.5:
  8973. @example
  8974. lutyuv=y=gammaval(0.5)
  8975. @end example
  8976. @item
  8977. Discard least significant bits of luma:
  8978. @example
  8979. lutyuv=y='bitand(val, 128+64+32)'
  8980. @end example
  8981. @item
  8982. Technicolor like effect:
  8983. @example
  8984. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8985. @end example
  8986. @end itemize
  8987. @section lut2, tlut2
  8988. The @code{lut2} filter takes two input streams and outputs one
  8989. stream.
  8990. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8991. from one single stream.
  8992. This filter accepts the following parameters:
  8993. @table @option
  8994. @item c0
  8995. set first pixel component expression
  8996. @item c1
  8997. set second pixel component expression
  8998. @item c2
  8999. set third pixel component expression
  9000. @item c3
  9001. set fourth pixel component expression, corresponds to the alpha component
  9002. @item d
  9003. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9004. which means bit depth is automatically picked from first input format.
  9005. @end table
  9006. Each of them specifies the expression to use for computing the lookup table for
  9007. the corresponding pixel component values.
  9008. The exact component associated to each of the @var{c*} options depends on the
  9009. format in inputs.
  9010. The expressions can contain the following constants:
  9011. @table @option
  9012. @item w
  9013. @item h
  9014. The input width and height.
  9015. @item x
  9016. The first input value for the pixel component.
  9017. @item y
  9018. The second input value for the pixel component.
  9019. @item bdx
  9020. The first input video bit depth.
  9021. @item bdy
  9022. The second input video bit depth.
  9023. @end table
  9024. All expressions default to "x".
  9025. @subsection Examples
  9026. @itemize
  9027. @item
  9028. Highlight differences between two RGB video streams:
  9029. @example
  9030. 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)'
  9031. @end example
  9032. @item
  9033. Highlight differences between two YUV video streams:
  9034. @example
  9035. 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)'
  9036. @end example
  9037. @item
  9038. Show max difference between two video streams:
  9039. @example
  9040. 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)))'
  9041. @end example
  9042. @end itemize
  9043. @section maskedclamp
  9044. Clamp the first input stream with the second input and third input stream.
  9045. Returns the value of first stream to be between second input
  9046. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9047. This filter accepts the following options:
  9048. @table @option
  9049. @item undershoot
  9050. Default value is @code{0}.
  9051. @item overshoot
  9052. Default value is @code{0}.
  9053. @item planes
  9054. Set which planes will be processed as bitmap, unprocessed planes will be
  9055. copied from first stream.
  9056. By default value 0xf, all planes will be processed.
  9057. @end table
  9058. @section maskedmerge
  9059. Merge the first input stream with the second input stream using per pixel
  9060. weights in the third input stream.
  9061. A value of 0 in the third stream pixel component means that pixel component
  9062. from first stream is returned unchanged, while maximum value (eg. 255 for
  9063. 8-bit videos) means that pixel component from second stream is returned
  9064. unchanged. Intermediate values define the amount of merging between both
  9065. input stream's pixel components.
  9066. This filter accepts the following options:
  9067. @table @option
  9068. @item planes
  9069. Set which planes will be processed as bitmap, unprocessed planes will be
  9070. copied from first stream.
  9071. By default value 0xf, all planes will be processed.
  9072. @end table
  9073. @section mcdeint
  9074. Apply motion-compensation deinterlacing.
  9075. It needs one field per frame as input and must thus be used together
  9076. with yadif=1/3 or equivalent.
  9077. This filter accepts the following options:
  9078. @table @option
  9079. @item mode
  9080. Set the deinterlacing mode.
  9081. It accepts one of the following values:
  9082. @table @samp
  9083. @item fast
  9084. @item medium
  9085. @item slow
  9086. use iterative motion estimation
  9087. @item extra_slow
  9088. like @samp{slow}, but use multiple reference frames.
  9089. @end table
  9090. Default value is @samp{fast}.
  9091. @item parity
  9092. Set the picture field parity assumed for the input video. It must be
  9093. one of the following values:
  9094. @table @samp
  9095. @item 0, tff
  9096. assume top field first
  9097. @item 1, bff
  9098. assume bottom field first
  9099. @end table
  9100. Default value is @samp{bff}.
  9101. @item qp
  9102. Set per-block quantization parameter (QP) used by the internal
  9103. encoder.
  9104. Higher values should result in a smoother motion vector field but less
  9105. optimal individual vectors. Default value is 1.
  9106. @end table
  9107. @section mergeplanes
  9108. Merge color channel components from several video streams.
  9109. The filter accepts up to 4 input streams, and merge selected input
  9110. planes to the output video.
  9111. This filter accepts the following options:
  9112. @table @option
  9113. @item mapping
  9114. Set input to output plane mapping. Default is @code{0}.
  9115. The mappings is specified as a bitmap. It should be specified as a
  9116. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9117. mapping for the first plane of the output stream. 'A' sets the number of
  9118. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9119. corresponding input to use (from 0 to 3). The rest of the mappings is
  9120. similar, 'Bb' describes the mapping for the output stream second
  9121. plane, 'Cc' describes the mapping for the output stream third plane and
  9122. 'Dd' describes the mapping for the output stream fourth plane.
  9123. @item format
  9124. Set output pixel format. Default is @code{yuva444p}.
  9125. @end table
  9126. @subsection Examples
  9127. @itemize
  9128. @item
  9129. Merge three gray video streams of same width and height into single video stream:
  9130. @example
  9131. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9132. @end example
  9133. @item
  9134. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9135. @example
  9136. [a0][a1]mergeplanes=0x00010210:yuva444p
  9137. @end example
  9138. @item
  9139. Swap Y and A plane in yuva444p stream:
  9140. @example
  9141. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9142. @end example
  9143. @item
  9144. Swap U and V plane in yuv420p stream:
  9145. @example
  9146. format=yuv420p,mergeplanes=0x000201:yuv420p
  9147. @end example
  9148. @item
  9149. Cast a rgb24 clip to yuv444p:
  9150. @example
  9151. format=rgb24,mergeplanes=0x000102:yuv444p
  9152. @end example
  9153. @end itemize
  9154. @section mestimate
  9155. Estimate and export motion vectors using block matching algorithms.
  9156. Motion vectors are stored in frame side data to be used by other filters.
  9157. This filter accepts the following options:
  9158. @table @option
  9159. @item method
  9160. Specify the motion estimation method. Accepts one of the following values:
  9161. @table @samp
  9162. @item esa
  9163. Exhaustive search algorithm.
  9164. @item tss
  9165. Three step search algorithm.
  9166. @item tdls
  9167. Two dimensional logarithmic search algorithm.
  9168. @item ntss
  9169. New three step search algorithm.
  9170. @item fss
  9171. Four step search algorithm.
  9172. @item ds
  9173. Diamond search algorithm.
  9174. @item hexbs
  9175. Hexagon-based search algorithm.
  9176. @item epzs
  9177. Enhanced predictive zonal search algorithm.
  9178. @item umh
  9179. Uneven multi-hexagon search algorithm.
  9180. @end table
  9181. Default value is @samp{esa}.
  9182. @item mb_size
  9183. Macroblock size. Default @code{16}.
  9184. @item search_param
  9185. Search parameter. Default @code{7}.
  9186. @end table
  9187. @section midequalizer
  9188. Apply Midway Image Equalization effect using two video streams.
  9189. Midway Image Equalization adjusts a pair of images to have the same
  9190. histogram, while maintaining their dynamics as much as possible. It's
  9191. useful for e.g. matching exposures from a pair of stereo cameras.
  9192. This filter has two inputs and one output, which must be of same pixel format, but
  9193. may be of different sizes. The output of filter is first input adjusted with
  9194. midway histogram of both inputs.
  9195. This filter accepts the following option:
  9196. @table @option
  9197. @item planes
  9198. Set which planes to process. Default is @code{15}, which is all available planes.
  9199. @end table
  9200. @section minterpolate
  9201. Convert the video to specified frame rate using motion interpolation.
  9202. This filter accepts the following options:
  9203. @table @option
  9204. @item fps
  9205. 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}.
  9206. @item mi_mode
  9207. Motion interpolation mode. Following values are accepted:
  9208. @table @samp
  9209. @item dup
  9210. Duplicate previous or next frame for interpolating new ones.
  9211. @item blend
  9212. Blend source frames. Interpolated frame is mean of previous and next frames.
  9213. @item mci
  9214. Motion compensated interpolation. Following options are effective when this mode is selected:
  9215. @table @samp
  9216. @item mc_mode
  9217. Motion compensation mode. Following values are accepted:
  9218. @table @samp
  9219. @item obmc
  9220. Overlapped block motion compensation.
  9221. @item aobmc
  9222. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9223. @end table
  9224. Default mode is @samp{obmc}.
  9225. @item me_mode
  9226. Motion estimation mode. Following values are accepted:
  9227. @table @samp
  9228. @item bidir
  9229. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9230. @item bilat
  9231. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9232. @end table
  9233. Default mode is @samp{bilat}.
  9234. @item me
  9235. The algorithm to be used for motion estimation. Following values are accepted:
  9236. @table @samp
  9237. @item esa
  9238. Exhaustive search algorithm.
  9239. @item tss
  9240. Three step search algorithm.
  9241. @item tdls
  9242. Two dimensional logarithmic search algorithm.
  9243. @item ntss
  9244. New three step search algorithm.
  9245. @item fss
  9246. Four step search algorithm.
  9247. @item ds
  9248. Diamond search algorithm.
  9249. @item hexbs
  9250. Hexagon-based search algorithm.
  9251. @item epzs
  9252. Enhanced predictive zonal search algorithm.
  9253. @item umh
  9254. Uneven multi-hexagon search algorithm.
  9255. @end table
  9256. Default algorithm is @samp{epzs}.
  9257. @item mb_size
  9258. Macroblock size. Default @code{16}.
  9259. @item search_param
  9260. Motion estimation search parameter. Default @code{32}.
  9261. @item vsbmc
  9262. 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).
  9263. @end table
  9264. @end table
  9265. @item scd
  9266. 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:
  9267. @table @samp
  9268. @item none
  9269. Disable scene change detection.
  9270. @item fdiff
  9271. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9272. @end table
  9273. Default method is @samp{fdiff}.
  9274. @item scd_threshold
  9275. Scene change detection threshold. Default is @code{5.0}.
  9276. @end table
  9277. @section mix
  9278. Mix several video input streams into one video stream.
  9279. A description of the accepted options follows.
  9280. @table @option
  9281. @item nb_inputs
  9282. The number of inputs. If unspecified, it defaults to 2.
  9283. @item weights
  9284. Specify weight of each input video stream as sequence.
  9285. Each weight is separated by space. If number of weights
  9286. is smaller than number of @var{frames} last specified
  9287. weight will be used for all remaining unset weights.
  9288. @item scale
  9289. Specify scale, if it is set it will be multiplied with sum
  9290. of each weight multiplied with pixel values to give final destination
  9291. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9292. @item duration
  9293. Specify how end of stream is determined.
  9294. @table @samp
  9295. @item longest
  9296. The duration of the longest input. (default)
  9297. @item shortest
  9298. The duration of the shortest input.
  9299. @item first
  9300. The duration of the first input.
  9301. @end table
  9302. @end table
  9303. @section mpdecimate
  9304. Drop frames that do not differ greatly from the previous frame in
  9305. order to reduce frame rate.
  9306. The main use of this filter is for very-low-bitrate encoding
  9307. (e.g. streaming over dialup modem), but it could in theory be used for
  9308. fixing movies that were inverse-telecined incorrectly.
  9309. A description of the accepted options follows.
  9310. @table @option
  9311. @item max
  9312. Set the maximum number of consecutive frames which can be dropped (if
  9313. positive), or the minimum interval between dropped frames (if
  9314. negative). If the value is 0, the frame is dropped disregarding the
  9315. number of previous sequentially dropped frames.
  9316. Default value is 0.
  9317. @item hi
  9318. @item lo
  9319. @item frac
  9320. Set the dropping threshold values.
  9321. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9322. represent actual pixel value differences, so a threshold of 64
  9323. corresponds to 1 unit of difference for each pixel, or the same spread
  9324. out differently over the block.
  9325. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9326. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9327. meaning the whole image) differ by more than a threshold of @option{lo}.
  9328. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9329. 64*5, and default value for @option{frac} is 0.33.
  9330. @end table
  9331. @section negate
  9332. Negate (invert) the input video.
  9333. It accepts the following option:
  9334. @table @option
  9335. @item negate_alpha
  9336. With value 1, it negates the alpha component, if present. Default value is 0.
  9337. @end table
  9338. @anchor{nlmeans}
  9339. @section nlmeans
  9340. Denoise frames using Non-Local Means algorithm.
  9341. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9342. context similarity is defined by comparing their surrounding patches of size
  9343. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9344. around the pixel.
  9345. Note that the research area defines centers for patches, which means some
  9346. patches will be made of pixels outside that research area.
  9347. The filter accepts the following options.
  9348. @table @option
  9349. @item s
  9350. Set denoising strength.
  9351. @item p
  9352. Set patch size.
  9353. @item pc
  9354. Same as @option{p} but for chroma planes.
  9355. The default value is @var{0} and means automatic.
  9356. @item r
  9357. Set research size.
  9358. @item rc
  9359. Same as @option{r} but for chroma planes.
  9360. The default value is @var{0} and means automatic.
  9361. @end table
  9362. @section nnedi
  9363. Deinterlace video using neural network edge directed interpolation.
  9364. This filter accepts the following options:
  9365. @table @option
  9366. @item weights
  9367. Mandatory option, without binary file filter can not work.
  9368. Currently file can be found here:
  9369. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9370. @item deint
  9371. Set which frames to deinterlace, by default it is @code{all}.
  9372. Can be @code{all} or @code{interlaced}.
  9373. @item field
  9374. Set mode of operation.
  9375. Can be one of the following:
  9376. @table @samp
  9377. @item af
  9378. Use frame flags, both fields.
  9379. @item a
  9380. Use frame flags, single field.
  9381. @item t
  9382. Use top field only.
  9383. @item b
  9384. Use bottom field only.
  9385. @item tf
  9386. Use both fields, top first.
  9387. @item bf
  9388. Use both fields, bottom first.
  9389. @end table
  9390. @item planes
  9391. Set which planes to process, by default filter process all frames.
  9392. @item nsize
  9393. Set size of local neighborhood around each pixel, used by the predictor neural
  9394. network.
  9395. Can be one of the following:
  9396. @table @samp
  9397. @item s8x6
  9398. @item s16x6
  9399. @item s32x6
  9400. @item s48x6
  9401. @item s8x4
  9402. @item s16x4
  9403. @item s32x4
  9404. @end table
  9405. @item nns
  9406. Set the number of neurons in predictor neural network.
  9407. Can be one of the following:
  9408. @table @samp
  9409. @item n16
  9410. @item n32
  9411. @item n64
  9412. @item n128
  9413. @item n256
  9414. @end table
  9415. @item qual
  9416. Controls the number of different neural network predictions that are blended
  9417. together to compute the final output value. Can be @code{fast}, default or
  9418. @code{slow}.
  9419. @item etype
  9420. Set which set of weights to use in the predictor.
  9421. Can be one of the following:
  9422. @table @samp
  9423. @item a
  9424. weights trained to minimize absolute error
  9425. @item s
  9426. weights trained to minimize squared error
  9427. @end table
  9428. @item pscrn
  9429. Controls whether or not the prescreener neural network is used to decide
  9430. which pixels should be processed by the predictor neural network and which
  9431. can be handled by simple cubic interpolation.
  9432. The prescreener is trained to know whether cubic interpolation will be
  9433. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9434. The computational complexity of the prescreener nn is much less than that of
  9435. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9436. using the prescreener generally results in much faster processing.
  9437. The prescreener is pretty accurate, so the difference between using it and not
  9438. using it is almost always unnoticeable.
  9439. Can be one of the following:
  9440. @table @samp
  9441. @item none
  9442. @item original
  9443. @item new
  9444. @end table
  9445. Default is @code{new}.
  9446. @item fapprox
  9447. Set various debugging flags.
  9448. @end table
  9449. @section noformat
  9450. Force libavfilter not to use any of the specified pixel formats for the
  9451. input to the next filter.
  9452. It accepts the following parameters:
  9453. @table @option
  9454. @item pix_fmts
  9455. A '|'-separated list of pixel format names, such as
  9456. pix_fmts=yuv420p|monow|rgb24".
  9457. @end table
  9458. @subsection Examples
  9459. @itemize
  9460. @item
  9461. Force libavfilter to use a format different from @var{yuv420p} for the
  9462. input to the vflip filter:
  9463. @example
  9464. noformat=pix_fmts=yuv420p,vflip
  9465. @end example
  9466. @item
  9467. Convert the input video to any of the formats not contained in the list:
  9468. @example
  9469. noformat=yuv420p|yuv444p|yuv410p
  9470. @end example
  9471. @end itemize
  9472. @section noise
  9473. Add noise on video input frame.
  9474. The filter accepts the following options:
  9475. @table @option
  9476. @item all_seed
  9477. @item c0_seed
  9478. @item c1_seed
  9479. @item c2_seed
  9480. @item c3_seed
  9481. Set noise seed for specific pixel component or all pixel components in case
  9482. of @var{all_seed}. Default value is @code{123457}.
  9483. @item all_strength, alls
  9484. @item c0_strength, c0s
  9485. @item c1_strength, c1s
  9486. @item c2_strength, c2s
  9487. @item c3_strength, c3s
  9488. Set noise strength for specific pixel component or all pixel components in case
  9489. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9490. @item all_flags, allf
  9491. @item c0_flags, c0f
  9492. @item c1_flags, c1f
  9493. @item c2_flags, c2f
  9494. @item c3_flags, c3f
  9495. Set pixel component flags or set flags for all components if @var{all_flags}.
  9496. Available values for component flags are:
  9497. @table @samp
  9498. @item a
  9499. averaged temporal noise (smoother)
  9500. @item p
  9501. mix random noise with a (semi)regular pattern
  9502. @item t
  9503. temporal noise (noise pattern changes between frames)
  9504. @item u
  9505. uniform noise (gaussian otherwise)
  9506. @end table
  9507. @end table
  9508. @subsection Examples
  9509. Add temporal and uniform noise to input video:
  9510. @example
  9511. noise=alls=20:allf=t+u
  9512. @end example
  9513. @section normalize
  9514. Normalize RGB video (aka histogram stretching, contrast stretching).
  9515. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9516. For each channel of each frame, the filter computes the input range and maps
  9517. it linearly to the user-specified output range. The output range defaults
  9518. to the full dynamic range from pure black to pure white.
  9519. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9520. changes in brightness) caused when small dark or bright objects enter or leave
  9521. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9522. video camera, and, like a video camera, it may cause a period of over- or
  9523. under-exposure of the video.
  9524. The R,G,B channels can be normalized independently, which may cause some
  9525. color shifting, or linked together as a single channel, which prevents
  9526. color shifting. Linked normalization preserves hue. Independent normalization
  9527. does not, so it can be used to remove some color casts. Independent and linked
  9528. normalization can be combined in any ratio.
  9529. The normalize filter accepts the following options:
  9530. @table @option
  9531. @item blackpt
  9532. @item whitept
  9533. Colors which define the output range. The minimum input value is mapped to
  9534. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9535. The defaults are black and white respectively. Specifying white for
  9536. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9537. normalized video. Shades of grey can be used to reduce the dynamic range
  9538. (contrast). Specifying saturated colors here can create some interesting
  9539. effects.
  9540. @item smoothing
  9541. The number of previous frames to use for temporal smoothing. The input range
  9542. of each channel is smoothed using a rolling average over the current frame
  9543. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9544. smoothing).
  9545. @item independence
  9546. Controls the ratio of independent (color shifting) channel normalization to
  9547. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9548. independent. Defaults to 1.0 (fully independent).
  9549. @item strength
  9550. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9551. expensive no-op. Defaults to 1.0 (full strength).
  9552. @end table
  9553. @subsection Examples
  9554. Stretch video contrast to use the full dynamic range, with no temporal
  9555. smoothing; may flicker depending on the source content:
  9556. @example
  9557. normalize=blackpt=black:whitept=white:smoothing=0
  9558. @end example
  9559. As above, but with 50 frames of temporal smoothing; flicker should be
  9560. reduced, depending on the source content:
  9561. @example
  9562. normalize=blackpt=black:whitept=white:smoothing=50
  9563. @end example
  9564. As above, but with hue-preserving linked channel normalization:
  9565. @example
  9566. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9567. @end example
  9568. As above, but with half strength:
  9569. @example
  9570. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9571. @end example
  9572. Map the darkest input color to red, the brightest input color to cyan:
  9573. @example
  9574. normalize=blackpt=red:whitept=cyan
  9575. @end example
  9576. @section null
  9577. Pass the video source unchanged to the output.
  9578. @section ocr
  9579. Optical Character Recognition
  9580. This filter uses Tesseract for optical character recognition. To enable
  9581. compilation of this filter, you need to configure FFmpeg with
  9582. @code{--enable-libtesseract}.
  9583. It accepts the following options:
  9584. @table @option
  9585. @item datapath
  9586. Set datapath to tesseract data. Default is to use whatever was
  9587. set at installation.
  9588. @item language
  9589. Set language, default is "eng".
  9590. @item whitelist
  9591. Set character whitelist.
  9592. @item blacklist
  9593. Set character blacklist.
  9594. @end table
  9595. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9596. @section ocv
  9597. Apply a video transform using libopencv.
  9598. To enable this filter, install the libopencv library and headers and
  9599. configure FFmpeg with @code{--enable-libopencv}.
  9600. It accepts the following parameters:
  9601. @table @option
  9602. @item filter_name
  9603. The name of the libopencv filter to apply.
  9604. @item filter_params
  9605. The parameters to pass to the libopencv filter. If not specified, the default
  9606. values are assumed.
  9607. @end table
  9608. Refer to the official libopencv documentation for more precise
  9609. information:
  9610. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9611. Several libopencv filters are supported; see the following subsections.
  9612. @anchor{dilate}
  9613. @subsection dilate
  9614. Dilate an image by using a specific structuring element.
  9615. It corresponds to the libopencv function @code{cvDilate}.
  9616. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9617. @var{struct_el} represents a structuring element, and has the syntax:
  9618. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9619. @var{cols} and @var{rows} represent the number of columns and rows of
  9620. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9621. point, and @var{shape} the shape for the structuring element. @var{shape}
  9622. must be "rect", "cross", "ellipse", or "custom".
  9623. If the value for @var{shape} is "custom", it must be followed by a
  9624. string of the form "=@var{filename}". The file with name
  9625. @var{filename} is assumed to represent a binary image, with each
  9626. printable character corresponding to a bright pixel. When a custom
  9627. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9628. or columns and rows of the read file are assumed instead.
  9629. The default value for @var{struct_el} is "3x3+0x0/rect".
  9630. @var{nb_iterations} specifies the number of times the transform is
  9631. applied to the image, and defaults to 1.
  9632. Some examples:
  9633. @example
  9634. # Use the default values
  9635. ocv=dilate
  9636. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9637. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9638. # Read the shape from the file diamond.shape, iterating two times.
  9639. # The file diamond.shape may contain a pattern of characters like this
  9640. # *
  9641. # ***
  9642. # *****
  9643. # ***
  9644. # *
  9645. # The specified columns and rows are ignored
  9646. # but the anchor point coordinates are not
  9647. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9648. @end example
  9649. @subsection erode
  9650. Erode an image by using a specific structuring element.
  9651. It corresponds to the libopencv function @code{cvErode}.
  9652. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9653. with the same syntax and semantics as the @ref{dilate} filter.
  9654. @subsection smooth
  9655. Smooth the input video.
  9656. The filter takes the following parameters:
  9657. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9658. @var{type} is the type of smooth filter to apply, and must be one of
  9659. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9660. or "bilateral". The default value is "gaussian".
  9661. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9662. depend on the smooth type. @var{param1} and
  9663. @var{param2} accept integer positive values or 0. @var{param3} and
  9664. @var{param4} accept floating point values.
  9665. The default value for @var{param1} is 3. The default value for the
  9666. other parameters is 0.
  9667. These parameters correspond to the parameters assigned to the
  9668. libopencv function @code{cvSmooth}.
  9669. @section oscilloscope
  9670. 2D Video Oscilloscope.
  9671. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9672. It accepts the following parameters:
  9673. @table @option
  9674. @item x
  9675. Set scope center x position.
  9676. @item y
  9677. Set scope center y position.
  9678. @item s
  9679. Set scope size, relative to frame diagonal.
  9680. @item t
  9681. Set scope tilt/rotation.
  9682. @item o
  9683. Set trace opacity.
  9684. @item tx
  9685. Set trace center x position.
  9686. @item ty
  9687. Set trace center y position.
  9688. @item tw
  9689. Set trace width, relative to width of frame.
  9690. @item th
  9691. Set trace height, relative to height of frame.
  9692. @item c
  9693. Set which components to trace. By default it traces first three components.
  9694. @item g
  9695. Draw trace grid. By default is enabled.
  9696. @item st
  9697. Draw some statistics. By default is enabled.
  9698. @item sc
  9699. Draw scope. By default is enabled.
  9700. @end table
  9701. @subsection Examples
  9702. @itemize
  9703. @item
  9704. Inspect full first row of video frame.
  9705. @example
  9706. oscilloscope=x=0.5:y=0:s=1
  9707. @end example
  9708. @item
  9709. Inspect full last row of video frame.
  9710. @example
  9711. oscilloscope=x=0.5:y=1:s=1
  9712. @end example
  9713. @item
  9714. Inspect full 5th line of video frame of height 1080.
  9715. @example
  9716. oscilloscope=x=0.5:y=5/1080:s=1
  9717. @end example
  9718. @item
  9719. Inspect full last column of video frame.
  9720. @example
  9721. oscilloscope=x=1:y=0.5:s=1:t=1
  9722. @end example
  9723. @end itemize
  9724. @anchor{overlay}
  9725. @section overlay
  9726. Overlay one video on top of another.
  9727. It takes two inputs and has one output. The first input is the "main"
  9728. video on which the second input is overlaid.
  9729. It accepts the following parameters:
  9730. A description of the accepted options follows.
  9731. @table @option
  9732. @item x
  9733. @item y
  9734. Set the expression for the x and y coordinates of the overlaid video
  9735. on the main video. Default value is "0" for both expressions. In case
  9736. the expression is invalid, it is set to a huge value (meaning that the
  9737. overlay will not be displayed within the output visible area).
  9738. @item eof_action
  9739. See @ref{framesync}.
  9740. @item eval
  9741. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9742. It accepts the following values:
  9743. @table @samp
  9744. @item init
  9745. only evaluate expressions once during the filter initialization or
  9746. when a command is processed
  9747. @item frame
  9748. evaluate expressions for each incoming frame
  9749. @end table
  9750. Default value is @samp{frame}.
  9751. @item shortest
  9752. See @ref{framesync}.
  9753. @item format
  9754. Set the format for the output video.
  9755. It accepts the following values:
  9756. @table @samp
  9757. @item yuv420
  9758. force YUV420 output
  9759. @item yuv422
  9760. force YUV422 output
  9761. @item yuv444
  9762. force YUV444 output
  9763. @item rgb
  9764. force packed RGB output
  9765. @item gbrp
  9766. force planar RGB output
  9767. @item auto
  9768. automatically pick format
  9769. @end table
  9770. Default value is @samp{yuv420}.
  9771. @item repeatlast
  9772. See @ref{framesync}.
  9773. @item alpha
  9774. Set format of alpha of the overlaid video, it can be @var{straight} or
  9775. @var{premultiplied}. Default is @var{straight}.
  9776. @end table
  9777. The @option{x}, and @option{y} expressions can contain the following
  9778. parameters.
  9779. @table @option
  9780. @item main_w, W
  9781. @item main_h, H
  9782. The main input width and height.
  9783. @item overlay_w, w
  9784. @item overlay_h, h
  9785. The overlay input width and height.
  9786. @item x
  9787. @item y
  9788. The computed values for @var{x} and @var{y}. They are evaluated for
  9789. each new frame.
  9790. @item hsub
  9791. @item vsub
  9792. horizontal and vertical chroma subsample values of the output
  9793. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9794. @var{vsub} is 1.
  9795. @item n
  9796. the number of input frame, starting from 0
  9797. @item pos
  9798. the position in the file of the input frame, NAN if unknown
  9799. @item t
  9800. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9801. @end table
  9802. This filter also supports the @ref{framesync} options.
  9803. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9804. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9805. when @option{eval} is set to @samp{init}.
  9806. Be aware that frames are taken from each input video in timestamp
  9807. order, hence, if their initial timestamps differ, it is a good idea
  9808. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9809. have them begin in the same zero timestamp, as the example for
  9810. the @var{movie} filter does.
  9811. You can chain together more overlays but you should test the
  9812. efficiency of such approach.
  9813. @subsection Commands
  9814. This filter supports the following commands:
  9815. @table @option
  9816. @item x
  9817. @item y
  9818. Modify the x and y of the overlay input.
  9819. The command accepts the same syntax of the corresponding option.
  9820. If the specified expression is not valid, it is kept at its current
  9821. value.
  9822. @end table
  9823. @subsection Examples
  9824. @itemize
  9825. @item
  9826. Draw the overlay at 10 pixels from the bottom right corner of the main
  9827. video:
  9828. @example
  9829. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9830. @end example
  9831. Using named options the example above becomes:
  9832. @example
  9833. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9834. @end example
  9835. @item
  9836. Insert a transparent PNG logo in the bottom left corner of the input,
  9837. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9838. @example
  9839. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9840. @end example
  9841. @item
  9842. Insert 2 different transparent PNG logos (second logo on bottom
  9843. right corner) using the @command{ffmpeg} tool:
  9844. @example
  9845. 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
  9846. @end example
  9847. @item
  9848. Add a transparent color layer on top of the main video; @code{WxH}
  9849. must specify the size of the main input to the overlay filter:
  9850. @example
  9851. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9852. @end example
  9853. @item
  9854. Play an original video and a filtered version (here with the deshake
  9855. filter) side by side using the @command{ffplay} tool:
  9856. @example
  9857. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9858. @end example
  9859. The above command is the same as:
  9860. @example
  9861. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9862. @end example
  9863. @item
  9864. Make a sliding overlay appearing from the left to the right top part of the
  9865. screen starting since time 2:
  9866. @example
  9867. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9868. @end example
  9869. @item
  9870. Compose output by putting two input videos side to side:
  9871. @example
  9872. ffmpeg -i left.avi -i right.avi -filter_complex "
  9873. nullsrc=size=200x100 [background];
  9874. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9875. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9876. [background][left] overlay=shortest=1 [background+left];
  9877. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9878. "
  9879. @end example
  9880. @item
  9881. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9882. @example
  9883. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9884. -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]'
  9885. masked.avi
  9886. @end example
  9887. @item
  9888. Chain several overlays in cascade:
  9889. @example
  9890. nullsrc=s=200x200 [bg];
  9891. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9892. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9893. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9894. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9895. [in3] null, [mid2] overlay=100:100 [out0]
  9896. @end example
  9897. @end itemize
  9898. @section owdenoise
  9899. Apply Overcomplete Wavelet denoiser.
  9900. The filter accepts the following options:
  9901. @table @option
  9902. @item depth
  9903. Set depth.
  9904. Larger depth values will denoise lower frequency components more, but
  9905. slow down filtering.
  9906. Must be an int in the range 8-16, default is @code{8}.
  9907. @item luma_strength, ls
  9908. Set luma strength.
  9909. Must be a double value in the range 0-1000, default is @code{1.0}.
  9910. @item chroma_strength, cs
  9911. Set chroma strength.
  9912. Must be a double value in the range 0-1000, default is @code{1.0}.
  9913. @end table
  9914. @anchor{pad}
  9915. @section pad
  9916. Add paddings to the input image, and place the original input at the
  9917. provided @var{x}, @var{y} coordinates.
  9918. It accepts the following parameters:
  9919. @table @option
  9920. @item width, w
  9921. @item height, h
  9922. Specify an expression for the size of the output image with the
  9923. paddings added. If the value for @var{width} or @var{height} is 0, the
  9924. corresponding input size is used for the output.
  9925. The @var{width} expression can reference the value set by the
  9926. @var{height} expression, and vice versa.
  9927. The default value of @var{width} and @var{height} is 0.
  9928. @item x
  9929. @item y
  9930. Specify the offsets to place the input image at within the padded area,
  9931. with respect to the top/left border of the output image.
  9932. The @var{x} expression can reference the value set by the @var{y}
  9933. expression, and vice versa.
  9934. The default value of @var{x} and @var{y} is 0.
  9935. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9936. so the input image is centered on the padded area.
  9937. @item color
  9938. Specify the color of the padded area. For the syntax of this option,
  9939. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9940. manual,ffmpeg-utils}.
  9941. The default value of @var{color} is "black".
  9942. @item eval
  9943. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9944. It accepts the following values:
  9945. @table @samp
  9946. @item init
  9947. Only evaluate expressions once during the filter initialization or when
  9948. a command is processed.
  9949. @item frame
  9950. Evaluate expressions for each incoming frame.
  9951. @end table
  9952. Default value is @samp{init}.
  9953. @item aspect
  9954. Pad to aspect instead to a resolution.
  9955. @end table
  9956. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9957. options are expressions containing the following constants:
  9958. @table @option
  9959. @item in_w
  9960. @item in_h
  9961. The input video width and height.
  9962. @item iw
  9963. @item ih
  9964. These are the same as @var{in_w} and @var{in_h}.
  9965. @item out_w
  9966. @item out_h
  9967. The output width and height (the size of the padded area), as
  9968. specified by the @var{width} and @var{height} expressions.
  9969. @item ow
  9970. @item oh
  9971. These are the same as @var{out_w} and @var{out_h}.
  9972. @item x
  9973. @item y
  9974. The x and y offsets as specified by the @var{x} and @var{y}
  9975. expressions, or NAN if not yet specified.
  9976. @item a
  9977. same as @var{iw} / @var{ih}
  9978. @item sar
  9979. input sample aspect ratio
  9980. @item dar
  9981. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9982. @item hsub
  9983. @item vsub
  9984. The horizontal and vertical chroma subsample values. For example for the
  9985. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9986. @end table
  9987. @subsection Examples
  9988. @itemize
  9989. @item
  9990. Add paddings with the color "violet" to the input video. The output video
  9991. size is 640x480, and the top-left corner of the input video is placed at
  9992. column 0, row 40
  9993. @example
  9994. pad=640:480:0:40:violet
  9995. @end example
  9996. The example above is equivalent to the following command:
  9997. @example
  9998. pad=width=640:height=480:x=0:y=40:color=violet
  9999. @end example
  10000. @item
  10001. Pad the input to get an output with dimensions increased by 3/2,
  10002. and put the input video at the center of the padded area:
  10003. @example
  10004. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10005. @end example
  10006. @item
  10007. Pad the input to get a squared output with size equal to the maximum
  10008. value between the input width and height, and put the input video at
  10009. the center of the padded area:
  10010. @example
  10011. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10012. @end example
  10013. @item
  10014. Pad the input to get a final w/h ratio of 16:9:
  10015. @example
  10016. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10017. @end example
  10018. @item
  10019. In case of anamorphic video, in order to set the output display aspect
  10020. correctly, it is necessary to use @var{sar} in the expression,
  10021. according to the relation:
  10022. @example
  10023. (ih * X / ih) * sar = output_dar
  10024. X = output_dar / sar
  10025. @end example
  10026. Thus the previous example needs to be modified to:
  10027. @example
  10028. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10029. @end example
  10030. @item
  10031. Double the output size and put the input video in the bottom-right
  10032. corner of the output padded area:
  10033. @example
  10034. pad="2*iw:2*ih:ow-iw:oh-ih"
  10035. @end example
  10036. @end itemize
  10037. @anchor{palettegen}
  10038. @section palettegen
  10039. Generate one palette for a whole video stream.
  10040. It accepts the following options:
  10041. @table @option
  10042. @item max_colors
  10043. Set the maximum number of colors to quantize in the palette.
  10044. Note: the palette will still contain 256 colors; the unused palette entries
  10045. will be black.
  10046. @item reserve_transparent
  10047. Create a palette of 255 colors maximum and reserve the last one for
  10048. transparency. Reserving the transparency color is useful for GIF optimization.
  10049. If not set, the maximum of colors in the palette will be 256. You probably want
  10050. to disable this option for a standalone image.
  10051. Set by default.
  10052. @item transparency_color
  10053. Set the color that will be used as background for transparency.
  10054. @item stats_mode
  10055. Set statistics mode.
  10056. It accepts the following values:
  10057. @table @samp
  10058. @item full
  10059. Compute full frame histograms.
  10060. @item diff
  10061. Compute histograms only for the part that differs from previous frame. This
  10062. might be relevant to give more importance to the moving part of your input if
  10063. the background is static.
  10064. @item single
  10065. Compute new histogram for each frame.
  10066. @end table
  10067. Default value is @var{full}.
  10068. @end table
  10069. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10070. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10071. color quantization of the palette. This information is also visible at
  10072. @var{info} logging level.
  10073. @subsection Examples
  10074. @itemize
  10075. @item
  10076. Generate a representative palette of a given video using @command{ffmpeg}:
  10077. @example
  10078. ffmpeg -i input.mkv -vf palettegen palette.png
  10079. @end example
  10080. @end itemize
  10081. @section paletteuse
  10082. Use a palette to downsample an input video stream.
  10083. The filter takes two inputs: one video stream and a palette. The palette must
  10084. be a 256 pixels image.
  10085. It accepts the following options:
  10086. @table @option
  10087. @item dither
  10088. Select dithering mode. Available algorithms are:
  10089. @table @samp
  10090. @item bayer
  10091. Ordered 8x8 bayer dithering (deterministic)
  10092. @item heckbert
  10093. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10094. Note: this dithering is sometimes considered "wrong" and is included as a
  10095. reference.
  10096. @item floyd_steinberg
  10097. Floyd and Steingberg dithering (error diffusion)
  10098. @item sierra2
  10099. Frankie Sierra dithering v2 (error diffusion)
  10100. @item sierra2_4a
  10101. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10102. @end table
  10103. Default is @var{sierra2_4a}.
  10104. @item bayer_scale
  10105. When @var{bayer} dithering is selected, this option defines the scale of the
  10106. pattern (how much the crosshatch pattern is visible). A low value means more
  10107. visible pattern for less banding, and higher value means less visible pattern
  10108. at the cost of more banding.
  10109. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10110. @item diff_mode
  10111. If set, define the zone to process
  10112. @table @samp
  10113. @item rectangle
  10114. Only the changing rectangle will be reprocessed. This is similar to GIF
  10115. cropping/offsetting compression mechanism. This option can be useful for speed
  10116. if only a part of the image is changing, and has use cases such as limiting the
  10117. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10118. moving scene (it leads to more deterministic output if the scene doesn't change
  10119. much, and as a result less moving noise and better GIF compression).
  10120. @end table
  10121. Default is @var{none}.
  10122. @item new
  10123. Take new palette for each output frame.
  10124. @item alpha_threshold
  10125. Sets the alpha threshold for transparency. Alpha values above this threshold
  10126. will be treated as completely opaque, and values below this threshold will be
  10127. treated as completely transparent.
  10128. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10129. @end table
  10130. @subsection Examples
  10131. @itemize
  10132. @item
  10133. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10134. using @command{ffmpeg}:
  10135. @example
  10136. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10137. @end example
  10138. @end itemize
  10139. @section perspective
  10140. Correct perspective of video not recorded perpendicular to the screen.
  10141. A description of the accepted parameters follows.
  10142. @table @option
  10143. @item x0
  10144. @item y0
  10145. @item x1
  10146. @item y1
  10147. @item x2
  10148. @item y2
  10149. @item x3
  10150. @item y3
  10151. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10152. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10153. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10154. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10155. then the corners of the source will be sent to the specified coordinates.
  10156. The expressions can use the following variables:
  10157. @table @option
  10158. @item W
  10159. @item H
  10160. the width and height of video frame.
  10161. @item in
  10162. Input frame count.
  10163. @item on
  10164. Output frame count.
  10165. @end table
  10166. @item interpolation
  10167. Set interpolation for perspective correction.
  10168. It accepts the following values:
  10169. @table @samp
  10170. @item linear
  10171. @item cubic
  10172. @end table
  10173. Default value is @samp{linear}.
  10174. @item sense
  10175. Set interpretation of coordinate options.
  10176. It accepts the following values:
  10177. @table @samp
  10178. @item 0, source
  10179. Send point in the source specified by the given coordinates to
  10180. the corners of the destination.
  10181. @item 1, destination
  10182. Send the corners of the source to the point in the destination specified
  10183. by the given coordinates.
  10184. Default value is @samp{source}.
  10185. @end table
  10186. @item eval
  10187. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10188. It accepts the following values:
  10189. @table @samp
  10190. @item init
  10191. only evaluate expressions once during the filter initialization or
  10192. when a command is processed
  10193. @item frame
  10194. evaluate expressions for each incoming frame
  10195. @end table
  10196. Default value is @samp{init}.
  10197. @end table
  10198. @section phase
  10199. Delay interlaced video by one field time so that the field order changes.
  10200. The intended use is to fix PAL movies that have been captured with the
  10201. opposite field order to the film-to-video transfer.
  10202. A description of the accepted parameters follows.
  10203. @table @option
  10204. @item mode
  10205. Set phase mode.
  10206. It accepts the following values:
  10207. @table @samp
  10208. @item t
  10209. Capture field order top-first, transfer bottom-first.
  10210. Filter will delay the bottom field.
  10211. @item b
  10212. Capture field order bottom-first, transfer top-first.
  10213. Filter will delay the top field.
  10214. @item p
  10215. Capture and transfer with the same field order. This mode only exists
  10216. for the documentation of the other options to refer to, but if you
  10217. actually select it, the filter will faithfully do nothing.
  10218. @item a
  10219. Capture field order determined automatically by field flags, transfer
  10220. opposite.
  10221. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10222. basis using field flags. If no field information is available,
  10223. then this works just like @samp{u}.
  10224. @item u
  10225. Capture unknown or varying, transfer opposite.
  10226. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10227. analyzing the images and selecting the alternative that produces best
  10228. match between the fields.
  10229. @item T
  10230. Capture top-first, transfer unknown or varying.
  10231. Filter selects among @samp{t} and @samp{p} using image analysis.
  10232. @item B
  10233. Capture bottom-first, transfer unknown or varying.
  10234. Filter selects among @samp{b} and @samp{p} using image analysis.
  10235. @item A
  10236. Capture determined by field flags, transfer unknown or varying.
  10237. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10238. image analysis. If no field information is available, then this works just
  10239. like @samp{U}. This is the default mode.
  10240. @item U
  10241. Both capture and transfer unknown or varying.
  10242. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10243. @end table
  10244. @end table
  10245. @section pixdesctest
  10246. Pixel format descriptor test filter, mainly useful for internal
  10247. testing. The output video should be equal to the input video.
  10248. For example:
  10249. @example
  10250. format=monow, pixdesctest
  10251. @end example
  10252. can be used to test the monowhite pixel format descriptor definition.
  10253. @section pixscope
  10254. Display sample values of color channels. Mainly useful for checking color
  10255. and levels. Minimum supported resolution is 640x480.
  10256. The filters accept the following options:
  10257. @table @option
  10258. @item x
  10259. Set scope X position, relative offset on X axis.
  10260. @item y
  10261. Set scope Y position, relative offset on Y axis.
  10262. @item w
  10263. Set scope width.
  10264. @item h
  10265. Set scope height.
  10266. @item o
  10267. Set window opacity. This window also holds statistics about pixel area.
  10268. @item wx
  10269. Set window X position, relative offset on X axis.
  10270. @item wy
  10271. Set window Y position, relative offset on Y axis.
  10272. @end table
  10273. @section pp
  10274. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10275. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10276. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10277. Each subfilter and some options have a short and a long name that can be used
  10278. interchangeably, i.e. dr/dering are the same.
  10279. The filters accept the following options:
  10280. @table @option
  10281. @item subfilters
  10282. Set postprocessing subfilters string.
  10283. @end table
  10284. All subfilters share common options to determine their scope:
  10285. @table @option
  10286. @item a/autoq
  10287. Honor the quality commands for this subfilter.
  10288. @item c/chrom
  10289. Do chrominance filtering, too (default).
  10290. @item y/nochrom
  10291. Do luminance filtering only (no chrominance).
  10292. @item n/noluma
  10293. Do chrominance filtering only (no luminance).
  10294. @end table
  10295. These options can be appended after the subfilter name, separated by a '|'.
  10296. Available subfilters are:
  10297. @table @option
  10298. @item hb/hdeblock[|difference[|flatness]]
  10299. Horizontal deblocking filter
  10300. @table @option
  10301. @item difference
  10302. Difference factor where higher values mean more deblocking (default: @code{32}).
  10303. @item flatness
  10304. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10305. @end table
  10306. @item vb/vdeblock[|difference[|flatness]]
  10307. Vertical deblocking filter
  10308. @table @option
  10309. @item difference
  10310. Difference factor where higher values mean more deblocking (default: @code{32}).
  10311. @item flatness
  10312. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10313. @end table
  10314. @item ha/hadeblock[|difference[|flatness]]
  10315. Accurate horizontal deblocking filter
  10316. @table @option
  10317. @item difference
  10318. Difference factor where higher values mean more deblocking (default: @code{32}).
  10319. @item flatness
  10320. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10321. @end table
  10322. @item va/vadeblock[|difference[|flatness]]
  10323. Accurate vertical deblocking filter
  10324. @table @option
  10325. @item difference
  10326. Difference factor where higher values mean more deblocking (default: @code{32}).
  10327. @item flatness
  10328. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10329. @end table
  10330. @end table
  10331. The horizontal and vertical deblocking filters share the difference and
  10332. flatness values so you cannot set different horizontal and vertical
  10333. thresholds.
  10334. @table @option
  10335. @item h1/x1hdeblock
  10336. Experimental horizontal deblocking filter
  10337. @item v1/x1vdeblock
  10338. Experimental vertical deblocking filter
  10339. @item dr/dering
  10340. Deringing filter
  10341. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10342. @table @option
  10343. @item threshold1
  10344. larger -> stronger filtering
  10345. @item threshold2
  10346. larger -> stronger filtering
  10347. @item threshold3
  10348. larger -> stronger filtering
  10349. @end table
  10350. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10351. @table @option
  10352. @item f/fullyrange
  10353. Stretch luminance to @code{0-255}.
  10354. @end table
  10355. @item lb/linblenddeint
  10356. Linear blend deinterlacing filter that deinterlaces the given block by
  10357. filtering all lines with a @code{(1 2 1)} filter.
  10358. @item li/linipoldeint
  10359. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10360. linearly interpolating every second line.
  10361. @item ci/cubicipoldeint
  10362. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10363. cubically interpolating every second line.
  10364. @item md/mediandeint
  10365. Median deinterlacing filter that deinterlaces the given block by applying a
  10366. median filter to every second line.
  10367. @item fd/ffmpegdeint
  10368. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10369. second line with a @code{(-1 4 2 4 -1)} filter.
  10370. @item l5/lowpass5
  10371. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10372. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10373. @item fq/forceQuant[|quantizer]
  10374. Overrides the quantizer table from the input with the constant quantizer you
  10375. specify.
  10376. @table @option
  10377. @item quantizer
  10378. Quantizer to use
  10379. @end table
  10380. @item de/default
  10381. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10382. @item fa/fast
  10383. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10384. @item ac
  10385. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10386. @end table
  10387. @subsection Examples
  10388. @itemize
  10389. @item
  10390. Apply horizontal and vertical deblocking, deringing and automatic
  10391. brightness/contrast:
  10392. @example
  10393. pp=hb/vb/dr/al
  10394. @end example
  10395. @item
  10396. Apply default filters without brightness/contrast correction:
  10397. @example
  10398. pp=de/-al
  10399. @end example
  10400. @item
  10401. Apply default filters and temporal denoiser:
  10402. @example
  10403. pp=default/tmpnoise|1|2|3
  10404. @end example
  10405. @item
  10406. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10407. automatically depending on available CPU time:
  10408. @example
  10409. pp=hb|y/vb|a
  10410. @end example
  10411. @end itemize
  10412. @section pp7
  10413. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10414. similar to spp = 6 with 7 point DCT, where only the center sample is
  10415. used after IDCT.
  10416. The filter accepts the following options:
  10417. @table @option
  10418. @item qp
  10419. Force a constant quantization parameter. It accepts an integer in range
  10420. 0 to 63. If not set, the filter will use the QP from the video stream
  10421. (if available).
  10422. @item mode
  10423. Set thresholding mode. Available modes are:
  10424. @table @samp
  10425. @item hard
  10426. Set hard thresholding.
  10427. @item soft
  10428. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10429. @item medium
  10430. Set medium thresholding (good results, default).
  10431. @end table
  10432. @end table
  10433. @section premultiply
  10434. Apply alpha premultiply effect to input video stream using first plane
  10435. of second stream as alpha.
  10436. Both streams must have same dimensions and same pixel format.
  10437. The filter accepts the following option:
  10438. @table @option
  10439. @item planes
  10440. Set which planes will be processed, unprocessed planes will be copied.
  10441. By default value 0xf, all planes will be processed.
  10442. @item inplace
  10443. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10444. @end table
  10445. @section prewitt
  10446. Apply prewitt operator to input video stream.
  10447. The filter accepts the following option:
  10448. @table @option
  10449. @item planes
  10450. Set which planes will be processed, unprocessed planes will be copied.
  10451. By default value 0xf, all planes will be processed.
  10452. @item scale
  10453. Set value which will be multiplied with filtered result.
  10454. @item delta
  10455. Set value which will be added to filtered result.
  10456. @end table
  10457. @anchor{program_opencl}
  10458. @section program_opencl
  10459. Filter video using an OpenCL program.
  10460. @table @option
  10461. @item source
  10462. OpenCL program source file.
  10463. @item kernel
  10464. Kernel name in program.
  10465. @item inputs
  10466. Number of inputs to the filter. Defaults to 1.
  10467. @item size, s
  10468. Size of output frames. Defaults to the same as the first input.
  10469. @end table
  10470. The program source file must contain a kernel function with the given name,
  10471. which will be run once for each plane of the output. Each run on a plane
  10472. gets enqueued as a separate 2D global NDRange with one work-item for each
  10473. pixel to be generated. The global ID offset for each work-item is therefore
  10474. the coordinates of a pixel in the destination image.
  10475. The kernel function needs to take the following arguments:
  10476. @itemize
  10477. @item
  10478. Destination image, @var{__write_only image2d_t}.
  10479. This image will become the output; the kernel should write all of it.
  10480. @item
  10481. Frame index, @var{unsigned int}.
  10482. This is a counter starting from zero and increasing by one for each frame.
  10483. @item
  10484. Source images, @var{__read_only image2d_t}.
  10485. These are the most recent images on each input. The kernel may read from
  10486. them to generate the output, but they can't be written to.
  10487. @end itemize
  10488. Example programs:
  10489. @itemize
  10490. @item
  10491. Copy the input to the output (output must be the same size as the input).
  10492. @verbatim
  10493. __kernel void copy(__write_only image2d_t destination,
  10494. unsigned int index,
  10495. __read_only image2d_t source)
  10496. {
  10497. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10498. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10499. float4 value = read_imagef(source, sampler, location);
  10500. write_imagef(destination, location, value);
  10501. }
  10502. @end verbatim
  10503. @item
  10504. Apply a simple transformation, rotating the input by an amount increasing
  10505. with the index counter. Pixel values are linearly interpolated by the
  10506. sampler, and the output need not have the same dimensions as the input.
  10507. @verbatim
  10508. __kernel void rotate_image(__write_only image2d_t dst,
  10509. unsigned int index,
  10510. __read_only image2d_t src)
  10511. {
  10512. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10513. CLK_FILTER_LINEAR);
  10514. float angle = (float)index / 100.0f;
  10515. float2 dst_dim = convert_float2(get_image_dim(dst));
  10516. float2 src_dim = convert_float2(get_image_dim(src));
  10517. float2 dst_cen = dst_dim / 2.0f;
  10518. float2 src_cen = src_dim / 2.0f;
  10519. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10520. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10521. float2 src_pos = {
  10522. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10523. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10524. };
  10525. src_pos = src_pos * src_dim / dst_dim;
  10526. float2 src_loc = src_pos + src_cen;
  10527. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10528. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10529. write_imagef(dst, dst_loc, 0.5f);
  10530. else
  10531. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10532. }
  10533. @end verbatim
  10534. @item
  10535. Blend two inputs together, with the amount of each input used varying
  10536. with the index counter.
  10537. @verbatim
  10538. __kernel void blend_images(__write_only image2d_t dst,
  10539. unsigned int index,
  10540. __read_only image2d_t src1,
  10541. __read_only image2d_t src2)
  10542. {
  10543. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10544. CLK_FILTER_LINEAR);
  10545. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10546. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10547. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10548. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10549. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10550. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10551. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10552. }
  10553. @end verbatim
  10554. @end itemize
  10555. @section pseudocolor
  10556. Alter frame colors in video with pseudocolors.
  10557. This filter accept the following options:
  10558. @table @option
  10559. @item c0
  10560. set pixel first component expression
  10561. @item c1
  10562. set pixel second component expression
  10563. @item c2
  10564. set pixel third component expression
  10565. @item c3
  10566. set pixel fourth component expression, corresponds to the alpha component
  10567. @item i
  10568. set component to use as base for altering colors
  10569. @end table
  10570. Each of them specifies the expression to use for computing the lookup table for
  10571. the corresponding pixel component values.
  10572. The expressions can contain the following constants and functions:
  10573. @table @option
  10574. @item w
  10575. @item h
  10576. The input width and height.
  10577. @item val
  10578. The input value for the pixel component.
  10579. @item ymin, umin, vmin, amin
  10580. The minimum allowed component value.
  10581. @item ymax, umax, vmax, amax
  10582. The maximum allowed component value.
  10583. @end table
  10584. All expressions default to "val".
  10585. @subsection Examples
  10586. @itemize
  10587. @item
  10588. Change too high luma values to gradient:
  10589. @example
  10590. 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'"
  10591. @end example
  10592. @end itemize
  10593. @section psnr
  10594. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10595. Ratio) between two input videos.
  10596. This filter takes in input two input videos, the first input is
  10597. considered the "main" source and is passed unchanged to the
  10598. output. The second input is used as a "reference" video for computing
  10599. the PSNR.
  10600. Both video inputs must have the same resolution and pixel format for
  10601. this filter to work correctly. Also it assumes that both inputs
  10602. have the same number of frames, which are compared one by one.
  10603. The obtained average PSNR is printed through the logging system.
  10604. The filter stores the accumulated MSE (mean squared error) of each
  10605. frame, and at the end of the processing it is averaged across all frames
  10606. equally, and the following formula is applied to obtain the PSNR:
  10607. @example
  10608. PSNR = 10*log10(MAX^2/MSE)
  10609. @end example
  10610. Where MAX is the average of the maximum values of each component of the
  10611. image.
  10612. The description of the accepted parameters follows.
  10613. @table @option
  10614. @item stats_file, f
  10615. If specified the filter will use the named file to save the PSNR of
  10616. each individual frame. When filename equals "-" the data is sent to
  10617. standard output.
  10618. @item stats_version
  10619. Specifies which version of the stats file format to use. Details of
  10620. each format are written below.
  10621. Default value is 1.
  10622. @item stats_add_max
  10623. Determines whether the max value is output to the stats log.
  10624. Default value is 0.
  10625. Requires stats_version >= 2. If this is set and stats_version < 2,
  10626. the filter will return an error.
  10627. @end table
  10628. This filter also supports the @ref{framesync} options.
  10629. The file printed if @var{stats_file} is selected, contains a sequence of
  10630. key/value pairs of the form @var{key}:@var{value} for each compared
  10631. couple of frames.
  10632. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10633. the list of per-frame-pair stats, with key value pairs following the frame
  10634. format with the following parameters:
  10635. @table @option
  10636. @item psnr_log_version
  10637. The version of the log file format. Will match @var{stats_version}.
  10638. @item fields
  10639. A comma separated list of the per-frame-pair parameters included in
  10640. the log.
  10641. @end table
  10642. A description of each shown per-frame-pair parameter follows:
  10643. @table @option
  10644. @item n
  10645. sequential number of the input frame, starting from 1
  10646. @item mse_avg
  10647. Mean Square Error pixel-by-pixel average difference of the compared
  10648. frames, averaged over all the image components.
  10649. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10650. Mean Square Error pixel-by-pixel average difference of the compared
  10651. frames for the component specified by the suffix.
  10652. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10653. Peak Signal to Noise ratio of the compared frames for the component
  10654. specified by the suffix.
  10655. @item max_avg, max_y, max_u, max_v
  10656. Maximum allowed value for each channel, and average over all
  10657. channels.
  10658. @end table
  10659. For example:
  10660. @example
  10661. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10662. [main][ref] psnr="stats_file=stats.log" [out]
  10663. @end example
  10664. On this example the input file being processed is compared with the
  10665. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10666. is stored in @file{stats.log}.
  10667. @anchor{pullup}
  10668. @section pullup
  10669. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10670. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10671. content.
  10672. The pullup filter is designed to take advantage of future context in making
  10673. its decisions. This filter is stateless in the sense that it does not lock
  10674. onto a pattern to follow, but it instead looks forward to the following
  10675. fields in order to identify matches and rebuild progressive frames.
  10676. To produce content with an even framerate, insert the fps filter after
  10677. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10678. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10679. The filter accepts the following options:
  10680. @table @option
  10681. @item jl
  10682. @item jr
  10683. @item jt
  10684. @item jb
  10685. These options set the amount of "junk" to ignore at the left, right, top, and
  10686. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10687. while top and bottom are in units of 2 lines.
  10688. The default is 8 pixels on each side.
  10689. @item sb
  10690. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10691. filter generating an occasional mismatched frame, but it may also cause an
  10692. excessive number of frames to be dropped during high motion sequences.
  10693. Conversely, setting it to -1 will make filter match fields more easily.
  10694. This may help processing of video where there is slight blurring between
  10695. the fields, but may also cause there to be interlaced frames in the output.
  10696. Default value is @code{0}.
  10697. @item mp
  10698. Set the metric plane to use. It accepts the following values:
  10699. @table @samp
  10700. @item l
  10701. Use luma plane.
  10702. @item u
  10703. Use chroma blue plane.
  10704. @item v
  10705. Use chroma red plane.
  10706. @end table
  10707. This option may be set to use chroma plane instead of the default luma plane
  10708. for doing filter's computations. This may improve accuracy on very clean
  10709. source material, but more likely will decrease accuracy, especially if there
  10710. is chroma noise (rainbow effect) or any grayscale video.
  10711. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10712. load and make pullup usable in realtime on slow machines.
  10713. @end table
  10714. For best results (without duplicated frames in the output file) it is
  10715. necessary to change the output frame rate. For example, to inverse
  10716. telecine NTSC input:
  10717. @example
  10718. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10719. @end example
  10720. @section qp
  10721. Change video quantization parameters (QP).
  10722. The filter accepts the following option:
  10723. @table @option
  10724. @item qp
  10725. Set expression for quantization parameter.
  10726. @end table
  10727. The expression is evaluated through the eval API and can contain, among others,
  10728. the following constants:
  10729. @table @var
  10730. @item known
  10731. 1 if index is not 129, 0 otherwise.
  10732. @item qp
  10733. Sequential index starting from -129 to 128.
  10734. @end table
  10735. @subsection Examples
  10736. @itemize
  10737. @item
  10738. Some equation like:
  10739. @example
  10740. qp=2+2*sin(PI*qp)
  10741. @end example
  10742. @end itemize
  10743. @section random
  10744. Flush video frames from internal cache of frames into a random order.
  10745. No frame is discarded.
  10746. Inspired by @ref{frei0r} nervous filter.
  10747. @table @option
  10748. @item frames
  10749. Set size in number of frames of internal cache, in range from @code{2} to
  10750. @code{512}. Default is @code{30}.
  10751. @item seed
  10752. Set seed for random number generator, must be an integer included between
  10753. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10754. less than @code{0}, the filter will try to use a good random seed on a
  10755. best effort basis.
  10756. @end table
  10757. @section readeia608
  10758. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10759. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10760. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10761. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10762. @table @option
  10763. @item lavfi.readeia608.X.cc
  10764. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10765. @item lavfi.readeia608.X.line
  10766. The number of the line on which the EIA-608 data was identified and read.
  10767. @end table
  10768. This filter accepts the following options:
  10769. @table @option
  10770. @item scan_min
  10771. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10772. @item scan_max
  10773. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10774. @item mac
  10775. Set minimal acceptable amplitude change for sync codes detection.
  10776. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10777. @item spw
  10778. Set the ratio of width reserved for sync code detection.
  10779. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10780. @item mhd
  10781. Set the max peaks height difference for sync code detection.
  10782. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10783. @item mpd
  10784. Set max peaks period difference for sync code detection.
  10785. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10786. @item msd
  10787. Set the first two max start code bits differences.
  10788. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10789. @item bhd
  10790. Set the minimum ratio of bits height compared to 3rd start code bit.
  10791. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10792. @item th_w
  10793. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10794. @item th_b
  10795. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10796. @item chp
  10797. Enable checking the parity bit. In the event of a parity error, the filter will output
  10798. @code{0x00} for that character. Default is false.
  10799. @end table
  10800. @subsection Examples
  10801. @itemize
  10802. @item
  10803. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10804. @example
  10805. 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
  10806. @end example
  10807. @end itemize
  10808. @section readvitc
  10809. Read vertical interval timecode (VITC) information from the top lines of a
  10810. video frame.
  10811. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10812. timecode value, if a valid timecode has been detected. Further metadata key
  10813. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10814. timecode data has been found or not.
  10815. This filter accepts the following options:
  10816. @table @option
  10817. @item scan_max
  10818. Set the maximum number of lines to scan for VITC data. If the value is set to
  10819. @code{-1} the full video frame is scanned. Default is @code{45}.
  10820. @item thr_b
  10821. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10822. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10823. @item thr_w
  10824. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10825. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10826. @end table
  10827. @subsection Examples
  10828. @itemize
  10829. @item
  10830. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10831. draw @code{--:--:--:--} as a placeholder:
  10832. @example
  10833. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10834. @end example
  10835. @end itemize
  10836. @section remap
  10837. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10838. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10839. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10840. value for pixel will be used for destination pixel.
  10841. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10842. will have Xmap/Ymap video stream dimensions.
  10843. Xmap and Ymap input video streams are 16bit depth, single channel.
  10844. @section removegrain
  10845. The removegrain filter is a spatial denoiser for progressive video.
  10846. @table @option
  10847. @item m0
  10848. Set mode for the first plane.
  10849. @item m1
  10850. Set mode for the second plane.
  10851. @item m2
  10852. Set mode for the third plane.
  10853. @item m3
  10854. Set mode for the fourth plane.
  10855. @end table
  10856. Range of mode is from 0 to 24. Description of each mode follows:
  10857. @table @var
  10858. @item 0
  10859. Leave input plane unchanged. Default.
  10860. @item 1
  10861. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10862. @item 2
  10863. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10864. @item 3
  10865. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10866. @item 4
  10867. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10868. This is equivalent to a median filter.
  10869. @item 5
  10870. Line-sensitive clipping giving the minimal change.
  10871. @item 6
  10872. Line-sensitive clipping, intermediate.
  10873. @item 7
  10874. Line-sensitive clipping, intermediate.
  10875. @item 8
  10876. Line-sensitive clipping, intermediate.
  10877. @item 9
  10878. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10879. @item 10
  10880. Replaces the target pixel with the closest neighbour.
  10881. @item 11
  10882. [1 2 1] horizontal and vertical kernel blur.
  10883. @item 12
  10884. Same as mode 11.
  10885. @item 13
  10886. Bob mode, interpolates top field from the line where the neighbours
  10887. pixels are the closest.
  10888. @item 14
  10889. Bob mode, interpolates bottom field from the line where the neighbours
  10890. pixels are the closest.
  10891. @item 15
  10892. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10893. interpolation formula.
  10894. @item 16
  10895. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10896. interpolation formula.
  10897. @item 17
  10898. Clips the pixel with the minimum and maximum of respectively the maximum and
  10899. minimum of each pair of opposite neighbour pixels.
  10900. @item 18
  10901. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10902. the current pixel is minimal.
  10903. @item 19
  10904. Replaces the pixel with the average of its 8 neighbours.
  10905. @item 20
  10906. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10907. @item 21
  10908. Clips pixels using the averages of opposite neighbour.
  10909. @item 22
  10910. Same as mode 21 but simpler and faster.
  10911. @item 23
  10912. Small edge and halo removal, but reputed useless.
  10913. @item 24
  10914. Similar as 23.
  10915. @end table
  10916. @section removelogo
  10917. Suppress a TV station logo, using an image file to determine which
  10918. pixels comprise the logo. It works by filling in the pixels that
  10919. comprise the logo with neighboring pixels.
  10920. The filter accepts the following options:
  10921. @table @option
  10922. @item filename, f
  10923. Set the filter bitmap file, which can be any image format supported by
  10924. libavformat. The width and height of the image file must match those of the
  10925. video stream being processed.
  10926. @end table
  10927. Pixels in the provided bitmap image with a value of zero are not
  10928. considered part of the logo, non-zero pixels are considered part of
  10929. the logo. If you use white (255) for the logo and black (0) for the
  10930. rest, you will be safe. For making the filter bitmap, it is
  10931. recommended to take a screen capture of a black frame with the logo
  10932. visible, and then using a threshold filter followed by the erode
  10933. filter once or twice.
  10934. If needed, little splotches can be fixed manually. Remember that if
  10935. logo pixels are not covered, the filter quality will be much
  10936. reduced. Marking too many pixels as part of the logo does not hurt as
  10937. much, but it will increase the amount of blurring needed to cover over
  10938. the image and will destroy more information than necessary, and extra
  10939. pixels will slow things down on a large logo.
  10940. @section repeatfields
  10941. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10942. fields based on its value.
  10943. @section reverse
  10944. Reverse a video clip.
  10945. Warning: This filter requires memory to buffer the entire clip, so trimming
  10946. is suggested.
  10947. @subsection Examples
  10948. @itemize
  10949. @item
  10950. Take the first 5 seconds of a clip, and reverse it.
  10951. @example
  10952. trim=end=5,reverse
  10953. @end example
  10954. @end itemize
  10955. @section rgbashift
  10956. Shift R/G/B/A pixels horizontally and/or vertically.
  10957. The filter accepts the following options:
  10958. @table @option
  10959. @item rh
  10960. Set amount to shift red horizontally.
  10961. @item rv
  10962. Set amount to shift red vertically.
  10963. @item gh
  10964. Set amount to shift green horizontally.
  10965. @item gv
  10966. Set amount to shift green vertically.
  10967. @item bh
  10968. Set amount to shift blue horizontally.
  10969. @item bv
  10970. Set amount to shift blue vertically.
  10971. @item ah
  10972. Set amount to shift alpha horizontally.
  10973. @item av
  10974. Set amount to shift alpha vertically.
  10975. @item edge
  10976. Set edge mode, can be @var{smear}, default, or @var{warp}.
  10977. @end table
  10978. @section roberts
  10979. Apply roberts cross operator to input video stream.
  10980. The filter accepts the following option:
  10981. @table @option
  10982. @item planes
  10983. Set which planes will be processed, unprocessed planes will be copied.
  10984. By default value 0xf, all planes will be processed.
  10985. @item scale
  10986. Set value which will be multiplied with filtered result.
  10987. @item delta
  10988. Set value which will be added to filtered result.
  10989. @end table
  10990. @section rotate
  10991. Rotate video by an arbitrary angle expressed in radians.
  10992. The filter accepts the following options:
  10993. A description of the optional parameters follows.
  10994. @table @option
  10995. @item angle, a
  10996. Set an expression for the angle by which to rotate the input video
  10997. clockwise, expressed as a number of radians. A negative value will
  10998. result in a counter-clockwise rotation. By default it is set to "0".
  10999. This expression is evaluated for each frame.
  11000. @item out_w, ow
  11001. Set the output width expression, default value is "iw".
  11002. This expression is evaluated just once during configuration.
  11003. @item out_h, oh
  11004. Set the output height expression, default value is "ih".
  11005. This expression is evaluated just once during configuration.
  11006. @item bilinear
  11007. Enable bilinear interpolation if set to 1, a value of 0 disables
  11008. it. Default value is 1.
  11009. @item fillcolor, c
  11010. Set the color used to fill the output area not covered by the rotated
  11011. image. For the general syntax of this option, check the
  11012. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11013. If the special value "none" is selected then no
  11014. background is printed (useful for example if the background is never shown).
  11015. Default value is "black".
  11016. @end table
  11017. The expressions for the angle and the output size can contain the
  11018. following constants and functions:
  11019. @table @option
  11020. @item n
  11021. sequential number of the input frame, starting from 0. It is always NAN
  11022. before the first frame is filtered.
  11023. @item t
  11024. time in seconds of the input frame, it is set to 0 when the filter is
  11025. configured. It is always NAN before the first frame is filtered.
  11026. @item hsub
  11027. @item vsub
  11028. horizontal and vertical chroma subsample values. For example for the
  11029. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11030. @item in_w, iw
  11031. @item in_h, ih
  11032. the input video width and height
  11033. @item out_w, ow
  11034. @item out_h, oh
  11035. the output width and height, that is the size of the padded area as
  11036. specified by the @var{width} and @var{height} expressions
  11037. @item rotw(a)
  11038. @item roth(a)
  11039. the minimal width/height required for completely containing the input
  11040. video rotated by @var{a} radians.
  11041. These are only available when computing the @option{out_w} and
  11042. @option{out_h} expressions.
  11043. @end table
  11044. @subsection Examples
  11045. @itemize
  11046. @item
  11047. Rotate the input by PI/6 radians clockwise:
  11048. @example
  11049. rotate=PI/6
  11050. @end example
  11051. @item
  11052. Rotate the input by PI/6 radians counter-clockwise:
  11053. @example
  11054. rotate=-PI/6
  11055. @end example
  11056. @item
  11057. Rotate the input by 45 degrees clockwise:
  11058. @example
  11059. rotate=45*PI/180
  11060. @end example
  11061. @item
  11062. Apply a constant rotation with period T, starting from an angle of PI/3:
  11063. @example
  11064. rotate=PI/3+2*PI*t/T
  11065. @end example
  11066. @item
  11067. Make the input video rotation oscillating with a period of T
  11068. seconds and an amplitude of A radians:
  11069. @example
  11070. rotate=A*sin(2*PI/T*t)
  11071. @end example
  11072. @item
  11073. Rotate the video, output size is chosen so that the whole rotating
  11074. input video is always completely contained in the output:
  11075. @example
  11076. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11077. @end example
  11078. @item
  11079. Rotate the video, reduce the output size so that no background is ever
  11080. shown:
  11081. @example
  11082. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11083. @end example
  11084. @end itemize
  11085. @subsection Commands
  11086. The filter supports the following commands:
  11087. @table @option
  11088. @item a, angle
  11089. Set the angle expression.
  11090. The command accepts the same syntax of the corresponding option.
  11091. If the specified expression is not valid, it is kept at its current
  11092. value.
  11093. @end table
  11094. @section sab
  11095. Apply Shape Adaptive Blur.
  11096. The filter accepts the following options:
  11097. @table @option
  11098. @item luma_radius, lr
  11099. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11100. value is 1.0. A greater value will result in a more blurred image, and
  11101. in slower processing.
  11102. @item luma_pre_filter_radius, lpfr
  11103. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11104. value is 1.0.
  11105. @item luma_strength, ls
  11106. Set luma maximum difference between pixels to still be considered, must
  11107. be a value in the 0.1-100.0 range, default value is 1.0.
  11108. @item chroma_radius, cr
  11109. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11110. greater value will result in a more blurred image, and in slower
  11111. processing.
  11112. @item chroma_pre_filter_radius, cpfr
  11113. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11114. @item chroma_strength, cs
  11115. Set chroma maximum difference between pixels to still be considered,
  11116. must be a value in the -0.9-100.0 range.
  11117. @end table
  11118. Each chroma option value, if not explicitly specified, is set to the
  11119. corresponding luma option value.
  11120. @anchor{scale}
  11121. @section scale
  11122. Scale (resize) the input video, using the libswscale library.
  11123. The scale filter forces the output display aspect ratio to be the same
  11124. of the input, by changing the output sample aspect ratio.
  11125. If the input image format is different from the format requested by
  11126. the next filter, the scale filter will convert the input to the
  11127. requested format.
  11128. @subsection Options
  11129. The filter accepts the following options, or any of the options
  11130. supported by the libswscale scaler.
  11131. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11132. the complete list of scaler options.
  11133. @table @option
  11134. @item width, w
  11135. @item height, h
  11136. Set the output video dimension expression. Default value is the input
  11137. dimension.
  11138. If the @var{width} or @var{w} value is 0, the input width is used for
  11139. the output. If the @var{height} or @var{h} value is 0, the input height
  11140. is used for the output.
  11141. If one and only one of the values is -n with n >= 1, the scale filter
  11142. will use a value that maintains the aspect ratio of the input image,
  11143. calculated from the other specified dimension. After that it will,
  11144. however, make sure that the calculated dimension is divisible by n and
  11145. adjust the value if necessary.
  11146. If both values are -n with n >= 1, the behavior will be identical to
  11147. both values being set to 0 as previously detailed.
  11148. See below for the list of accepted constants for use in the dimension
  11149. expression.
  11150. @item eval
  11151. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11152. @table @samp
  11153. @item init
  11154. Only evaluate expressions once during the filter initialization or when a command is processed.
  11155. @item frame
  11156. Evaluate expressions for each incoming frame.
  11157. @end table
  11158. Default value is @samp{init}.
  11159. @item interl
  11160. Set the interlacing mode. It accepts the following values:
  11161. @table @samp
  11162. @item 1
  11163. Force interlaced aware scaling.
  11164. @item 0
  11165. Do not apply interlaced scaling.
  11166. @item -1
  11167. Select interlaced aware scaling depending on whether the source frames
  11168. are flagged as interlaced or not.
  11169. @end table
  11170. Default value is @samp{0}.
  11171. @item flags
  11172. Set libswscale scaling flags. See
  11173. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11174. complete list of values. If not explicitly specified the filter applies
  11175. the default flags.
  11176. @item param0, param1
  11177. Set libswscale input parameters for scaling algorithms that need them. See
  11178. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11179. complete documentation. If not explicitly specified the filter applies
  11180. empty parameters.
  11181. @item size, s
  11182. Set the video size. For the syntax of this option, check the
  11183. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11184. @item in_color_matrix
  11185. @item out_color_matrix
  11186. Set in/output YCbCr color space type.
  11187. This allows the autodetected value to be overridden as well as allows forcing
  11188. a specific value used for the output and encoder.
  11189. If not specified, the color space type depends on the pixel format.
  11190. Possible values:
  11191. @table @samp
  11192. @item auto
  11193. Choose automatically.
  11194. @item bt709
  11195. Format conforming to International Telecommunication Union (ITU)
  11196. Recommendation BT.709.
  11197. @item fcc
  11198. Set color space conforming to the United States Federal Communications
  11199. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11200. @item bt601
  11201. Set color space conforming to:
  11202. @itemize
  11203. @item
  11204. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11205. @item
  11206. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11207. @item
  11208. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11209. @end itemize
  11210. @item smpte240m
  11211. Set color space conforming to SMPTE ST 240:1999.
  11212. @end table
  11213. @item in_range
  11214. @item out_range
  11215. Set in/output YCbCr sample range.
  11216. This allows the autodetected value to be overridden as well as allows forcing
  11217. a specific value used for the output and encoder. If not specified, the
  11218. range depends on the pixel format. Possible values:
  11219. @table @samp
  11220. @item auto/unknown
  11221. Choose automatically.
  11222. @item jpeg/full/pc
  11223. Set full range (0-255 in case of 8-bit luma).
  11224. @item mpeg/limited/tv
  11225. Set "MPEG" range (16-235 in case of 8-bit luma).
  11226. @end table
  11227. @item force_original_aspect_ratio
  11228. Enable decreasing or increasing output video width or height if necessary to
  11229. keep the original aspect ratio. Possible values:
  11230. @table @samp
  11231. @item disable
  11232. Scale the video as specified and disable this feature.
  11233. @item decrease
  11234. The output video dimensions will automatically be decreased if needed.
  11235. @item increase
  11236. The output video dimensions will automatically be increased if needed.
  11237. @end table
  11238. One useful instance of this option is that when you know a specific device's
  11239. maximum allowed resolution, you can use this to limit the output video to
  11240. that, while retaining the aspect ratio. For example, device A allows
  11241. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11242. decrease) and specifying 1280x720 to the command line makes the output
  11243. 1280x533.
  11244. Please note that this is a different thing than specifying -1 for @option{w}
  11245. or @option{h}, you still need to specify the output resolution for this option
  11246. to work.
  11247. @end table
  11248. The values of the @option{w} and @option{h} options are expressions
  11249. containing the following constants:
  11250. @table @var
  11251. @item in_w
  11252. @item in_h
  11253. The input width and height
  11254. @item iw
  11255. @item ih
  11256. These are the same as @var{in_w} and @var{in_h}.
  11257. @item out_w
  11258. @item out_h
  11259. The output (scaled) width and height
  11260. @item ow
  11261. @item oh
  11262. These are the same as @var{out_w} and @var{out_h}
  11263. @item a
  11264. The same as @var{iw} / @var{ih}
  11265. @item sar
  11266. input sample aspect ratio
  11267. @item dar
  11268. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11269. @item hsub
  11270. @item vsub
  11271. horizontal and vertical input chroma subsample values. For example for the
  11272. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11273. @item ohsub
  11274. @item ovsub
  11275. horizontal and vertical output chroma subsample values. For example for the
  11276. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11277. @end table
  11278. @subsection Examples
  11279. @itemize
  11280. @item
  11281. Scale the input video to a size of 200x100
  11282. @example
  11283. scale=w=200:h=100
  11284. @end example
  11285. This is equivalent to:
  11286. @example
  11287. scale=200:100
  11288. @end example
  11289. or:
  11290. @example
  11291. scale=200x100
  11292. @end example
  11293. @item
  11294. Specify a size abbreviation for the output size:
  11295. @example
  11296. scale=qcif
  11297. @end example
  11298. which can also be written as:
  11299. @example
  11300. scale=size=qcif
  11301. @end example
  11302. @item
  11303. Scale the input to 2x:
  11304. @example
  11305. scale=w=2*iw:h=2*ih
  11306. @end example
  11307. @item
  11308. The above is the same as:
  11309. @example
  11310. scale=2*in_w:2*in_h
  11311. @end example
  11312. @item
  11313. Scale the input to 2x with forced interlaced scaling:
  11314. @example
  11315. scale=2*iw:2*ih:interl=1
  11316. @end example
  11317. @item
  11318. Scale the input to half size:
  11319. @example
  11320. scale=w=iw/2:h=ih/2
  11321. @end example
  11322. @item
  11323. Increase the width, and set the height to the same size:
  11324. @example
  11325. scale=3/2*iw:ow
  11326. @end example
  11327. @item
  11328. Seek Greek harmony:
  11329. @example
  11330. scale=iw:1/PHI*iw
  11331. scale=ih*PHI:ih
  11332. @end example
  11333. @item
  11334. Increase the height, and set the width to 3/2 of the height:
  11335. @example
  11336. scale=w=3/2*oh:h=3/5*ih
  11337. @end example
  11338. @item
  11339. Increase the size, making the size a multiple of the chroma
  11340. subsample values:
  11341. @example
  11342. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11343. @end example
  11344. @item
  11345. Increase the width to a maximum of 500 pixels,
  11346. keeping the same aspect ratio as the input:
  11347. @example
  11348. scale=w='min(500\, iw*3/2):h=-1'
  11349. @end example
  11350. @item
  11351. Make pixels square by combining scale and setsar:
  11352. @example
  11353. scale='trunc(ih*dar):ih',setsar=1/1
  11354. @end example
  11355. @item
  11356. Make pixels square by combining scale and setsar,
  11357. making sure the resulting resolution is even (required by some codecs):
  11358. @example
  11359. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11360. @end example
  11361. @end itemize
  11362. @subsection Commands
  11363. This filter supports the following commands:
  11364. @table @option
  11365. @item width, w
  11366. @item height, h
  11367. Set the output video dimension expression.
  11368. The command accepts the same syntax of the corresponding option.
  11369. If the specified expression is not valid, it is kept at its current
  11370. value.
  11371. @end table
  11372. @section scale_npp
  11373. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11374. format conversion on CUDA video frames. Setting the output width and height
  11375. works in the same way as for the @var{scale} filter.
  11376. The following additional options are accepted:
  11377. @table @option
  11378. @item format
  11379. The pixel format of the output CUDA frames. If set to the string "same" (the
  11380. default), the input format will be kept. Note that automatic format negotiation
  11381. and conversion is not yet supported for hardware frames
  11382. @item interp_algo
  11383. The interpolation algorithm used for resizing. One of the following:
  11384. @table @option
  11385. @item nn
  11386. Nearest neighbour.
  11387. @item linear
  11388. @item cubic
  11389. @item cubic2p_bspline
  11390. 2-parameter cubic (B=1, C=0)
  11391. @item cubic2p_catmullrom
  11392. 2-parameter cubic (B=0, C=1/2)
  11393. @item cubic2p_b05c03
  11394. 2-parameter cubic (B=1/2, C=3/10)
  11395. @item super
  11396. Supersampling
  11397. @item lanczos
  11398. @end table
  11399. @end table
  11400. @section scale2ref
  11401. Scale (resize) the input video, based on a reference video.
  11402. See the scale filter for available options, scale2ref supports the same but
  11403. uses the reference video instead of the main input as basis. scale2ref also
  11404. supports the following additional constants for the @option{w} and
  11405. @option{h} options:
  11406. @table @var
  11407. @item main_w
  11408. @item main_h
  11409. The main input video's width and height
  11410. @item main_a
  11411. The same as @var{main_w} / @var{main_h}
  11412. @item main_sar
  11413. The main input video's sample aspect ratio
  11414. @item main_dar, mdar
  11415. The main input video's display aspect ratio. Calculated from
  11416. @code{(main_w / main_h) * main_sar}.
  11417. @item main_hsub
  11418. @item main_vsub
  11419. The main input video's horizontal and vertical chroma subsample values.
  11420. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11421. is 1.
  11422. @end table
  11423. @subsection Examples
  11424. @itemize
  11425. @item
  11426. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11427. @example
  11428. 'scale2ref[b][a];[a][b]overlay'
  11429. @end example
  11430. @end itemize
  11431. @anchor{selectivecolor}
  11432. @section selectivecolor
  11433. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11434. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11435. by the "purity" of the color (that is, how saturated it already is).
  11436. This filter is similar to the Adobe Photoshop Selective Color tool.
  11437. The filter accepts the following options:
  11438. @table @option
  11439. @item correction_method
  11440. Select color correction method.
  11441. Available values are:
  11442. @table @samp
  11443. @item absolute
  11444. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11445. component value).
  11446. @item relative
  11447. Specified adjustments are relative to the original component value.
  11448. @end table
  11449. Default is @code{absolute}.
  11450. @item reds
  11451. Adjustments for red pixels (pixels where the red component is the maximum)
  11452. @item yellows
  11453. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11454. @item greens
  11455. Adjustments for green pixels (pixels where the green component is the maximum)
  11456. @item cyans
  11457. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11458. @item blues
  11459. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11460. @item magentas
  11461. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11462. @item whites
  11463. Adjustments for white pixels (pixels where all components are greater than 128)
  11464. @item neutrals
  11465. Adjustments for all pixels except pure black and pure white
  11466. @item blacks
  11467. Adjustments for black pixels (pixels where all components are lesser than 128)
  11468. @item psfile
  11469. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11470. @end table
  11471. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11472. 4 space separated floating point adjustment values in the [-1,1] range,
  11473. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11474. pixels of its range.
  11475. @subsection Examples
  11476. @itemize
  11477. @item
  11478. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11479. increase magenta by 27% in blue areas:
  11480. @example
  11481. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11482. @end example
  11483. @item
  11484. Use a Photoshop selective color preset:
  11485. @example
  11486. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11487. @end example
  11488. @end itemize
  11489. @anchor{separatefields}
  11490. @section separatefields
  11491. The @code{separatefields} takes a frame-based video input and splits
  11492. each frame into its components fields, producing a new half height clip
  11493. with twice the frame rate and twice the frame count.
  11494. This filter use field-dominance information in frame to decide which
  11495. of each pair of fields to place first in the output.
  11496. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11497. @section setdar, setsar
  11498. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11499. output video.
  11500. This is done by changing the specified Sample (aka Pixel) Aspect
  11501. Ratio, according to the following equation:
  11502. @example
  11503. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11504. @end example
  11505. Keep in mind that the @code{setdar} filter does not modify the pixel
  11506. dimensions of the video frame. Also, the display aspect ratio set by
  11507. this filter may be changed by later filters in the filterchain,
  11508. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11509. applied.
  11510. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11511. the filter output video.
  11512. Note that as a consequence of the application of this filter, the
  11513. output display aspect ratio will change according to the equation
  11514. above.
  11515. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11516. filter may be changed by later filters in the filterchain, e.g. if
  11517. another "setsar" or a "setdar" filter is applied.
  11518. It accepts the following parameters:
  11519. @table @option
  11520. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11521. Set the aspect ratio used by the filter.
  11522. The parameter can be a floating point number string, an expression, or
  11523. a string of the form @var{num}:@var{den}, where @var{num} and
  11524. @var{den} are the numerator and denominator of the aspect ratio. If
  11525. the parameter is not specified, it is assumed the value "0".
  11526. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11527. should be escaped.
  11528. @item max
  11529. Set the maximum integer value to use for expressing numerator and
  11530. denominator when reducing the expressed aspect ratio to a rational.
  11531. Default value is @code{100}.
  11532. @end table
  11533. The parameter @var{sar} is an expression containing
  11534. the following constants:
  11535. @table @option
  11536. @item E, PI, PHI
  11537. These are approximated values for the mathematical constants e
  11538. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11539. @item w, h
  11540. The input width and height.
  11541. @item a
  11542. These are the same as @var{w} / @var{h}.
  11543. @item sar
  11544. The input sample aspect ratio.
  11545. @item dar
  11546. The input display aspect ratio. It is the same as
  11547. (@var{w} / @var{h}) * @var{sar}.
  11548. @item hsub, vsub
  11549. Horizontal and vertical chroma subsample values. For example, for the
  11550. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11551. @end table
  11552. @subsection Examples
  11553. @itemize
  11554. @item
  11555. To change the display aspect ratio to 16:9, specify one of the following:
  11556. @example
  11557. setdar=dar=1.77777
  11558. setdar=dar=16/9
  11559. @end example
  11560. @item
  11561. To change the sample aspect ratio to 10:11, specify:
  11562. @example
  11563. setsar=sar=10/11
  11564. @end example
  11565. @item
  11566. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11567. 1000 in the aspect ratio reduction, use the command:
  11568. @example
  11569. setdar=ratio=16/9:max=1000
  11570. @end example
  11571. @end itemize
  11572. @anchor{setfield}
  11573. @section setfield
  11574. Force field for the output video frame.
  11575. The @code{setfield} filter marks the interlace type field for the
  11576. output frames. It does not change the input frame, but only sets the
  11577. corresponding property, which affects how the frame is treated by
  11578. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11579. The filter accepts the following options:
  11580. @table @option
  11581. @item mode
  11582. Available values are:
  11583. @table @samp
  11584. @item auto
  11585. Keep the same field property.
  11586. @item bff
  11587. Mark the frame as bottom-field-first.
  11588. @item tff
  11589. Mark the frame as top-field-first.
  11590. @item prog
  11591. Mark the frame as progressive.
  11592. @end table
  11593. @end table
  11594. @anchor{setparams}
  11595. @section setparams
  11596. Force frame parameter for the output video frame.
  11597. The @code{setparams} filter marks interlace and color range for the
  11598. output frames. It does not change the input frame, but only sets the
  11599. corresponding property, which affects how the frame is treated by
  11600. filters/encoders.
  11601. @table @option
  11602. @item field_mode
  11603. Available values are:
  11604. @table @samp
  11605. @item auto
  11606. Keep the same field property (default).
  11607. @item bff
  11608. Mark the frame as bottom-field-first.
  11609. @item tff
  11610. Mark the frame as top-field-first.
  11611. @item prog
  11612. Mark the frame as progressive.
  11613. @end table
  11614. @item range
  11615. Available values are:
  11616. @table @samp
  11617. @item auto
  11618. Keep the same color range property (default).
  11619. @item unspecified, unknown
  11620. Mark the frame as unspecified color range.
  11621. @item limited, tv, mpeg
  11622. Mark the frame as limited range.
  11623. @item full, pc, jpeg
  11624. Mark the frame as full range.
  11625. @end table
  11626. @item color_primaries
  11627. Set the color primaries.
  11628. Available values are:
  11629. @table @samp
  11630. @item auto
  11631. Keep the same color primaries property (default).
  11632. @item bt709
  11633. @item unknown
  11634. @item bt470m
  11635. @item bt470bg
  11636. @item smpte170m
  11637. @item smpte240m
  11638. @item film
  11639. @item bt2020
  11640. @item smpte428
  11641. @item smpte431
  11642. @item smpte432
  11643. @item jedec-p22
  11644. @end table
  11645. @item color_trc
  11646. Set the color transfert.
  11647. Available values are:
  11648. @table @samp
  11649. @item auto
  11650. Keep the same color trc property (default).
  11651. @item bt709
  11652. @item unknown
  11653. @item bt470m
  11654. @item bt470bg
  11655. @item smpte170m
  11656. @item smpte240m
  11657. @item linear
  11658. @item log100
  11659. @item log316
  11660. @item iec61966-2-4
  11661. @item bt1361e
  11662. @item iec61966-2-1
  11663. @item bt2020-10
  11664. @item bt2020-12
  11665. @item smpte2084
  11666. @item smpte428
  11667. @item arib-std-b67
  11668. @end table
  11669. @item colorspace
  11670. Set the colorspace.
  11671. Available values are:
  11672. @table @samp
  11673. @item auto
  11674. Keep the same colorspace property (default).
  11675. @item gbr
  11676. @item bt709
  11677. @item unknown
  11678. @item fcc
  11679. @item bt470bg
  11680. @item smpte170m
  11681. @item smpte240m
  11682. @item ycgco
  11683. @item bt2020nc
  11684. @item bt2020c
  11685. @item smpte2085
  11686. @item chroma-derived-nc
  11687. @item chroma-derived-c
  11688. @item ictcp
  11689. @end table
  11690. @end table
  11691. @section showinfo
  11692. Show a line containing various information for each input video frame.
  11693. The input video is not modified.
  11694. This filter supports the following options:
  11695. @table @option
  11696. @item checksum
  11697. Calculate checksums of each plane. By default enabled.
  11698. @end table
  11699. The shown line contains a sequence of key/value pairs of the form
  11700. @var{key}:@var{value}.
  11701. The following values are shown in the output:
  11702. @table @option
  11703. @item n
  11704. The (sequential) number of the input frame, starting from 0.
  11705. @item pts
  11706. The Presentation TimeStamp of the input frame, expressed as a number of
  11707. time base units. The time base unit depends on the filter input pad.
  11708. @item pts_time
  11709. The Presentation TimeStamp of the input frame, expressed as a number of
  11710. seconds.
  11711. @item pos
  11712. The position of the frame in the input stream, or -1 if this information is
  11713. unavailable and/or meaningless (for example in case of synthetic video).
  11714. @item fmt
  11715. The pixel format name.
  11716. @item sar
  11717. The sample aspect ratio of the input frame, expressed in the form
  11718. @var{num}/@var{den}.
  11719. @item s
  11720. The size of the input frame. For the syntax of this option, check the
  11721. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11722. @item i
  11723. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  11724. for bottom field first).
  11725. @item iskey
  11726. This is 1 if the frame is a key frame, 0 otherwise.
  11727. @item type
  11728. The picture type of the input frame ("I" for an I-frame, "P" for a
  11729. P-frame, "B" for a B-frame, or "?" for an unknown type).
  11730. Also refer to the documentation of the @code{AVPictureType} enum and of
  11731. the @code{av_get_picture_type_char} function defined in
  11732. @file{libavutil/avutil.h}.
  11733. @item checksum
  11734. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  11735. @item plane_checksum
  11736. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  11737. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  11738. @end table
  11739. @section showpalette
  11740. Displays the 256 colors palette of each frame. This filter is only relevant for
  11741. @var{pal8} pixel format frames.
  11742. It accepts the following option:
  11743. @table @option
  11744. @item s
  11745. Set the size of the box used to represent one palette color entry. Default is
  11746. @code{30} (for a @code{30x30} pixel box).
  11747. @end table
  11748. @section shuffleframes
  11749. Reorder and/or duplicate and/or drop video frames.
  11750. It accepts the following parameters:
  11751. @table @option
  11752. @item mapping
  11753. Set the destination indexes of input frames.
  11754. This is space or '|' separated list of indexes that maps input frames to output
  11755. frames. Number of indexes also sets maximal value that each index may have.
  11756. '-1' index have special meaning and that is to drop frame.
  11757. @end table
  11758. The first frame has the index 0. The default is to keep the input unchanged.
  11759. @subsection Examples
  11760. @itemize
  11761. @item
  11762. Swap second and third frame of every three frames of the input:
  11763. @example
  11764. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  11765. @end example
  11766. @item
  11767. Swap 10th and 1st frame of every ten frames of the input:
  11768. @example
  11769. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  11770. @end example
  11771. @end itemize
  11772. @section shuffleplanes
  11773. Reorder and/or duplicate video planes.
  11774. It accepts the following parameters:
  11775. @table @option
  11776. @item map0
  11777. The index of the input plane to be used as the first output plane.
  11778. @item map1
  11779. The index of the input plane to be used as the second output plane.
  11780. @item map2
  11781. The index of the input plane to be used as the third output plane.
  11782. @item map3
  11783. The index of the input plane to be used as the fourth output plane.
  11784. @end table
  11785. The first plane has the index 0. The default is to keep the input unchanged.
  11786. @subsection Examples
  11787. @itemize
  11788. @item
  11789. Swap the second and third planes of the input:
  11790. @example
  11791. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  11792. @end example
  11793. @end itemize
  11794. @anchor{signalstats}
  11795. @section signalstats
  11796. Evaluate various visual metrics that assist in determining issues associated
  11797. with the digitization of analog video media.
  11798. By default the filter will log these metadata values:
  11799. @table @option
  11800. @item YMIN
  11801. Display the minimal Y value contained within the input frame. Expressed in
  11802. range of [0-255].
  11803. @item YLOW
  11804. Display the Y value at the 10% percentile within the input frame. Expressed in
  11805. range of [0-255].
  11806. @item YAVG
  11807. Display the average Y value within the input frame. Expressed in range of
  11808. [0-255].
  11809. @item YHIGH
  11810. Display the Y value at the 90% percentile within the input frame. Expressed in
  11811. range of [0-255].
  11812. @item YMAX
  11813. Display the maximum Y value contained within the input frame. Expressed in
  11814. range of [0-255].
  11815. @item UMIN
  11816. Display the minimal U value contained within the input frame. Expressed in
  11817. range of [0-255].
  11818. @item ULOW
  11819. Display the U value at the 10% percentile within the input frame. Expressed in
  11820. range of [0-255].
  11821. @item UAVG
  11822. Display the average U value within the input frame. Expressed in range of
  11823. [0-255].
  11824. @item UHIGH
  11825. Display the U value at the 90% percentile within the input frame. Expressed in
  11826. range of [0-255].
  11827. @item UMAX
  11828. Display the maximum U value contained within the input frame. Expressed in
  11829. range of [0-255].
  11830. @item VMIN
  11831. Display the minimal V value contained within the input frame. Expressed in
  11832. range of [0-255].
  11833. @item VLOW
  11834. Display the V value at the 10% percentile within the input frame. Expressed in
  11835. range of [0-255].
  11836. @item VAVG
  11837. Display the average V value within the input frame. Expressed in range of
  11838. [0-255].
  11839. @item VHIGH
  11840. Display the V value at the 90% percentile within the input frame. Expressed in
  11841. range of [0-255].
  11842. @item VMAX
  11843. Display the maximum V value contained within the input frame. Expressed in
  11844. range of [0-255].
  11845. @item SATMIN
  11846. Display the minimal saturation value contained within the input frame.
  11847. Expressed in range of [0-~181.02].
  11848. @item SATLOW
  11849. Display the saturation value at the 10% percentile within the input frame.
  11850. Expressed in range of [0-~181.02].
  11851. @item SATAVG
  11852. Display the average saturation value within the input frame. Expressed in range
  11853. of [0-~181.02].
  11854. @item SATHIGH
  11855. Display the saturation value at the 90% percentile within the input frame.
  11856. Expressed in range of [0-~181.02].
  11857. @item SATMAX
  11858. Display the maximum saturation value contained within the input frame.
  11859. Expressed in range of [0-~181.02].
  11860. @item HUEMED
  11861. Display the median value for hue within the input frame. Expressed in range of
  11862. [0-360].
  11863. @item HUEAVG
  11864. Display the average value for hue within the input frame. Expressed in range of
  11865. [0-360].
  11866. @item YDIF
  11867. Display the average of sample value difference between all values of the Y
  11868. plane in the current frame and corresponding values of the previous input frame.
  11869. Expressed in range of [0-255].
  11870. @item UDIF
  11871. Display the average of sample value difference between all values of the U
  11872. plane in the current frame and corresponding values of the previous input frame.
  11873. Expressed in range of [0-255].
  11874. @item VDIF
  11875. Display the average of sample value difference between all values of the V
  11876. plane in the current frame and corresponding values of the previous input frame.
  11877. Expressed in range of [0-255].
  11878. @item YBITDEPTH
  11879. Display bit depth of Y plane in current frame.
  11880. Expressed in range of [0-16].
  11881. @item UBITDEPTH
  11882. Display bit depth of U plane in current frame.
  11883. Expressed in range of [0-16].
  11884. @item VBITDEPTH
  11885. Display bit depth of V plane in current frame.
  11886. Expressed in range of [0-16].
  11887. @end table
  11888. The filter accepts the following options:
  11889. @table @option
  11890. @item stat
  11891. @item out
  11892. @option{stat} specify an additional form of image analysis.
  11893. @option{out} output video with the specified type of pixel highlighted.
  11894. Both options accept the following values:
  11895. @table @samp
  11896. @item tout
  11897. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  11898. unlike the neighboring pixels of the same field. Examples of temporal outliers
  11899. include the results of video dropouts, head clogs, or tape tracking issues.
  11900. @item vrep
  11901. Identify @var{vertical line repetition}. Vertical line repetition includes
  11902. similar rows of pixels within a frame. In born-digital video vertical line
  11903. repetition is common, but this pattern is uncommon in video digitized from an
  11904. analog source. When it occurs in video that results from the digitization of an
  11905. analog source it can indicate concealment from a dropout compensator.
  11906. @item brng
  11907. Identify pixels that fall outside of legal broadcast range.
  11908. @end table
  11909. @item color, c
  11910. Set the highlight color for the @option{out} option. The default color is
  11911. yellow.
  11912. @end table
  11913. @subsection Examples
  11914. @itemize
  11915. @item
  11916. Output data of various video metrics:
  11917. @example
  11918. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11919. @end example
  11920. @item
  11921. Output specific data about the minimum and maximum values of the Y plane per frame:
  11922. @example
  11923. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11924. @end example
  11925. @item
  11926. Playback video while highlighting pixels that are outside of broadcast range in red.
  11927. @example
  11928. ffplay example.mov -vf signalstats="out=brng:color=red"
  11929. @end example
  11930. @item
  11931. Playback video with signalstats metadata drawn over the frame.
  11932. @example
  11933. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11934. @end example
  11935. The contents of signalstat_drawtext.txt used in the command are:
  11936. @example
  11937. time %@{pts:hms@}
  11938. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11939. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11940. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11941. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11942. @end example
  11943. @end itemize
  11944. @anchor{signature}
  11945. @section signature
  11946. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11947. input. In this case the matching between the inputs can be calculated additionally.
  11948. The filter always passes through the first input. The signature of each stream can
  11949. be written into a file.
  11950. It accepts the following options:
  11951. @table @option
  11952. @item detectmode
  11953. Enable or disable the matching process.
  11954. Available values are:
  11955. @table @samp
  11956. @item off
  11957. Disable the calculation of a matching (default).
  11958. @item full
  11959. Calculate the matching for the whole video and output whether the whole video
  11960. matches or only parts.
  11961. @item fast
  11962. Calculate only until a matching is found or the video ends. Should be faster in
  11963. some cases.
  11964. @end table
  11965. @item nb_inputs
  11966. Set the number of inputs. The option value must be a non negative integer.
  11967. Default value is 1.
  11968. @item filename
  11969. Set the path to which the output is written. If there is more than one input,
  11970. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11971. integer), that will be replaced with the input number. If no filename is
  11972. specified, no output will be written. This is the default.
  11973. @item format
  11974. Choose the output format.
  11975. Available values are:
  11976. @table @samp
  11977. @item binary
  11978. Use the specified binary representation (default).
  11979. @item xml
  11980. Use the specified xml representation.
  11981. @end table
  11982. @item th_d
  11983. Set threshold to detect one word as similar. The option value must be an integer
  11984. greater than zero. The default value is 9000.
  11985. @item th_dc
  11986. Set threshold to detect all words as similar. The option value must be an integer
  11987. greater than zero. The default value is 60000.
  11988. @item th_xh
  11989. Set threshold to detect frames as similar. The option value must be an integer
  11990. greater than zero. The default value is 116.
  11991. @item th_di
  11992. Set the minimum length of a sequence in frames to recognize it as matching
  11993. sequence. The option value must be a non negative integer value.
  11994. The default value is 0.
  11995. @item th_it
  11996. Set the minimum relation, that matching frames to all frames must have.
  11997. The option value must be a double value between 0 and 1. The default value is 0.5.
  11998. @end table
  11999. @subsection Examples
  12000. @itemize
  12001. @item
  12002. To calculate the signature of an input video and store it in signature.bin:
  12003. @example
  12004. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12005. @end example
  12006. @item
  12007. To detect whether two videos match and store the signatures in XML format in
  12008. signature0.xml and signature1.xml:
  12009. @example
  12010. 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 -
  12011. @end example
  12012. @end itemize
  12013. @anchor{smartblur}
  12014. @section smartblur
  12015. Blur the input video without impacting the outlines.
  12016. It accepts the following options:
  12017. @table @option
  12018. @item luma_radius, lr
  12019. Set the luma radius. The option value must be a float number in
  12020. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12021. used to blur the image (slower if larger). Default value is 1.0.
  12022. @item luma_strength, ls
  12023. Set the luma strength. The option value must be a float number
  12024. in the range [-1.0,1.0] that configures the blurring. A value included
  12025. in [0.0,1.0] will blur the image whereas a value included in
  12026. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12027. @item luma_threshold, lt
  12028. Set the luma threshold used as a coefficient to determine
  12029. whether a pixel should be blurred or not. The option value must be an
  12030. integer in the range [-30,30]. A value of 0 will filter all the image,
  12031. a value included in [0,30] will filter flat areas and a value included
  12032. in [-30,0] will filter edges. Default value is 0.
  12033. @item chroma_radius, cr
  12034. Set the chroma radius. The option value must be a float number in
  12035. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12036. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12037. @item chroma_strength, cs
  12038. Set the chroma strength. The option value must be a float number
  12039. in the range [-1.0,1.0] that configures the blurring. A value included
  12040. in [0.0,1.0] will blur the image whereas a value included in
  12041. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12042. @item chroma_threshold, ct
  12043. Set the chroma threshold used as a coefficient to determine
  12044. whether a pixel should be blurred or not. The option value must be an
  12045. integer in the range [-30,30]. A value of 0 will filter all the image,
  12046. a value included in [0,30] will filter flat areas and a value included
  12047. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12048. @end table
  12049. If a chroma option is not explicitly set, the corresponding luma value
  12050. is set.
  12051. @section ssim
  12052. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12053. This filter takes in input two input videos, the first input is
  12054. considered the "main" source and is passed unchanged to the
  12055. output. The second input is used as a "reference" video for computing
  12056. the SSIM.
  12057. Both video inputs must have the same resolution and pixel format for
  12058. this filter to work correctly. Also it assumes that both inputs
  12059. have the same number of frames, which are compared one by one.
  12060. The filter stores the calculated SSIM of each frame.
  12061. The description of the accepted parameters follows.
  12062. @table @option
  12063. @item stats_file, f
  12064. If specified the filter will use the named file to save the SSIM of
  12065. each individual frame. When filename equals "-" the data is sent to
  12066. standard output.
  12067. @end table
  12068. The file printed if @var{stats_file} is selected, contains a sequence of
  12069. key/value pairs of the form @var{key}:@var{value} for each compared
  12070. couple of frames.
  12071. A description of each shown parameter follows:
  12072. @table @option
  12073. @item n
  12074. sequential number of the input frame, starting from 1
  12075. @item Y, U, V, R, G, B
  12076. SSIM of the compared frames for the component specified by the suffix.
  12077. @item All
  12078. SSIM of the compared frames for the whole frame.
  12079. @item dB
  12080. Same as above but in dB representation.
  12081. @end table
  12082. This filter also supports the @ref{framesync} options.
  12083. For example:
  12084. @example
  12085. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12086. [main][ref] ssim="stats_file=stats.log" [out]
  12087. @end example
  12088. On this example the input file being processed is compared with the
  12089. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12090. is stored in @file{stats.log}.
  12091. Another example with both psnr and ssim at same time:
  12092. @example
  12093. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12094. @end example
  12095. @section stereo3d
  12096. Convert between different stereoscopic image formats.
  12097. The filters accept the following options:
  12098. @table @option
  12099. @item in
  12100. Set stereoscopic image format of input.
  12101. Available values for input image formats are:
  12102. @table @samp
  12103. @item sbsl
  12104. side by side parallel (left eye left, right eye right)
  12105. @item sbsr
  12106. side by side crosseye (right eye left, left eye right)
  12107. @item sbs2l
  12108. side by side parallel with half width resolution
  12109. (left eye left, right eye right)
  12110. @item sbs2r
  12111. side by side crosseye with half width resolution
  12112. (right eye left, left eye right)
  12113. @item abl
  12114. above-below (left eye above, right eye below)
  12115. @item abr
  12116. above-below (right eye above, left eye below)
  12117. @item ab2l
  12118. above-below with half height resolution
  12119. (left eye above, right eye below)
  12120. @item ab2r
  12121. above-below with half height resolution
  12122. (right eye above, left eye below)
  12123. @item al
  12124. alternating frames (left eye first, right eye second)
  12125. @item ar
  12126. alternating frames (right eye first, left eye second)
  12127. @item irl
  12128. interleaved rows (left eye has top row, right eye starts on next row)
  12129. @item irr
  12130. interleaved rows (right eye has top row, left eye starts on next row)
  12131. @item icl
  12132. interleaved columns, left eye first
  12133. @item icr
  12134. interleaved columns, right eye first
  12135. Default value is @samp{sbsl}.
  12136. @end table
  12137. @item out
  12138. Set stereoscopic image format of output.
  12139. @table @samp
  12140. @item sbsl
  12141. side by side parallel (left eye left, right eye right)
  12142. @item sbsr
  12143. side by side crosseye (right eye left, left eye right)
  12144. @item sbs2l
  12145. side by side parallel with half width resolution
  12146. (left eye left, right eye right)
  12147. @item sbs2r
  12148. side by side crosseye with half width resolution
  12149. (right eye left, left eye right)
  12150. @item abl
  12151. above-below (left eye above, right eye below)
  12152. @item abr
  12153. above-below (right eye above, left eye below)
  12154. @item ab2l
  12155. above-below with half height resolution
  12156. (left eye above, right eye below)
  12157. @item ab2r
  12158. above-below with half height resolution
  12159. (right eye above, left eye below)
  12160. @item al
  12161. alternating frames (left eye first, right eye second)
  12162. @item ar
  12163. alternating frames (right eye first, left eye second)
  12164. @item irl
  12165. interleaved rows (left eye has top row, right eye starts on next row)
  12166. @item irr
  12167. interleaved rows (right eye has top row, left eye starts on next row)
  12168. @item arbg
  12169. anaglyph red/blue gray
  12170. (red filter on left eye, blue filter on right eye)
  12171. @item argg
  12172. anaglyph red/green gray
  12173. (red filter on left eye, green filter on right eye)
  12174. @item arcg
  12175. anaglyph red/cyan gray
  12176. (red filter on left eye, cyan filter on right eye)
  12177. @item arch
  12178. anaglyph red/cyan half colored
  12179. (red filter on left eye, cyan filter on right eye)
  12180. @item arcc
  12181. anaglyph red/cyan color
  12182. (red filter on left eye, cyan filter on right eye)
  12183. @item arcd
  12184. anaglyph red/cyan color optimized with the least squares projection of dubois
  12185. (red filter on left eye, cyan filter on right eye)
  12186. @item agmg
  12187. anaglyph green/magenta gray
  12188. (green filter on left eye, magenta filter on right eye)
  12189. @item agmh
  12190. anaglyph green/magenta half colored
  12191. (green filter on left eye, magenta filter on right eye)
  12192. @item agmc
  12193. anaglyph green/magenta colored
  12194. (green filter on left eye, magenta filter on right eye)
  12195. @item agmd
  12196. anaglyph green/magenta color optimized with the least squares projection of dubois
  12197. (green filter on left eye, magenta filter on right eye)
  12198. @item aybg
  12199. anaglyph yellow/blue gray
  12200. (yellow filter on left eye, blue filter on right eye)
  12201. @item aybh
  12202. anaglyph yellow/blue half colored
  12203. (yellow filter on left eye, blue filter on right eye)
  12204. @item aybc
  12205. anaglyph yellow/blue colored
  12206. (yellow filter on left eye, blue filter on right eye)
  12207. @item aybd
  12208. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12209. (yellow filter on left eye, blue filter on right eye)
  12210. @item ml
  12211. mono output (left eye only)
  12212. @item mr
  12213. mono output (right eye only)
  12214. @item chl
  12215. checkerboard, left eye first
  12216. @item chr
  12217. checkerboard, right eye first
  12218. @item icl
  12219. interleaved columns, left eye first
  12220. @item icr
  12221. interleaved columns, right eye first
  12222. @item hdmi
  12223. HDMI frame pack
  12224. @end table
  12225. Default value is @samp{arcd}.
  12226. @end table
  12227. @subsection Examples
  12228. @itemize
  12229. @item
  12230. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12231. @example
  12232. stereo3d=sbsl:aybd
  12233. @end example
  12234. @item
  12235. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12236. @example
  12237. stereo3d=abl:sbsr
  12238. @end example
  12239. @end itemize
  12240. @section streamselect, astreamselect
  12241. Select video or audio streams.
  12242. The filter accepts the following options:
  12243. @table @option
  12244. @item inputs
  12245. Set number of inputs. Default is 2.
  12246. @item map
  12247. Set input indexes to remap to outputs.
  12248. @end table
  12249. @subsection Commands
  12250. The @code{streamselect} and @code{astreamselect} filter supports the following
  12251. commands:
  12252. @table @option
  12253. @item map
  12254. Set input indexes to remap to outputs.
  12255. @end table
  12256. @subsection Examples
  12257. @itemize
  12258. @item
  12259. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12260. @example
  12261. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12262. @end example
  12263. @item
  12264. Same as above, but for audio:
  12265. @example
  12266. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12267. @end example
  12268. @end itemize
  12269. @section sobel
  12270. Apply sobel operator to input video stream.
  12271. The filter accepts the following option:
  12272. @table @option
  12273. @item planes
  12274. Set which planes will be processed, unprocessed planes will be copied.
  12275. By default value 0xf, all planes will be processed.
  12276. @item scale
  12277. Set value which will be multiplied with filtered result.
  12278. @item delta
  12279. Set value which will be added to filtered result.
  12280. @end table
  12281. @anchor{spp}
  12282. @section spp
  12283. Apply a simple postprocessing filter that compresses and decompresses the image
  12284. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12285. and average the results.
  12286. The filter accepts the following options:
  12287. @table @option
  12288. @item quality
  12289. Set quality. This option defines the number of levels for averaging. It accepts
  12290. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12291. effect. A value of @code{6} means the higher quality. For each increment of
  12292. that value the speed drops by a factor of approximately 2. Default value is
  12293. @code{3}.
  12294. @item qp
  12295. Force a constant quantization parameter. If not set, the filter will use the QP
  12296. from the video stream (if available).
  12297. @item mode
  12298. Set thresholding mode. Available modes are:
  12299. @table @samp
  12300. @item hard
  12301. Set hard thresholding (default).
  12302. @item soft
  12303. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12304. @end table
  12305. @item use_bframe_qp
  12306. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12307. option may cause flicker since the B-Frames have often larger QP. Default is
  12308. @code{0} (not enabled).
  12309. @end table
  12310. @section sr
  12311. Scale the input by applying one of the super-resolution methods based on
  12312. convolutional neural networks. Supported models:
  12313. @itemize
  12314. @item
  12315. Super-Resolution Convolutional Neural Network model (SRCNN).
  12316. See @url{https://arxiv.org/abs/1501.00092}.
  12317. @item
  12318. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12319. See @url{https://arxiv.org/abs/1609.05158}.
  12320. @end itemize
  12321. Training scripts as well as scripts for model generation are provided in
  12322. the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12323. The filter accepts the following options:
  12324. @table @option
  12325. @item dnn_backend
  12326. Specify which DNN backend to use for model loading and execution. This option accepts
  12327. the following values:
  12328. @table @samp
  12329. @item native
  12330. Native implementation of DNN loading and execution.
  12331. @item tensorflow
  12332. TensorFlow backend. To enable this backend you
  12333. need to install the TensorFlow for C library (see
  12334. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12335. @code{--enable-libtensorflow}
  12336. @end table
  12337. Default value is @samp{native}.
  12338. @item model
  12339. Set path to model file specifying network architecture and its parameters.
  12340. Note that different backends use different file formats. TensorFlow backend
  12341. can load files for both formats, while native backend can load files for only
  12342. its format.
  12343. @item scale_factor
  12344. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12345. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12346. input upscaled using bicubic upscaling with proper scale factor.
  12347. @end table
  12348. @anchor{subtitles}
  12349. @section subtitles
  12350. Draw subtitles on top of input video using the libass library.
  12351. To enable compilation of this filter you need to configure FFmpeg with
  12352. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12353. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12354. Alpha) subtitles format.
  12355. The filter accepts the following options:
  12356. @table @option
  12357. @item filename, f
  12358. Set the filename of the subtitle file to read. It must be specified.
  12359. @item original_size
  12360. Specify the size of the original video, the video for which the ASS file
  12361. was composed. For the syntax of this option, check the
  12362. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12363. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12364. correctly scale the fonts if the aspect ratio has been changed.
  12365. @item fontsdir
  12366. Set a directory path containing fonts that can be used by the filter.
  12367. These fonts will be used in addition to whatever the font provider uses.
  12368. @item alpha
  12369. Process alpha channel, by default alpha channel is untouched.
  12370. @item charenc
  12371. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12372. useful if not UTF-8.
  12373. @item stream_index, si
  12374. Set subtitles stream index. @code{subtitles} filter only.
  12375. @item force_style
  12376. Override default style or script info parameters of the subtitles. It accepts a
  12377. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12378. @end table
  12379. If the first key is not specified, it is assumed that the first value
  12380. specifies the @option{filename}.
  12381. For example, to render the file @file{sub.srt} on top of the input
  12382. video, use the command:
  12383. @example
  12384. subtitles=sub.srt
  12385. @end example
  12386. which is equivalent to:
  12387. @example
  12388. subtitles=filename=sub.srt
  12389. @end example
  12390. To render the default subtitles stream from file @file{video.mkv}, use:
  12391. @example
  12392. subtitles=video.mkv
  12393. @end example
  12394. To render the second subtitles stream from that file, use:
  12395. @example
  12396. subtitles=video.mkv:si=1
  12397. @end example
  12398. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12399. @code{DejaVu Serif}, use:
  12400. @example
  12401. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12402. @end example
  12403. @section super2xsai
  12404. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12405. Interpolate) pixel art scaling algorithm.
  12406. Useful for enlarging pixel art images without reducing sharpness.
  12407. @section swaprect
  12408. Swap two rectangular objects in video.
  12409. This filter accepts the following options:
  12410. @table @option
  12411. @item w
  12412. Set object width.
  12413. @item h
  12414. Set object height.
  12415. @item x1
  12416. Set 1st rect x coordinate.
  12417. @item y1
  12418. Set 1st rect y coordinate.
  12419. @item x2
  12420. Set 2nd rect x coordinate.
  12421. @item y2
  12422. Set 2nd rect y coordinate.
  12423. All expressions are evaluated once for each frame.
  12424. @end table
  12425. The all options are expressions containing the following constants:
  12426. @table @option
  12427. @item w
  12428. @item h
  12429. The input width and height.
  12430. @item a
  12431. same as @var{w} / @var{h}
  12432. @item sar
  12433. input sample aspect ratio
  12434. @item dar
  12435. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12436. @item n
  12437. The number of the input frame, starting from 0.
  12438. @item t
  12439. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12440. @item pos
  12441. the position in the file of the input frame, NAN if unknown
  12442. @end table
  12443. @section swapuv
  12444. Swap U & V plane.
  12445. @section telecine
  12446. Apply telecine process to the video.
  12447. This filter accepts the following options:
  12448. @table @option
  12449. @item first_field
  12450. @table @samp
  12451. @item top, t
  12452. top field first
  12453. @item bottom, b
  12454. bottom field first
  12455. The default value is @code{top}.
  12456. @end table
  12457. @item pattern
  12458. A string of numbers representing the pulldown pattern you wish to apply.
  12459. The default value is @code{23}.
  12460. @end table
  12461. @example
  12462. Some typical patterns:
  12463. NTSC output (30i):
  12464. 27.5p: 32222
  12465. 24p: 23 (classic)
  12466. 24p: 2332 (preferred)
  12467. 20p: 33
  12468. 18p: 334
  12469. 16p: 3444
  12470. PAL output (25i):
  12471. 27.5p: 12222
  12472. 24p: 222222222223 ("Euro pulldown")
  12473. 16.67p: 33
  12474. 16p: 33333334
  12475. @end example
  12476. @section threshold
  12477. Apply threshold effect to video stream.
  12478. This filter needs four video streams to perform thresholding.
  12479. First stream is stream we are filtering.
  12480. Second stream is holding threshold values, third stream is holding min values,
  12481. and last, fourth stream is holding max values.
  12482. The filter accepts the following option:
  12483. @table @option
  12484. @item planes
  12485. Set which planes will be processed, unprocessed planes will be copied.
  12486. By default value 0xf, all planes will be processed.
  12487. @end table
  12488. For example if first stream pixel's component value is less then threshold value
  12489. of pixel component from 2nd threshold stream, third stream value will picked,
  12490. otherwise fourth stream pixel component value will be picked.
  12491. Using color source filter one can perform various types of thresholding:
  12492. @subsection Examples
  12493. @itemize
  12494. @item
  12495. Binary threshold, using gray color as threshold:
  12496. @example
  12497. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12498. @end example
  12499. @item
  12500. Inverted binary threshold, using gray color as threshold:
  12501. @example
  12502. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12503. @end example
  12504. @item
  12505. Truncate binary threshold, using gray color as threshold:
  12506. @example
  12507. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12508. @end example
  12509. @item
  12510. Threshold to zero, using gray color as threshold:
  12511. @example
  12512. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12513. @end example
  12514. @item
  12515. Inverted threshold to zero, using gray color as threshold:
  12516. @example
  12517. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12518. @end example
  12519. @end itemize
  12520. @section thumbnail
  12521. Select the most representative frame in a given sequence of consecutive frames.
  12522. The filter accepts the following options:
  12523. @table @option
  12524. @item n
  12525. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12526. will pick one of them, and then handle the next batch of @var{n} frames until
  12527. the end. Default is @code{100}.
  12528. @end table
  12529. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12530. value will result in a higher memory usage, so a high value is not recommended.
  12531. @subsection Examples
  12532. @itemize
  12533. @item
  12534. Extract one picture each 50 frames:
  12535. @example
  12536. thumbnail=50
  12537. @end example
  12538. @item
  12539. Complete example of a thumbnail creation with @command{ffmpeg}:
  12540. @example
  12541. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12542. @end example
  12543. @end itemize
  12544. @section tile
  12545. Tile several successive frames together.
  12546. The filter accepts the following options:
  12547. @table @option
  12548. @item layout
  12549. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12550. this option, check the
  12551. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12552. @item nb_frames
  12553. Set the maximum number of frames to render in the given area. It must be less
  12554. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12555. the area will be used.
  12556. @item margin
  12557. Set the outer border margin in pixels.
  12558. @item padding
  12559. Set the inner border thickness (i.e. the number of pixels between frames). For
  12560. more advanced padding options (such as having different values for the edges),
  12561. refer to the pad video filter.
  12562. @item color
  12563. Specify the color of the unused area. For the syntax of this option, check the
  12564. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12565. The default value of @var{color} is "black".
  12566. @item overlap
  12567. Set the number of frames to overlap when tiling several successive frames together.
  12568. The value must be between @code{0} and @var{nb_frames - 1}.
  12569. @item init_padding
  12570. Set the number of frames to initially be empty before displaying first output frame.
  12571. This controls how soon will one get first output frame.
  12572. The value must be between @code{0} and @var{nb_frames - 1}.
  12573. @end table
  12574. @subsection Examples
  12575. @itemize
  12576. @item
  12577. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12578. @example
  12579. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12580. @end example
  12581. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12582. duplicating each output frame to accommodate the originally detected frame
  12583. rate.
  12584. @item
  12585. Display @code{5} pictures in an area of @code{3x2} frames,
  12586. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12587. mixed flat and named options:
  12588. @example
  12589. tile=3x2:nb_frames=5:padding=7:margin=2
  12590. @end example
  12591. @end itemize
  12592. @section tinterlace
  12593. Perform various types of temporal field interlacing.
  12594. Frames are counted starting from 1, so the first input frame is
  12595. considered odd.
  12596. The filter accepts the following options:
  12597. @table @option
  12598. @item mode
  12599. Specify the mode of the interlacing. This option can also be specified
  12600. as a value alone. See below for a list of values for this option.
  12601. Available values are:
  12602. @table @samp
  12603. @item merge, 0
  12604. Move odd frames into the upper field, even into the lower field,
  12605. generating a double height frame at half frame rate.
  12606. @example
  12607. ------> time
  12608. Input:
  12609. Frame 1 Frame 2 Frame 3 Frame 4
  12610. 11111 22222 33333 44444
  12611. 11111 22222 33333 44444
  12612. 11111 22222 33333 44444
  12613. 11111 22222 33333 44444
  12614. Output:
  12615. 11111 33333
  12616. 22222 44444
  12617. 11111 33333
  12618. 22222 44444
  12619. 11111 33333
  12620. 22222 44444
  12621. 11111 33333
  12622. 22222 44444
  12623. @end example
  12624. @item drop_even, 1
  12625. Only output odd frames, even frames are dropped, generating a frame with
  12626. unchanged height at half frame rate.
  12627. @example
  12628. ------> time
  12629. Input:
  12630. Frame 1 Frame 2 Frame 3 Frame 4
  12631. 11111 22222 33333 44444
  12632. 11111 22222 33333 44444
  12633. 11111 22222 33333 44444
  12634. 11111 22222 33333 44444
  12635. Output:
  12636. 11111 33333
  12637. 11111 33333
  12638. 11111 33333
  12639. 11111 33333
  12640. @end example
  12641. @item drop_odd, 2
  12642. Only output even frames, odd frames are dropped, generating a frame with
  12643. unchanged height at half frame rate.
  12644. @example
  12645. ------> time
  12646. Input:
  12647. Frame 1 Frame 2 Frame 3 Frame 4
  12648. 11111 22222 33333 44444
  12649. 11111 22222 33333 44444
  12650. 11111 22222 33333 44444
  12651. 11111 22222 33333 44444
  12652. Output:
  12653. 22222 44444
  12654. 22222 44444
  12655. 22222 44444
  12656. 22222 44444
  12657. @end example
  12658. @item pad, 3
  12659. Expand each frame to full height, but pad alternate lines with black,
  12660. generating a frame with double height at the same input frame rate.
  12661. @example
  12662. ------> time
  12663. Input:
  12664. Frame 1 Frame 2 Frame 3 Frame 4
  12665. 11111 22222 33333 44444
  12666. 11111 22222 33333 44444
  12667. 11111 22222 33333 44444
  12668. 11111 22222 33333 44444
  12669. Output:
  12670. 11111 ..... 33333 .....
  12671. ..... 22222 ..... 44444
  12672. 11111 ..... 33333 .....
  12673. ..... 22222 ..... 44444
  12674. 11111 ..... 33333 .....
  12675. ..... 22222 ..... 44444
  12676. 11111 ..... 33333 .....
  12677. ..... 22222 ..... 44444
  12678. @end example
  12679. @item interleave_top, 4
  12680. Interleave the upper field from odd frames with the lower field from
  12681. even frames, generating a frame with unchanged height at half frame rate.
  12682. @example
  12683. ------> time
  12684. Input:
  12685. Frame 1 Frame 2 Frame 3 Frame 4
  12686. 11111<- 22222 33333<- 44444
  12687. 11111 22222<- 33333 44444<-
  12688. 11111<- 22222 33333<- 44444
  12689. 11111 22222<- 33333 44444<-
  12690. Output:
  12691. 11111 33333
  12692. 22222 44444
  12693. 11111 33333
  12694. 22222 44444
  12695. @end example
  12696. @item interleave_bottom, 5
  12697. Interleave the lower field from odd frames with the upper field from
  12698. even frames, generating a frame with unchanged height at half frame rate.
  12699. @example
  12700. ------> time
  12701. Input:
  12702. Frame 1 Frame 2 Frame 3 Frame 4
  12703. 11111 22222<- 33333 44444<-
  12704. 11111<- 22222 33333<- 44444
  12705. 11111 22222<- 33333 44444<-
  12706. 11111<- 22222 33333<- 44444
  12707. Output:
  12708. 22222 44444
  12709. 11111 33333
  12710. 22222 44444
  12711. 11111 33333
  12712. @end example
  12713. @item interlacex2, 6
  12714. Double frame rate with unchanged height. Frames are inserted each
  12715. containing the second temporal field from the previous input frame and
  12716. the first temporal field from the next input frame. This mode relies on
  12717. the top_field_first flag. Useful for interlaced video displays with no
  12718. field synchronisation.
  12719. @example
  12720. ------> time
  12721. Input:
  12722. Frame 1 Frame 2 Frame 3 Frame 4
  12723. 11111 22222 33333 44444
  12724. 11111 22222 33333 44444
  12725. 11111 22222 33333 44444
  12726. 11111 22222 33333 44444
  12727. Output:
  12728. 11111 22222 22222 33333 33333 44444 44444
  12729. 11111 11111 22222 22222 33333 33333 44444
  12730. 11111 22222 22222 33333 33333 44444 44444
  12731. 11111 11111 22222 22222 33333 33333 44444
  12732. @end example
  12733. @item mergex2, 7
  12734. Move odd frames into the upper field, even into the lower field,
  12735. generating a double height frame at same frame rate.
  12736. @example
  12737. ------> time
  12738. Input:
  12739. Frame 1 Frame 2 Frame 3 Frame 4
  12740. 11111 22222 33333 44444
  12741. 11111 22222 33333 44444
  12742. 11111 22222 33333 44444
  12743. 11111 22222 33333 44444
  12744. Output:
  12745. 11111 33333 33333 55555
  12746. 22222 22222 44444 44444
  12747. 11111 33333 33333 55555
  12748. 22222 22222 44444 44444
  12749. 11111 33333 33333 55555
  12750. 22222 22222 44444 44444
  12751. 11111 33333 33333 55555
  12752. 22222 22222 44444 44444
  12753. @end example
  12754. @end table
  12755. Numeric values are deprecated but are accepted for backward
  12756. compatibility reasons.
  12757. Default mode is @code{merge}.
  12758. @item flags
  12759. Specify flags influencing the filter process.
  12760. Available value for @var{flags} is:
  12761. @table @option
  12762. @item low_pass_filter, vlfp
  12763. Enable linear vertical low-pass filtering in the filter.
  12764. Vertical low-pass filtering is required when creating an interlaced
  12765. destination from a progressive source which contains high-frequency
  12766. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  12767. patterning.
  12768. @item complex_filter, cvlfp
  12769. Enable complex vertical low-pass filtering.
  12770. This will slightly less reduce interlace 'twitter' and Moire
  12771. patterning but better retain detail and subjective sharpness impression.
  12772. @end table
  12773. Vertical low-pass filtering can only be enabled for @option{mode}
  12774. @var{interleave_top} and @var{interleave_bottom}.
  12775. @end table
  12776. @section tmix
  12777. Mix successive video frames.
  12778. A description of the accepted options follows.
  12779. @table @option
  12780. @item frames
  12781. The number of successive frames to mix. If unspecified, it defaults to 3.
  12782. @item weights
  12783. Specify weight of each input video frame.
  12784. Each weight is separated by space. If number of weights is smaller than
  12785. number of @var{frames} last specified weight will be used for all remaining
  12786. unset weights.
  12787. @item scale
  12788. Specify scale, if it is set it will be multiplied with sum
  12789. of each weight multiplied with pixel values to give final destination
  12790. pixel value. By default @var{scale} is auto scaled to sum of weights.
  12791. @end table
  12792. @subsection Examples
  12793. @itemize
  12794. @item
  12795. Average 7 successive frames:
  12796. @example
  12797. tmix=frames=7:weights="1 1 1 1 1 1 1"
  12798. @end example
  12799. @item
  12800. Apply simple temporal convolution:
  12801. @example
  12802. tmix=frames=3:weights="-1 3 -1"
  12803. @end example
  12804. @item
  12805. Similar as above but only showing temporal differences:
  12806. @example
  12807. tmix=frames=3:weights="-1 2 -1":scale=1
  12808. @end example
  12809. @end itemize
  12810. @anchor{tonemap}
  12811. @section tonemap
  12812. Tone map colors from different dynamic ranges.
  12813. This filter expects data in single precision floating point, as it needs to
  12814. operate on (and can output) out-of-range values. Another filter, such as
  12815. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  12816. The tonemapping algorithms implemented only work on linear light, so input
  12817. data should be linearized beforehand (and possibly correctly tagged).
  12818. @example
  12819. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  12820. @end example
  12821. @subsection Options
  12822. The filter accepts the following options.
  12823. @table @option
  12824. @item tonemap
  12825. Set the tone map algorithm to use.
  12826. Possible values are:
  12827. @table @var
  12828. @item none
  12829. Do not apply any tone map, only desaturate overbright pixels.
  12830. @item clip
  12831. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  12832. in-range values, while distorting out-of-range values.
  12833. @item linear
  12834. Stretch the entire reference gamut to a linear multiple of the display.
  12835. @item gamma
  12836. Fit a logarithmic transfer between the tone curves.
  12837. @item reinhard
  12838. Preserve overall image brightness with a simple curve, using nonlinear
  12839. contrast, which results in flattening details and degrading color accuracy.
  12840. @item hable
  12841. Preserve both dark and bright details better than @var{reinhard}, at the cost
  12842. of slightly darkening everything. Use it when detail preservation is more
  12843. important than color and brightness accuracy.
  12844. @item mobius
  12845. Smoothly map out-of-range values, while retaining contrast and colors for
  12846. in-range material as much as possible. Use it when color accuracy is more
  12847. important than detail preservation.
  12848. @end table
  12849. Default is none.
  12850. @item param
  12851. Tune the tone mapping algorithm.
  12852. This affects the following algorithms:
  12853. @table @var
  12854. @item none
  12855. Ignored.
  12856. @item linear
  12857. Specifies the scale factor to use while stretching.
  12858. Default to 1.0.
  12859. @item gamma
  12860. Specifies the exponent of the function.
  12861. Default to 1.8.
  12862. @item clip
  12863. Specify an extra linear coefficient to multiply into the signal before clipping.
  12864. Default to 1.0.
  12865. @item reinhard
  12866. Specify the local contrast coefficient at the display peak.
  12867. Default to 0.5, which means that in-gamut values will be about half as bright
  12868. as when clipping.
  12869. @item hable
  12870. Ignored.
  12871. @item mobius
  12872. Specify the transition point from linear to mobius transform. Every value
  12873. below this point is guaranteed to be mapped 1:1. The higher the value, the
  12874. more accurate the result will be, at the cost of losing bright details.
  12875. Default to 0.3, which due to the steep initial slope still preserves in-range
  12876. colors fairly accurately.
  12877. @end table
  12878. @item desat
  12879. Apply desaturation for highlights that exceed this level of brightness. The
  12880. higher the parameter, the more color information will be preserved. This
  12881. setting helps prevent unnaturally blown-out colors for super-highlights, by
  12882. (smoothly) turning into white instead. This makes images feel more natural,
  12883. at the cost of reducing information about out-of-range colors.
  12884. The default of 2.0 is somewhat conservative and will mostly just apply to
  12885. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  12886. This option works only if the input frame has a supported color tag.
  12887. @item peak
  12888. Override signal/nominal/reference peak with this value. Useful when the
  12889. embedded peak information in display metadata is not reliable or when tone
  12890. mapping from a lower range to a higher range.
  12891. @end table
  12892. @section tpad
  12893. Temporarily pad video frames.
  12894. The filter accepts the following options:
  12895. @table @option
  12896. @item start
  12897. Specify number of delay frames before input video stream.
  12898. @item stop
  12899. Specify number of padding frames after input video stream.
  12900. Set to -1 to pad indefinitely.
  12901. @item start_mode
  12902. Set kind of frames added to beginning of stream.
  12903. Can be either @var{add} or @var{clone}.
  12904. With @var{add} frames of solid-color are added.
  12905. With @var{clone} frames are clones of first frame.
  12906. @item stop_mode
  12907. Set kind of frames added to end of stream.
  12908. Can be either @var{add} or @var{clone}.
  12909. With @var{add} frames of solid-color are added.
  12910. With @var{clone} frames are clones of last frame.
  12911. @item start_duration, stop_duration
  12912. Specify the duration of the start/stop delay. See
  12913. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12914. for the accepted syntax.
  12915. These options override @var{start} and @var{stop}.
  12916. @item color
  12917. Specify the color of the padded area. For the syntax of this option,
  12918. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12919. manual,ffmpeg-utils}.
  12920. The default value of @var{color} is "black".
  12921. @end table
  12922. @anchor{transpose}
  12923. @section transpose
  12924. Transpose rows with columns in the input video and optionally flip it.
  12925. It accepts the following parameters:
  12926. @table @option
  12927. @item dir
  12928. Specify the transposition direction.
  12929. Can assume the following values:
  12930. @table @samp
  12931. @item 0, 4, cclock_flip
  12932. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  12933. @example
  12934. L.R L.l
  12935. . . -> . .
  12936. l.r R.r
  12937. @end example
  12938. @item 1, 5, clock
  12939. Rotate by 90 degrees clockwise, that is:
  12940. @example
  12941. L.R l.L
  12942. . . -> . .
  12943. l.r r.R
  12944. @end example
  12945. @item 2, 6, cclock
  12946. Rotate by 90 degrees counterclockwise, that is:
  12947. @example
  12948. L.R R.r
  12949. . . -> . .
  12950. l.r L.l
  12951. @end example
  12952. @item 3, 7, clock_flip
  12953. Rotate by 90 degrees clockwise and vertically flip, that is:
  12954. @example
  12955. L.R r.R
  12956. . . -> . .
  12957. l.r l.L
  12958. @end example
  12959. @end table
  12960. For values between 4-7, the transposition is only done if the input
  12961. video geometry is portrait and not landscape. These values are
  12962. deprecated, the @code{passthrough} option should be used instead.
  12963. Numerical values are deprecated, and should be dropped in favor of
  12964. symbolic constants.
  12965. @item passthrough
  12966. Do not apply the transposition if the input geometry matches the one
  12967. specified by the specified value. It accepts the following values:
  12968. @table @samp
  12969. @item none
  12970. Always apply transposition.
  12971. @item portrait
  12972. Preserve portrait geometry (when @var{height} >= @var{width}).
  12973. @item landscape
  12974. Preserve landscape geometry (when @var{width} >= @var{height}).
  12975. @end table
  12976. Default value is @code{none}.
  12977. @end table
  12978. For example to rotate by 90 degrees clockwise and preserve portrait
  12979. layout:
  12980. @example
  12981. transpose=dir=1:passthrough=portrait
  12982. @end example
  12983. The command above can also be specified as:
  12984. @example
  12985. transpose=1:portrait
  12986. @end example
  12987. @section transpose_npp
  12988. Transpose rows with columns in the input video and optionally flip it.
  12989. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  12990. It accepts the following parameters:
  12991. @table @option
  12992. @item dir
  12993. Specify the transposition direction.
  12994. Can assume the following values:
  12995. @table @samp
  12996. @item cclock_flip
  12997. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  12998. @item clock
  12999. Rotate by 90 degrees clockwise.
  13000. @item cclock
  13001. Rotate by 90 degrees counterclockwise.
  13002. @item clock_flip
  13003. Rotate by 90 degrees clockwise and vertically flip.
  13004. @end table
  13005. @item passthrough
  13006. Do not apply the transposition if the input geometry matches the one
  13007. specified by the specified value. It accepts the following values:
  13008. @table @samp
  13009. @item none
  13010. Always apply transposition. (default)
  13011. @item portrait
  13012. Preserve portrait geometry (when @var{height} >= @var{width}).
  13013. @item landscape
  13014. Preserve landscape geometry (when @var{width} >= @var{height}).
  13015. @end table
  13016. @end table
  13017. @section trim
  13018. Trim the input so that the output contains one continuous subpart of the input.
  13019. It accepts the following parameters:
  13020. @table @option
  13021. @item start
  13022. Specify the time of the start of the kept section, i.e. the frame with the
  13023. timestamp @var{start} will be the first frame in the output.
  13024. @item end
  13025. Specify the time of the first frame that will be dropped, i.e. the frame
  13026. immediately preceding the one with the timestamp @var{end} will be the last
  13027. frame in the output.
  13028. @item start_pts
  13029. This is the same as @var{start}, except this option sets the start timestamp
  13030. in timebase units instead of seconds.
  13031. @item end_pts
  13032. This is the same as @var{end}, except this option sets the end timestamp
  13033. in timebase units instead of seconds.
  13034. @item duration
  13035. The maximum duration of the output in seconds.
  13036. @item start_frame
  13037. The number of the first frame that should be passed to the output.
  13038. @item end_frame
  13039. The number of the first frame that should be dropped.
  13040. @end table
  13041. @option{start}, @option{end}, and @option{duration} are expressed as time
  13042. duration specifications; see
  13043. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13044. for the accepted syntax.
  13045. Note that the first two sets of the start/end options and the @option{duration}
  13046. option look at the frame timestamp, while the _frame variants simply count the
  13047. frames that pass through the filter. Also note that this filter does not modify
  13048. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13049. setpts filter after the trim filter.
  13050. If multiple start or end options are set, this filter tries to be greedy and
  13051. keep all the frames that match at least one of the specified constraints. To keep
  13052. only the part that matches all the constraints at once, chain multiple trim
  13053. filters.
  13054. The defaults are such that all the input is kept. So it is possible to set e.g.
  13055. just the end values to keep everything before the specified time.
  13056. Examples:
  13057. @itemize
  13058. @item
  13059. Drop everything except the second minute of input:
  13060. @example
  13061. ffmpeg -i INPUT -vf trim=60:120
  13062. @end example
  13063. @item
  13064. Keep only the first second:
  13065. @example
  13066. ffmpeg -i INPUT -vf trim=duration=1
  13067. @end example
  13068. @end itemize
  13069. @section unpremultiply
  13070. Apply alpha unpremultiply effect to input video stream using first plane
  13071. of second stream as alpha.
  13072. Both streams must have same dimensions and same pixel format.
  13073. The filter accepts the following option:
  13074. @table @option
  13075. @item planes
  13076. Set which planes will be processed, unprocessed planes will be copied.
  13077. By default value 0xf, all planes will be processed.
  13078. If the format has 1 or 2 components, then luma is bit 0.
  13079. If the format has 3 or 4 components:
  13080. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13081. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13082. If present, the alpha channel is always the last bit.
  13083. @item inplace
  13084. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13085. @end table
  13086. @anchor{unsharp}
  13087. @section unsharp
  13088. Sharpen or blur the input video.
  13089. It accepts the following parameters:
  13090. @table @option
  13091. @item luma_msize_x, lx
  13092. Set the luma matrix horizontal size. It must be an odd integer between
  13093. 3 and 23. The default value is 5.
  13094. @item luma_msize_y, ly
  13095. Set the luma matrix vertical size. It must be an odd integer between 3
  13096. and 23. The default value is 5.
  13097. @item luma_amount, la
  13098. Set the luma effect strength. It must be a floating point number, reasonable
  13099. values lay between -1.5 and 1.5.
  13100. Negative values will blur the input video, while positive values will
  13101. sharpen it, a value of zero will disable the effect.
  13102. Default value is 1.0.
  13103. @item chroma_msize_x, cx
  13104. Set the chroma matrix horizontal size. It must be an odd integer
  13105. between 3 and 23. The default value is 5.
  13106. @item chroma_msize_y, cy
  13107. Set the chroma matrix vertical size. It must be an odd integer
  13108. between 3 and 23. The default value is 5.
  13109. @item chroma_amount, ca
  13110. Set the chroma effect strength. It must be a floating point number, reasonable
  13111. values lay between -1.5 and 1.5.
  13112. Negative values will blur the input video, while positive values will
  13113. sharpen it, a value of zero will disable the effect.
  13114. Default value is 0.0.
  13115. @end table
  13116. All parameters are optional and default to the equivalent of the
  13117. string '5:5:1.0:5:5:0.0'.
  13118. @subsection Examples
  13119. @itemize
  13120. @item
  13121. Apply strong luma sharpen effect:
  13122. @example
  13123. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13124. @end example
  13125. @item
  13126. Apply a strong blur of both luma and chroma parameters:
  13127. @example
  13128. unsharp=7:7:-2:7:7:-2
  13129. @end example
  13130. @end itemize
  13131. @section uspp
  13132. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13133. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13134. shifts and average the results.
  13135. The way this differs from the behavior of spp is that uspp actually encodes &
  13136. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13137. DCT similar to MJPEG.
  13138. The filter accepts the following options:
  13139. @table @option
  13140. @item quality
  13141. Set quality. This option defines the number of levels for averaging. It accepts
  13142. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13143. effect. A value of @code{8} means the higher quality. For each increment of
  13144. that value the speed drops by a factor of approximately 2. Default value is
  13145. @code{3}.
  13146. @item qp
  13147. Force a constant quantization parameter. If not set, the filter will use the QP
  13148. from the video stream (if available).
  13149. @end table
  13150. @section vaguedenoiser
  13151. Apply a wavelet based denoiser.
  13152. It transforms each frame from the video input into the wavelet domain,
  13153. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13154. the obtained coefficients. It does an inverse wavelet transform after.
  13155. Due to wavelet properties, it should give a nice smoothed result, and
  13156. reduced noise, without blurring picture features.
  13157. This filter accepts the following options:
  13158. @table @option
  13159. @item threshold
  13160. The filtering strength. The higher, the more filtered the video will be.
  13161. Hard thresholding can use a higher threshold than soft thresholding
  13162. before the video looks overfiltered. Default value is 2.
  13163. @item method
  13164. The filtering method the filter will use.
  13165. It accepts the following values:
  13166. @table @samp
  13167. @item hard
  13168. All values under the threshold will be zeroed.
  13169. @item soft
  13170. All values under the threshold will be zeroed. All values above will be
  13171. reduced by the threshold.
  13172. @item garrote
  13173. Scales or nullifies coefficients - intermediary between (more) soft and
  13174. (less) hard thresholding.
  13175. @end table
  13176. Default is garrote.
  13177. @item nsteps
  13178. Number of times, the wavelet will decompose the picture. Picture can't
  13179. be decomposed beyond a particular point (typically, 8 for a 640x480
  13180. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13181. @item percent
  13182. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13183. @item planes
  13184. A list of the planes to process. By default all planes are processed.
  13185. @end table
  13186. @section vectorscope
  13187. Display 2 color component values in the two dimensional graph (which is called
  13188. a vectorscope).
  13189. This filter accepts the following options:
  13190. @table @option
  13191. @item mode, m
  13192. Set vectorscope mode.
  13193. It accepts the following values:
  13194. @table @samp
  13195. @item gray
  13196. Gray values are displayed on graph, higher brightness means more pixels have
  13197. same component color value on location in graph. This is the default mode.
  13198. @item color
  13199. Gray values are displayed on graph. Surrounding pixels values which are not
  13200. present in video frame are drawn in gradient of 2 color components which are
  13201. set by option @code{x} and @code{y}. The 3rd color component is static.
  13202. @item color2
  13203. Actual color components values present in video frame are displayed on graph.
  13204. @item color3
  13205. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13206. on graph increases value of another color component, which is luminance by
  13207. default values of @code{x} and @code{y}.
  13208. @item color4
  13209. Actual colors present in video frame are displayed on graph. If two different
  13210. colors map to same position on graph then color with higher value of component
  13211. not present in graph is picked.
  13212. @item color5
  13213. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13214. component picked from radial gradient.
  13215. @end table
  13216. @item x
  13217. Set which color component will be represented on X-axis. Default is @code{1}.
  13218. @item y
  13219. Set which color component will be represented on Y-axis. Default is @code{2}.
  13220. @item intensity, i
  13221. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13222. of color component which represents frequency of (X, Y) location in graph.
  13223. @item envelope, e
  13224. @table @samp
  13225. @item none
  13226. No envelope, this is default.
  13227. @item instant
  13228. Instant envelope, even darkest single pixel will be clearly highlighted.
  13229. @item peak
  13230. Hold maximum and minimum values presented in graph over time. This way you
  13231. can still spot out of range values without constantly looking at vectorscope.
  13232. @item peak+instant
  13233. Peak and instant envelope combined together.
  13234. @end table
  13235. @item graticule, g
  13236. Set what kind of graticule to draw.
  13237. @table @samp
  13238. @item none
  13239. @item green
  13240. @item color
  13241. @end table
  13242. @item opacity, o
  13243. Set graticule opacity.
  13244. @item flags, f
  13245. Set graticule flags.
  13246. @table @samp
  13247. @item white
  13248. Draw graticule for white point.
  13249. @item black
  13250. Draw graticule for black point.
  13251. @item name
  13252. Draw color points short names.
  13253. @end table
  13254. @item bgopacity, b
  13255. Set background opacity.
  13256. @item lthreshold, l
  13257. Set low threshold for color component not represented on X or Y axis.
  13258. Values lower than this value will be ignored. Default is 0.
  13259. Note this value is multiplied with actual max possible value one pixel component
  13260. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13261. is 0.1 * 255 = 25.
  13262. @item hthreshold, h
  13263. Set high threshold for color component not represented on X or Y axis.
  13264. Values higher than this value will be ignored. Default is 1.
  13265. Note this value is multiplied with actual max possible value one pixel component
  13266. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13267. is 0.9 * 255 = 230.
  13268. @item colorspace, c
  13269. Set what kind of colorspace to use when drawing graticule.
  13270. @table @samp
  13271. @item auto
  13272. @item 601
  13273. @item 709
  13274. @end table
  13275. Default is auto.
  13276. @end table
  13277. @anchor{vidstabdetect}
  13278. @section vidstabdetect
  13279. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13280. @ref{vidstabtransform} for pass 2.
  13281. This filter generates a file with relative translation and rotation
  13282. transform information about subsequent frames, which is then used by
  13283. the @ref{vidstabtransform} filter.
  13284. To enable compilation of this filter you need to configure FFmpeg with
  13285. @code{--enable-libvidstab}.
  13286. This filter accepts the following options:
  13287. @table @option
  13288. @item result
  13289. Set the path to the file used to write the transforms information.
  13290. Default value is @file{transforms.trf}.
  13291. @item shakiness
  13292. Set how shaky the video is and how quick the camera is. It accepts an
  13293. integer in the range 1-10, a value of 1 means little shakiness, a
  13294. value of 10 means strong shakiness. Default value is 5.
  13295. @item accuracy
  13296. Set the accuracy of the detection process. It must be a value in the
  13297. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13298. accuracy. Default value is 15.
  13299. @item stepsize
  13300. Set stepsize of the search process. The region around minimum is
  13301. scanned with 1 pixel resolution. Default value is 6.
  13302. @item mincontrast
  13303. Set minimum contrast. Below this value a local measurement field is
  13304. discarded. Must be a floating point value in the range 0-1. Default
  13305. value is 0.3.
  13306. @item tripod
  13307. Set reference frame number for tripod mode.
  13308. If enabled, the motion of the frames is compared to a reference frame
  13309. in the filtered stream, identified by the specified number. The idea
  13310. is to compensate all movements in a more-or-less static scene and keep
  13311. the camera view absolutely still.
  13312. If set to 0, it is disabled. The frames are counted starting from 1.
  13313. @item show
  13314. Show fields and transforms in the resulting frames. It accepts an
  13315. integer in the range 0-2. Default value is 0, which disables any
  13316. visualization.
  13317. @end table
  13318. @subsection Examples
  13319. @itemize
  13320. @item
  13321. Use default values:
  13322. @example
  13323. vidstabdetect
  13324. @end example
  13325. @item
  13326. Analyze strongly shaky movie and put the results in file
  13327. @file{mytransforms.trf}:
  13328. @example
  13329. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13330. @end example
  13331. @item
  13332. Visualize the result of internal transformations in the resulting
  13333. video:
  13334. @example
  13335. vidstabdetect=show=1
  13336. @end example
  13337. @item
  13338. Analyze a video with medium shakiness using @command{ffmpeg}:
  13339. @example
  13340. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13341. @end example
  13342. @end itemize
  13343. @anchor{vidstabtransform}
  13344. @section vidstabtransform
  13345. Video stabilization/deshaking: pass 2 of 2,
  13346. see @ref{vidstabdetect} for pass 1.
  13347. Read a file with transform information for each frame and
  13348. apply/compensate them. Together with the @ref{vidstabdetect}
  13349. filter this can be used to deshake videos. See also
  13350. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13351. the @ref{unsharp} filter, see below.
  13352. To enable compilation of this filter you need to configure FFmpeg with
  13353. @code{--enable-libvidstab}.
  13354. @subsection Options
  13355. @table @option
  13356. @item input
  13357. Set path to the file used to read the transforms. Default value is
  13358. @file{transforms.trf}.
  13359. @item smoothing
  13360. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13361. camera movements. Default value is 10.
  13362. For example a number of 10 means that 21 frames are used (10 in the
  13363. past and 10 in the future) to smoothen the motion in the video. A
  13364. larger value leads to a smoother video, but limits the acceleration of
  13365. the camera (pan/tilt movements). 0 is a special case where a static
  13366. camera is simulated.
  13367. @item optalgo
  13368. Set the camera path optimization algorithm.
  13369. Accepted values are:
  13370. @table @samp
  13371. @item gauss
  13372. gaussian kernel low-pass filter on camera motion (default)
  13373. @item avg
  13374. averaging on transformations
  13375. @end table
  13376. @item maxshift
  13377. Set maximal number of pixels to translate frames. Default value is -1,
  13378. meaning no limit.
  13379. @item maxangle
  13380. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13381. value is -1, meaning no limit.
  13382. @item crop
  13383. Specify how to deal with borders that may be visible due to movement
  13384. compensation.
  13385. Available values are:
  13386. @table @samp
  13387. @item keep
  13388. keep image information from previous frame (default)
  13389. @item black
  13390. fill the border black
  13391. @end table
  13392. @item invert
  13393. Invert transforms if set to 1. Default value is 0.
  13394. @item relative
  13395. Consider transforms as relative to previous frame if set to 1,
  13396. absolute if set to 0. Default value is 0.
  13397. @item zoom
  13398. Set percentage to zoom. A positive value will result in a zoom-in
  13399. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13400. zoom).
  13401. @item optzoom
  13402. Set optimal zooming to avoid borders.
  13403. Accepted values are:
  13404. @table @samp
  13405. @item 0
  13406. disabled
  13407. @item 1
  13408. optimal static zoom value is determined (only very strong movements
  13409. will lead to visible borders) (default)
  13410. @item 2
  13411. optimal adaptive zoom value is determined (no borders will be
  13412. visible), see @option{zoomspeed}
  13413. @end table
  13414. Note that the value given at zoom is added to the one calculated here.
  13415. @item zoomspeed
  13416. Set percent to zoom maximally each frame (enabled when
  13417. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13418. 0.25.
  13419. @item interpol
  13420. Specify type of interpolation.
  13421. Available values are:
  13422. @table @samp
  13423. @item no
  13424. no interpolation
  13425. @item linear
  13426. linear only horizontal
  13427. @item bilinear
  13428. linear in both directions (default)
  13429. @item bicubic
  13430. cubic in both directions (slow)
  13431. @end table
  13432. @item tripod
  13433. Enable virtual tripod mode if set to 1, which is equivalent to
  13434. @code{relative=0:smoothing=0}. Default value is 0.
  13435. Use also @code{tripod} option of @ref{vidstabdetect}.
  13436. @item debug
  13437. Increase log verbosity if set to 1. Also the detected global motions
  13438. are written to the temporary file @file{global_motions.trf}. Default
  13439. value is 0.
  13440. @end table
  13441. @subsection Examples
  13442. @itemize
  13443. @item
  13444. Use @command{ffmpeg} for a typical stabilization with default values:
  13445. @example
  13446. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13447. @end example
  13448. Note the use of the @ref{unsharp} filter which is always recommended.
  13449. @item
  13450. Zoom in a bit more and load transform data from a given file:
  13451. @example
  13452. vidstabtransform=zoom=5:input="mytransforms.trf"
  13453. @end example
  13454. @item
  13455. Smoothen the video even more:
  13456. @example
  13457. vidstabtransform=smoothing=30
  13458. @end example
  13459. @end itemize
  13460. @section vflip
  13461. Flip the input video vertically.
  13462. For example, to vertically flip a video with @command{ffmpeg}:
  13463. @example
  13464. ffmpeg -i in.avi -vf "vflip" out.avi
  13465. @end example
  13466. @section vfrdet
  13467. Detect variable frame rate video.
  13468. This filter tries to detect if the input is variable or constant frame rate.
  13469. At end it will output number of frames detected as having variable delta pts,
  13470. and ones with constant delta pts.
  13471. If there was frames with variable delta, than it will also show min and max delta
  13472. encountered.
  13473. @section vibrance
  13474. Boost or alter saturation.
  13475. The filter accepts the following options:
  13476. @table @option
  13477. @item intensity
  13478. Set strength of boost if positive value or strength of alter if negative value.
  13479. Default is 0. Allowed range is from -2 to 2.
  13480. @item rbal
  13481. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  13482. @item gbal
  13483. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  13484. @item bbal
  13485. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  13486. @item rlum
  13487. Set the red luma coefficient.
  13488. @item glum
  13489. Set the green luma coefficient.
  13490. @item blum
  13491. Set the blue luma coefficient.
  13492. @end table
  13493. @anchor{vignette}
  13494. @section vignette
  13495. Make or reverse a natural vignetting effect.
  13496. The filter accepts the following options:
  13497. @table @option
  13498. @item angle, a
  13499. Set lens angle expression as a number of radians.
  13500. The value is clipped in the @code{[0,PI/2]} range.
  13501. Default value: @code{"PI/5"}
  13502. @item x0
  13503. @item y0
  13504. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13505. by default.
  13506. @item mode
  13507. Set forward/backward mode.
  13508. Available modes are:
  13509. @table @samp
  13510. @item forward
  13511. The larger the distance from the central point, the darker the image becomes.
  13512. @item backward
  13513. The larger the distance from the central point, the brighter the image becomes.
  13514. This can be used to reverse a vignette effect, though there is no automatic
  13515. detection to extract the lens @option{angle} and other settings (yet). It can
  13516. also be used to create a burning effect.
  13517. @end table
  13518. Default value is @samp{forward}.
  13519. @item eval
  13520. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13521. It accepts the following values:
  13522. @table @samp
  13523. @item init
  13524. Evaluate expressions only once during the filter initialization.
  13525. @item frame
  13526. Evaluate expressions for each incoming frame. This is way slower than the
  13527. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13528. allows advanced dynamic expressions.
  13529. @end table
  13530. Default value is @samp{init}.
  13531. @item dither
  13532. Set dithering to reduce the circular banding effects. Default is @code{1}
  13533. (enabled).
  13534. @item aspect
  13535. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13536. Setting this value to the SAR of the input will make a rectangular vignetting
  13537. following the dimensions of the video.
  13538. Default is @code{1/1}.
  13539. @end table
  13540. @subsection Expressions
  13541. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13542. following parameters.
  13543. @table @option
  13544. @item w
  13545. @item h
  13546. input width and height
  13547. @item n
  13548. the number of input frame, starting from 0
  13549. @item pts
  13550. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13551. @var{TB} units, NAN if undefined
  13552. @item r
  13553. frame rate of the input video, NAN if the input frame rate is unknown
  13554. @item t
  13555. the PTS (Presentation TimeStamp) of the filtered video frame,
  13556. expressed in seconds, NAN if undefined
  13557. @item tb
  13558. time base of the input video
  13559. @end table
  13560. @subsection Examples
  13561. @itemize
  13562. @item
  13563. Apply simple strong vignetting effect:
  13564. @example
  13565. vignette=PI/4
  13566. @end example
  13567. @item
  13568. Make a flickering vignetting:
  13569. @example
  13570. vignette='PI/4+random(1)*PI/50':eval=frame
  13571. @end example
  13572. @end itemize
  13573. @section vmafmotion
  13574. Obtain the average vmaf motion score of a video.
  13575. It is one of the component filters of VMAF.
  13576. The obtained average motion score is printed through the logging system.
  13577. In the below example the input file @file{ref.mpg} is being processed and score
  13578. is computed.
  13579. @example
  13580. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13581. @end example
  13582. @section vstack
  13583. Stack input videos vertically.
  13584. All streams must be of same pixel format and of same width.
  13585. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13586. to create same output.
  13587. The filter accept the following option:
  13588. @table @option
  13589. @item inputs
  13590. Set number of input streams. Default is 2.
  13591. @item shortest
  13592. If set to 1, force the output to terminate when the shortest input
  13593. terminates. Default value is 0.
  13594. @end table
  13595. @section w3fdif
  13596. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13597. Deinterlacing Filter").
  13598. Based on the process described by Martin Weston for BBC R&D, and
  13599. implemented based on the de-interlace algorithm written by Jim
  13600. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13601. uses filter coefficients calculated by BBC R&D.
  13602. There are two sets of filter coefficients, so called "simple":
  13603. and "complex". Which set of filter coefficients is used can
  13604. be set by passing an optional parameter:
  13605. @table @option
  13606. @item filter
  13607. Set the interlacing filter coefficients. Accepts one of the following values:
  13608. @table @samp
  13609. @item simple
  13610. Simple filter coefficient set.
  13611. @item complex
  13612. More-complex filter coefficient set.
  13613. @end table
  13614. Default value is @samp{complex}.
  13615. @item deint
  13616. Specify which frames to deinterlace. Accept one of the following values:
  13617. @table @samp
  13618. @item all
  13619. Deinterlace all frames,
  13620. @item interlaced
  13621. Only deinterlace frames marked as interlaced.
  13622. @end table
  13623. Default value is @samp{all}.
  13624. @end table
  13625. @section waveform
  13626. Video waveform monitor.
  13627. The waveform monitor plots color component intensity. By default luminance
  13628. only. Each column of the waveform corresponds to a column of pixels in the
  13629. source video.
  13630. It accepts the following options:
  13631. @table @option
  13632. @item mode, m
  13633. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13634. In row mode, the graph on the left side represents color component value 0 and
  13635. the right side represents value = 255. In column mode, the top side represents
  13636. color component value = 0 and bottom side represents value = 255.
  13637. @item intensity, i
  13638. Set intensity. Smaller values are useful to find out how many values of the same
  13639. luminance are distributed across input rows/columns.
  13640. Default value is @code{0.04}. Allowed range is [0, 1].
  13641. @item mirror, r
  13642. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13643. In mirrored mode, higher values will be represented on the left
  13644. side for @code{row} mode and at the top for @code{column} mode. Default is
  13645. @code{1} (mirrored).
  13646. @item display, d
  13647. Set display mode.
  13648. It accepts the following values:
  13649. @table @samp
  13650. @item overlay
  13651. Presents information identical to that in the @code{parade}, except
  13652. that the graphs representing color components are superimposed directly
  13653. over one another.
  13654. This display mode makes it easier to spot relative differences or similarities
  13655. in overlapping areas of the color components that are supposed to be identical,
  13656. such as neutral whites, grays, or blacks.
  13657. @item stack
  13658. Display separate graph for the color components side by side in
  13659. @code{row} mode or one below the other in @code{column} mode.
  13660. @item parade
  13661. Display separate graph for the color components side by side in
  13662. @code{column} mode or one below the other in @code{row} mode.
  13663. Using this display mode makes it easy to spot color casts in the highlights
  13664. and shadows of an image, by comparing the contours of the top and the bottom
  13665. graphs of each waveform. Since whites, grays, and blacks are characterized
  13666. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  13667. should display three waveforms of roughly equal width/height. If not, the
  13668. correction is easy to perform by making level adjustments the three waveforms.
  13669. @end table
  13670. Default is @code{stack}.
  13671. @item components, c
  13672. Set which color components to display. Default is 1, which means only luminance
  13673. or red color component if input is in RGB colorspace. If is set for example to
  13674. 7 it will display all 3 (if) available color components.
  13675. @item envelope, e
  13676. @table @samp
  13677. @item none
  13678. No envelope, this is default.
  13679. @item instant
  13680. Instant envelope, minimum and maximum values presented in graph will be easily
  13681. visible even with small @code{step} value.
  13682. @item peak
  13683. Hold minimum and maximum values presented in graph across time. This way you
  13684. can still spot out of range values without constantly looking at waveforms.
  13685. @item peak+instant
  13686. Peak and instant envelope combined together.
  13687. @end table
  13688. @item filter, f
  13689. @table @samp
  13690. @item lowpass
  13691. No filtering, this is default.
  13692. @item flat
  13693. Luma and chroma combined together.
  13694. @item aflat
  13695. Similar as above, but shows difference between blue and red chroma.
  13696. @item xflat
  13697. Similar as above, but use different colors.
  13698. @item chroma
  13699. Displays only chroma.
  13700. @item color
  13701. Displays actual color value on waveform.
  13702. @item acolor
  13703. Similar as above, but with luma showing frequency of chroma values.
  13704. @end table
  13705. @item graticule, g
  13706. Set which graticule to display.
  13707. @table @samp
  13708. @item none
  13709. Do not display graticule.
  13710. @item green
  13711. Display green graticule showing legal broadcast ranges.
  13712. @item orange
  13713. Display orange graticule showing legal broadcast ranges.
  13714. @end table
  13715. @item opacity, o
  13716. Set graticule opacity.
  13717. @item flags, fl
  13718. Set graticule flags.
  13719. @table @samp
  13720. @item numbers
  13721. Draw numbers above lines. By default enabled.
  13722. @item dots
  13723. Draw dots instead of lines.
  13724. @end table
  13725. @item scale, s
  13726. Set scale used for displaying graticule.
  13727. @table @samp
  13728. @item digital
  13729. @item millivolts
  13730. @item ire
  13731. @end table
  13732. Default is digital.
  13733. @item bgopacity, b
  13734. Set background opacity.
  13735. @end table
  13736. @section weave, doubleweave
  13737. The @code{weave} takes a field-based video input and join
  13738. each two sequential fields into single frame, producing a new double
  13739. height clip with half the frame rate and half the frame count.
  13740. The @code{doubleweave} works same as @code{weave} but without
  13741. halving frame rate and frame count.
  13742. It accepts the following option:
  13743. @table @option
  13744. @item first_field
  13745. Set first field. Available values are:
  13746. @table @samp
  13747. @item top, t
  13748. Set the frame as top-field-first.
  13749. @item bottom, b
  13750. Set the frame as bottom-field-first.
  13751. @end table
  13752. @end table
  13753. @subsection Examples
  13754. @itemize
  13755. @item
  13756. Interlace video using @ref{select} and @ref{separatefields} filter:
  13757. @example
  13758. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  13759. @end example
  13760. @end itemize
  13761. @section xbr
  13762. Apply the xBR high-quality magnification filter which is designed for pixel
  13763. art. It follows a set of edge-detection rules, see
  13764. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  13765. It accepts the following option:
  13766. @table @option
  13767. @item n
  13768. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  13769. @code{3xBR} and @code{4} for @code{4xBR}.
  13770. Default is @code{3}.
  13771. @end table
  13772. @section xstack
  13773. Stack video inputs into custom layout.
  13774. All streams must be of same pixel format.
  13775. The filter accept the following option:
  13776. @table @option
  13777. @item inputs
  13778. Set number of input streams. Default is 2.
  13779. @item layout
  13780. Specify layout of inputs.
  13781. This option requires the desired layout configuration to be explicitly set by the user.
  13782. This sets position of each video input in output. Each input
  13783. is separated by '|'.
  13784. The first number represents the column, and the second number represents the row.
  13785. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  13786. where X is video input from which to take width or height.
  13787. Multiple values can be used when separated by '+'. In such
  13788. case values are summed together.
  13789. @item shortest
  13790. If set to 1, force the output to terminate when the shortest input
  13791. terminates. Default value is 0.
  13792. @end table
  13793. @subsection Examples
  13794. @itemize
  13795. @item
  13796. Display 4 inputs into 2x2 grid,
  13797. note that if inputs are of different sizes unused gaps might appear,
  13798. as not all of output video is used.
  13799. @example
  13800. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  13801. @end example
  13802. @item
  13803. Display 4 inputs into 1x4 grid,
  13804. note that if inputs are of different sizes unused gaps might appear,
  13805. as not all of output video is used.
  13806. @example
  13807. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  13808. @end example
  13809. @item
  13810. Display 9 inputs into 3x3 grid,
  13811. note that if inputs are of different sizes unused gaps might appear,
  13812. as not all of output video is used.
  13813. @example
  13814. xstack=inputs=9:layout=w3_0|w3_h0+h2|w3_h0|0_h4|0_0|w3+w1_0|0_h1+h2|w3+w1_h0|w3+w1_h1+h2
  13815. @end example
  13816. @end itemize
  13817. @anchor{yadif}
  13818. @section yadif
  13819. Deinterlace the input video ("yadif" means "yet another deinterlacing
  13820. filter").
  13821. It accepts the following parameters:
  13822. @table @option
  13823. @item mode
  13824. The interlacing mode to adopt. It accepts one of the following values:
  13825. @table @option
  13826. @item 0, send_frame
  13827. Output one frame for each frame.
  13828. @item 1, send_field
  13829. Output one frame for each field.
  13830. @item 2, send_frame_nospatial
  13831. Like @code{send_frame}, but it skips the spatial interlacing check.
  13832. @item 3, send_field_nospatial
  13833. Like @code{send_field}, but it skips the spatial interlacing check.
  13834. @end table
  13835. The default value is @code{send_frame}.
  13836. @item parity
  13837. The picture field parity assumed for the input interlaced video. It accepts one
  13838. of the following values:
  13839. @table @option
  13840. @item 0, tff
  13841. Assume the top field is first.
  13842. @item 1, bff
  13843. Assume the bottom field is first.
  13844. @item -1, auto
  13845. Enable automatic detection of field parity.
  13846. @end table
  13847. The default value is @code{auto}.
  13848. If the interlacing is unknown or the decoder does not export this information,
  13849. top field first will be assumed.
  13850. @item deint
  13851. Specify which frames to deinterlace. Accept one of the following
  13852. values:
  13853. @table @option
  13854. @item 0, all
  13855. Deinterlace all frames.
  13856. @item 1, interlaced
  13857. Only deinterlace frames marked as interlaced.
  13858. @end table
  13859. The default value is @code{all}.
  13860. @end table
  13861. @section yadif_cuda
  13862. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  13863. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  13864. and/or nvenc.
  13865. It accepts the following parameters:
  13866. @table @option
  13867. @item mode
  13868. The interlacing mode to adopt. It accepts one of the following values:
  13869. @table @option
  13870. @item 0, send_frame
  13871. Output one frame for each frame.
  13872. @item 1, send_field
  13873. Output one frame for each field.
  13874. @item 2, send_frame_nospatial
  13875. Like @code{send_frame}, but it skips the spatial interlacing check.
  13876. @item 3, send_field_nospatial
  13877. Like @code{send_field}, but it skips the spatial interlacing check.
  13878. @end table
  13879. The default value is @code{send_frame}.
  13880. @item parity
  13881. The picture field parity assumed for the input interlaced video. It accepts one
  13882. of the following values:
  13883. @table @option
  13884. @item 0, tff
  13885. Assume the top field is first.
  13886. @item 1, bff
  13887. Assume the bottom field is first.
  13888. @item -1, auto
  13889. Enable automatic detection of field parity.
  13890. @end table
  13891. The default value is @code{auto}.
  13892. If the interlacing is unknown or the decoder does not export this information,
  13893. top field first will be assumed.
  13894. @item deint
  13895. Specify which frames to deinterlace. Accept one of the following
  13896. values:
  13897. @table @option
  13898. @item 0, all
  13899. Deinterlace all frames.
  13900. @item 1, interlaced
  13901. Only deinterlace frames marked as interlaced.
  13902. @end table
  13903. The default value is @code{all}.
  13904. @end table
  13905. @section zoompan
  13906. Apply Zoom & Pan effect.
  13907. This filter accepts the following options:
  13908. @table @option
  13909. @item zoom, z
  13910. Set the zoom expression. Default is 1.
  13911. @item x
  13912. @item y
  13913. Set the x and y expression. Default is 0.
  13914. @item d
  13915. Set the duration expression in number of frames.
  13916. This sets for how many number of frames effect will last for
  13917. single input image.
  13918. @item s
  13919. Set the output image size, default is 'hd720'.
  13920. @item fps
  13921. Set the output frame rate, default is '25'.
  13922. @end table
  13923. Each expression can contain the following constants:
  13924. @table @option
  13925. @item in_w, iw
  13926. Input width.
  13927. @item in_h, ih
  13928. Input height.
  13929. @item out_w, ow
  13930. Output width.
  13931. @item out_h, oh
  13932. Output height.
  13933. @item in
  13934. Input frame count.
  13935. @item on
  13936. Output frame count.
  13937. @item x
  13938. @item y
  13939. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  13940. for current input frame.
  13941. @item px
  13942. @item py
  13943. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  13944. not yet such frame (first input frame).
  13945. @item zoom
  13946. Last calculated zoom from 'z' expression for current input frame.
  13947. @item pzoom
  13948. Last calculated zoom of last output frame of previous input frame.
  13949. @item duration
  13950. Number of output frames for current input frame. Calculated from 'd' expression
  13951. for each input frame.
  13952. @item pduration
  13953. number of output frames created for previous input frame
  13954. @item a
  13955. Rational number: input width / input height
  13956. @item sar
  13957. sample aspect ratio
  13958. @item dar
  13959. display aspect ratio
  13960. @end table
  13961. @subsection Examples
  13962. @itemize
  13963. @item
  13964. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  13965. @example
  13966. 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
  13967. @end example
  13968. @item
  13969. Zoom-in up to 1.5 and pan always at center of picture:
  13970. @example
  13971. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13972. @end example
  13973. @item
  13974. Same as above but without pausing:
  13975. @example
  13976. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13977. @end example
  13978. @end itemize
  13979. @anchor{zscale}
  13980. @section zscale
  13981. Scale (resize) the input video, using the z.lib library:
  13982. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  13983. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  13984. The zscale filter forces the output display aspect ratio to be the same
  13985. as the input, by changing the output sample aspect ratio.
  13986. If the input image format is different from the format requested by
  13987. the next filter, the zscale filter will convert the input to the
  13988. requested format.
  13989. @subsection Options
  13990. The filter accepts the following options.
  13991. @table @option
  13992. @item width, w
  13993. @item height, h
  13994. Set the output video dimension expression. Default value is the input
  13995. dimension.
  13996. If the @var{width} or @var{w} value is 0, the input width is used for
  13997. the output. If the @var{height} or @var{h} value is 0, the input height
  13998. is used for the output.
  13999. If one and only one of the values is -n with n >= 1, the zscale filter
  14000. will use a value that maintains the aspect ratio of the input image,
  14001. calculated from the other specified dimension. After that it will,
  14002. however, make sure that the calculated dimension is divisible by n and
  14003. adjust the value if necessary.
  14004. If both values are -n with n >= 1, the behavior will be identical to
  14005. both values being set to 0 as previously detailed.
  14006. See below for the list of accepted constants for use in the dimension
  14007. expression.
  14008. @item size, s
  14009. Set the video size. For the syntax of this option, check the
  14010. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14011. @item dither, d
  14012. Set the dither type.
  14013. Possible values are:
  14014. @table @var
  14015. @item none
  14016. @item ordered
  14017. @item random
  14018. @item error_diffusion
  14019. @end table
  14020. Default is none.
  14021. @item filter, f
  14022. Set the resize filter type.
  14023. Possible values are:
  14024. @table @var
  14025. @item point
  14026. @item bilinear
  14027. @item bicubic
  14028. @item spline16
  14029. @item spline36
  14030. @item lanczos
  14031. @end table
  14032. Default is bilinear.
  14033. @item range, r
  14034. Set the color range.
  14035. Possible values are:
  14036. @table @var
  14037. @item input
  14038. @item limited
  14039. @item full
  14040. @end table
  14041. Default is same as input.
  14042. @item primaries, p
  14043. Set the color primaries.
  14044. Possible values are:
  14045. @table @var
  14046. @item input
  14047. @item 709
  14048. @item unspecified
  14049. @item 170m
  14050. @item 240m
  14051. @item 2020
  14052. @end table
  14053. Default is same as input.
  14054. @item transfer, t
  14055. Set the transfer characteristics.
  14056. Possible values are:
  14057. @table @var
  14058. @item input
  14059. @item 709
  14060. @item unspecified
  14061. @item 601
  14062. @item linear
  14063. @item 2020_10
  14064. @item 2020_12
  14065. @item smpte2084
  14066. @item iec61966-2-1
  14067. @item arib-std-b67
  14068. @end table
  14069. Default is same as input.
  14070. @item matrix, m
  14071. Set the colorspace matrix.
  14072. Possible value are:
  14073. @table @var
  14074. @item input
  14075. @item 709
  14076. @item unspecified
  14077. @item 470bg
  14078. @item 170m
  14079. @item 2020_ncl
  14080. @item 2020_cl
  14081. @end table
  14082. Default is same as input.
  14083. @item rangein, rin
  14084. Set the input color range.
  14085. Possible values are:
  14086. @table @var
  14087. @item input
  14088. @item limited
  14089. @item full
  14090. @end table
  14091. Default is same as input.
  14092. @item primariesin, pin
  14093. Set the input color primaries.
  14094. Possible values are:
  14095. @table @var
  14096. @item input
  14097. @item 709
  14098. @item unspecified
  14099. @item 170m
  14100. @item 240m
  14101. @item 2020
  14102. @end table
  14103. Default is same as input.
  14104. @item transferin, tin
  14105. Set the input transfer characteristics.
  14106. Possible values are:
  14107. @table @var
  14108. @item input
  14109. @item 709
  14110. @item unspecified
  14111. @item 601
  14112. @item linear
  14113. @item 2020_10
  14114. @item 2020_12
  14115. @end table
  14116. Default is same as input.
  14117. @item matrixin, min
  14118. Set the input colorspace matrix.
  14119. Possible value are:
  14120. @table @var
  14121. @item input
  14122. @item 709
  14123. @item unspecified
  14124. @item 470bg
  14125. @item 170m
  14126. @item 2020_ncl
  14127. @item 2020_cl
  14128. @end table
  14129. @item chromal, c
  14130. Set the output chroma location.
  14131. Possible values are:
  14132. @table @var
  14133. @item input
  14134. @item left
  14135. @item center
  14136. @item topleft
  14137. @item top
  14138. @item bottomleft
  14139. @item bottom
  14140. @end table
  14141. @item chromalin, cin
  14142. Set the input chroma location.
  14143. Possible values are:
  14144. @table @var
  14145. @item input
  14146. @item left
  14147. @item center
  14148. @item topleft
  14149. @item top
  14150. @item bottomleft
  14151. @item bottom
  14152. @end table
  14153. @item npl
  14154. Set the nominal peak luminance.
  14155. @end table
  14156. The values of the @option{w} and @option{h} options are expressions
  14157. containing the following constants:
  14158. @table @var
  14159. @item in_w
  14160. @item in_h
  14161. The input width and height
  14162. @item iw
  14163. @item ih
  14164. These are the same as @var{in_w} and @var{in_h}.
  14165. @item out_w
  14166. @item out_h
  14167. The output (scaled) width and height
  14168. @item ow
  14169. @item oh
  14170. These are the same as @var{out_w} and @var{out_h}
  14171. @item a
  14172. The same as @var{iw} / @var{ih}
  14173. @item sar
  14174. input sample aspect ratio
  14175. @item dar
  14176. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14177. @item hsub
  14178. @item vsub
  14179. horizontal and vertical input chroma subsample values. For example for the
  14180. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14181. @item ohsub
  14182. @item ovsub
  14183. horizontal and vertical output chroma subsample values. For example for the
  14184. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14185. @end table
  14186. @table @option
  14187. @end table
  14188. @c man end VIDEO FILTERS
  14189. @chapter OpenCL Video Filters
  14190. @c man begin OPENCL VIDEO FILTERS
  14191. Below is a description of the currently available OpenCL video filters.
  14192. To enable compilation of these filters you need to configure FFmpeg with
  14193. @code{--enable-opencl}.
  14194. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14195. @table @option
  14196. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14197. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14198. given device parameters.
  14199. @item -filter_hw_device @var{name}
  14200. Pass the hardware device called @var{name} to all filters in any filter graph.
  14201. @end table
  14202. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14203. @itemize
  14204. @item
  14205. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14206. @example
  14207. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14208. @end example
  14209. @end itemize
  14210. 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.
  14211. @section avgblur_opencl
  14212. Apply average blur filter.
  14213. The filter accepts the following options:
  14214. @table @option
  14215. @item sizeX
  14216. Set horizontal radius size.
  14217. Range is @code{[1, 1024]} and default value is @code{1}.
  14218. @item planes
  14219. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14220. @item sizeY
  14221. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14222. @end table
  14223. @subsection Example
  14224. @itemize
  14225. @item
  14226. 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.
  14227. @example
  14228. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14229. @end example
  14230. @end itemize
  14231. @section boxblur_opencl
  14232. Apply a boxblur algorithm to the input video.
  14233. It accepts the following parameters:
  14234. @table @option
  14235. @item luma_radius, lr
  14236. @item luma_power, lp
  14237. @item chroma_radius, cr
  14238. @item chroma_power, cp
  14239. @item alpha_radius, ar
  14240. @item alpha_power, ap
  14241. @end table
  14242. A description of the accepted options follows.
  14243. @table @option
  14244. @item luma_radius, lr
  14245. @item chroma_radius, cr
  14246. @item alpha_radius, ar
  14247. Set an expression for the box radius in pixels used for blurring the
  14248. corresponding input plane.
  14249. The radius value must be a non-negative number, and must not be
  14250. greater than the value of the expression @code{min(w,h)/2} for the
  14251. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14252. planes.
  14253. Default value for @option{luma_radius} is "2". If not specified,
  14254. @option{chroma_radius} and @option{alpha_radius} default to the
  14255. corresponding value set for @option{luma_radius}.
  14256. The expressions can contain the following constants:
  14257. @table @option
  14258. @item w
  14259. @item h
  14260. The input width and height in pixels.
  14261. @item cw
  14262. @item ch
  14263. The input chroma image width and height in pixels.
  14264. @item hsub
  14265. @item vsub
  14266. The horizontal and vertical chroma subsample values. For example, for the
  14267. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14268. @end table
  14269. @item luma_power, lp
  14270. @item chroma_power, cp
  14271. @item alpha_power, ap
  14272. Specify how many times the boxblur filter is applied to the
  14273. corresponding plane.
  14274. Default value for @option{luma_power} is 2. If not specified,
  14275. @option{chroma_power} and @option{alpha_power} default to the
  14276. corresponding value set for @option{luma_power}.
  14277. A value of 0 will disable the effect.
  14278. @end table
  14279. @subsection Examples
  14280. 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.
  14281. @itemize
  14282. @item
  14283. Apply a boxblur filter with the luma, chroma, and alpha radius
  14284. 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.
  14285. @example
  14286. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14287. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14288. @end example
  14289. @item
  14290. 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.
  14291. For the luma plane, a 2x2 box radius will be run once.
  14292. For the chroma plane, a 4x4 box radius will be run 5 times.
  14293. For the alpha plane, a 3x3 box radius will be run 7 times.
  14294. @example
  14295. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14296. @end example
  14297. @end itemize
  14298. @section convolution_opencl
  14299. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14300. The filter accepts the following options:
  14301. @table @option
  14302. @item 0m
  14303. @item 1m
  14304. @item 2m
  14305. @item 3m
  14306. Set matrix for each plane.
  14307. Matrix is sequence of 9, 25 or 49 signed numbers.
  14308. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14309. @item 0rdiv
  14310. @item 1rdiv
  14311. @item 2rdiv
  14312. @item 3rdiv
  14313. Set multiplier for calculated value for each plane.
  14314. If unset or 0, it will be sum of all matrix elements.
  14315. The option value must be an float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14316. @item 0bias
  14317. @item 1bias
  14318. @item 2bias
  14319. @item 3bias
  14320. Set bias for each plane. This value is added to the result of the multiplication.
  14321. Useful for making the overall image brighter or darker.
  14322. The option value must be an float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  14323. @end table
  14324. @subsection Examples
  14325. @itemize
  14326. @item
  14327. Apply sharpen:
  14328. @example
  14329. -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
  14330. @end example
  14331. @item
  14332. Apply blur:
  14333. @example
  14334. -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
  14335. @end example
  14336. @item
  14337. Apply edge enhance:
  14338. @example
  14339. -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
  14340. @end example
  14341. @item
  14342. Apply edge detect:
  14343. @example
  14344. -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
  14345. @end example
  14346. @item
  14347. Apply laplacian edge detector which includes diagonals:
  14348. @example
  14349. -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
  14350. @end example
  14351. @item
  14352. Apply emboss:
  14353. @example
  14354. -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
  14355. @end example
  14356. @end itemize
  14357. @section dilation_opencl
  14358. Apply dilation effect to the video.
  14359. This filter replaces the pixel by the local(3x3) maximum.
  14360. It accepts the following options:
  14361. @table @option
  14362. @item threshold0
  14363. @item threshold1
  14364. @item threshold2
  14365. @item threshold3
  14366. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14367. If @code{0}, plane will remain unchanged.
  14368. @item coordinates
  14369. Flag which specifies the pixel to refer to.
  14370. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14371. Flags to local 3x3 coordinates region centered on @code{x}:
  14372. 1 2 3
  14373. 4 x 5
  14374. 6 7 8
  14375. @end table
  14376. @subsection Example
  14377. @itemize
  14378. @item
  14379. 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.
  14380. @example
  14381. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14382. @end example
  14383. @end itemize
  14384. @section erosion_opencl
  14385. Apply erosion effect to the video.
  14386. This filter replaces the pixel by the local(3x3) minimum.
  14387. It accepts the following options:
  14388. @table @option
  14389. @item threshold0
  14390. @item threshold1
  14391. @item threshold2
  14392. @item threshold3
  14393. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14394. If @code{0}, plane will remain unchanged.
  14395. @item coordinates
  14396. Flag which specifies the pixel to refer to.
  14397. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14398. Flags to local 3x3 coordinates region centered on @code{x}:
  14399. 1 2 3
  14400. 4 x 5
  14401. 6 7 8
  14402. @end table
  14403. @subsection Example
  14404. @itemize
  14405. @item
  14406. 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.
  14407. @example
  14408. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14409. @end example
  14410. @end itemize
  14411. @section overlay_opencl
  14412. Overlay one video on top of another.
  14413. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  14414. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  14415. The filter accepts the following options:
  14416. @table @option
  14417. @item x
  14418. Set the x coordinate of the overlaid video on the main video.
  14419. Default value is @code{0}.
  14420. @item y
  14421. Set the x coordinate of the overlaid video on the main video.
  14422. Default value is @code{0}.
  14423. @end table
  14424. @subsection Examples
  14425. @itemize
  14426. @item
  14427. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  14428. @example
  14429. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14430. @end example
  14431. @item
  14432. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  14433. @example
  14434. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14435. @end example
  14436. @end itemize
  14437. @section prewitt_opencl
  14438. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  14439. The filter accepts the following option:
  14440. @table @option
  14441. @item planes
  14442. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14443. @item scale
  14444. Set value which will be multiplied with filtered result.
  14445. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14446. @item delta
  14447. Set value which will be added to filtered result.
  14448. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14449. @end table
  14450. @subsection Example
  14451. @itemize
  14452. @item
  14453. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  14454. @example
  14455. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14456. @end example
  14457. @end itemize
  14458. @section roberts_opencl
  14459. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  14460. The filter accepts the following option:
  14461. @table @option
  14462. @item planes
  14463. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14464. @item scale
  14465. Set value which will be multiplied with filtered result.
  14466. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14467. @item delta
  14468. Set value which will be added to filtered result.
  14469. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14470. @end table
  14471. @subsection Example
  14472. @itemize
  14473. @item
  14474. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  14475. @example
  14476. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14477. @end example
  14478. @end itemize
  14479. @section sobel_opencl
  14480. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  14481. The filter accepts the following option:
  14482. @table @option
  14483. @item planes
  14484. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14485. @item scale
  14486. Set value which will be multiplied with filtered result.
  14487. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14488. @item delta
  14489. Set value which will be added to filtered result.
  14490. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14491. @end table
  14492. @subsection Example
  14493. @itemize
  14494. @item
  14495. Apply sobel operator with scale set to 2 and delta set to 10
  14496. @example
  14497. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14498. @end example
  14499. @end itemize
  14500. @section tonemap_opencl
  14501. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  14502. It accepts the following parameters:
  14503. @table @option
  14504. @item tonemap
  14505. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  14506. @item param
  14507. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  14508. @item desat
  14509. Apply desaturation for highlights that exceed this level of brightness. The
  14510. higher the parameter, the more color information will be preserved. This
  14511. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14512. (smoothly) turning into white instead. This makes images feel more natural,
  14513. at the cost of reducing information about out-of-range colors.
  14514. The default value is 0.5, and the algorithm here is a little different from
  14515. the cpu version tonemap currently. A setting of 0.0 disables this option.
  14516. @item threshold
  14517. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  14518. is used to detect whether the scene has changed or not. If the distance beween
  14519. the current frame average brightness and the current running average exceeds
  14520. a threshold value, we would re-calculate scene average and peak brightness.
  14521. The default value is 0.2.
  14522. @item format
  14523. Specify the output pixel format.
  14524. Currently supported formats are:
  14525. @table @var
  14526. @item p010
  14527. @item nv12
  14528. @end table
  14529. @item range, r
  14530. Set the output color range.
  14531. Possible values are:
  14532. @table @var
  14533. @item tv/mpeg
  14534. @item pc/jpeg
  14535. @end table
  14536. Default is same as input.
  14537. @item primaries, p
  14538. Set the output color primaries.
  14539. Possible values are:
  14540. @table @var
  14541. @item bt709
  14542. @item bt2020
  14543. @end table
  14544. Default is same as input.
  14545. @item transfer, t
  14546. Set the output transfer characteristics.
  14547. Possible values are:
  14548. @table @var
  14549. @item bt709
  14550. @item bt2020
  14551. @end table
  14552. Default is bt709.
  14553. @item matrix, m
  14554. Set the output colorspace matrix.
  14555. Possible value are:
  14556. @table @var
  14557. @item bt709
  14558. @item bt2020
  14559. @end table
  14560. Default is same as input.
  14561. @end table
  14562. @subsection Example
  14563. @itemize
  14564. @item
  14565. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  14566. @example
  14567. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  14568. @end example
  14569. @end itemize
  14570. @section unsharp_opencl
  14571. Sharpen or blur the input video.
  14572. It accepts the following parameters:
  14573. @table @option
  14574. @item luma_msize_x, lx
  14575. Set the luma matrix horizontal size.
  14576. Range is @code{[1, 23]} and default value is @code{5}.
  14577. @item luma_msize_y, ly
  14578. Set the luma matrix vertical size.
  14579. Range is @code{[1, 23]} and default value is @code{5}.
  14580. @item luma_amount, la
  14581. Set the luma effect strength.
  14582. Range is @code{[-10, 10]} and default value is @code{1.0}.
  14583. Negative values will blur the input video, while positive values will
  14584. sharpen it, a value of zero will disable the effect.
  14585. @item chroma_msize_x, cx
  14586. Set the chroma matrix horizontal size.
  14587. Range is @code{[1, 23]} and default value is @code{5}.
  14588. @item chroma_msize_y, cy
  14589. Set the chroma matrix vertical size.
  14590. Range is @code{[1, 23]} and default value is @code{5}.
  14591. @item chroma_amount, ca
  14592. Set the chroma effect strength.
  14593. Range is @code{[-10, 10]} and default value is @code{0.0}.
  14594. Negative values will blur the input video, while positive values will
  14595. sharpen it, a value of zero will disable the effect.
  14596. @end table
  14597. All parameters are optional and default to the equivalent of the
  14598. string '5:5:1.0:5:5:0.0'.
  14599. @subsection Examples
  14600. @itemize
  14601. @item
  14602. Apply strong luma sharpen effect:
  14603. @example
  14604. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  14605. @end example
  14606. @item
  14607. Apply a strong blur of both luma and chroma parameters:
  14608. @example
  14609. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  14610. @end example
  14611. @end itemize
  14612. @c man end OPENCL VIDEO FILTERS
  14613. @chapter Video Sources
  14614. @c man begin VIDEO SOURCES
  14615. Below is a description of the currently available video sources.
  14616. @section buffer
  14617. Buffer video frames, and make them available to the filter chain.
  14618. This source is mainly intended for a programmatic use, in particular
  14619. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  14620. It accepts the following parameters:
  14621. @table @option
  14622. @item video_size
  14623. Specify the size (width and height) of the buffered video frames. For the
  14624. syntax of this option, check the
  14625. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14626. @item width
  14627. The input video width.
  14628. @item height
  14629. The input video height.
  14630. @item pix_fmt
  14631. A string representing the pixel format of the buffered video frames.
  14632. It may be a number corresponding to a pixel format, or a pixel format
  14633. name.
  14634. @item time_base
  14635. Specify the timebase assumed by the timestamps of the buffered frames.
  14636. @item frame_rate
  14637. Specify the frame rate expected for the video stream.
  14638. @item pixel_aspect, sar
  14639. The sample (pixel) aspect ratio of the input video.
  14640. @item sws_param
  14641. Specify the optional parameters to be used for the scale filter which
  14642. is automatically inserted when an input change is detected in the
  14643. input size or format.
  14644. @item hw_frames_ctx
  14645. When using a hardware pixel format, this should be a reference to an
  14646. AVHWFramesContext describing input frames.
  14647. @end table
  14648. For example:
  14649. @example
  14650. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  14651. @end example
  14652. will instruct the source to accept video frames with size 320x240 and
  14653. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  14654. square pixels (1:1 sample aspect ratio).
  14655. Since the pixel format with name "yuv410p" corresponds to the number 6
  14656. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  14657. this example corresponds to:
  14658. @example
  14659. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  14660. @end example
  14661. Alternatively, the options can be specified as a flat string, but this
  14662. syntax is deprecated:
  14663. @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}]
  14664. @section cellauto
  14665. Create a pattern generated by an elementary cellular automaton.
  14666. The initial state of the cellular automaton can be defined through the
  14667. @option{filename} and @option{pattern} options. If such options are
  14668. not specified an initial state is created randomly.
  14669. At each new frame a new row in the video is filled with the result of
  14670. the cellular automaton next generation. The behavior when the whole
  14671. frame is filled is defined by the @option{scroll} option.
  14672. This source accepts the following options:
  14673. @table @option
  14674. @item filename, f
  14675. Read the initial cellular automaton state, i.e. the starting row, from
  14676. the specified file.
  14677. In the file, each non-whitespace character is considered an alive
  14678. cell, a newline will terminate the row, and further characters in the
  14679. file will be ignored.
  14680. @item pattern, p
  14681. Read the initial cellular automaton state, i.e. the starting row, from
  14682. the specified string.
  14683. Each non-whitespace character in the string is considered an alive
  14684. cell, a newline will terminate the row, and further characters in the
  14685. string will be ignored.
  14686. @item rate, r
  14687. Set the video rate, that is the number of frames generated per second.
  14688. Default is 25.
  14689. @item random_fill_ratio, ratio
  14690. Set the random fill ratio for the initial cellular automaton row. It
  14691. is a floating point number value ranging from 0 to 1, defaults to
  14692. 1/PHI.
  14693. This option is ignored when a file or a pattern is specified.
  14694. @item random_seed, seed
  14695. Set the seed for filling randomly the initial row, must be an integer
  14696. included between 0 and UINT32_MAX. If not specified, or if explicitly
  14697. set to -1, the filter will try to use a good random seed on a best
  14698. effort basis.
  14699. @item rule
  14700. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  14701. Default value is 110.
  14702. @item size, s
  14703. Set the size of the output video. For the syntax of this option, check the
  14704. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14705. If @option{filename} or @option{pattern} is specified, the size is set
  14706. by default to the width of the specified initial state row, and the
  14707. height is set to @var{width} * PHI.
  14708. If @option{size} is set, it must contain the width of the specified
  14709. pattern string, and the specified pattern will be centered in the
  14710. larger row.
  14711. If a filename or a pattern string is not specified, the size value
  14712. defaults to "320x518" (used for a randomly generated initial state).
  14713. @item scroll
  14714. If set to 1, scroll the output upward when all the rows in the output
  14715. have been already filled. If set to 0, the new generated row will be
  14716. written over the top row just after the bottom row is filled.
  14717. Defaults to 1.
  14718. @item start_full, full
  14719. If set to 1, completely fill the output with generated rows before
  14720. outputting the first frame.
  14721. This is the default behavior, for disabling set the value to 0.
  14722. @item stitch
  14723. If set to 1, stitch the left and right row edges together.
  14724. This is the default behavior, for disabling set the value to 0.
  14725. @end table
  14726. @subsection Examples
  14727. @itemize
  14728. @item
  14729. Read the initial state from @file{pattern}, and specify an output of
  14730. size 200x400.
  14731. @example
  14732. cellauto=f=pattern:s=200x400
  14733. @end example
  14734. @item
  14735. Generate a random initial row with a width of 200 cells, with a fill
  14736. ratio of 2/3:
  14737. @example
  14738. cellauto=ratio=2/3:s=200x200
  14739. @end example
  14740. @item
  14741. Create a pattern generated by rule 18 starting by a single alive cell
  14742. centered on an initial row with width 100:
  14743. @example
  14744. cellauto=p=@@:s=100x400:full=0:rule=18
  14745. @end example
  14746. @item
  14747. Specify a more elaborated initial pattern:
  14748. @example
  14749. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  14750. @end example
  14751. @end itemize
  14752. @anchor{coreimagesrc}
  14753. @section coreimagesrc
  14754. Video source generated on GPU using Apple's CoreImage API on OSX.
  14755. This video source is a specialized version of the @ref{coreimage} video filter.
  14756. Use a core image generator at the beginning of the applied filterchain to
  14757. generate the content.
  14758. The coreimagesrc video source accepts the following options:
  14759. @table @option
  14760. @item list_generators
  14761. List all available generators along with all their respective options as well as
  14762. possible minimum and maximum values along with the default values.
  14763. @example
  14764. list_generators=true
  14765. @end example
  14766. @item size, s
  14767. Specify the size of the sourced video. For the syntax of this option, check the
  14768. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14769. The default value is @code{320x240}.
  14770. @item rate, r
  14771. Specify the frame rate of the sourced video, as the number of frames
  14772. generated per second. It has to be a string in the format
  14773. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14774. number or a valid video frame rate abbreviation. The default value is
  14775. "25".
  14776. @item sar
  14777. Set the sample aspect ratio of the sourced video.
  14778. @item duration, d
  14779. Set the duration of the sourced video. See
  14780. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14781. for the accepted syntax.
  14782. If not specified, or the expressed duration is negative, the video is
  14783. supposed to be generated forever.
  14784. @end table
  14785. Additionally, all options of the @ref{coreimage} video filter are accepted.
  14786. A complete filterchain can be used for further processing of the
  14787. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  14788. and examples for details.
  14789. @subsection Examples
  14790. @itemize
  14791. @item
  14792. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  14793. given as complete and escaped command-line for Apple's standard bash shell:
  14794. @example
  14795. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  14796. @end example
  14797. This example is equivalent to the QRCode example of @ref{coreimage} without the
  14798. need for a nullsrc video source.
  14799. @end itemize
  14800. @section mandelbrot
  14801. Generate a Mandelbrot set fractal, and progressively zoom towards the
  14802. point specified with @var{start_x} and @var{start_y}.
  14803. This source accepts the following options:
  14804. @table @option
  14805. @item end_pts
  14806. Set the terminal pts value. Default value is 400.
  14807. @item end_scale
  14808. Set the terminal scale value.
  14809. Must be a floating point value. Default value is 0.3.
  14810. @item inner
  14811. Set the inner coloring mode, that is the algorithm used to draw the
  14812. Mandelbrot fractal internal region.
  14813. It shall assume one of the following values:
  14814. @table @option
  14815. @item black
  14816. Set black mode.
  14817. @item convergence
  14818. Show time until convergence.
  14819. @item mincol
  14820. Set color based on point closest to the origin of the iterations.
  14821. @item period
  14822. Set period mode.
  14823. @end table
  14824. Default value is @var{mincol}.
  14825. @item bailout
  14826. Set the bailout value. Default value is 10.0.
  14827. @item maxiter
  14828. Set the maximum of iterations performed by the rendering
  14829. algorithm. Default value is 7189.
  14830. @item outer
  14831. Set outer coloring mode.
  14832. It shall assume one of following values:
  14833. @table @option
  14834. @item iteration_count
  14835. Set iteration cound mode.
  14836. @item normalized_iteration_count
  14837. set normalized iteration count mode.
  14838. @end table
  14839. Default value is @var{normalized_iteration_count}.
  14840. @item rate, r
  14841. Set frame rate, expressed as number of frames per second. Default
  14842. value is "25".
  14843. @item size, s
  14844. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  14845. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  14846. @item start_scale
  14847. Set the initial scale value. Default value is 3.0.
  14848. @item start_x
  14849. Set the initial x position. Must be a floating point value between
  14850. -100 and 100. Default value is -0.743643887037158704752191506114774.
  14851. @item start_y
  14852. Set the initial y position. Must be a floating point value between
  14853. -100 and 100. Default value is -0.131825904205311970493132056385139.
  14854. @end table
  14855. @section mptestsrc
  14856. Generate various test patterns, as generated by the MPlayer test filter.
  14857. The size of the generated video is fixed, and is 256x256.
  14858. This source is useful in particular for testing encoding features.
  14859. This source accepts the following options:
  14860. @table @option
  14861. @item rate, r
  14862. Specify the frame rate of the sourced video, as the number of frames
  14863. generated per second. It has to be a string in the format
  14864. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14865. number or a valid video frame rate abbreviation. The default value is
  14866. "25".
  14867. @item duration, d
  14868. Set the duration of the sourced video. See
  14869. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14870. for the accepted syntax.
  14871. If not specified, or the expressed duration is negative, the video is
  14872. supposed to be generated forever.
  14873. @item test, t
  14874. Set the number or the name of the test to perform. Supported tests are:
  14875. @table @option
  14876. @item dc_luma
  14877. @item dc_chroma
  14878. @item freq_luma
  14879. @item freq_chroma
  14880. @item amp_luma
  14881. @item amp_chroma
  14882. @item cbp
  14883. @item mv
  14884. @item ring1
  14885. @item ring2
  14886. @item all
  14887. @end table
  14888. Default value is "all", which will cycle through the list of all tests.
  14889. @end table
  14890. Some examples:
  14891. @example
  14892. mptestsrc=t=dc_luma
  14893. @end example
  14894. will generate a "dc_luma" test pattern.
  14895. @section frei0r_src
  14896. Provide a frei0r source.
  14897. To enable compilation of this filter you need to install the frei0r
  14898. header and configure FFmpeg with @code{--enable-frei0r}.
  14899. This source accepts the following parameters:
  14900. @table @option
  14901. @item size
  14902. The size of the video to generate. For the syntax of this option, check the
  14903. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14904. @item framerate
  14905. The framerate of the generated video. It may be a string of the form
  14906. @var{num}/@var{den} or a frame rate abbreviation.
  14907. @item filter_name
  14908. The name to the frei0r source to load. For more information regarding frei0r and
  14909. how to set the parameters, read the @ref{frei0r} section in the video filters
  14910. documentation.
  14911. @item filter_params
  14912. A '|'-separated list of parameters to pass to the frei0r source.
  14913. @end table
  14914. For example, to generate a frei0r partik0l source with size 200x200
  14915. and frame rate 10 which is overlaid on the overlay filter main input:
  14916. @example
  14917. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  14918. @end example
  14919. @section life
  14920. Generate a life pattern.
  14921. This source is based on a generalization of John Conway's life game.
  14922. The sourced input represents a life grid, each pixel represents a cell
  14923. which can be in one of two possible states, alive or dead. Every cell
  14924. interacts with its eight neighbours, which are the cells that are
  14925. horizontally, vertically, or diagonally adjacent.
  14926. At each interaction the grid evolves according to the adopted rule,
  14927. which specifies the number of neighbor alive cells which will make a
  14928. cell stay alive or born. The @option{rule} option allows one to specify
  14929. the rule to adopt.
  14930. This source accepts the following options:
  14931. @table @option
  14932. @item filename, f
  14933. Set the file from which to read the initial grid state. In the file,
  14934. each non-whitespace character is considered an alive cell, and newline
  14935. is used to delimit the end of each row.
  14936. If this option is not specified, the initial grid is generated
  14937. randomly.
  14938. @item rate, r
  14939. Set the video rate, that is the number of frames generated per second.
  14940. Default is 25.
  14941. @item random_fill_ratio, ratio
  14942. Set the random fill ratio for the initial random grid. It is a
  14943. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  14944. It is ignored when a file is specified.
  14945. @item random_seed, seed
  14946. Set the seed for filling the initial random grid, must be an integer
  14947. included between 0 and UINT32_MAX. If not specified, or if explicitly
  14948. set to -1, the filter will try to use a good random seed on a best
  14949. effort basis.
  14950. @item rule
  14951. Set the life rule.
  14952. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  14953. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  14954. @var{NS} specifies the number of alive neighbor cells which make a
  14955. live cell stay alive, and @var{NB} the number of alive neighbor cells
  14956. which make a dead cell to become alive (i.e. to "born").
  14957. "s" and "b" can be used in place of "S" and "B", respectively.
  14958. Alternatively a rule can be specified by an 18-bits integer. The 9
  14959. high order bits are used to encode the next cell state if it is alive
  14960. for each number of neighbor alive cells, the low order bits specify
  14961. the rule for "borning" new cells. Higher order bits encode for an
  14962. higher number of neighbor cells.
  14963. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  14964. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  14965. Default value is "S23/B3", which is the original Conway's game of life
  14966. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  14967. cells, and will born a new cell if there are three alive cells around
  14968. a dead cell.
  14969. @item size, s
  14970. Set the size of the output video. For the syntax of this option, check the
  14971. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14972. If @option{filename} is specified, the size is set by default to the
  14973. same size of the input file. If @option{size} is set, it must contain
  14974. the size specified in the input file, and the initial grid defined in
  14975. that file is centered in the larger resulting area.
  14976. If a filename is not specified, the size value defaults to "320x240"
  14977. (used for a randomly generated initial grid).
  14978. @item stitch
  14979. If set to 1, stitch the left and right grid edges together, and the
  14980. top and bottom edges also. Defaults to 1.
  14981. @item mold
  14982. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  14983. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  14984. value from 0 to 255.
  14985. @item life_color
  14986. Set the color of living (or new born) cells.
  14987. @item death_color
  14988. Set the color of dead cells. If @option{mold} is set, this is the first color
  14989. used to represent a dead cell.
  14990. @item mold_color
  14991. Set mold color, for definitely dead and moldy cells.
  14992. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  14993. ffmpeg-utils manual,ffmpeg-utils}.
  14994. @end table
  14995. @subsection Examples
  14996. @itemize
  14997. @item
  14998. Read a grid from @file{pattern}, and center it on a grid of size
  14999. 300x300 pixels:
  15000. @example
  15001. life=f=pattern:s=300x300
  15002. @end example
  15003. @item
  15004. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15005. @example
  15006. life=ratio=2/3:s=200x200
  15007. @end example
  15008. @item
  15009. Specify a custom rule for evolving a randomly generated grid:
  15010. @example
  15011. life=rule=S14/B34
  15012. @end example
  15013. @item
  15014. Full example with slow death effect (mold) using @command{ffplay}:
  15015. @example
  15016. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15017. @end example
  15018. @end itemize
  15019. @anchor{allrgb}
  15020. @anchor{allyuv}
  15021. @anchor{color}
  15022. @anchor{haldclutsrc}
  15023. @anchor{nullsrc}
  15024. @anchor{pal75bars}
  15025. @anchor{pal100bars}
  15026. @anchor{rgbtestsrc}
  15027. @anchor{smptebars}
  15028. @anchor{smptehdbars}
  15029. @anchor{testsrc}
  15030. @anchor{testsrc2}
  15031. @anchor{yuvtestsrc}
  15032. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15033. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15034. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15035. The @code{color} source provides an uniformly colored input.
  15036. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15037. @ref{haldclut} filter.
  15038. The @code{nullsrc} source returns unprocessed video frames. It is
  15039. mainly useful to be employed in analysis / debugging tools, or as the
  15040. source for filters which ignore the input data.
  15041. The @code{pal75bars} source generates a color bars pattern, based on
  15042. EBU PAL recommendations with 75% color levels.
  15043. The @code{pal100bars} source generates a color bars pattern, based on
  15044. EBU PAL recommendations with 100% color levels.
  15045. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15046. detecting RGB vs BGR issues. You should see a red, green and blue
  15047. stripe from top to bottom.
  15048. The @code{smptebars} source generates a color bars pattern, based on
  15049. the SMPTE Engineering Guideline EG 1-1990.
  15050. The @code{smptehdbars} source generates a color bars pattern, based on
  15051. the SMPTE RP 219-2002.
  15052. The @code{testsrc} source generates a test video pattern, showing a
  15053. color pattern, a scrolling gradient and a timestamp. This is mainly
  15054. intended for testing purposes.
  15055. The @code{testsrc2} source is similar to testsrc, but supports more
  15056. pixel formats instead of just @code{rgb24}. This allows using it as an
  15057. input for other tests without requiring a format conversion.
  15058. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15059. see a y, cb and cr stripe from top to bottom.
  15060. The sources accept the following parameters:
  15061. @table @option
  15062. @item level
  15063. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15064. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15065. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15066. coded on a @code{1/(N*N)} scale.
  15067. @item color, c
  15068. Specify the color of the source, only available in the @code{color}
  15069. source. For the syntax of this option, check the
  15070. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15071. @item size, s
  15072. Specify the size of the sourced video. For the syntax of this option, check the
  15073. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15074. The default value is @code{320x240}.
  15075. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15076. @code{haldclutsrc} filters.
  15077. @item rate, r
  15078. Specify the frame rate of the sourced video, as the number of frames
  15079. generated per second. It has to be a string in the format
  15080. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15081. number or a valid video frame rate abbreviation. The default value is
  15082. "25".
  15083. @item duration, d
  15084. Set the duration of the sourced video. See
  15085. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15086. for the accepted syntax.
  15087. If not specified, or the expressed duration is negative, the video is
  15088. supposed to be generated forever.
  15089. @item sar
  15090. Set the sample aspect ratio of the sourced video.
  15091. @item alpha
  15092. Specify the alpha (opacity) of the background, only available in the
  15093. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15094. 255 (fully opaque, the default).
  15095. @item decimals, n
  15096. Set the number of decimals to show in the timestamp, only available in the
  15097. @code{testsrc} source.
  15098. The displayed timestamp value will correspond to the original
  15099. timestamp value multiplied by the power of 10 of the specified
  15100. value. Default value is 0.
  15101. @end table
  15102. @subsection Examples
  15103. @itemize
  15104. @item
  15105. Generate a video with a duration of 5.3 seconds, with size
  15106. 176x144 and a frame rate of 10 frames per second:
  15107. @example
  15108. testsrc=duration=5.3:size=qcif:rate=10
  15109. @end example
  15110. @item
  15111. The following graph description will generate a red source
  15112. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15113. frames per second:
  15114. @example
  15115. color=c=red@@0.2:s=qcif:r=10
  15116. @end example
  15117. @item
  15118. If the input content is to be ignored, @code{nullsrc} can be used. The
  15119. following command generates noise in the luminance plane by employing
  15120. the @code{geq} filter:
  15121. @example
  15122. nullsrc=s=256x256, geq=random(1)*255:128:128
  15123. @end example
  15124. @end itemize
  15125. @subsection Commands
  15126. The @code{color} source supports the following commands:
  15127. @table @option
  15128. @item c, color
  15129. Set the color of the created image. Accepts the same syntax of the
  15130. corresponding @option{color} option.
  15131. @end table
  15132. @section openclsrc
  15133. Generate video using an OpenCL program.
  15134. @table @option
  15135. @item source
  15136. OpenCL program source file.
  15137. @item kernel
  15138. Kernel name in program.
  15139. @item size, s
  15140. Size of frames to generate. This must be set.
  15141. @item format
  15142. Pixel format to use for the generated frames. This must be set.
  15143. @item rate, r
  15144. Number of frames generated every second. Default value is '25'.
  15145. @end table
  15146. For details of how the program loading works, see the @ref{program_opencl}
  15147. filter.
  15148. Example programs:
  15149. @itemize
  15150. @item
  15151. Generate a colour ramp by setting pixel values from the position of the pixel
  15152. in the output image. (Note that this will work with all pixel formats, but
  15153. the generated output will not be the same.)
  15154. @verbatim
  15155. __kernel void ramp(__write_only image2d_t dst,
  15156. unsigned int index)
  15157. {
  15158. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15159. float4 val;
  15160. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15161. write_imagef(dst, loc, val);
  15162. }
  15163. @end verbatim
  15164. @item
  15165. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15166. @verbatim
  15167. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15168. unsigned int index)
  15169. {
  15170. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15171. float4 value = 0.0f;
  15172. int x = loc.x + index;
  15173. int y = loc.y + index;
  15174. while (x > 0 || y > 0) {
  15175. if (x % 3 == 1 && y % 3 == 1) {
  15176. value = 1.0f;
  15177. break;
  15178. }
  15179. x /= 3;
  15180. y /= 3;
  15181. }
  15182. write_imagef(dst, loc, value);
  15183. }
  15184. @end verbatim
  15185. @end itemize
  15186. @c man end VIDEO SOURCES
  15187. @chapter Video Sinks
  15188. @c man begin VIDEO SINKS
  15189. Below is a description of the currently available video sinks.
  15190. @section buffersink
  15191. Buffer video frames, and make them available to the end of the filter
  15192. graph.
  15193. This sink is mainly intended for programmatic use, in particular
  15194. through the interface defined in @file{libavfilter/buffersink.h}
  15195. or the options system.
  15196. It accepts a pointer to an AVBufferSinkContext structure, which
  15197. defines the incoming buffers' formats, to be passed as the opaque
  15198. parameter to @code{avfilter_init_filter} for initialization.
  15199. @section nullsink
  15200. Null video sink: do absolutely nothing with the input video. It is
  15201. mainly useful as a template and for use in analysis / debugging
  15202. tools.
  15203. @c man end VIDEO SINKS
  15204. @chapter Multimedia Filters
  15205. @c man begin MULTIMEDIA FILTERS
  15206. Below is a description of the currently available multimedia filters.
  15207. @section abitscope
  15208. Convert input audio to a video output, displaying the audio bit scope.
  15209. The filter accepts the following options:
  15210. @table @option
  15211. @item rate, r
  15212. Set frame rate, expressed as number of frames per second. Default
  15213. value is "25".
  15214. @item size, s
  15215. Specify the video size for the output. For the syntax of this option, check the
  15216. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15217. Default value is @code{1024x256}.
  15218. @item colors
  15219. Specify list of colors separated by space or by '|' which will be used to
  15220. draw channels. Unrecognized or missing colors will be replaced
  15221. by white color.
  15222. @end table
  15223. @section ahistogram
  15224. Convert input audio to a video output, displaying the volume histogram.
  15225. The filter accepts the following options:
  15226. @table @option
  15227. @item dmode
  15228. Specify how histogram is calculated.
  15229. It accepts the following values:
  15230. @table @samp
  15231. @item single
  15232. Use single histogram for all channels.
  15233. @item separate
  15234. Use separate histogram for each channel.
  15235. @end table
  15236. Default is @code{single}.
  15237. @item rate, r
  15238. Set frame rate, expressed as number of frames per second. Default
  15239. value is "25".
  15240. @item size, s
  15241. Specify the video size for the output. For the syntax of this option, check the
  15242. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15243. Default value is @code{hd720}.
  15244. @item scale
  15245. Set display scale.
  15246. It accepts the following values:
  15247. @table @samp
  15248. @item log
  15249. logarithmic
  15250. @item sqrt
  15251. square root
  15252. @item cbrt
  15253. cubic root
  15254. @item lin
  15255. linear
  15256. @item rlog
  15257. reverse logarithmic
  15258. @end table
  15259. Default is @code{log}.
  15260. @item ascale
  15261. Set amplitude scale.
  15262. It accepts the following values:
  15263. @table @samp
  15264. @item log
  15265. logarithmic
  15266. @item lin
  15267. linear
  15268. @end table
  15269. Default is @code{log}.
  15270. @item acount
  15271. Set how much frames to accumulate in histogram.
  15272. Defauls is 1. Setting this to -1 accumulates all frames.
  15273. @item rheight
  15274. Set histogram ratio of window height.
  15275. @item slide
  15276. Set sonogram sliding.
  15277. It accepts the following values:
  15278. @table @samp
  15279. @item replace
  15280. replace old rows with new ones.
  15281. @item scroll
  15282. scroll from top to bottom.
  15283. @end table
  15284. Default is @code{replace}.
  15285. @end table
  15286. @section aphasemeter
  15287. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  15288. representing mean phase of current audio frame. A video output can also be produced and is
  15289. enabled by default. The audio is passed through as first output.
  15290. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  15291. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  15292. and @code{1} means channels are in phase.
  15293. The filter accepts the following options, all related to its video output:
  15294. @table @option
  15295. @item rate, r
  15296. Set the output frame rate. Default value is @code{25}.
  15297. @item size, s
  15298. Set the video size for the output. For the syntax of this option, check the
  15299. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15300. Default value is @code{800x400}.
  15301. @item rc
  15302. @item gc
  15303. @item bc
  15304. Specify the red, green, blue contrast. Default values are @code{2},
  15305. @code{7} and @code{1}.
  15306. Allowed range is @code{[0, 255]}.
  15307. @item mpc
  15308. Set color which will be used for drawing median phase. If color is
  15309. @code{none} which is default, no median phase value will be drawn.
  15310. @item video
  15311. Enable video output. Default is enabled.
  15312. @end table
  15313. @section avectorscope
  15314. Convert input audio to a video output, representing the audio vector
  15315. scope.
  15316. The filter is used to measure the difference between channels of stereo
  15317. audio stream. A monoaural signal, consisting of identical left and right
  15318. signal, results in straight vertical line. Any stereo separation is visible
  15319. as a deviation from this line, creating a Lissajous figure.
  15320. If the straight (or deviation from it) but horizontal line appears this
  15321. indicates that the left and right channels are out of phase.
  15322. The filter accepts the following options:
  15323. @table @option
  15324. @item mode, m
  15325. Set the vectorscope mode.
  15326. Available values are:
  15327. @table @samp
  15328. @item lissajous
  15329. Lissajous rotated by 45 degrees.
  15330. @item lissajous_xy
  15331. Same as above but not rotated.
  15332. @item polar
  15333. Shape resembling half of circle.
  15334. @end table
  15335. Default value is @samp{lissajous}.
  15336. @item size, s
  15337. Set the video size for the output. For the syntax of this option, check the
  15338. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15339. Default value is @code{400x400}.
  15340. @item rate, r
  15341. Set the output frame rate. Default value is @code{25}.
  15342. @item rc
  15343. @item gc
  15344. @item bc
  15345. @item ac
  15346. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  15347. @code{160}, @code{80} and @code{255}.
  15348. Allowed range is @code{[0, 255]}.
  15349. @item rf
  15350. @item gf
  15351. @item bf
  15352. @item af
  15353. Specify the red, green, blue and alpha fade. Default values are @code{15},
  15354. @code{10}, @code{5} and @code{5}.
  15355. Allowed range is @code{[0, 255]}.
  15356. @item zoom
  15357. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  15358. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  15359. @item draw
  15360. Set the vectorscope drawing mode.
  15361. Available values are:
  15362. @table @samp
  15363. @item dot
  15364. Draw dot for each sample.
  15365. @item line
  15366. Draw line between previous and current sample.
  15367. @end table
  15368. Default value is @samp{dot}.
  15369. @item scale
  15370. Specify amplitude scale of audio samples.
  15371. Available values are:
  15372. @table @samp
  15373. @item lin
  15374. Linear.
  15375. @item sqrt
  15376. Square root.
  15377. @item cbrt
  15378. Cubic root.
  15379. @item log
  15380. Logarithmic.
  15381. @end table
  15382. @item swap
  15383. Swap left channel axis with right channel axis.
  15384. @item mirror
  15385. Mirror axis.
  15386. @table @samp
  15387. @item none
  15388. No mirror.
  15389. @item x
  15390. Mirror only x axis.
  15391. @item y
  15392. Mirror only y axis.
  15393. @item xy
  15394. Mirror both axis.
  15395. @end table
  15396. @end table
  15397. @subsection Examples
  15398. @itemize
  15399. @item
  15400. Complete example using @command{ffplay}:
  15401. @example
  15402. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15403. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  15404. @end example
  15405. @end itemize
  15406. @section bench, abench
  15407. Benchmark part of a filtergraph.
  15408. The filter accepts the following options:
  15409. @table @option
  15410. @item action
  15411. Start or stop a timer.
  15412. Available values are:
  15413. @table @samp
  15414. @item start
  15415. Get the current time, set it as frame metadata (using the key
  15416. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  15417. @item stop
  15418. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  15419. the input frame metadata to get the time difference. Time difference, average,
  15420. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  15421. @code{min}) are then printed. The timestamps are expressed in seconds.
  15422. @end table
  15423. @end table
  15424. @subsection Examples
  15425. @itemize
  15426. @item
  15427. Benchmark @ref{selectivecolor} filter:
  15428. @example
  15429. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  15430. @end example
  15431. @end itemize
  15432. @section concat
  15433. Concatenate audio and video streams, joining them together one after the
  15434. other.
  15435. The filter works on segments of synchronized video and audio streams. All
  15436. segments must have the same number of streams of each type, and that will
  15437. also be the number of streams at output.
  15438. The filter accepts the following options:
  15439. @table @option
  15440. @item n
  15441. Set the number of segments. Default is 2.
  15442. @item v
  15443. Set the number of output video streams, that is also the number of video
  15444. streams in each segment. Default is 1.
  15445. @item a
  15446. Set the number of output audio streams, that is also the number of audio
  15447. streams in each segment. Default is 0.
  15448. @item unsafe
  15449. Activate unsafe mode: do not fail if segments have a different format.
  15450. @end table
  15451. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  15452. @var{a} audio outputs.
  15453. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  15454. segment, in the same order as the outputs, then the inputs for the second
  15455. segment, etc.
  15456. Related streams do not always have exactly the same duration, for various
  15457. reasons including codec frame size or sloppy authoring. For that reason,
  15458. related synchronized streams (e.g. a video and its audio track) should be
  15459. concatenated at once. The concat filter will use the duration of the longest
  15460. stream in each segment (except the last one), and if necessary pad shorter
  15461. audio streams with silence.
  15462. For this filter to work correctly, all segments must start at timestamp 0.
  15463. All corresponding streams must have the same parameters in all segments; the
  15464. filtering system will automatically select a common pixel format for video
  15465. streams, and a common sample format, sample rate and channel layout for
  15466. audio streams, but other settings, such as resolution, must be converted
  15467. explicitly by the user.
  15468. Different frame rates are acceptable but will result in variable frame rate
  15469. at output; be sure to configure the output file to handle it.
  15470. @subsection Examples
  15471. @itemize
  15472. @item
  15473. Concatenate an opening, an episode and an ending, all in bilingual version
  15474. (video in stream 0, audio in streams 1 and 2):
  15475. @example
  15476. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  15477. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  15478. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  15479. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  15480. @end example
  15481. @item
  15482. Concatenate two parts, handling audio and video separately, using the
  15483. (a)movie sources, and adjusting the resolution:
  15484. @example
  15485. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  15486. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  15487. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  15488. @end example
  15489. Note that a desync will happen at the stitch if the audio and video streams
  15490. do not have exactly the same duration in the first file.
  15491. @end itemize
  15492. @subsection Commands
  15493. This filter supports the following commands:
  15494. @table @option
  15495. @item next
  15496. Close the current segment and step to the next one
  15497. @end table
  15498. @section drawgraph, adrawgraph
  15499. Draw a graph using input video or audio metadata.
  15500. It accepts the following parameters:
  15501. @table @option
  15502. @item m1
  15503. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  15504. @item fg1
  15505. Set 1st foreground color expression.
  15506. @item m2
  15507. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  15508. @item fg2
  15509. Set 2nd foreground color expression.
  15510. @item m3
  15511. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  15512. @item fg3
  15513. Set 3rd foreground color expression.
  15514. @item m4
  15515. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  15516. @item fg4
  15517. Set 4th foreground color expression.
  15518. @item min
  15519. Set minimal value of metadata value.
  15520. @item max
  15521. Set maximal value of metadata value.
  15522. @item bg
  15523. Set graph background color. Default is white.
  15524. @item mode
  15525. Set graph mode.
  15526. Available values for mode is:
  15527. @table @samp
  15528. @item bar
  15529. @item dot
  15530. @item line
  15531. @end table
  15532. Default is @code{line}.
  15533. @item slide
  15534. Set slide mode.
  15535. Available values for slide is:
  15536. @table @samp
  15537. @item frame
  15538. Draw new frame when right border is reached.
  15539. @item replace
  15540. Replace old columns with new ones.
  15541. @item scroll
  15542. Scroll from right to left.
  15543. @item rscroll
  15544. Scroll from left to right.
  15545. @item picture
  15546. Draw single picture.
  15547. @end table
  15548. Default is @code{frame}.
  15549. @item size
  15550. Set size of graph video. For the syntax of this option, check the
  15551. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15552. The default value is @code{900x256}.
  15553. The foreground color expressions can use the following variables:
  15554. @table @option
  15555. @item MIN
  15556. Minimal value of metadata value.
  15557. @item MAX
  15558. Maximal value of metadata value.
  15559. @item VAL
  15560. Current metadata key value.
  15561. @end table
  15562. The color is defined as 0xAABBGGRR.
  15563. @end table
  15564. Example using metadata from @ref{signalstats} filter:
  15565. @example
  15566. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  15567. @end example
  15568. Example using metadata from @ref{ebur128} filter:
  15569. @example
  15570. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  15571. @end example
  15572. @anchor{ebur128}
  15573. @section ebur128
  15574. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  15575. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  15576. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  15577. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  15578. The filter also has a video output (see the @var{video} option) with a real
  15579. time graph to observe the loudness evolution. The graphic contains the logged
  15580. message mentioned above, so it is not printed anymore when this option is set,
  15581. unless the verbose logging is set. The main graphing area contains the
  15582. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  15583. the momentary loudness (400 milliseconds), but can optionally be configured
  15584. to instead display short-term loudness (see @var{gauge}).
  15585. The green area marks a +/- 1LU target range around the target loudness
  15586. (-23LUFS by default, unless modified through @var{target}).
  15587. More information about the Loudness Recommendation EBU R128 on
  15588. @url{http://tech.ebu.ch/loudness}.
  15589. The filter accepts the following options:
  15590. @table @option
  15591. @item video
  15592. Activate the video output. The audio stream is passed unchanged whether this
  15593. option is set or no. The video stream will be the first output stream if
  15594. activated. Default is @code{0}.
  15595. @item size
  15596. Set the video size. This option is for video only. For the syntax of this
  15597. option, check the
  15598. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15599. Default and minimum resolution is @code{640x480}.
  15600. @item meter
  15601. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  15602. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  15603. other integer value between this range is allowed.
  15604. @item metadata
  15605. Set metadata injection. If set to @code{1}, the audio input will be segmented
  15606. into 100ms output frames, each of them containing various loudness information
  15607. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  15608. Default is @code{0}.
  15609. @item framelog
  15610. Force the frame logging level.
  15611. Available values are:
  15612. @table @samp
  15613. @item info
  15614. information logging level
  15615. @item verbose
  15616. verbose logging level
  15617. @end table
  15618. By default, the logging level is set to @var{info}. If the @option{video} or
  15619. the @option{metadata} options are set, it switches to @var{verbose}.
  15620. @item peak
  15621. Set peak mode(s).
  15622. Available modes can be cumulated (the option is a @code{flag} type). Possible
  15623. values are:
  15624. @table @samp
  15625. @item none
  15626. Disable any peak mode (default).
  15627. @item sample
  15628. Enable sample-peak mode.
  15629. Simple peak mode looking for the higher sample value. It logs a message
  15630. for sample-peak (identified by @code{SPK}).
  15631. @item true
  15632. Enable true-peak mode.
  15633. If enabled, the peak lookup is done on an over-sampled version of the input
  15634. stream for better peak accuracy. It logs a message for true-peak.
  15635. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  15636. This mode requires a build with @code{libswresample}.
  15637. @end table
  15638. @item dualmono
  15639. Treat mono input files as "dual mono". If a mono file is intended for playback
  15640. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  15641. If set to @code{true}, this option will compensate for this effect.
  15642. Multi-channel input files are not affected by this option.
  15643. @item panlaw
  15644. Set a specific pan law to be used for the measurement of dual mono files.
  15645. This parameter is optional, and has a default value of -3.01dB.
  15646. @item target
  15647. Set a specific target level (in LUFS) used as relative zero in the visualization.
  15648. This parameter is optional and has a default value of -23LUFS as specified
  15649. by EBU R128. However, material published online may prefer a level of -16LUFS
  15650. (e.g. for use with podcasts or video platforms).
  15651. @item gauge
  15652. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  15653. @code{shortterm}. By default the momentary value will be used, but in certain
  15654. scenarios it may be more useful to observe the short term value instead (e.g.
  15655. live mixing).
  15656. @item scale
  15657. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  15658. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  15659. video output, not the summary or continuous log output.
  15660. @end table
  15661. @subsection Examples
  15662. @itemize
  15663. @item
  15664. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  15665. @example
  15666. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  15667. @end example
  15668. @item
  15669. Run an analysis with @command{ffmpeg}:
  15670. @example
  15671. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  15672. @end example
  15673. @end itemize
  15674. @section interleave, ainterleave
  15675. Temporally interleave frames from several inputs.
  15676. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  15677. These filters read frames from several inputs and send the oldest
  15678. queued frame to the output.
  15679. Input streams must have well defined, monotonically increasing frame
  15680. timestamp values.
  15681. In order to submit one frame to output, these filters need to enqueue
  15682. at least one frame for each input, so they cannot work in case one
  15683. input is not yet terminated and will not receive incoming frames.
  15684. For example consider the case when one input is a @code{select} filter
  15685. which always drops input frames. The @code{interleave} filter will keep
  15686. reading from that input, but it will never be able to send new frames
  15687. to output until the input sends an end-of-stream signal.
  15688. Also, depending on inputs synchronization, the filters will drop
  15689. frames in case one input receives more frames than the other ones, and
  15690. the queue is already filled.
  15691. These filters accept the following options:
  15692. @table @option
  15693. @item nb_inputs, n
  15694. Set the number of different inputs, it is 2 by default.
  15695. @end table
  15696. @subsection Examples
  15697. @itemize
  15698. @item
  15699. Interleave frames belonging to different streams using @command{ffmpeg}:
  15700. @example
  15701. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  15702. @end example
  15703. @item
  15704. Add flickering blur effect:
  15705. @example
  15706. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  15707. @end example
  15708. @end itemize
  15709. @section metadata, ametadata
  15710. Manipulate frame metadata.
  15711. This filter accepts the following options:
  15712. @table @option
  15713. @item mode
  15714. Set mode of operation of the filter.
  15715. Can be one of the following:
  15716. @table @samp
  15717. @item select
  15718. If both @code{value} and @code{key} is set, select frames
  15719. which have such metadata. If only @code{key} is set, select
  15720. every frame that has such key in metadata.
  15721. @item add
  15722. Add new metadata @code{key} and @code{value}. If key is already available
  15723. do nothing.
  15724. @item modify
  15725. Modify value of already present key.
  15726. @item delete
  15727. If @code{value} is set, delete only keys that have such value.
  15728. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  15729. the frame.
  15730. @item print
  15731. Print key and its value if metadata was found. If @code{key} is not set print all
  15732. metadata values available in frame.
  15733. @end table
  15734. @item key
  15735. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  15736. @item value
  15737. Set metadata value which will be used. This option is mandatory for
  15738. @code{modify} and @code{add} mode.
  15739. @item function
  15740. Which function to use when comparing metadata value and @code{value}.
  15741. Can be one of following:
  15742. @table @samp
  15743. @item same_str
  15744. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  15745. @item starts_with
  15746. Values are interpreted as strings, returns true if metadata value starts with
  15747. the @code{value} option string.
  15748. @item less
  15749. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  15750. @item equal
  15751. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  15752. @item greater
  15753. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  15754. @item expr
  15755. Values are interpreted as floats, returns true if expression from option @code{expr}
  15756. evaluates to true.
  15757. @end table
  15758. @item expr
  15759. Set expression which is used when @code{function} is set to @code{expr}.
  15760. The expression is evaluated through the eval API and can contain the following
  15761. constants:
  15762. @table @option
  15763. @item VALUE1
  15764. Float representation of @code{value} from metadata key.
  15765. @item VALUE2
  15766. Float representation of @code{value} as supplied by user in @code{value} option.
  15767. @end table
  15768. @item file
  15769. If specified in @code{print} mode, output is written to the named file. Instead of
  15770. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  15771. for standard output. If @code{file} option is not set, output is written to the log
  15772. with AV_LOG_INFO loglevel.
  15773. @end table
  15774. @subsection Examples
  15775. @itemize
  15776. @item
  15777. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  15778. between 0 and 1.
  15779. @example
  15780. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  15781. @end example
  15782. @item
  15783. Print silencedetect output to file @file{metadata.txt}.
  15784. @example
  15785. silencedetect,ametadata=mode=print:file=metadata.txt
  15786. @end example
  15787. @item
  15788. Direct all metadata to a pipe with file descriptor 4.
  15789. @example
  15790. metadata=mode=print:file='pipe\:4'
  15791. @end example
  15792. @end itemize
  15793. @section perms, aperms
  15794. Set read/write permissions for the output frames.
  15795. These filters are mainly aimed at developers to test direct path in the
  15796. following filter in the filtergraph.
  15797. The filters accept the following options:
  15798. @table @option
  15799. @item mode
  15800. Select the permissions mode.
  15801. It accepts the following values:
  15802. @table @samp
  15803. @item none
  15804. Do nothing. This is the default.
  15805. @item ro
  15806. Set all the output frames read-only.
  15807. @item rw
  15808. Set all the output frames directly writable.
  15809. @item toggle
  15810. Make the frame read-only if writable, and writable if read-only.
  15811. @item random
  15812. Set each output frame read-only or writable randomly.
  15813. @end table
  15814. @item seed
  15815. Set the seed for the @var{random} mode, must be an integer included between
  15816. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  15817. @code{-1}, the filter will try to use a good random seed on a best effort
  15818. basis.
  15819. @end table
  15820. Note: in case of auto-inserted filter between the permission filter and the
  15821. following one, the permission might not be received as expected in that
  15822. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  15823. perms/aperms filter can avoid this problem.
  15824. @section realtime, arealtime
  15825. Slow down filtering to match real time approximately.
  15826. These filters will pause the filtering for a variable amount of time to
  15827. match the output rate with the input timestamps.
  15828. They are similar to the @option{re} option to @code{ffmpeg}.
  15829. They accept the following options:
  15830. @table @option
  15831. @item limit
  15832. Time limit for the pauses. Any pause longer than that will be considered
  15833. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  15834. @end table
  15835. @anchor{select}
  15836. @section select, aselect
  15837. Select frames to pass in output.
  15838. This filter accepts the following options:
  15839. @table @option
  15840. @item expr, e
  15841. Set expression, which is evaluated for each input frame.
  15842. If the expression is evaluated to zero, the frame is discarded.
  15843. If the evaluation result is negative or NaN, the frame is sent to the
  15844. first output; otherwise it is sent to the output with index
  15845. @code{ceil(val)-1}, assuming that the input index starts from 0.
  15846. For example a value of @code{1.2} corresponds to the output with index
  15847. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  15848. @item outputs, n
  15849. Set the number of outputs. The output to which to send the selected
  15850. frame is based on the result of the evaluation. Default value is 1.
  15851. @end table
  15852. The expression can contain the following constants:
  15853. @table @option
  15854. @item n
  15855. The (sequential) number of the filtered frame, starting from 0.
  15856. @item selected_n
  15857. The (sequential) number of the selected frame, starting from 0.
  15858. @item prev_selected_n
  15859. The sequential number of the last selected frame. It's NAN if undefined.
  15860. @item TB
  15861. The timebase of the input timestamps.
  15862. @item pts
  15863. The PTS (Presentation TimeStamp) of the filtered video frame,
  15864. expressed in @var{TB} units. It's NAN if undefined.
  15865. @item t
  15866. The PTS of the filtered video frame,
  15867. expressed in seconds. It's NAN if undefined.
  15868. @item prev_pts
  15869. The PTS of the previously filtered video frame. It's NAN if undefined.
  15870. @item prev_selected_pts
  15871. The PTS of the last previously filtered video frame. It's NAN if undefined.
  15872. @item prev_selected_t
  15873. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  15874. @item start_pts
  15875. The PTS of the first video frame in the video. It's NAN if undefined.
  15876. @item start_t
  15877. The time of the first video frame in the video. It's NAN if undefined.
  15878. @item pict_type @emph{(video only)}
  15879. The type of the filtered frame. It can assume one of the following
  15880. values:
  15881. @table @option
  15882. @item I
  15883. @item P
  15884. @item B
  15885. @item S
  15886. @item SI
  15887. @item SP
  15888. @item BI
  15889. @end table
  15890. @item interlace_type @emph{(video only)}
  15891. The frame interlace type. It can assume one of the following values:
  15892. @table @option
  15893. @item PROGRESSIVE
  15894. The frame is progressive (not interlaced).
  15895. @item TOPFIRST
  15896. The frame is top-field-first.
  15897. @item BOTTOMFIRST
  15898. The frame is bottom-field-first.
  15899. @end table
  15900. @item consumed_sample_n @emph{(audio only)}
  15901. the number of selected samples before the current frame
  15902. @item samples_n @emph{(audio only)}
  15903. the number of samples in the current frame
  15904. @item sample_rate @emph{(audio only)}
  15905. the input sample rate
  15906. @item key
  15907. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  15908. @item pos
  15909. the position in the file of the filtered frame, -1 if the information
  15910. is not available (e.g. for synthetic video)
  15911. @item scene @emph{(video only)}
  15912. value between 0 and 1 to indicate a new scene; a low value reflects a low
  15913. probability for the current frame to introduce a new scene, while a higher
  15914. value means the current frame is more likely to be one (see the example below)
  15915. @item concatdec_select
  15916. The concat demuxer can select only part of a concat input file by setting an
  15917. inpoint and an outpoint, but the output packets may not be entirely contained
  15918. in the selected interval. By using this variable, it is possible to skip frames
  15919. generated by the concat demuxer which are not exactly contained in the selected
  15920. interval.
  15921. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  15922. and the @var{lavf.concat.duration} packet metadata values which are also
  15923. present in the decoded frames.
  15924. The @var{concatdec_select} variable is -1 if the frame pts is at least
  15925. start_time and either the duration metadata is missing or the frame pts is less
  15926. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  15927. missing.
  15928. That basically means that an input frame is selected if its pts is within the
  15929. interval set by the concat demuxer.
  15930. @end table
  15931. The default value of the select expression is "1".
  15932. @subsection Examples
  15933. @itemize
  15934. @item
  15935. Select all frames in input:
  15936. @example
  15937. select
  15938. @end example
  15939. The example above is the same as:
  15940. @example
  15941. select=1
  15942. @end example
  15943. @item
  15944. Skip all frames:
  15945. @example
  15946. select=0
  15947. @end example
  15948. @item
  15949. Select only I-frames:
  15950. @example
  15951. select='eq(pict_type\,I)'
  15952. @end example
  15953. @item
  15954. Select one frame every 100:
  15955. @example
  15956. select='not(mod(n\,100))'
  15957. @end example
  15958. @item
  15959. Select only frames contained in the 10-20 time interval:
  15960. @example
  15961. select=between(t\,10\,20)
  15962. @end example
  15963. @item
  15964. Select only I-frames contained in the 10-20 time interval:
  15965. @example
  15966. select=between(t\,10\,20)*eq(pict_type\,I)
  15967. @end example
  15968. @item
  15969. Select frames with a minimum distance of 10 seconds:
  15970. @example
  15971. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  15972. @end example
  15973. @item
  15974. Use aselect to select only audio frames with samples number > 100:
  15975. @example
  15976. aselect='gt(samples_n\,100)'
  15977. @end example
  15978. @item
  15979. Create a mosaic of the first scenes:
  15980. @example
  15981. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  15982. @end example
  15983. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  15984. choice.
  15985. @item
  15986. Send even and odd frames to separate outputs, and compose them:
  15987. @example
  15988. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  15989. @end example
  15990. @item
  15991. Select useful frames from an ffconcat file which is using inpoints and
  15992. outpoints but where the source files are not intra frame only.
  15993. @example
  15994. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  15995. @end example
  15996. @end itemize
  15997. @section sendcmd, asendcmd
  15998. Send commands to filters in the filtergraph.
  15999. These filters read commands to be sent to other filters in the
  16000. filtergraph.
  16001. @code{sendcmd} must be inserted between two video filters,
  16002. @code{asendcmd} must be inserted between two audio filters, but apart
  16003. from that they act the same way.
  16004. The specification of commands can be provided in the filter arguments
  16005. with the @var{commands} option, or in a file specified by the
  16006. @var{filename} option.
  16007. These filters accept the following options:
  16008. @table @option
  16009. @item commands, c
  16010. Set the commands to be read and sent to the other filters.
  16011. @item filename, f
  16012. Set the filename of the commands to be read and sent to the other
  16013. filters.
  16014. @end table
  16015. @subsection Commands syntax
  16016. A commands description consists of a sequence of interval
  16017. specifications, comprising a list of commands to be executed when a
  16018. particular event related to that interval occurs. The occurring event
  16019. is typically the current frame time entering or leaving a given time
  16020. interval.
  16021. An interval is specified by the following syntax:
  16022. @example
  16023. @var{START}[-@var{END}] @var{COMMANDS};
  16024. @end example
  16025. The time interval is specified by the @var{START} and @var{END} times.
  16026. @var{END} is optional and defaults to the maximum time.
  16027. The current frame time is considered within the specified interval if
  16028. it is included in the interval [@var{START}, @var{END}), that is when
  16029. the time is greater or equal to @var{START} and is lesser than
  16030. @var{END}.
  16031. @var{COMMANDS} consists of a sequence of one or more command
  16032. specifications, separated by ",", relating to that interval. The
  16033. syntax of a command specification is given by:
  16034. @example
  16035. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16036. @end example
  16037. @var{FLAGS} is optional and specifies the type of events relating to
  16038. the time interval which enable sending the specified command, and must
  16039. be a non-null sequence of identifier flags separated by "+" or "|" and
  16040. enclosed between "[" and "]".
  16041. The following flags are recognized:
  16042. @table @option
  16043. @item enter
  16044. The command is sent when the current frame timestamp enters the
  16045. specified interval. In other words, the command is sent when the
  16046. previous frame timestamp was not in the given interval, and the
  16047. current is.
  16048. @item leave
  16049. The command is sent when the current frame timestamp leaves the
  16050. specified interval. In other words, the command is sent when the
  16051. previous frame timestamp was in the given interval, and the
  16052. current is not.
  16053. @end table
  16054. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16055. assumed.
  16056. @var{TARGET} specifies the target of the command, usually the name of
  16057. the filter class or a specific filter instance name.
  16058. @var{COMMAND} specifies the name of the command for the target filter.
  16059. @var{ARG} is optional and specifies the optional list of argument for
  16060. the given @var{COMMAND}.
  16061. Between one interval specification and another, whitespaces, or
  16062. sequences of characters starting with @code{#} until the end of line,
  16063. are ignored and can be used to annotate comments.
  16064. A simplified BNF description of the commands specification syntax
  16065. follows:
  16066. @example
  16067. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16068. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16069. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16070. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16071. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16072. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16073. @end example
  16074. @subsection Examples
  16075. @itemize
  16076. @item
  16077. Specify audio tempo change at second 4:
  16078. @example
  16079. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16080. @end example
  16081. @item
  16082. Target a specific filter instance:
  16083. @example
  16084. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  16085. @end example
  16086. @item
  16087. Specify a list of drawtext and hue commands in a file.
  16088. @example
  16089. # show text in the interval 5-10
  16090. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  16091. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  16092. # desaturate the image in the interval 15-20
  16093. 15.0-20.0 [enter] hue s 0,
  16094. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16095. [leave] hue s 1,
  16096. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16097. # apply an exponential saturation fade-out effect, starting from time 25
  16098. 25 [enter] hue s exp(25-t)
  16099. @end example
  16100. A filtergraph allowing to read and process the above command list
  16101. stored in a file @file{test.cmd}, can be specified with:
  16102. @example
  16103. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16104. @end example
  16105. @end itemize
  16106. @anchor{setpts}
  16107. @section setpts, asetpts
  16108. Change the PTS (presentation timestamp) of the input frames.
  16109. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16110. This filter accepts the following options:
  16111. @table @option
  16112. @item expr
  16113. The expression which is evaluated for each frame to construct its timestamp.
  16114. @end table
  16115. The expression is evaluated through the eval API and can contain the following
  16116. constants:
  16117. @table @option
  16118. @item FRAME_RATE, FR
  16119. frame rate, only defined for constant frame-rate video
  16120. @item PTS
  16121. The presentation timestamp in input
  16122. @item N
  16123. The count of the input frame for video or the number of consumed samples,
  16124. not including the current frame for audio, starting from 0.
  16125. @item NB_CONSUMED_SAMPLES
  16126. The number of consumed samples, not including the current frame (only
  16127. audio)
  16128. @item NB_SAMPLES, S
  16129. The number of samples in the current frame (only audio)
  16130. @item SAMPLE_RATE, SR
  16131. The audio sample rate.
  16132. @item STARTPTS
  16133. The PTS of the first frame.
  16134. @item STARTT
  16135. the time in seconds of the first frame
  16136. @item INTERLACED
  16137. State whether the current frame is interlaced.
  16138. @item T
  16139. the time in seconds of the current frame
  16140. @item POS
  16141. original position in the file of the frame, or undefined if undefined
  16142. for the current frame
  16143. @item PREV_INPTS
  16144. The previous input PTS.
  16145. @item PREV_INT
  16146. previous input time in seconds
  16147. @item PREV_OUTPTS
  16148. The previous output PTS.
  16149. @item PREV_OUTT
  16150. previous output time in seconds
  16151. @item RTCTIME
  16152. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16153. instead.
  16154. @item RTCSTART
  16155. The wallclock (RTC) time at the start of the movie in microseconds.
  16156. @item TB
  16157. The timebase of the input timestamps.
  16158. @end table
  16159. @subsection Examples
  16160. @itemize
  16161. @item
  16162. Start counting PTS from zero
  16163. @example
  16164. setpts=PTS-STARTPTS
  16165. @end example
  16166. @item
  16167. Apply fast motion effect:
  16168. @example
  16169. setpts=0.5*PTS
  16170. @end example
  16171. @item
  16172. Apply slow motion effect:
  16173. @example
  16174. setpts=2.0*PTS
  16175. @end example
  16176. @item
  16177. Set fixed rate of 25 frames per second:
  16178. @example
  16179. setpts=N/(25*TB)
  16180. @end example
  16181. @item
  16182. Set fixed rate 25 fps with some jitter:
  16183. @example
  16184. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16185. @end example
  16186. @item
  16187. Apply an offset of 10 seconds to the input PTS:
  16188. @example
  16189. setpts=PTS+10/TB
  16190. @end example
  16191. @item
  16192. Generate timestamps from a "live source" and rebase onto the current timebase:
  16193. @example
  16194. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16195. @end example
  16196. @item
  16197. Generate timestamps by counting samples:
  16198. @example
  16199. asetpts=N/SR/TB
  16200. @end example
  16201. @end itemize
  16202. @section setrange
  16203. Force color range for the output video frame.
  16204. The @code{setrange} filter marks the color range property for the
  16205. output frames. It does not change the input frame, but only sets the
  16206. corresponding property, which affects how the frame is treated by
  16207. following filters.
  16208. The filter accepts the following options:
  16209. @table @option
  16210. @item range
  16211. Available values are:
  16212. @table @samp
  16213. @item auto
  16214. Keep the same color range property.
  16215. @item unspecified, unknown
  16216. Set the color range as unspecified.
  16217. @item limited, tv, mpeg
  16218. Set the color range as limited.
  16219. @item full, pc, jpeg
  16220. Set the color range as full.
  16221. @end table
  16222. @end table
  16223. @section settb, asettb
  16224. Set the timebase to use for the output frames timestamps.
  16225. It is mainly useful for testing timebase configuration.
  16226. It accepts the following parameters:
  16227. @table @option
  16228. @item expr, tb
  16229. The expression which is evaluated into the output timebase.
  16230. @end table
  16231. The value for @option{tb} is an arithmetic expression representing a
  16232. rational. The expression can contain the constants "AVTB" (the default
  16233. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16234. audio only). Default value is "intb".
  16235. @subsection Examples
  16236. @itemize
  16237. @item
  16238. Set the timebase to 1/25:
  16239. @example
  16240. settb=expr=1/25
  16241. @end example
  16242. @item
  16243. Set the timebase to 1/10:
  16244. @example
  16245. settb=expr=0.1
  16246. @end example
  16247. @item
  16248. Set the timebase to 1001/1000:
  16249. @example
  16250. settb=1+0.001
  16251. @end example
  16252. @item
  16253. Set the timebase to 2*intb:
  16254. @example
  16255. settb=2*intb
  16256. @end example
  16257. @item
  16258. Set the default timebase value:
  16259. @example
  16260. settb=AVTB
  16261. @end example
  16262. @end itemize
  16263. @section showcqt
  16264. Convert input audio to a video output representing frequency spectrum
  16265. logarithmically using Brown-Puckette constant Q transform algorithm with
  16266. direct frequency domain coefficient calculation (but the transform itself
  16267. is not really constant Q, instead the Q factor is actually variable/clamped),
  16268. with musical tone scale, from E0 to D#10.
  16269. The filter accepts the following options:
  16270. @table @option
  16271. @item size, s
  16272. Specify the video size for the output. It must be even. For the syntax of this option,
  16273. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16274. Default value is @code{1920x1080}.
  16275. @item fps, rate, r
  16276. Set the output frame rate. Default value is @code{25}.
  16277. @item bar_h
  16278. Set the bargraph height. It must be even. Default value is @code{-1} which
  16279. computes the bargraph height automatically.
  16280. @item axis_h
  16281. Set the axis height. It must be even. Default value is @code{-1} which computes
  16282. the axis height automatically.
  16283. @item sono_h
  16284. Set the sonogram height. It must be even. Default value is @code{-1} which
  16285. computes the sonogram height automatically.
  16286. @item fullhd
  16287. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  16288. instead. Default value is @code{1}.
  16289. @item sono_v, volume
  16290. Specify the sonogram volume expression. It can contain variables:
  16291. @table @option
  16292. @item bar_v
  16293. the @var{bar_v} evaluated expression
  16294. @item frequency, freq, f
  16295. the frequency where it is evaluated
  16296. @item timeclamp, tc
  16297. the value of @var{timeclamp} option
  16298. @end table
  16299. and functions:
  16300. @table @option
  16301. @item a_weighting(f)
  16302. A-weighting of equal loudness
  16303. @item b_weighting(f)
  16304. B-weighting of equal loudness
  16305. @item c_weighting(f)
  16306. C-weighting of equal loudness.
  16307. @end table
  16308. Default value is @code{16}.
  16309. @item bar_v, volume2
  16310. Specify the bargraph volume expression. It can contain variables:
  16311. @table @option
  16312. @item sono_v
  16313. the @var{sono_v} evaluated expression
  16314. @item frequency, freq, f
  16315. the frequency where it is evaluated
  16316. @item timeclamp, tc
  16317. the value of @var{timeclamp} option
  16318. @end table
  16319. and functions:
  16320. @table @option
  16321. @item a_weighting(f)
  16322. A-weighting of equal loudness
  16323. @item b_weighting(f)
  16324. B-weighting of equal loudness
  16325. @item c_weighting(f)
  16326. C-weighting of equal loudness.
  16327. @end table
  16328. Default value is @code{sono_v}.
  16329. @item sono_g, gamma
  16330. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  16331. higher gamma makes the spectrum having more range. Default value is @code{3}.
  16332. Acceptable range is @code{[1, 7]}.
  16333. @item bar_g, gamma2
  16334. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  16335. @code{[1, 7]}.
  16336. @item bar_t
  16337. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  16338. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  16339. @item timeclamp, tc
  16340. Specify the transform timeclamp. At low frequency, there is trade-off between
  16341. accuracy in time domain and frequency domain. If timeclamp is lower,
  16342. event in time domain is represented more accurately (such as fast bass drum),
  16343. otherwise event in frequency domain is represented more accurately
  16344. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  16345. @item attack
  16346. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  16347. limits future samples by applying asymmetric windowing in time domain, useful
  16348. when low latency is required. Accepted range is @code{[0, 1]}.
  16349. @item basefreq
  16350. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  16351. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  16352. @item endfreq
  16353. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  16354. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  16355. @item coeffclamp
  16356. This option is deprecated and ignored.
  16357. @item tlength
  16358. Specify the transform length in time domain. Use this option to control accuracy
  16359. trade-off between time domain and frequency domain at every frequency sample.
  16360. It can contain variables:
  16361. @table @option
  16362. @item frequency, freq, f
  16363. the frequency where it is evaluated
  16364. @item timeclamp, tc
  16365. the value of @var{timeclamp} option.
  16366. @end table
  16367. Default value is @code{384*tc/(384+tc*f)}.
  16368. @item count
  16369. Specify the transform count for every video frame. Default value is @code{6}.
  16370. Acceptable range is @code{[1, 30]}.
  16371. @item fcount
  16372. Specify the transform count for every single pixel. Default value is @code{0},
  16373. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  16374. @item fontfile
  16375. Specify font file for use with freetype to draw the axis. If not specified,
  16376. use embedded font. Note that drawing with font file or embedded font is not
  16377. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  16378. option instead.
  16379. @item font
  16380. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  16381. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  16382. @item fontcolor
  16383. Specify font color expression. This is arithmetic expression that should return
  16384. integer value 0xRRGGBB. It can contain variables:
  16385. @table @option
  16386. @item frequency, freq, f
  16387. the frequency where it is evaluated
  16388. @item timeclamp, tc
  16389. the value of @var{timeclamp} option
  16390. @end table
  16391. and functions:
  16392. @table @option
  16393. @item midi(f)
  16394. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  16395. @item r(x), g(x), b(x)
  16396. red, green, and blue value of intensity x.
  16397. @end table
  16398. Default value is @code{st(0, (midi(f)-59.5)/12);
  16399. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  16400. r(1-ld(1)) + b(ld(1))}.
  16401. @item axisfile
  16402. Specify image file to draw the axis. This option override @var{fontfile} and
  16403. @var{fontcolor} option.
  16404. @item axis, text
  16405. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  16406. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  16407. Default value is @code{1}.
  16408. @item csp
  16409. Set colorspace. The accepted values are:
  16410. @table @samp
  16411. @item unspecified
  16412. Unspecified (default)
  16413. @item bt709
  16414. BT.709
  16415. @item fcc
  16416. FCC
  16417. @item bt470bg
  16418. BT.470BG or BT.601-6 625
  16419. @item smpte170m
  16420. SMPTE-170M or BT.601-6 525
  16421. @item smpte240m
  16422. SMPTE-240M
  16423. @item bt2020ncl
  16424. BT.2020 with non-constant luminance
  16425. @end table
  16426. @item cscheme
  16427. Set spectrogram color scheme. This is list of floating point values with format
  16428. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  16429. The default is @code{1|0.5|0|0|0.5|1}.
  16430. @end table
  16431. @subsection Examples
  16432. @itemize
  16433. @item
  16434. Playing audio while showing the spectrum:
  16435. @example
  16436. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  16437. @end example
  16438. @item
  16439. Same as above, but with frame rate 30 fps:
  16440. @example
  16441. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  16442. @end example
  16443. @item
  16444. Playing at 1280x720:
  16445. @example
  16446. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  16447. @end example
  16448. @item
  16449. Disable sonogram display:
  16450. @example
  16451. sono_h=0
  16452. @end example
  16453. @item
  16454. A1 and its harmonics: A1, A2, (near)E3, A3:
  16455. @example
  16456. 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),
  16457. asplit[a][out1]; [a] showcqt [out0]'
  16458. @end example
  16459. @item
  16460. Same as above, but with more accuracy in frequency domain:
  16461. @example
  16462. 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),
  16463. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  16464. @end example
  16465. @item
  16466. Custom volume:
  16467. @example
  16468. bar_v=10:sono_v=bar_v*a_weighting(f)
  16469. @end example
  16470. @item
  16471. Custom gamma, now spectrum is linear to the amplitude.
  16472. @example
  16473. bar_g=2:sono_g=2
  16474. @end example
  16475. @item
  16476. Custom tlength equation:
  16477. @example
  16478. 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)))'
  16479. @end example
  16480. @item
  16481. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  16482. @example
  16483. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  16484. @end example
  16485. @item
  16486. Custom font using fontconfig:
  16487. @example
  16488. font='Courier New,Monospace,mono|bold'
  16489. @end example
  16490. @item
  16491. Custom frequency range with custom axis using image file:
  16492. @example
  16493. axisfile=myaxis.png:basefreq=40:endfreq=10000
  16494. @end example
  16495. @end itemize
  16496. @section showfreqs
  16497. Convert input audio to video output representing the audio power spectrum.
  16498. Audio amplitude is on Y-axis while frequency is on X-axis.
  16499. The filter accepts the following options:
  16500. @table @option
  16501. @item size, s
  16502. Specify size of video. For the syntax of this option, check the
  16503. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16504. Default is @code{1024x512}.
  16505. @item mode
  16506. Set display mode.
  16507. This set how each frequency bin will be represented.
  16508. It accepts the following values:
  16509. @table @samp
  16510. @item line
  16511. @item bar
  16512. @item dot
  16513. @end table
  16514. Default is @code{bar}.
  16515. @item ascale
  16516. Set amplitude scale.
  16517. It accepts the following values:
  16518. @table @samp
  16519. @item lin
  16520. Linear scale.
  16521. @item sqrt
  16522. Square root scale.
  16523. @item cbrt
  16524. Cubic root scale.
  16525. @item log
  16526. Logarithmic scale.
  16527. @end table
  16528. Default is @code{log}.
  16529. @item fscale
  16530. Set frequency scale.
  16531. It accepts the following values:
  16532. @table @samp
  16533. @item lin
  16534. Linear scale.
  16535. @item log
  16536. Logarithmic scale.
  16537. @item rlog
  16538. Reverse logarithmic scale.
  16539. @end table
  16540. Default is @code{lin}.
  16541. @item win_size
  16542. Set window size.
  16543. It accepts the following values:
  16544. @table @samp
  16545. @item w16
  16546. @item w32
  16547. @item w64
  16548. @item w128
  16549. @item w256
  16550. @item w512
  16551. @item w1024
  16552. @item w2048
  16553. @item w4096
  16554. @item w8192
  16555. @item w16384
  16556. @item w32768
  16557. @item w65536
  16558. @end table
  16559. Default is @code{w2048}
  16560. @item win_func
  16561. Set windowing function.
  16562. It accepts the following values:
  16563. @table @samp
  16564. @item rect
  16565. @item bartlett
  16566. @item hanning
  16567. @item hamming
  16568. @item blackman
  16569. @item welch
  16570. @item flattop
  16571. @item bharris
  16572. @item bnuttall
  16573. @item bhann
  16574. @item sine
  16575. @item nuttall
  16576. @item lanczos
  16577. @item gauss
  16578. @item tukey
  16579. @item dolph
  16580. @item cauchy
  16581. @item parzen
  16582. @item poisson
  16583. @item bohman
  16584. @end table
  16585. Default is @code{hanning}.
  16586. @item overlap
  16587. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16588. which means optimal overlap for selected window function will be picked.
  16589. @item averaging
  16590. Set time averaging. Setting this to 0 will display current maximal peaks.
  16591. Default is @code{1}, which means time averaging is disabled.
  16592. @item colors
  16593. Specify list of colors separated by space or by '|' which will be used to
  16594. draw channel frequencies. Unrecognized or missing colors will be replaced
  16595. by white color.
  16596. @item cmode
  16597. Set channel display mode.
  16598. It accepts the following values:
  16599. @table @samp
  16600. @item combined
  16601. @item separate
  16602. @end table
  16603. Default is @code{combined}.
  16604. @item minamp
  16605. Set minimum amplitude used in @code{log} amplitude scaler.
  16606. @end table
  16607. @anchor{showspectrum}
  16608. @section showspectrum
  16609. Convert input audio to a video output, representing the audio frequency
  16610. spectrum.
  16611. The filter accepts the following options:
  16612. @table @option
  16613. @item size, s
  16614. Specify the video size for the output. For the syntax of this option, check the
  16615. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16616. Default value is @code{640x512}.
  16617. @item slide
  16618. Specify how the spectrum should slide along the window.
  16619. It accepts the following values:
  16620. @table @samp
  16621. @item replace
  16622. the samples start again on the left when they reach the right
  16623. @item scroll
  16624. the samples scroll from right to left
  16625. @item fullframe
  16626. frames are only produced when the samples reach the right
  16627. @item rscroll
  16628. the samples scroll from left to right
  16629. @end table
  16630. Default value is @code{replace}.
  16631. @item mode
  16632. Specify display mode.
  16633. It accepts the following values:
  16634. @table @samp
  16635. @item combined
  16636. all channels are displayed in the same row
  16637. @item separate
  16638. all channels are displayed in separate rows
  16639. @end table
  16640. Default value is @samp{combined}.
  16641. @item color
  16642. Specify display color mode.
  16643. It accepts the following values:
  16644. @table @samp
  16645. @item channel
  16646. each channel is displayed in a separate color
  16647. @item intensity
  16648. each channel is displayed using the same color scheme
  16649. @item rainbow
  16650. each channel is displayed using the rainbow color scheme
  16651. @item moreland
  16652. each channel is displayed using the moreland color scheme
  16653. @item nebulae
  16654. each channel is displayed using the nebulae color scheme
  16655. @item fire
  16656. each channel is displayed using the fire color scheme
  16657. @item fiery
  16658. each channel is displayed using the fiery color scheme
  16659. @item fruit
  16660. each channel is displayed using the fruit color scheme
  16661. @item cool
  16662. each channel is displayed using the cool color scheme
  16663. @item magma
  16664. each channel is displayed using the magma color scheme
  16665. @item green
  16666. each channel is displayed using the green color scheme
  16667. @item viridis
  16668. each channel is displayed using the viridis color scheme
  16669. @item plasma
  16670. each channel is displayed using the plasma color scheme
  16671. @item cividis
  16672. each channel is displayed using the cividis color scheme
  16673. @item terrain
  16674. each channel is displayed using the terrain color scheme
  16675. @end table
  16676. Default value is @samp{channel}.
  16677. @item scale
  16678. Specify scale used for calculating intensity color values.
  16679. It accepts the following values:
  16680. @table @samp
  16681. @item lin
  16682. linear
  16683. @item sqrt
  16684. square root, default
  16685. @item cbrt
  16686. cubic root
  16687. @item log
  16688. logarithmic
  16689. @item 4thrt
  16690. 4th root
  16691. @item 5thrt
  16692. 5th root
  16693. @end table
  16694. Default value is @samp{sqrt}.
  16695. @item saturation
  16696. Set saturation modifier for displayed colors. Negative values provide
  16697. alternative color scheme. @code{0} is no saturation at all.
  16698. Saturation must be in [-10.0, 10.0] range.
  16699. Default value is @code{1}.
  16700. @item win_func
  16701. Set window function.
  16702. It accepts the following values:
  16703. @table @samp
  16704. @item rect
  16705. @item bartlett
  16706. @item hann
  16707. @item hanning
  16708. @item hamming
  16709. @item blackman
  16710. @item welch
  16711. @item flattop
  16712. @item bharris
  16713. @item bnuttall
  16714. @item bhann
  16715. @item sine
  16716. @item nuttall
  16717. @item lanczos
  16718. @item gauss
  16719. @item tukey
  16720. @item dolph
  16721. @item cauchy
  16722. @item parzen
  16723. @item poisson
  16724. @item bohman
  16725. @end table
  16726. Default value is @code{hann}.
  16727. @item orientation
  16728. Set orientation of time vs frequency axis. Can be @code{vertical} or
  16729. @code{horizontal}. Default is @code{vertical}.
  16730. @item overlap
  16731. Set ratio of overlap window. Default value is @code{0}.
  16732. When value is @code{1} overlap is set to recommended size for specific
  16733. window function currently used.
  16734. @item gain
  16735. Set scale gain for calculating intensity color values.
  16736. Default value is @code{1}.
  16737. @item data
  16738. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  16739. @item rotation
  16740. Set color rotation, must be in [-1.0, 1.0] range.
  16741. Default value is @code{0}.
  16742. @item start
  16743. Set start frequency from which to display spectrogram. Default is @code{0}.
  16744. @item stop
  16745. Set stop frequency to which to display spectrogram. Default is @code{0}.
  16746. @item fps
  16747. Set upper frame rate limit. Default is @code{auto}, unlimited.
  16748. @item legend
  16749. Draw time and frequency axes and legends. Default is disabled.
  16750. @end table
  16751. The usage is very similar to the showwaves filter; see the examples in that
  16752. section.
  16753. @subsection Examples
  16754. @itemize
  16755. @item
  16756. Large window with logarithmic color scaling:
  16757. @example
  16758. showspectrum=s=1280x480:scale=log
  16759. @end example
  16760. @item
  16761. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  16762. @example
  16763. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16764. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  16765. @end example
  16766. @end itemize
  16767. @section showspectrumpic
  16768. Convert input audio to a single video frame, representing the audio frequency
  16769. spectrum.
  16770. The filter accepts the following options:
  16771. @table @option
  16772. @item size, s
  16773. Specify the video size for the output. For the syntax of this option, check the
  16774. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16775. Default value is @code{4096x2048}.
  16776. @item mode
  16777. Specify display mode.
  16778. It accepts the following values:
  16779. @table @samp
  16780. @item combined
  16781. all channels are displayed in the same row
  16782. @item separate
  16783. all channels are displayed in separate rows
  16784. @end table
  16785. Default value is @samp{combined}.
  16786. @item color
  16787. Specify display color mode.
  16788. It accepts the following values:
  16789. @table @samp
  16790. @item channel
  16791. each channel is displayed in a separate color
  16792. @item intensity
  16793. each channel is displayed using the same color scheme
  16794. @item rainbow
  16795. each channel is displayed using the rainbow color scheme
  16796. @item moreland
  16797. each channel is displayed using the moreland color scheme
  16798. @item nebulae
  16799. each channel is displayed using the nebulae color scheme
  16800. @item fire
  16801. each channel is displayed using the fire color scheme
  16802. @item fiery
  16803. each channel is displayed using the fiery color scheme
  16804. @item fruit
  16805. each channel is displayed using the fruit color scheme
  16806. @item cool
  16807. each channel is displayed using the cool color scheme
  16808. @item magma
  16809. each channel is displayed using the magma color scheme
  16810. @item green
  16811. each channel is displayed using the green color scheme
  16812. @item viridis
  16813. each channel is displayed using the viridis color scheme
  16814. @item plasma
  16815. each channel is displayed using the plasma color scheme
  16816. @item cividis
  16817. each channel is displayed using the cividis color scheme
  16818. @item terrain
  16819. each channel is displayed using the terrain color scheme
  16820. @end table
  16821. Default value is @samp{intensity}.
  16822. @item scale
  16823. Specify scale used for calculating intensity color values.
  16824. It accepts the following values:
  16825. @table @samp
  16826. @item lin
  16827. linear
  16828. @item sqrt
  16829. square root, default
  16830. @item cbrt
  16831. cubic root
  16832. @item log
  16833. logarithmic
  16834. @item 4thrt
  16835. 4th root
  16836. @item 5thrt
  16837. 5th root
  16838. @end table
  16839. Default value is @samp{log}.
  16840. @item saturation
  16841. Set saturation modifier for displayed colors. Negative values provide
  16842. alternative color scheme. @code{0} is no saturation at all.
  16843. Saturation must be in [-10.0, 10.0] range.
  16844. Default value is @code{1}.
  16845. @item win_func
  16846. Set window function.
  16847. It accepts the following values:
  16848. @table @samp
  16849. @item rect
  16850. @item bartlett
  16851. @item hann
  16852. @item hanning
  16853. @item hamming
  16854. @item blackman
  16855. @item welch
  16856. @item flattop
  16857. @item bharris
  16858. @item bnuttall
  16859. @item bhann
  16860. @item sine
  16861. @item nuttall
  16862. @item lanczos
  16863. @item gauss
  16864. @item tukey
  16865. @item dolph
  16866. @item cauchy
  16867. @item parzen
  16868. @item poisson
  16869. @item bohman
  16870. @end table
  16871. Default value is @code{hann}.
  16872. @item orientation
  16873. Set orientation of time vs frequency axis. Can be @code{vertical} or
  16874. @code{horizontal}. Default is @code{vertical}.
  16875. @item gain
  16876. Set scale gain for calculating intensity color values.
  16877. Default value is @code{1}.
  16878. @item legend
  16879. Draw time and frequency axes and legends. Default is enabled.
  16880. @item rotation
  16881. Set color rotation, must be in [-1.0, 1.0] range.
  16882. Default value is @code{0}.
  16883. @item start
  16884. Set start frequency from which to display spectrogram. Default is @code{0}.
  16885. @item stop
  16886. Set stop frequency to which to display spectrogram. Default is @code{0}.
  16887. @end table
  16888. @subsection Examples
  16889. @itemize
  16890. @item
  16891. Extract an audio spectrogram of a whole audio track
  16892. in a 1024x1024 picture using @command{ffmpeg}:
  16893. @example
  16894. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  16895. @end example
  16896. @end itemize
  16897. @section showvolume
  16898. Convert input audio volume to a video output.
  16899. The filter accepts the following options:
  16900. @table @option
  16901. @item rate, r
  16902. Set video rate.
  16903. @item b
  16904. Set border width, allowed range is [0, 5]. Default is 1.
  16905. @item w
  16906. Set channel width, allowed range is [80, 8192]. Default is 400.
  16907. @item h
  16908. Set channel height, allowed range is [1, 900]. Default is 20.
  16909. @item f
  16910. Set fade, allowed range is [0, 1]. Default is 0.95.
  16911. @item c
  16912. Set volume color expression.
  16913. The expression can use the following variables:
  16914. @table @option
  16915. @item VOLUME
  16916. Current max volume of channel in dB.
  16917. @item PEAK
  16918. Current peak.
  16919. @item CHANNEL
  16920. Current channel number, starting from 0.
  16921. @end table
  16922. @item t
  16923. If set, displays channel names. Default is enabled.
  16924. @item v
  16925. If set, displays volume values. Default is enabled.
  16926. @item o
  16927. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  16928. default is @code{h}.
  16929. @item s
  16930. Set step size, allowed range is [0, 5]. Default is 0, which means
  16931. step is disabled.
  16932. @item p
  16933. Set background opacity, allowed range is [0, 1]. Default is 0.
  16934. @item m
  16935. Set metering mode, can be peak: @code{p} or rms: @code{r},
  16936. default is @code{p}.
  16937. @item ds
  16938. Set display scale, can be linear: @code{lin} or log: @code{log},
  16939. default is @code{lin}.
  16940. @item dm
  16941. In second.
  16942. If set to > 0., display a line for the max level
  16943. in the previous seconds.
  16944. default is disabled: @code{0.}
  16945. @item dmc
  16946. The color of the max line. Use when @code{dm} option is set to > 0.
  16947. default is: @code{orange}
  16948. @end table
  16949. @section showwaves
  16950. Convert input audio to a video output, representing the samples waves.
  16951. The filter accepts the following options:
  16952. @table @option
  16953. @item size, s
  16954. Specify the video size for the output. For the syntax of this option, check the
  16955. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16956. Default value is @code{600x240}.
  16957. @item mode
  16958. Set display mode.
  16959. Available values are:
  16960. @table @samp
  16961. @item point
  16962. Draw a point for each sample.
  16963. @item line
  16964. Draw a vertical line for each sample.
  16965. @item p2p
  16966. Draw a point for each sample and a line between them.
  16967. @item cline
  16968. Draw a centered vertical line for each sample.
  16969. @end table
  16970. Default value is @code{point}.
  16971. @item n
  16972. Set the number of samples which are printed on the same column. A
  16973. larger value will decrease the frame rate. Must be a positive
  16974. integer. This option can be set only if the value for @var{rate}
  16975. is not explicitly specified.
  16976. @item rate, r
  16977. Set the (approximate) output frame rate. This is done by setting the
  16978. option @var{n}. Default value is "25".
  16979. @item split_channels
  16980. Set if channels should be drawn separately or overlap. Default value is 0.
  16981. @item colors
  16982. Set colors separated by '|' which are going to be used for drawing of each channel.
  16983. @item scale
  16984. Set amplitude scale.
  16985. Available values are:
  16986. @table @samp
  16987. @item lin
  16988. Linear.
  16989. @item log
  16990. Logarithmic.
  16991. @item sqrt
  16992. Square root.
  16993. @item cbrt
  16994. Cubic root.
  16995. @end table
  16996. Default is linear.
  16997. @item draw
  16998. Set the draw mode. This is mostly useful to set for high @var{n}.
  16999. Available values are:
  17000. @table @samp
  17001. @item scale
  17002. Scale pixel values for each drawn sample.
  17003. @item full
  17004. Draw every sample directly.
  17005. @end table
  17006. Default value is @code{scale}.
  17007. @end table
  17008. @subsection Examples
  17009. @itemize
  17010. @item
  17011. Output the input file audio and the corresponding video representation
  17012. at the same time:
  17013. @example
  17014. amovie=a.mp3,asplit[out0],showwaves[out1]
  17015. @end example
  17016. @item
  17017. Create a synthetic signal and show it with showwaves, forcing a
  17018. frame rate of 30 frames per second:
  17019. @example
  17020. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17021. @end example
  17022. @end itemize
  17023. @section showwavespic
  17024. Convert input audio to a single video frame, representing the samples waves.
  17025. The filter accepts the following options:
  17026. @table @option
  17027. @item size, s
  17028. Specify the video size for the output. For the syntax of this option, check the
  17029. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17030. Default value is @code{600x240}.
  17031. @item split_channels
  17032. Set if channels should be drawn separately or overlap. Default value is 0.
  17033. @item colors
  17034. Set colors separated by '|' which are going to be used for drawing of each channel.
  17035. @item scale
  17036. Set amplitude scale.
  17037. Available values are:
  17038. @table @samp
  17039. @item lin
  17040. Linear.
  17041. @item log
  17042. Logarithmic.
  17043. @item sqrt
  17044. Square root.
  17045. @item cbrt
  17046. Cubic root.
  17047. @end table
  17048. Default is linear.
  17049. @end table
  17050. @subsection Examples
  17051. @itemize
  17052. @item
  17053. Extract a channel split representation of the wave form of a whole audio track
  17054. in a 1024x800 picture using @command{ffmpeg}:
  17055. @example
  17056. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  17057. @end example
  17058. @end itemize
  17059. @section sidedata, asidedata
  17060. Delete frame side data, or select frames based on it.
  17061. This filter accepts the following options:
  17062. @table @option
  17063. @item mode
  17064. Set mode of operation of the filter.
  17065. Can be one of the following:
  17066. @table @samp
  17067. @item select
  17068. Select every frame with side data of @code{type}.
  17069. @item delete
  17070. Delete side data of @code{type}. If @code{type} is not set, delete all side
  17071. data in the frame.
  17072. @end table
  17073. @item type
  17074. Set side data type used with all modes. Must be set for @code{select} mode. For
  17075. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  17076. in @file{libavutil/frame.h}. For example, to choose
  17077. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  17078. @end table
  17079. @section spectrumsynth
  17080. Sythesize audio from 2 input video spectrums, first input stream represents
  17081. magnitude across time and second represents phase across time.
  17082. The filter will transform from frequency domain as displayed in videos back
  17083. to time domain as presented in audio output.
  17084. This filter is primarily created for reversing processed @ref{showspectrum}
  17085. filter outputs, but can synthesize sound from other spectrograms too.
  17086. But in such case results are going to be poor if the phase data is not
  17087. available, because in such cases phase data need to be recreated, usually
  17088. its just recreated from random noise.
  17089. For best results use gray only output (@code{channel} color mode in
  17090. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  17091. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  17092. @code{data} option. Inputs videos should generally use @code{fullframe}
  17093. slide mode as that saves resources needed for decoding video.
  17094. The filter accepts the following options:
  17095. @table @option
  17096. @item sample_rate
  17097. Specify sample rate of output audio, the sample rate of audio from which
  17098. spectrum was generated may differ.
  17099. @item channels
  17100. Set number of channels represented in input video spectrums.
  17101. @item scale
  17102. Set scale which was used when generating magnitude input spectrum.
  17103. Can be @code{lin} or @code{log}. Default is @code{log}.
  17104. @item slide
  17105. Set slide which was used when generating inputs spectrums.
  17106. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17107. Default is @code{fullframe}.
  17108. @item win_func
  17109. Set window function used for resynthesis.
  17110. @item overlap
  17111. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17112. which means optimal overlap for selected window function will be picked.
  17113. @item orientation
  17114. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17115. Default is @code{vertical}.
  17116. @end table
  17117. @subsection Examples
  17118. @itemize
  17119. @item
  17120. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17121. then resynthesize videos back to audio with spectrumsynth:
  17122. @example
  17123. 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
  17124. 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
  17125. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17126. @end example
  17127. @end itemize
  17128. @section split, asplit
  17129. Split input into several identical outputs.
  17130. @code{asplit} works with audio input, @code{split} with video.
  17131. The filter accepts a single parameter which specifies the number of outputs. If
  17132. unspecified, it defaults to 2.
  17133. @subsection Examples
  17134. @itemize
  17135. @item
  17136. Create two separate outputs from the same input:
  17137. @example
  17138. [in] split [out0][out1]
  17139. @end example
  17140. @item
  17141. To create 3 or more outputs, you need to specify the number of
  17142. outputs, like in:
  17143. @example
  17144. [in] asplit=3 [out0][out1][out2]
  17145. @end example
  17146. @item
  17147. Create two separate outputs from the same input, one cropped and
  17148. one padded:
  17149. @example
  17150. [in] split [splitout1][splitout2];
  17151. [splitout1] crop=100:100:0:0 [cropout];
  17152. [splitout2] pad=200:200:100:100 [padout];
  17153. @end example
  17154. @item
  17155. Create 5 copies of the input audio with @command{ffmpeg}:
  17156. @example
  17157. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17158. @end example
  17159. @end itemize
  17160. @section zmq, azmq
  17161. Receive commands sent through a libzmq client, and forward them to
  17162. filters in the filtergraph.
  17163. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17164. must be inserted between two video filters, @code{azmq} between two
  17165. audio filters. Both are capable to send messages to any filter type.
  17166. To enable these filters you need to install the libzmq library and
  17167. headers and configure FFmpeg with @code{--enable-libzmq}.
  17168. For more information about libzmq see:
  17169. @url{http://www.zeromq.org/}
  17170. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17171. receives messages sent through a network interface defined by the
  17172. @option{bind_address} (or the abbreviation "@option{b}") option.
  17173. Default value of this option is @file{tcp://localhost:5555}. You may
  17174. want to alter this value to your needs, but do not forget to escape any
  17175. ':' signs (see @ref{filtergraph escaping}).
  17176. The received message must be in the form:
  17177. @example
  17178. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17179. @end example
  17180. @var{TARGET} specifies the target of the command, usually the name of
  17181. the filter class or a specific filter instance name. The default
  17182. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17183. but you can override this by using the @samp{filter_name@@id} syntax
  17184. (see @ref{Filtergraph syntax}).
  17185. @var{COMMAND} specifies the name of the command for the target filter.
  17186. @var{ARG} is optional and specifies the optional argument list for the
  17187. given @var{COMMAND}.
  17188. Upon reception, the message is processed and the corresponding command
  17189. is injected into the filtergraph. Depending on the result, the filter
  17190. will send a reply to the client, adopting the format:
  17191. @example
  17192. @var{ERROR_CODE} @var{ERROR_REASON}
  17193. @var{MESSAGE}
  17194. @end example
  17195. @var{MESSAGE} is optional.
  17196. @subsection Examples
  17197. Look at @file{tools/zmqsend} for an example of a zmq client which can
  17198. be used to send commands processed by these filters.
  17199. Consider the following filtergraph generated by @command{ffplay}.
  17200. In this example the last overlay filter has an instance name. All other
  17201. filters will have default instance names.
  17202. @example
  17203. ffplay -dumpgraph 1 -f lavfi "
  17204. color=s=100x100:c=red [l];
  17205. color=s=100x100:c=blue [r];
  17206. nullsrc=s=200x100, zmq [bg];
  17207. [bg][l] overlay [bg+l];
  17208. [bg+l][r] overlay@@my=x=100 "
  17209. @end example
  17210. To change the color of the left side of the video, the following
  17211. command can be used:
  17212. @example
  17213. echo Parsed_color_0 c yellow | tools/zmqsend
  17214. @end example
  17215. To change the right side:
  17216. @example
  17217. echo Parsed_color_1 c pink | tools/zmqsend
  17218. @end example
  17219. To change the position of the right side:
  17220. @example
  17221. echo overlay@@my x 150 | tools/zmqsend
  17222. @end example
  17223. @c man end MULTIMEDIA FILTERS
  17224. @chapter Multimedia Sources
  17225. @c man begin MULTIMEDIA SOURCES
  17226. Below is a description of the currently available multimedia sources.
  17227. @section amovie
  17228. This is the same as @ref{movie} source, except it selects an audio
  17229. stream by default.
  17230. @anchor{movie}
  17231. @section movie
  17232. Read audio and/or video stream(s) from a movie container.
  17233. It accepts the following parameters:
  17234. @table @option
  17235. @item filename
  17236. The name of the resource to read (not necessarily a file; it can also be a
  17237. device or a stream accessed through some protocol).
  17238. @item format_name, f
  17239. Specifies the format assumed for the movie to read, and can be either
  17240. the name of a container or an input device. If not specified, the
  17241. format is guessed from @var{movie_name} or by probing.
  17242. @item seek_point, sp
  17243. Specifies the seek point in seconds. The frames will be output
  17244. starting from this seek point. The parameter is evaluated with
  17245. @code{av_strtod}, so the numerical value may be suffixed by an IS
  17246. postfix. The default value is "0".
  17247. @item streams, s
  17248. Specifies the streams to read. Several streams can be specified,
  17249. separated by "+". The source will then have as many outputs, in the
  17250. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  17251. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  17252. respectively the default (best suited) video and audio stream. Default
  17253. is "dv", or "da" if the filter is called as "amovie".
  17254. @item stream_index, si
  17255. Specifies the index of the video stream to read. If the value is -1,
  17256. the most suitable video stream will be automatically selected. The default
  17257. value is "-1". Deprecated. If the filter is called "amovie", it will select
  17258. audio instead of video.
  17259. @item loop
  17260. Specifies how many times to read the stream in sequence.
  17261. If the value is 0, the stream will be looped infinitely.
  17262. Default value is "1".
  17263. Note that when the movie is looped the source timestamps are not
  17264. changed, so it will generate non monotonically increasing timestamps.
  17265. @item discontinuity
  17266. Specifies the time difference between frames above which the point is
  17267. considered a timestamp discontinuity which is removed by adjusting the later
  17268. timestamps.
  17269. @end table
  17270. It allows overlaying a second video on top of the main input of
  17271. a filtergraph, as shown in this graph:
  17272. @example
  17273. input -----------> deltapts0 --> overlay --> output
  17274. ^
  17275. |
  17276. movie --> scale--> deltapts1 -------+
  17277. @end example
  17278. @subsection Examples
  17279. @itemize
  17280. @item
  17281. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  17282. on top of the input labelled "in":
  17283. @example
  17284. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17285. [in] setpts=PTS-STARTPTS [main];
  17286. [main][over] overlay=16:16 [out]
  17287. @end example
  17288. @item
  17289. Read from a video4linux2 device, and overlay it on top of the input
  17290. labelled "in":
  17291. @example
  17292. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17293. [in] setpts=PTS-STARTPTS [main];
  17294. [main][over] overlay=16:16 [out]
  17295. @end example
  17296. @item
  17297. Read the first video stream and the audio stream with id 0x81 from
  17298. dvd.vob; the video is connected to the pad named "video" and the audio is
  17299. connected to the pad named "audio":
  17300. @example
  17301. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  17302. @end example
  17303. @end itemize
  17304. @subsection Commands
  17305. Both movie and amovie support the following commands:
  17306. @table @option
  17307. @item seek
  17308. Perform seek using "av_seek_frame".
  17309. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  17310. @itemize
  17311. @item
  17312. @var{stream_index}: If stream_index is -1, a default
  17313. stream is selected, and @var{timestamp} is automatically converted
  17314. from AV_TIME_BASE units to the stream specific time_base.
  17315. @item
  17316. @var{timestamp}: Timestamp in AVStream.time_base units
  17317. or, if no stream is specified, in AV_TIME_BASE units.
  17318. @item
  17319. @var{flags}: Flags which select direction and seeking mode.
  17320. @end itemize
  17321. @item get_duration
  17322. Get movie duration in AV_TIME_BASE units.
  17323. @end table
  17324. @c man end MULTIMEDIA SOURCES