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.

23996 lines
637KB

  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 mode
  315. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  316. Default is @code{downward}.
  317. @item threshold
  318. If a signal of stream rises above this level it will affect the gain
  319. reduction.
  320. By default it is 0.125. Range is between 0.00097563 and 1.
  321. @item ratio
  322. Set a ratio by which the signal is reduced. 1:2 means that if the level
  323. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  324. Default is 2. Range is between 1 and 20.
  325. @item attack
  326. Amount of milliseconds the signal has to rise above the threshold before gain
  327. reduction starts. Default is 20. Range is between 0.01 and 2000.
  328. @item release
  329. Amount of milliseconds the signal has to fall below the threshold before
  330. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  331. @item makeup
  332. Set the amount by how much signal will be amplified after processing.
  333. Default is 1. Range is from 1 to 64.
  334. @item knee
  335. Curve the sharp knee around the threshold to enter gain reduction more softly.
  336. Default is 2.82843. Range is between 1 and 8.
  337. @item link
  338. Choose if the @code{average} level between all channels of input stream
  339. or the louder(@code{maximum}) channel of input stream affects the
  340. reduction. Default is @code{average}.
  341. @item detection
  342. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  343. of @code{rms}. Default is @code{rms} which is mostly smoother.
  344. @item mix
  345. How much to use compressed signal in output. Default is 1.
  346. Range is between 0 and 1.
  347. @end table
  348. @section acontrast
  349. Simple audio dynamic range compression/expansion filter.
  350. The filter accepts the following options:
  351. @table @option
  352. @item contrast
  353. Set contrast. Default is 33. Allowed range is between 0 and 100.
  354. @end table
  355. @section acopy
  356. Copy the input audio source unchanged to the output. This is mainly useful for
  357. testing purposes.
  358. @section acrossfade
  359. Apply cross fade from one input audio stream to another input audio stream.
  360. The cross fade is applied for specified duration near the end of first stream.
  361. The filter accepts the following options:
  362. @table @option
  363. @item nb_samples, ns
  364. Specify the number of samples for which the cross fade effect has to last.
  365. At the end of the cross fade effect the first input audio will be completely
  366. silent. Default is 44100.
  367. @item duration, d
  368. Specify the duration of the cross fade effect. See
  369. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  370. for the accepted syntax.
  371. By default the duration is determined by @var{nb_samples}.
  372. If set this option is used instead of @var{nb_samples}.
  373. @item overlap, o
  374. Should first stream end overlap with second stream start. Default is enabled.
  375. @item curve1
  376. Set curve for cross fade transition for first stream.
  377. @item curve2
  378. Set curve for cross fade transition for second stream.
  379. For description of available curve types see @ref{afade} filter description.
  380. @end table
  381. @subsection Examples
  382. @itemize
  383. @item
  384. Cross fade from one input to another:
  385. @example
  386. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  387. @end example
  388. @item
  389. Cross fade from one input to another but without overlapping:
  390. @example
  391. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  392. @end example
  393. @end itemize
  394. @section acrossover
  395. Split audio stream into several bands.
  396. This filter splits audio stream into two or more frequency ranges.
  397. Summing all streams back will give flat output.
  398. The filter accepts the following options:
  399. @table @option
  400. @item split
  401. Set split frequencies. Those must be positive and increasing.
  402. @item order
  403. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  404. Default is @var{4th}.
  405. @end table
  406. @section acrusher
  407. Reduce audio bit resolution.
  408. This filter is bit crusher with enhanced functionality. A bit crusher
  409. is used to audibly reduce number of bits an audio signal is sampled
  410. with. This doesn't change the bit depth at all, it just produces the
  411. effect. Material reduced in bit depth sounds more harsh and "digital".
  412. This filter is able to even round to continuous values instead of discrete
  413. bit depths.
  414. Additionally it has a D/C offset which results in different crushing of
  415. the lower and the upper half of the signal.
  416. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  417. Another feature of this filter is the logarithmic mode.
  418. This setting switches from linear distances between bits to logarithmic ones.
  419. The result is a much more "natural" sounding crusher which doesn't gate low
  420. signals for example. The human ear has a logarithmic perception,
  421. so this kind of crushing is much more pleasant.
  422. Logarithmic crushing is also able to get anti-aliased.
  423. The filter accepts the following options:
  424. @table @option
  425. @item level_in
  426. Set level in.
  427. @item level_out
  428. Set level out.
  429. @item bits
  430. Set bit reduction.
  431. @item mix
  432. Set mixing amount.
  433. @item mode
  434. Can be linear: @code{lin} or logarithmic: @code{log}.
  435. @item dc
  436. Set DC.
  437. @item aa
  438. Set anti-aliasing.
  439. @item samples
  440. Set sample reduction.
  441. @item lfo
  442. Enable LFO. By default disabled.
  443. @item lforange
  444. Set LFO range.
  445. @item lforate
  446. Set LFO rate.
  447. @end table
  448. @section acue
  449. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  450. filter.
  451. @section adeclick
  452. Remove impulsive noise from input audio.
  453. Samples detected as impulsive noise are replaced by interpolated samples using
  454. autoregressive modelling.
  455. @table @option
  456. @item w
  457. Set window size, in milliseconds. Allowed range is from @code{10} to
  458. @code{100}. Default value is @code{55} milliseconds.
  459. This sets size of window which will be processed at once.
  460. @item o
  461. Set window overlap, in percentage of window size. Allowed range is from
  462. @code{50} to @code{95}. Default value is @code{75} percent.
  463. Setting this to a very high value increases impulsive noise removal but makes
  464. whole process much slower.
  465. @item a
  466. Set autoregression order, in percentage of window size. Allowed range is from
  467. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  468. controls quality of interpolated samples using neighbour good samples.
  469. @item t
  470. Set threshold value. Allowed range is from @code{1} to @code{100}.
  471. Default value is @code{2}.
  472. This controls the strength of impulsive noise which is going to be removed.
  473. The lower value, the more samples will be detected as impulsive noise.
  474. @item b
  475. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  476. @code{10}. Default value is @code{2}.
  477. If any two samples detected as noise are spaced less than this value then any
  478. sample between those two samples will be also detected as noise.
  479. @item m
  480. Set overlap method.
  481. It accepts the following values:
  482. @table @option
  483. @item a
  484. Select overlap-add method. Even not interpolated samples are slightly
  485. changed with this method.
  486. @item s
  487. Select overlap-save method. Not interpolated samples remain unchanged.
  488. @end table
  489. Default value is @code{a}.
  490. @end table
  491. @section adeclip
  492. Remove clipped samples from input audio.
  493. Samples detected as clipped are replaced by interpolated samples using
  494. autoregressive modelling.
  495. @table @option
  496. @item w
  497. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  498. Default value is @code{55} milliseconds.
  499. This sets size of window which will be processed at once.
  500. @item o
  501. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  502. to @code{95}. Default value is @code{75} percent.
  503. @item a
  504. Set autoregression order, in percentage of window size. Allowed range is from
  505. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  506. quality of interpolated samples using neighbour good samples.
  507. @item t
  508. Set threshold value. Allowed range is from @code{1} to @code{100}.
  509. Default value is @code{10}. Higher values make clip detection less aggressive.
  510. @item n
  511. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  512. Default value is @code{1000}. Higher values make clip detection less aggressive.
  513. @item m
  514. Set overlap method.
  515. It accepts the following values:
  516. @table @option
  517. @item a
  518. Select overlap-add method. Even not interpolated samples are slightly changed
  519. with this method.
  520. @item s
  521. Select overlap-save method. Not interpolated samples remain unchanged.
  522. @end table
  523. Default value is @code{a}.
  524. @end table
  525. @section adelay
  526. Delay one or more audio channels.
  527. Samples in delayed channel are filled with silence.
  528. The filter accepts the following option:
  529. @table @option
  530. @item delays
  531. Set list of delays in milliseconds for each channel separated by '|'.
  532. Unused delays will be silently ignored. If number of given delays is
  533. smaller than number of channels all remaining channels will not be delayed.
  534. If you want to delay exact number of samples, append 'S' to number.
  535. If you want instead to delay in seconds, append 's' to number.
  536. @end table
  537. @subsection Examples
  538. @itemize
  539. @item
  540. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  541. the second channel (and any other channels that may be present) unchanged.
  542. @example
  543. adelay=1500|0|500
  544. @end example
  545. @item
  546. Delay second channel by 500 samples, the third channel by 700 samples and leave
  547. the first channel (and any other channels that may be present) unchanged.
  548. @example
  549. adelay=0|500S|700S
  550. @end example
  551. @end itemize
  552. @section aderivative, aintegral
  553. Compute derivative/integral of audio stream.
  554. Applying both filters one after another produces original audio.
  555. @section aecho
  556. Apply echoing to the input audio.
  557. Echoes are reflected sound and can occur naturally amongst mountains
  558. (and sometimes large buildings) when talking or shouting; digital echo
  559. effects emulate this behaviour and are often used to help fill out the
  560. sound of a single instrument or vocal. The time difference between the
  561. original signal and the reflection is the @code{delay}, and the
  562. loudness of the reflected signal is the @code{decay}.
  563. Multiple echoes can have different delays and decays.
  564. A description of the accepted parameters follows.
  565. @table @option
  566. @item in_gain
  567. Set input gain of reflected signal. Default is @code{0.6}.
  568. @item out_gain
  569. Set output gain of reflected signal. Default is @code{0.3}.
  570. @item delays
  571. Set list of time intervals in milliseconds between original signal and reflections
  572. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  573. Default is @code{1000}.
  574. @item decays
  575. Set list of loudness of reflected signals separated by '|'.
  576. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  577. Default is @code{0.5}.
  578. @end table
  579. @subsection Examples
  580. @itemize
  581. @item
  582. Make it sound as if there are twice as many instruments as are actually playing:
  583. @example
  584. aecho=0.8:0.88:60:0.4
  585. @end example
  586. @item
  587. If delay is very short, then it sounds like a (metallic) robot playing music:
  588. @example
  589. aecho=0.8:0.88:6:0.4
  590. @end example
  591. @item
  592. A longer delay will sound like an open air concert in the mountains:
  593. @example
  594. aecho=0.8:0.9:1000:0.3
  595. @end example
  596. @item
  597. Same as above but with one more mountain:
  598. @example
  599. aecho=0.8:0.9:1000|1800:0.3|0.25
  600. @end example
  601. @end itemize
  602. @section aemphasis
  603. Audio emphasis filter creates or restores material directly taken from LPs or
  604. emphased CDs with different filter curves. E.g. to store music on vinyl the
  605. signal has to be altered by a filter first to even out the disadvantages of
  606. this recording medium.
  607. Once the material is played back the inverse filter has to be applied to
  608. restore the distortion of the frequency response.
  609. The filter accepts the following options:
  610. @table @option
  611. @item level_in
  612. Set input gain.
  613. @item level_out
  614. Set output gain.
  615. @item mode
  616. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  617. use @code{production} mode. Default is @code{reproduction} mode.
  618. @item type
  619. Set filter type. Selects medium. Can be one of the following:
  620. @table @option
  621. @item col
  622. select Columbia.
  623. @item emi
  624. select EMI.
  625. @item bsi
  626. select BSI (78RPM).
  627. @item riaa
  628. select RIAA.
  629. @item cd
  630. select Compact Disc (CD).
  631. @item 50fm
  632. select 50µs (FM).
  633. @item 75fm
  634. select 75µs (FM).
  635. @item 50kf
  636. select 50µs (FM-KF).
  637. @item 75kf
  638. select 75µs (FM-KF).
  639. @end table
  640. @end table
  641. @section aeval
  642. Modify an audio signal according to the specified expressions.
  643. This filter accepts one or more expressions (one for each channel),
  644. which are evaluated and used to modify a corresponding audio signal.
  645. It accepts the following parameters:
  646. @table @option
  647. @item exprs
  648. Set the '|'-separated expressions list for each separate channel. If
  649. the number of input channels is greater than the number of
  650. expressions, the last specified expression is used for the remaining
  651. output channels.
  652. @item channel_layout, c
  653. Set output channel layout. If not specified, the channel layout is
  654. specified by the number of expressions. If set to @samp{same}, it will
  655. use by default the same input channel layout.
  656. @end table
  657. Each expression in @var{exprs} can contain the following constants and functions:
  658. @table @option
  659. @item ch
  660. channel number of the current expression
  661. @item n
  662. number of the evaluated sample, starting from 0
  663. @item s
  664. sample rate
  665. @item t
  666. time of the evaluated sample expressed in seconds
  667. @item nb_in_channels
  668. @item nb_out_channels
  669. input and output number of channels
  670. @item val(CH)
  671. the value of input channel with number @var{CH}
  672. @end table
  673. Note: this filter is slow. For faster processing you should use a
  674. dedicated filter.
  675. @subsection Examples
  676. @itemize
  677. @item
  678. Half volume:
  679. @example
  680. aeval=val(ch)/2:c=same
  681. @end example
  682. @item
  683. Invert phase of the second channel:
  684. @example
  685. aeval=val(0)|-val(1)
  686. @end example
  687. @end itemize
  688. @anchor{afade}
  689. @section afade
  690. Apply fade-in/out effect to input audio.
  691. A description of the accepted parameters follows.
  692. @table @option
  693. @item type, t
  694. Specify the effect type, can be either @code{in} for fade-in, or
  695. @code{out} for a fade-out effect. Default is @code{in}.
  696. @item start_sample, ss
  697. Specify the number of the start sample for starting to apply the fade
  698. effect. Default is 0.
  699. @item nb_samples, ns
  700. Specify the number of samples for which the fade effect has to last. At
  701. the end of the fade-in effect the output audio will have the same
  702. volume as the input audio, at the end of the fade-out transition
  703. the output audio will be silence. Default is 44100.
  704. @item start_time, st
  705. Specify the start time of the fade effect. Default is 0.
  706. The value must be specified as a time duration; see
  707. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  708. for the accepted syntax.
  709. If set this option is used instead of @var{start_sample}.
  710. @item duration, d
  711. Specify the duration of the fade effect. See
  712. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  713. for the accepted syntax.
  714. At the end of the fade-in effect the output audio will have the same
  715. volume as the input audio, at the end of the fade-out transition
  716. the output audio will be silence.
  717. By default the duration is determined by @var{nb_samples}.
  718. If set this option is used instead of @var{nb_samples}.
  719. @item curve
  720. Set curve for fade transition.
  721. It accepts the following values:
  722. @table @option
  723. @item tri
  724. select triangular, linear slope (default)
  725. @item qsin
  726. select quarter of sine wave
  727. @item hsin
  728. select half of sine wave
  729. @item esin
  730. select exponential sine wave
  731. @item log
  732. select logarithmic
  733. @item ipar
  734. select inverted parabola
  735. @item qua
  736. select quadratic
  737. @item cub
  738. select cubic
  739. @item squ
  740. select square root
  741. @item cbr
  742. select cubic root
  743. @item par
  744. select parabola
  745. @item exp
  746. select exponential
  747. @item iqsin
  748. select inverted quarter of sine wave
  749. @item ihsin
  750. select inverted half of sine wave
  751. @item dese
  752. select double-exponential seat
  753. @item desi
  754. select double-exponential sigmoid
  755. @item losi
  756. select logistic sigmoid
  757. @item nofade
  758. no fade applied
  759. @end table
  760. @end table
  761. @subsection Examples
  762. @itemize
  763. @item
  764. Fade in first 15 seconds of audio:
  765. @example
  766. afade=t=in:ss=0:d=15
  767. @end example
  768. @item
  769. Fade out last 25 seconds of a 900 seconds audio:
  770. @example
  771. afade=t=out:st=875:d=25
  772. @end example
  773. @end itemize
  774. @section afftdn
  775. Denoise audio samples with FFT.
  776. A description of the accepted parameters follows.
  777. @table @option
  778. @item nr
  779. Set the noise reduction in dB, allowed range is 0.01 to 97.
  780. Default value is 12 dB.
  781. @item nf
  782. Set the noise floor in dB, allowed range is -80 to -20.
  783. Default value is -50 dB.
  784. @item nt
  785. Set the noise type.
  786. It accepts the following values:
  787. @table @option
  788. @item w
  789. Select white noise.
  790. @item v
  791. Select vinyl noise.
  792. @item s
  793. Select shellac noise.
  794. @item c
  795. Select custom noise, defined in @code{bn} option.
  796. Default value is white noise.
  797. @end table
  798. @item bn
  799. Set custom band noise for every one of 15 bands.
  800. Bands are separated by ' ' or '|'.
  801. @item rf
  802. Set the residual floor in dB, allowed range is -80 to -20.
  803. Default value is -38 dB.
  804. @item tn
  805. Enable noise tracking. By default is disabled.
  806. With this enabled, noise floor is automatically adjusted.
  807. @item tr
  808. Enable residual tracking. By default is disabled.
  809. @item om
  810. Set the output mode.
  811. It accepts the following values:
  812. @table @option
  813. @item i
  814. Pass input unchanged.
  815. @item o
  816. Pass noise filtered out.
  817. @item n
  818. Pass only noise.
  819. Default value is @var{o}.
  820. @end table
  821. @end table
  822. @subsection Commands
  823. This filter supports the following commands:
  824. @table @option
  825. @item sample_noise, sn
  826. Start or stop measuring noise profile.
  827. Syntax for the command is : "start" or "stop" string.
  828. After measuring noise profile is stopped it will be
  829. automatically applied in filtering.
  830. @item noise_reduction, nr
  831. Change noise reduction. Argument is single float number.
  832. Syntax for the command is : "@var{noise_reduction}"
  833. @item noise_floor, nf
  834. Change noise floor. Argument is single float number.
  835. Syntax for the command is : "@var{noise_floor}"
  836. @item output_mode, om
  837. Change output mode operation.
  838. Syntax for the command is : "i", "o" or "n" string.
  839. @end table
  840. @section afftfilt
  841. Apply arbitrary expressions to samples in frequency domain.
  842. @table @option
  843. @item real
  844. Set frequency domain real expression for each separate channel separated
  845. by '|'. Default is "re".
  846. If the number of input channels is greater than the number of
  847. expressions, the last specified expression is used for the remaining
  848. output channels.
  849. @item imag
  850. Set frequency domain imaginary expression for each separate channel
  851. separated by '|'. Default is "im".
  852. Each expression in @var{real} and @var{imag} can contain the following
  853. constants and functions:
  854. @table @option
  855. @item sr
  856. sample rate
  857. @item b
  858. current frequency bin number
  859. @item nb
  860. number of available bins
  861. @item ch
  862. channel number of the current expression
  863. @item chs
  864. number of channels
  865. @item pts
  866. current frame pts
  867. @item re
  868. current real part of frequency bin of current channel
  869. @item im
  870. current imaginary part of frequency bin of current channel
  871. @item real(b, ch)
  872. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  873. @item imag(b, ch)
  874. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  875. @end table
  876. @item win_size
  877. Set window size. Allowed range is from 16 to 131072.
  878. Default is @code{4096}
  879. @item win_func
  880. Set window function. Default is @code{hann}.
  881. @item overlap
  882. Set window overlap. If set to 1, the recommended overlap for selected
  883. window function will be picked. Default is @code{0.75}.
  884. @end table
  885. @subsection Examples
  886. @itemize
  887. @item
  888. Leave almost only low frequencies in audio:
  889. @example
  890. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  891. @end example
  892. @end itemize
  893. @anchor{afir}
  894. @section afir
  895. Apply an arbitrary Frequency Impulse Response filter.
  896. This filter is designed for applying long FIR filters,
  897. up to 60 seconds long.
  898. It can be used as component for digital crossover filters,
  899. room equalization, cross talk cancellation, wavefield synthesis,
  900. auralization, ambiophonics, ambisonics and spatialization.
  901. This filter uses the second stream as FIR coefficients.
  902. If the second stream holds a single channel, it will be used
  903. for all input channels in the first stream, otherwise
  904. the number of channels in the second stream must be same as
  905. the number of channels in the first stream.
  906. It accepts the following parameters:
  907. @table @option
  908. @item dry
  909. Set dry gain. This sets input gain.
  910. @item wet
  911. Set wet gain. This sets final output gain.
  912. @item length
  913. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  914. @item gtype
  915. Enable applying gain measured from power of IR.
  916. Set which approach to use for auto gain measurement.
  917. @table @option
  918. @item none
  919. Do not apply any gain.
  920. @item peak
  921. select peak gain, very conservative approach. This is default value.
  922. @item dc
  923. select DC gain, limited application.
  924. @item gn
  925. select gain to noise approach, this is most popular one.
  926. @end table
  927. @item irgain
  928. Set gain to be applied to IR coefficients before filtering.
  929. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  930. @item irfmt
  931. Set format of IR stream. Can be @code{mono} or @code{input}.
  932. Default is @code{input}.
  933. @item maxir
  934. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  935. Allowed range is 0.1 to 60 seconds.
  936. @item response
  937. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  938. By default it is disabled.
  939. @item channel
  940. Set for which IR channel to display frequency response. By default is first channel
  941. displayed. This option is used only when @var{response} is enabled.
  942. @item size
  943. Set video stream size. This option is used only when @var{response} is enabled.
  944. @item rate
  945. Set video stream frame rate. This option is used only when @var{response} is enabled.
  946. @item minp
  947. Set minimal partition size used for convolution. Default is @var{8192}.
  948. Allowed range is from @var{8} to @var{32768}.
  949. Lower values decreases latency at cost of higher CPU usage.
  950. @item maxp
  951. Set maximal partition size used for convolution. Default is @var{8192}.
  952. Allowed range is from @var{8} to @var{32768}.
  953. Lower values may increase CPU usage.
  954. @end table
  955. @subsection Examples
  956. @itemize
  957. @item
  958. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  959. @example
  960. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  961. @end example
  962. @end itemize
  963. @anchor{aformat}
  964. @section aformat
  965. Set output format constraints for the input audio. The framework will
  966. negotiate the most appropriate format to minimize conversions.
  967. It accepts the following parameters:
  968. @table @option
  969. @item sample_fmts
  970. A '|'-separated list of requested sample formats.
  971. @item sample_rates
  972. A '|'-separated list of requested sample rates.
  973. @item channel_layouts
  974. A '|'-separated list of requested channel layouts.
  975. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  976. for the required syntax.
  977. @end table
  978. If a parameter is omitted, all values are allowed.
  979. Force the output to either unsigned 8-bit or signed 16-bit stereo
  980. @example
  981. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  982. @end example
  983. @section agate
  984. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  985. processing reduces disturbing noise between useful signals.
  986. Gating is done by detecting the volume below a chosen level @var{threshold}
  987. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  988. floor is set via @var{range}. Because an exact manipulation of the signal
  989. would cause distortion of the waveform the reduction can be levelled over
  990. time. This is done by setting @var{attack} and @var{release}.
  991. @var{attack} determines how long the signal has to fall below the threshold
  992. before any reduction will occur and @var{release} sets the time the signal
  993. has to rise above the threshold to reduce the reduction again.
  994. Shorter signals than the chosen attack time will be left untouched.
  995. @table @option
  996. @item level_in
  997. Set input level before filtering.
  998. Default is 1. Allowed range is from 0.015625 to 64.
  999. @item mode
  1000. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1001. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1002. will be amplified, expanding dynamic range in upward direction.
  1003. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1004. @item range
  1005. Set the level of gain reduction when the signal is below the threshold.
  1006. Default is 0.06125. Allowed range is from 0 to 1.
  1007. Setting this to 0 disables reduction and then filter behaves like expander.
  1008. @item threshold
  1009. If a signal rises above this level the gain reduction is released.
  1010. Default is 0.125. Allowed range is from 0 to 1.
  1011. @item ratio
  1012. Set a ratio by which the signal is reduced.
  1013. Default is 2. Allowed range is from 1 to 9000.
  1014. @item attack
  1015. Amount of milliseconds the signal has to rise above the threshold before gain
  1016. reduction stops.
  1017. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1018. @item release
  1019. Amount of milliseconds the signal has to fall below the threshold before the
  1020. reduction is increased again. Default is 250 milliseconds.
  1021. Allowed range is from 0.01 to 9000.
  1022. @item makeup
  1023. Set amount of amplification of signal after processing.
  1024. Default is 1. Allowed range is from 1 to 64.
  1025. @item knee
  1026. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1027. Default is 2.828427125. Allowed range is from 1 to 8.
  1028. @item detection
  1029. Choose if exact signal should be taken for detection or an RMS like one.
  1030. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1031. @item link
  1032. Choose if the average level between all channels or the louder channel affects
  1033. the reduction.
  1034. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1035. @end table
  1036. @section aiir
  1037. Apply an arbitrary Infinite Impulse Response filter.
  1038. It accepts the following parameters:
  1039. @table @option
  1040. @item z
  1041. Set numerator/zeros coefficients.
  1042. @item p
  1043. Set denominator/poles coefficients.
  1044. @item k
  1045. Set channels gains.
  1046. @item dry_gain
  1047. Set input gain.
  1048. @item wet_gain
  1049. Set output gain.
  1050. @item f
  1051. Set coefficients format.
  1052. @table @samp
  1053. @item tf
  1054. transfer function
  1055. @item zp
  1056. Z-plane zeros/poles, cartesian (default)
  1057. @item pr
  1058. Z-plane zeros/poles, polar radians
  1059. @item pd
  1060. Z-plane zeros/poles, polar degrees
  1061. @end table
  1062. @item r
  1063. Set kind of processing.
  1064. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1065. @item e
  1066. Set filtering precision.
  1067. @table @samp
  1068. @item dbl
  1069. double-precision floating-point (default)
  1070. @item flt
  1071. single-precision floating-point
  1072. @item i32
  1073. 32-bit integers
  1074. @item i16
  1075. 16-bit integers
  1076. @end table
  1077. @item mix
  1078. How much to use filtered signal in output. Default is 1.
  1079. Range is between 0 and 1.
  1080. @item response
  1081. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1082. By default it is disabled.
  1083. @item channel
  1084. Set for which IR channel to display frequency response. By default is first channel
  1085. displayed. This option is used only when @var{response} is enabled.
  1086. @item size
  1087. Set video stream size. This option is used only when @var{response} is enabled.
  1088. @end table
  1089. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1090. order.
  1091. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1092. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1093. imaginary unit.
  1094. Different coefficients and gains can be provided for every channel, in such case
  1095. use '|' to separate coefficients or gains. Last provided coefficients will be
  1096. used for all remaining channels.
  1097. @subsection Examples
  1098. @itemize
  1099. @item
  1100. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1101. @example
  1102. 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
  1103. @end example
  1104. @item
  1105. Same as above but in @code{zp} format:
  1106. @example
  1107. 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
  1108. @end example
  1109. @end itemize
  1110. @section alimiter
  1111. The limiter prevents an input signal from rising over a desired threshold.
  1112. This limiter uses lookahead technology to prevent your signal from distorting.
  1113. It means that there is a small delay after the signal is processed. Keep in mind
  1114. that the delay it produces is the attack time you set.
  1115. The filter accepts the following options:
  1116. @table @option
  1117. @item level_in
  1118. Set input gain. Default is 1.
  1119. @item level_out
  1120. Set output gain. Default is 1.
  1121. @item limit
  1122. Don't let signals above this level pass the limiter. Default is 1.
  1123. @item attack
  1124. The limiter will reach its attenuation level in this amount of time in
  1125. milliseconds. Default is 5 milliseconds.
  1126. @item release
  1127. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1128. Default is 50 milliseconds.
  1129. @item asc
  1130. When gain reduction is always needed ASC takes care of releasing to an
  1131. average reduction level rather than reaching a reduction of 0 in the release
  1132. time.
  1133. @item asc_level
  1134. Select how much the release time is affected by ASC, 0 means nearly no changes
  1135. in release time while 1 produces higher release times.
  1136. @item level
  1137. Auto level output signal. Default is enabled.
  1138. This normalizes audio back to 0dB if enabled.
  1139. @end table
  1140. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1141. with @ref{aresample} before applying this filter.
  1142. @section allpass
  1143. Apply a two-pole all-pass filter with central frequency (in Hz)
  1144. @var{frequency}, and filter-width @var{width}.
  1145. An all-pass filter changes the audio's frequency to phase relationship
  1146. without changing its frequency to amplitude relationship.
  1147. The filter accepts the following options:
  1148. @table @option
  1149. @item frequency, f
  1150. Set frequency in Hz.
  1151. @item width_type, t
  1152. Set method to specify band-width of filter.
  1153. @table @option
  1154. @item h
  1155. Hz
  1156. @item q
  1157. Q-Factor
  1158. @item o
  1159. octave
  1160. @item s
  1161. slope
  1162. @item k
  1163. kHz
  1164. @end table
  1165. @item width, w
  1166. Specify the band-width of a filter in width_type units.
  1167. @item mix, m
  1168. How much to use filtered signal in output. Default is 1.
  1169. Range is between 0 and 1.
  1170. @item channels, c
  1171. Specify which channels to filter, by default all available are filtered.
  1172. @end table
  1173. @subsection Commands
  1174. This filter supports the following commands:
  1175. @table @option
  1176. @item frequency, f
  1177. Change allpass frequency.
  1178. Syntax for the command is : "@var{frequency}"
  1179. @item width_type, t
  1180. Change allpass width_type.
  1181. Syntax for the command is : "@var{width_type}"
  1182. @item width, w
  1183. Change allpass width.
  1184. Syntax for the command is : "@var{width}"
  1185. @item mix, m
  1186. Change allpass mix.
  1187. Syntax for the command is : "@var{mix}"
  1188. @end table
  1189. @section aloop
  1190. Loop audio samples.
  1191. The filter accepts the following options:
  1192. @table @option
  1193. @item loop
  1194. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1195. Default is 0.
  1196. @item size
  1197. Set maximal number of samples. Default is 0.
  1198. @item start
  1199. Set first sample of loop. Default is 0.
  1200. @end table
  1201. @anchor{amerge}
  1202. @section amerge
  1203. Merge two or more audio streams into a single multi-channel stream.
  1204. The filter accepts the following options:
  1205. @table @option
  1206. @item inputs
  1207. Set the number of inputs. Default is 2.
  1208. @end table
  1209. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1210. the channel layout of the output will be set accordingly and the channels
  1211. will be reordered as necessary. If the channel layouts of the inputs are not
  1212. disjoint, the output will have all the channels of the first input then all
  1213. the channels of the second input, in that order, and the channel layout of
  1214. the output will be the default value corresponding to the total number of
  1215. channels.
  1216. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1217. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1218. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1219. first input, b1 is the first channel of the second input).
  1220. On the other hand, if both input are in stereo, the output channels will be
  1221. in the default order: a1, a2, b1, b2, and the channel layout will be
  1222. arbitrarily set to 4.0, which may or may not be the expected value.
  1223. All inputs must have the same sample rate, and format.
  1224. If inputs do not have the same duration, the output will stop with the
  1225. shortest.
  1226. @subsection Examples
  1227. @itemize
  1228. @item
  1229. Merge two mono files into a stereo stream:
  1230. @example
  1231. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1232. @end example
  1233. @item
  1234. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1235. @example
  1236. 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
  1237. @end example
  1238. @end itemize
  1239. @section amix
  1240. Mixes multiple audio inputs into a single output.
  1241. Note that this filter only supports float samples (the @var{amerge}
  1242. and @var{pan} audio filters support many formats). If the @var{amix}
  1243. input has integer samples then @ref{aresample} will be automatically
  1244. inserted to perform the conversion to float samples.
  1245. For example
  1246. @example
  1247. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1248. @end example
  1249. will mix 3 input audio streams to a single output with the same duration as the
  1250. first input and a dropout transition time of 3 seconds.
  1251. It accepts the following parameters:
  1252. @table @option
  1253. @item inputs
  1254. The number of inputs. If unspecified, it defaults to 2.
  1255. @item duration
  1256. How to determine the end-of-stream.
  1257. @table @option
  1258. @item longest
  1259. The duration of the longest input. (default)
  1260. @item shortest
  1261. The duration of the shortest input.
  1262. @item first
  1263. The duration of the first input.
  1264. @end table
  1265. @item dropout_transition
  1266. The transition time, in seconds, for volume renormalization when an input
  1267. stream ends. The default value is 2 seconds.
  1268. @item weights
  1269. Specify weight of each input audio stream as sequence.
  1270. Each weight is separated by space. By default all inputs have same weight.
  1271. @end table
  1272. @section amultiply
  1273. Multiply first audio stream with second audio stream and store result
  1274. in output audio stream. Multiplication is done by multiplying each
  1275. sample from first stream with sample at same position from second stream.
  1276. With this element-wise multiplication one can create amplitude fades and
  1277. amplitude modulations.
  1278. @section anequalizer
  1279. High-order parametric multiband equalizer for each channel.
  1280. It accepts the following parameters:
  1281. @table @option
  1282. @item params
  1283. This option string is in format:
  1284. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1285. Each equalizer band is separated by '|'.
  1286. @table @option
  1287. @item chn
  1288. Set channel number to which equalization will be applied.
  1289. If input doesn't have that channel the entry is ignored.
  1290. @item f
  1291. Set central frequency for band.
  1292. If input doesn't have that frequency the entry is ignored.
  1293. @item w
  1294. Set band width in hertz.
  1295. @item g
  1296. Set band gain in dB.
  1297. @item t
  1298. Set filter type for band, optional, can be:
  1299. @table @samp
  1300. @item 0
  1301. Butterworth, this is default.
  1302. @item 1
  1303. Chebyshev type 1.
  1304. @item 2
  1305. Chebyshev type 2.
  1306. @end table
  1307. @end table
  1308. @item curves
  1309. With this option activated frequency response of anequalizer is displayed
  1310. in video stream.
  1311. @item size
  1312. Set video stream size. Only useful if curves option is activated.
  1313. @item mgain
  1314. Set max gain that will be displayed. Only useful if curves option is activated.
  1315. Setting this to a reasonable value makes it possible to display gain which is derived from
  1316. neighbour bands which are too close to each other and thus produce higher gain
  1317. when both are activated.
  1318. @item fscale
  1319. Set frequency scale used to draw frequency response in video output.
  1320. Can be linear or logarithmic. Default is logarithmic.
  1321. @item colors
  1322. Set color for each channel curve which is going to be displayed in video stream.
  1323. This is list of color names separated by space or by '|'.
  1324. Unrecognised or missing colors will be replaced by white color.
  1325. @end table
  1326. @subsection Examples
  1327. @itemize
  1328. @item
  1329. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1330. for first 2 channels using Chebyshev type 1 filter:
  1331. @example
  1332. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1333. @end example
  1334. @end itemize
  1335. @subsection Commands
  1336. This filter supports the following commands:
  1337. @table @option
  1338. @item change
  1339. Alter existing filter parameters.
  1340. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1341. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1342. error is returned.
  1343. @var{freq} set new frequency parameter.
  1344. @var{width} set new width parameter in herz.
  1345. @var{gain} set new gain parameter in dB.
  1346. Full filter invocation with asendcmd may look like this:
  1347. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1348. @end table
  1349. @section anlmdn
  1350. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1351. Each sample is adjusted by looking for other samples with similar contexts. This
  1352. context similarity is defined by comparing their surrounding patches of size
  1353. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1354. The filter accepts the following options:
  1355. @table @option
  1356. @item s
  1357. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1358. @item p
  1359. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1360. Default value is 2 milliseconds.
  1361. @item r
  1362. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1363. Default value is 6 milliseconds.
  1364. @item o
  1365. Set the output mode.
  1366. It accepts the following values:
  1367. @table @option
  1368. @item i
  1369. Pass input unchanged.
  1370. @item o
  1371. Pass noise filtered out.
  1372. @item n
  1373. Pass only noise.
  1374. Default value is @var{o}.
  1375. @end table
  1376. @item m
  1377. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1378. @end table
  1379. @subsection Commands
  1380. This filter supports the following commands:
  1381. @table @option
  1382. @item s
  1383. Change denoise strength. Argument is single float number.
  1384. Syntax for the command is : "@var{s}"
  1385. @item o
  1386. Change output mode.
  1387. Syntax for the command is : "i", "o" or "n" string.
  1388. @end table
  1389. @section anull
  1390. Pass the audio source unchanged to the output.
  1391. @section apad
  1392. Pad the end of an audio stream with silence.
  1393. This can be used together with @command{ffmpeg} @option{-shortest} to
  1394. extend audio streams to the same length as the video stream.
  1395. A description of the accepted options follows.
  1396. @table @option
  1397. @item packet_size
  1398. Set silence packet size. Default value is 4096.
  1399. @item pad_len
  1400. Set the number of samples of silence to add to the end. After the
  1401. value is reached, the stream is terminated. This option is mutually
  1402. exclusive with @option{whole_len}.
  1403. @item whole_len
  1404. Set the minimum total number of samples in the output audio stream. If
  1405. the value is longer than the input audio length, silence is added to
  1406. the end, until the value is reached. This option is mutually exclusive
  1407. with @option{pad_len}.
  1408. @item pad_dur
  1409. Specify the duration of samples of silence to add. See
  1410. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1411. for the accepted syntax. Used only if set to non-zero value.
  1412. @item whole_dur
  1413. Specify the minimum total duration in the output audio stream. See
  1414. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1415. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1416. the input audio length, silence is added to the end, until the value is reached.
  1417. This option is mutually exclusive with @option{pad_dur}
  1418. @end table
  1419. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1420. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1421. the input stream indefinitely.
  1422. @subsection Examples
  1423. @itemize
  1424. @item
  1425. Add 1024 samples of silence to the end of the input:
  1426. @example
  1427. apad=pad_len=1024
  1428. @end example
  1429. @item
  1430. Make sure the audio output will contain at least 10000 samples, pad
  1431. the input with silence if required:
  1432. @example
  1433. apad=whole_len=10000
  1434. @end example
  1435. @item
  1436. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1437. video stream will always result the shortest and will be converted
  1438. until the end in the output file when using the @option{shortest}
  1439. option:
  1440. @example
  1441. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1442. @end example
  1443. @end itemize
  1444. @section aphaser
  1445. Add a phasing effect to the input audio.
  1446. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1447. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1448. A description of the accepted parameters follows.
  1449. @table @option
  1450. @item in_gain
  1451. Set input gain. Default is 0.4.
  1452. @item out_gain
  1453. Set output gain. Default is 0.74
  1454. @item delay
  1455. Set delay in milliseconds. Default is 3.0.
  1456. @item decay
  1457. Set decay. Default is 0.4.
  1458. @item speed
  1459. Set modulation speed in Hz. Default is 0.5.
  1460. @item type
  1461. Set modulation type. Default is triangular.
  1462. It accepts the following values:
  1463. @table @samp
  1464. @item triangular, t
  1465. @item sinusoidal, s
  1466. @end table
  1467. @end table
  1468. @section apulsator
  1469. Audio pulsator is something between an autopanner and a tremolo.
  1470. But it can produce funny stereo effects as well. Pulsator changes the volume
  1471. of the left and right channel based on a LFO (low frequency oscillator) with
  1472. different waveforms and shifted phases.
  1473. This filter have the ability to define an offset between left and right
  1474. channel. An offset of 0 means that both LFO shapes match each other.
  1475. The left and right channel are altered equally - a conventional tremolo.
  1476. An offset of 50% means that the shape of the right channel is exactly shifted
  1477. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1478. an autopanner. At 1 both curves match again. Every setting in between moves the
  1479. phase shift gapless between all stages and produces some "bypassing" sounds with
  1480. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1481. the 0.5) the faster the signal passes from the left to the right speaker.
  1482. The filter accepts the following options:
  1483. @table @option
  1484. @item level_in
  1485. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1486. @item level_out
  1487. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1488. @item mode
  1489. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1490. sawup or sawdown. Default is sine.
  1491. @item amount
  1492. Set modulation. Define how much of original signal is affected by the LFO.
  1493. @item offset_l
  1494. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1495. @item offset_r
  1496. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1497. @item width
  1498. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1499. @item timing
  1500. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1501. @item bpm
  1502. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1503. is set to bpm.
  1504. @item ms
  1505. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1506. is set to ms.
  1507. @item hz
  1508. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1509. if timing is set to hz.
  1510. @end table
  1511. @anchor{aresample}
  1512. @section aresample
  1513. Resample the input audio to the specified parameters, using the
  1514. libswresample library. If none are specified then the filter will
  1515. automatically convert between its input and output.
  1516. This filter is also able to stretch/squeeze the audio data to make it match
  1517. the timestamps or to inject silence / cut out audio to make it match the
  1518. timestamps, do a combination of both or do neither.
  1519. The filter accepts the syntax
  1520. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1521. expresses a sample rate and @var{resampler_options} is a list of
  1522. @var{key}=@var{value} pairs, separated by ":". See the
  1523. @ref{Resampler Options,,"Resampler Options" section in the
  1524. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1525. for the complete list of supported options.
  1526. @subsection Examples
  1527. @itemize
  1528. @item
  1529. Resample the input audio to 44100Hz:
  1530. @example
  1531. aresample=44100
  1532. @end example
  1533. @item
  1534. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1535. samples per second compensation:
  1536. @example
  1537. aresample=async=1000
  1538. @end example
  1539. @end itemize
  1540. @section areverse
  1541. Reverse an audio clip.
  1542. Warning: This filter requires memory to buffer the entire clip, so trimming
  1543. is suggested.
  1544. @subsection Examples
  1545. @itemize
  1546. @item
  1547. Take the first 5 seconds of a clip, and reverse it.
  1548. @example
  1549. atrim=end=5,areverse
  1550. @end example
  1551. @end itemize
  1552. @section asetnsamples
  1553. Set the number of samples per each output audio frame.
  1554. The last output packet may contain a different number of samples, as
  1555. the filter will flush all the remaining samples when the input audio
  1556. signals its end.
  1557. The filter accepts the following options:
  1558. @table @option
  1559. @item nb_out_samples, n
  1560. Set the number of frames per each output audio frame. The number is
  1561. intended as the number of samples @emph{per each channel}.
  1562. Default value is 1024.
  1563. @item pad, p
  1564. If set to 1, the filter will pad the last audio frame with zeroes, so
  1565. that the last frame will contain the same number of samples as the
  1566. previous ones. Default value is 1.
  1567. @end table
  1568. For example, to set the number of per-frame samples to 1234 and
  1569. disable padding for the last frame, use:
  1570. @example
  1571. asetnsamples=n=1234:p=0
  1572. @end example
  1573. @section asetrate
  1574. Set the sample rate without altering the PCM data.
  1575. This will result in a change of speed and pitch.
  1576. The filter accepts the following options:
  1577. @table @option
  1578. @item sample_rate, r
  1579. Set the output sample rate. Default is 44100 Hz.
  1580. @end table
  1581. @section ashowinfo
  1582. Show a line containing various information for each input audio frame.
  1583. The input audio is not modified.
  1584. The shown line contains a sequence of key/value pairs of the form
  1585. @var{key}:@var{value}.
  1586. The following values are shown in the output:
  1587. @table @option
  1588. @item n
  1589. The (sequential) number of the input frame, starting from 0.
  1590. @item pts
  1591. The presentation timestamp of the input frame, in time base units; the time base
  1592. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1593. @item pts_time
  1594. The presentation timestamp of the input frame in seconds.
  1595. @item pos
  1596. position of the frame in the input stream, -1 if this information in
  1597. unavailable and/or meaningless (for example in case of synthetic audio)
  1598. @item fmt
  1599. The sample format.
  1600. @item chlayout
  1601. The channel layout.
  1602. @item rate
  1603. The sample rate for the audio frame.
  1604. @item nb_samples
  1605. The number of samples (per channel) in the frame.
  1606. @item checksum
  1607. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1608. audio, the data is treated as if all the planes were concatenated.
  1609. @item plane_checksums
  1610. A list of Adler-32 checksums for each data plane.
  1611. @end table
  1612. @section asoftclip
  1613. Apply audio soft clipping.
  1614. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  1615. along a smooth curve, rather than the abrupt shape of hard-clipping.
  1616. This filter accepts the following options:
  1617. @table @option
  1618. @item type
  1619. Set type of soft-clipping.
  1620. It accepts the following values:
  1621. @table @option
  1622. @item tanh
  1623. @item atan
  1624. @item cubic
  1625. @item exp
  1626. @item alg
  1627. @item quintic
  1628. @item sin
  1629. @end table
  1630. @item param
  1631. Set additional parameter which controls sigmoid function.
  1632. @end table
  1633. @section asr
  1634. Automatic Speech Recognition
  1635. This filter uses PocketSphinx for speech recognition. To enable
  1636. compilation of this filter, you need to configure FFmpeg with
  1637. @code{--enable-pocketsphinx}.
  1638. It accepts the following options:
  1639. @table @option
  1640. @item rate
  1641. Set sampling rate of input audio. Defaults is @code{16000}.
  1642. This need to match speech models, otherwise one will get poor results.
  1643. @item hmm
  1644. Set dictionary containing acoustic model files.
  1645. @item dict
  1646. Set pronunciation dictionary.
  1647. @item lm
  1648. Set language model file.
  1649. @item lmctl
  1650. Set language model set.
  1651. @item lmname
  1652. Set which language model to use.
  1653. @item logfn
  1654. Set output for log messages.
  1655. @end table
  1656. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  1657. @anchor{astats}
  1658. @section astats
  1659. Display time domain statistical information about the audio channels.
  1660. Statistics are calculated and displayed for each audio channel and,
  1661. where applicable, an overall figure is also given.
  1662. It accepts the following option:
  1663. @table @option
  1664. @item length
  1665. Short window length in seconds, used for peak and trough RMS measurement.
  1666. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1667. @item metadata
  1668. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1669. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1670. disabled.
  1671. Available keys for each channel are:
  1672. DC_offset
  1673. Min_level
  1674. Max_level
  1675. Min_difference
  1676. Max_difference
  1677. Mean_difference
  1678. RMS_difference
  1679. Peak_level
  1680. RMS_peak
  1681. RMS_trough
  1682. Crest_factor
  1683. Flat_factor
  1684. Peak_count
  1685. Bit_depth
  1686. Dynamic_range
  1687. Zero_crossings
  1688. Zero_crossings_rate
  1689. Number_of_NaNs
  1690. Number_of_Infs
  1691. Number_of_denormals
  1692. and for Overall:
  1693. DC_offset
  1694. Min_level
  1695. Max_level
  1696. Min_difference
  1697. Max_difference
  1698. Mean_difference
  1699. RMS_difference
  1700. Peak_level
  1701. RMS_level
  1702. RMS_peak
  1703. RMS_trough
  1704. Flat_factor
  1705. Peak_count
  1706. Bit_depth
  1707. Number_of_samples
  1708. Number_of_NaNs
  1709. Number_of_Infs
  1710. Number_of_denormals
  1711. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1712. this @code{lavfi.astats.Overall.Peak_count}.
  1713. For description what each key means read below.
  1714. @item reset
  1715. Set number of frame after which stats are going to be recalculated.
  1716. Default is disabled.
  1717. @item measure_perchannel
  1718. Select the entries which need to be measured per channel. The metadata keys can
  1719. be used as flags, default is @option{all} which measures everything.
  1720. @option{none} disables all per channel measurement.
  1721. @item measure_overall
  1722. Select the entries which need to be measured overall. The metadata keys can
  1723. be used as flags, default is @option{all} which measures everything.
  1724. @option{none} disables all overall measurement.
  1725. @end table
  1726. A description of each shown parameter follows:
  1727. @table @option
  1728. @item DC offset
  1729. Mean amplitude displacement from zero.
  1730. @item Min level
  1731. Minimal sample level.
  1732. @item Max level
  1733. Maximal sample level.
  1734. @item Min difference
  1735. Minimal difference between two consecutive samples.
  1736. @item Max difference
  1737. Maximal difference between two consecutive samples.
  1738. @item Mean difference
  1739. Mean difference between two consecutive samples.
  1740. The average of each difference between two consecutive samples.
  1741. @item RMS difference
  1742. Root Mean Square difference between two consecutive samples.
  1743. @item Peak level dB
  1744. @item RMS level dB
  1745. Standard peak and RMS level measured in dBFS.
  1746. @item RMS peak dB
  1747. @item RMS trough dB
  1748. Peak and trough values for RMS level measured over a short window.
  1749. @item Crest factor
  1750. Standard ratio of peak to RMS level (note: not in dB).
  1751. @item Flat factor
  1752. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1753. (i.e. either @var{Min level} or @var{Max level}).
  1754. @item Peak count
  1755. Number of occasions (not the number of samples) that the signal attained either
  1756. @var{Min level} or @var{Max level}.
  1757. @item Bit depth
  1758. Overall bit depth of audio. Number of bits used for each sample.
  1759. @item Dynamic range
  1760. Measured dynamic range of audio in dB.
  1761. @item Zero crossings
  1762. Number of points where the waveform crosses the zero level axis.
  1763. @item Zero crossings rate
  1764. Rate of Zero crossings and number of audio samples.
  1765. @end table
  1766. @section atempo
  1767. Adjust audio tempo.
  1768. The filter accepts exactly one parameter, the audio tempo. If not
  1769. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1770. be in the [0.5, 100.0] range.
  1771. Note that tempo greater than 2 will skip some samples rather than
  1772. blend them in. If for any reason this is a concern it is always
  1773. possible to daisy-chain several instances of atempo to achieve the
  1774. desired product tempo.
  1775. @subsection Examples
  1776. @itemize
  1777. @item
  1778. Slow down audio to 80% tempo:
  1779. @example
  1780. atempo=0.8
  1781. @end example
  1782. @item
  1783. To speed up audio to 300% tempo:
  1784. @example
  1785. atempo=3
  1786. @end example
  1787. @item
  1788. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1789. @example
  1790. atempo=sqrt(3),atempo=sqrt(3)
  1791. @end example
  1792. @end itemize
  1793. @section atrim
  1794. Trim the input so that the output contains one continuous subpart of the input.
  1795. It accepts the following parameters:
  1796. @table @option
  1797. @item start
  1798. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1799. sample with the timestamp @var{start} will be the first sample in the output.
  1800. @item end
  1801. Specify time of the first audio sample that will be dropped, i.e. the
  1802. audio sample immediately preceding the one with the timestamp @var{end} will be
  1803. the last sample in the output.
  1804. @item start_pts
  1805. Same as @var{start}, except this option sets the start timestamp in samples
  1806. instead of seconds.
  1807. @item end_pts
  1808. Same as @var{end}, except this option sets the end timestamp in samples instead
  1809. of seconds.
  1810. @item duration
  1811. The maximum duration of the output in seconds.
  1812. @item start_sample
  1813. The number of the first sample that should be output.
  1814. @item end_sample
  1815. The number of the first sample that should be dropped.
  1816. @end table
  1817. @option{start}, @option{end}, and @option{duration} are expressed as time
  1818. duration specifications; see
  1819. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1820. Note that the first two sets of the start/end options and the @option{duration}
  1821. option look at the frame timestamp, while the _sample options simply count the
  1822. samples that pass through the filter. So start/end_pts and start/end_sample will
  1823. give different results when the timestamps are wrong, inexact or do not start at
  1824. zero. Also note that this filter does not modify the timestamps. If you wish
  1825. to have the output timestamps start at zero, insert the asetpts filter after the
  1826. atrim filter.
  1827. If multiple start or end options are set, this filter tries to be greedy and
  1828. keep all samples that match at least one of the specified constraints. To keep
  1829. only the part that matches all the constraints at once, chain multiple atrim
  1830. filters.
  1831. The defaults are such that all the input is kept. So it is possible to set e.g.
  1832. just the end values to keep everything before the specified time.
  1833. Examples:
  1834. @itemize
  1835. @item
  1836. Drop everything except the second minute of input:
  1837. @example
  1838. ffmpeg -i INPUT -af atrim=60:120
  1839. @end example
  1840. @item
  1841. Keep only the first 1000 samples:
  1842. @example
  1843. ffmpeg -i INPUT -af atrim=end_sample=1000
  1844. @end example
  1845. @end itemize
  1846. @section bandpass
  1847. Apply a two-pole Butterworth band-pass filter with central
  1848. frequency @var{frequency}, and (3dB-point) band-width width.
  1849. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1850. instead of the default: constant 0dB peak gain.
  1851. The filter roll off at 6dB per octave (20dB per decade).
  1852. The filter accepts the following options:
  1853. @table @option
  1854. @item frequency, f
  1855. Set the filter's central frequency. Default is @code{3000}.
  1856. @item csg
  1857. Constant skirt gain if set to 1. Defaults to 0.
  1858. @item width_type, t
  1859. Set method to specify band-width of filter.
  1860. @table @option
  1861. @item h
  1862. Hz
  1863. @item q
  1864. Q-Factor
  1865. @item o
  1866. octave
  1867. @item s
  1868. slope
  1869. @item k
  1870. kHz
  1871. @end table
  1872. @item width, w
  1873. Specify the band-width of a filter in width_type units.
  1874. @item mix, m
  1875. How much to use filtered signal in output. Default is 1.
  1876. Range is between 0 and 1.
  1877. @item channels, c
  1878. Specify which channels to filter, by default all available are filtered.
  1879. @end table
  1880. @subsection Commands
  1881. This filter supports the following commands:
  1882. @table @option
  1883. @item frequency, f
  1884. Change bandpass frequency.
  1885. Syntax for the command is : "@var{frequency}"
  1886. @item width_type, t
  1887. Change bandpass width_type.
  1888. Syntax for the command is : "@var{width_type}"
  1889. @item width, w
  1890. Change bandpass width.
  1891. Syntax for the command is : "@var{width}"
  1892. @item mix, m
  1893. Change bandpass mix.
  1894. Syntax for the command is : "@var{mix}"
  1895. @end table
  1896. @section bandreject
  1897. Apply a two-pole Butterworth band-reject filter with central
  1898. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1899. The filter roll off at 6dB per octave (20dB per decade).
  1900. The filter accepts the following options:
  1901. @table @option
  1902. @item frequency, f
  1903. Set the filter's central frequency. Default is @code{3000}.
  1904. @item width_type, t
  1905. Set method to specify band-width of filter.
  1906. @table @option
  1907. @item h
  1908. Hz
  1909. @item q
  1910. Q-Factor
  1911. @item o
  1912. octave
  1913. @item s
  1914. slope
  1915. @item k
  1916. kHz
  1917. @end table
  1918. @item width, w
  1919. Specify the band-width of a filter in width_type units.
  1920. @item mix, m
  1921. How much to use filtered signal in output. Default is 1.
  1922. Range is between 0 and 1.
  1923. @item channels, c
  1924. Specify which channels to filter, by default all available are filtered.
  1925. @end table
  1926. @subsection Commands
  1927. This filter supports the following commands:
  1928. @table @option
  1929. @item frequency, f
  1930. Change bandreject frequency.
  1931. Syntax for the command is : "@var{frequency}"
  1932. @item width_type, t
  1933. Change bandreject width_type.
  1934. Syntax for the command is : "@var{width_type}"
  1935. @item width, w
  1936. Change bandreject width.
  1937. Syntax for the command is : "@var{width}"
  1938. @item mix, m
  1939. Change bandreject mix.
  1940. Syntax for the command is : "@var{mix}"
  1941. @end table
  1942. @section bass, lowshelf
  1943. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1944. shelving filter with a response similar to that of a standard
  1945. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1946. The filter accepts the following options:
  1947. @table @option
  1948. @item gain, g
  1949. Give the gain at 0 Hz. Its useful range is about -20
  1950. (for a large cut) to +20 (for a large boost).
  1951. Beware of clipping when using a positive gain.
  1952. @item frequency, f
  1953. Set the filter's central frequency and so can be used
  1954. to extend or reduce the frequency range to be boosted or cut.
  1955. The default value is @code{100} Hz.
  1956. @item width_type, t
  1957. Set method to specify band-width of filter.
  1958. @table @option
  1959. @item h
  1960. Hz
  1961. @item q
  1962. Q-Factor
  1963. @item o
  1964. octave
  1965. @item s
  1966. slope
  1967. @item k
  1968. kHz
  1969. @end table
  1970. @item width, w
  1971. Determine how steep is the filter's shelf transition.
  1972. @item mix, m
  1973. How much to use filtered signal in output. Default is 1.
  1974. Range is between 0 and 1.
  1975. @item channels, c
  1976. Specify which channels to filter, by default all available are filtered.
  1977. @end table
  1978. @subsection Commands
  1979. This filter supports the following commands:
  1980. @table @option
  1981. @item frequency, f
  1982. Change bass frequency.
  1983. Syntax for the command is : "@var{frequency}"
  1984. @item width_type, t
  1985. Change bass width_type.
  1986. Syntax for the command is : "@var{width_type}"
  1987. @item width, w
  1988. Change bass width.
  1989. Syntax for the command is : "@var{width}"
  1990. @item gain, g
  1991. Change bass gain.
  1992. Syntax for the command is : "@var{gain}"
  1993. @item mix, m
  1994. Change bass mix.
  1995. Syntax for the command is : "@var{mix}"
  1996. @end table
  1997. @section biquad
  1998. Apply a biquad IIR filter with the given coefficients.
  1999. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2000. are the numerator and denominator coefficients respectively.
  2001. and @var{channels}, @var{c} specify which channels to filter, by default all
  2002. available are filtered.
  2003. @subsection Commands
  2004. This filter supports the following commands:
  2005. @table @option
  2006. @item a0
  2007. @item a1
  2008. @item a2
  2009. @item b0
  2010. @item b1
  2011. @item b2
  2012. Change biquad parameter.
  2013. Syntax for the command is : "@var{value}"
  2014. @item mix, m
  2015. How much to use filtered signal in output. Default is 1.
  2016. Range is between 0 and 1.
  2017. @end table
  2018. @section bs2b
  2019. Bauer stereo to binaural transformation, which improves headphone listening of
  2020. stereo audio records.
  2021. To enable compilation of this filter you need to configure FFmpeg with
  2022. @code{--enable-libbs2b}.
  2023. It accepts the following parameters:
  2024. @table @option
  2025. @item profile
  2026. Pre-defined crossfeed level.
  2027. @table @option
  2028. @item default
  2029. Default level (fcut=700, feed=50).
  2030. @item cmoy
  2031. Chu Moy circuit (fcut=700, feed=60).
  2032. @item jmeier
  2033. Jan Meier circuit (fcut=650, feed=95).
  2034. @end table
  2035. @item fcut
  2036. Cut frequency (in Hz).
  2037. @item feed
  2038. Feed level (in Hz).
  2039. @end table
  2040. @section channelmap
  2041. Remap input channels to new locations.
  2042. It accepts the following parameters:
  2043. @table @option
  2044. @item map
  2045. Map channels from input to output. The argument is a '|'-separated list of
  2046. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2047. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2048. channel (e.g. FL for front left) or its index in the input channel layout.
  2049. @var{out_channel} is the name of the output channel or its index in the output
  2050. channel layout. If @var{out_channel} is not given then it is implicitly an
  2051. index, starting with zero and increasing by one for each mapping.
  2052. @item channel_layout
  2053. The channel layout of the output stream.
  2054. @end table
  2055. If no mapping is present, the filter will implicitly map input channels to
  2056. output channels, preserving indices.
  2057. @subsection Examples
  2058. @itemize
  2059. @item
  2060. For example, assuming a 5.1+downmix input MOV file,
  2061. @example
  2062. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2063. @end example
  2064. will create an output WAV file tagged as stereo from the downmix channels of
  2065. the input.
  2066. @item
  2067. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2068. @example
  2069. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2070. @end example
  2071. @end itemize
  2072. @section channelsplit
  2073. Split each channel from an input audio stream into a separate output stream.
  2074. It accepts the following parameters:
  2075. @table @option
  2076. @item channel_layout
  2077. The channel layout of the input stream. The default is "stereo".
  2078. @item channels
  2079. A channel layout describing the channels to be extracted as separate output streams
  2080. or "all" to extract each input channel as a separate stream. The default is "all".
  2081. Choosing channels not present in channel layout in the input will result in an error.
  2082. @end table
  2083. @subsection Examples
  2084. @itemize
  2085. @item
  2086. For example, assuming a stereo input MP3 file,
  2087. @example
  2088. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2089. @end example
  2090. will create an output Matroska file with two audio streams, one containing only
  2091. the left channel and the other the right channel.
  2092. @item
  2093. Split a 5.1 WAV file into per-channel files:
  2094. @example
  2095. ffmpeg -i in.wav -filter_complex
  2096. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2097. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2098. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2099. side_right.wav
  2100. @end example
  2101. @item
  2102. Extract only LFE from a 5.1 WAV file:
  2103. @example
  2104. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2105. -map '[LFE]' lfe.wav
  2106. @end example
  2107. @end itemize
  2108. @section chorus
  2109. Add a chorus effect to the audio.
  2110. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2111. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2112. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2113. The modulation depth defines the range the modulated delay is played before or after
  2114. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2115. sound tuned around the original one, like in a chorus where some vocals are slightly
  2116. off key.
  2117. It accepts the following parameters:
  2118. @table @option
  2119. @item in_gain
  2120. Set input gain. Default is 0.4.
  2121. @item out_gain
  2122. Set output gain. Default is 0.4.
  2123. @item delays
  2124. Set delays. A typical delay is around 40ms to 60ms.
  2125. @item decays
  2126. Set decays.
  2127. @item speeds
  2128. Set speeds.
  2129. @item depths
  2130. Set depths.
  2131. @end table
  2132. @subsection Examples
  2133. @itemize
  2134. @item
  2135. A single delay:
  2136. @example
  2137. chorus=0.7:0.9:55:0.4:0.25:2
  2138. @end example
  2139. @item
  2140. Two delays:
  2141. @example
  2142. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2143. @end example
  2144. @item
  2145. Fuller sounding chorus with three delays:
  2146. @example
  2147. 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
  2148. @end example
  2149. @end itemize
  2150. @section compand
  2151. Compress or expand the audio's dynamic range.
  2152. It accepts the following parameters:
  2153. @table @option
  2154. @item attacks
  2155. @item decays
  2156. A list of times in seconds for each channel over which the instantaneous level
  2157. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2158. increase of volume and @var{decays} refers to decrease of volume. For most
  2159. situations, the attack time (response to the audio getting louder) should be
  2160. shorter than the decay time, because the human ear is more sensitive to sudden
  2161. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2162. a typical value for decay is 0.8 seconds.
  2163. If specified number of attacks & decays is lower than number of channels, the last
  2164. set attack/decay will be used for all remaining channels.
  2165. @item points
  2166. A list of points for the transfer function, specified in dB relative to the
  2167. maximum possible signal amplitude. Each key points list must be defined using
  2168. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2169. @code{x0/y0 x1/y1 x2/y2 ....}
  2170. The input values must be in strictly increasing order but the transfer function
  2171. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2172. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2173. function are @code{-70/-70|-60/-20|1/0}.
  2174. @item soft-knee
  2175. Set the curve radius in dB for all joints. It defaults to 0.01.
  2176. @item gain
  2177. Set the additional gain in dB to be applied at all points on the transfer
  2178. function. This allows for easy adjustment of the overall gain.
  2179. It defaults to 0.
  2180. @item volume
  2181. Set an initial volume, in dB, to be assumed for each channel when filtering
  2182. starts. This permits the user to supply a nominal level initially, so that, for
  2183. example, a very large gain is not applied to initial signal levels before the
  2184. companding has begun to operate. A typical value for audio which is initially
  2185. quiet is -90 dB. It defaults to 0.
  2186. @item delay
  2187. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2188. delayed before being fed to the volume adjuster. Specifying a delay
  2189. approximately equal to the attack/decay times allows the filter to effectively
  2190. operate in predictive rather than reactive mode. It defaults to 0.
  2191. @end table
  2192. @subsection Examples
  2193. @itemize
  2194. @item
  2195. Make music with both quiet and loud passages suitable for listening to in a
  2196. noisy environment:
  2197. @example
  2198. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2199. @end example
  2200. Another example for audio with whisper and explosion parts:
  2201. @example
  2202. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2203. @end example
  2204. @item
  2205. A noise gate for when the noise is at a lower level than the signal:
  2206. @example
  2207. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2208. @end example
  2209. @item
  2210. Here is another noise gate, this time for when the noise is at a higher level
  2211. than the signal (making it, in some ways, similar to squelch):
  2212. @example
  2213. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2214. @end example
  2215. @item
  2216. 2:1 compression starting at -6dB:
  2217. @example
  2218. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2219. @end example
  2220. @item
  2221. 2:1 compression starting at -9dB:
  2222. @example
  2223. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2224. @end example
  2225. @item
  2226. 2:1 compression starting at -12dB:
  2227. @example
  2228. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2229. @end example
  2230. @item
  2231. 2:1 compression starting at -18dB:
  2232. @example
  2233. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2234. @end example
  2235. @item
  2236. 3:1 compression starting at -15dB:
  2237. @example
  2238. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2239. @end example
  2240. @item
  2241. Compressor/Gate:
  2242. @example
  2243. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2244. @end example
  2245. @item
  2246. Expander:
  2247. @example
  2248. 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
  2249. @end example
  2250. @item
  2251. Hard limiter at -6dB:
  2252. @example
  2253. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2254. @end example
  2255. @item
  2256. Hard limiter at -12dB:
  2257. @example
  2258. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2259. @end example
  2260. @item
  2261. Hard noise gate at -35 dB:
  2262. @example
  2263. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2264. @end example
  2265. @item
  2266. Soft limiter:
  2267. @example
  2268. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2269. @end example
  2270. @end itemize
  2271. @section compensationdelay
  2272. Compensation Delay Line is a metric based delay to compensate differing
  2273. positions of microphones or speakers.
  2274. For example, you have recorded guitar with two microphones placed in
  2275. different locations. Because the front of sound wave has fixed speed in
  2276. normal conditions, the phasing of microphones can vary and depends on
  2277. their location and interposition. The best sound mix can be achieved when
  2278. these microphones are in phase (synchronized). Note that a distance of
  2279. ~30 cm between microphones makes one microphone capture the signal in
  2280. antiphase to the other microphone. That makes the final mix sound moody.
  2281. This filter helps to solve phasing problems by adding different delays
  2282. to each microphone track and make them synchronized.
  2283. The best result can be reached when you take one track as base and
  2284. synchronize other tracks one by one with it.
  2285. Remember that synchronization/delay tolerance depends on sample rate, too.
  2286. Higher sample rates will give more tolerance.
  2287. The filter accepts the following parameters:
  2288. @table @option
  2289. @item mm
  2290. Set millimeters distance. This is compensation distance for fine tuning.
  2291. Default is 0.
  2292. @item cm
  2293. Set cm distance. This is compensation distance for tightening distance setup.
  2294. Default is 0.
  2295. @item m
  2296. Set meters distance. This is compensation distance for hard distance setup.
  2297. Default is 0.
  2298. @item dry
  2299. Set dry amount. Amount of unprocessed (dry) signal.
  2300. Default is 0.
  2301. @item wet
  2302. Set wet amount. Amount of processed (wet) signal.
  2303. Default is 1.
  2304. @item temp
  2305. Set temperature in degrees Celsius. This is the temperature of the environment.
  2306. Default is 20.
  2307. @end table
  2308. @section crossfeed
  2309. Apply headphone crossfeed filter.
  2310. Crossfeed is the process of blending the left and right channels of stereo
  2311. audio recording.
  2312. It is mainly used to reduce extreme stereo separation of low frequencies.
  2313. The intent is to produce more speaker like sound to the listener.
  2314. The filter accepts the following options:
  2315. @table @option
  2316. @item strength
  2317. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2318. This sets gain of low shelf filter for side part of stereo image.
  2319. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2320. @item range
  2321. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2322. This sets cut off frequency of low shelf filter. Default is cut off near
  2323. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2324. @item level_in
  2325. Set input gain. Default is 0.9.
  2326. @item level_out
  2327. Set output gain. Default is 1.
  2328. @end table
  2329. @section crystalizer
  2330. Simple algorithm to expand audio dynamic range.
  2331. The filter accepts the following options:
  2332. @table @option
  2333. @item i
  2334. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2335. (unchanged sound) to 10.0 (maximum effect).
  2336. @item c
  2337. Enable clipping. By default is enabled.
  2338. @end table
  2339. @section dcshift
  2340. Apply a DC shift to the audio.
  2341. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2342. in the recording chain) from the audio. The effect of a DC offset is reduced
  2343. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2344. a signal has a DC offset.
  2345. @table @option
  2346. @item shift
  2347. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2348. the audio.
  2349. @item limitergain
  2350. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2351. used to prevent clipping.
  2352. @end table
  2353. @section deesser
  2354. Apply de-essing to the audio samples.
  2355. @table @option
  2356. @item i
  2357. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  2358. Default is 0.
  2359. @item m
  2360. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  2361. Default is 0.5.
  2362. @item f
  2363. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  2364. Default is 0.5.
  2365. @item s
  2366. Set the output mode.
  2367. It accepts the following values:
  2368. @table @option
  2369. @item i
  2370. Pass input unchanged.
  2371. @item o
  2372. Pass ess filtered out.
  2373. @item e
  2374. Pass only ess.
  2375. Default value is @var{o}.
  2376. @end table
  2377. @end table
  2378. @section drmeter
  2379. Measure audio dynamic range.
  2380. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2381. is found in transition material. And anything less that 8 have very poor dynamics
  2382. and is very compressed.
  2383. The filter accepts the following options:
  2384. @table @option
  2385. @item length
  2386. Set window length in seconds used to split audio into segments of equal length.
  2387. Default is 3 seconds.
  2388. @end table
  2389. @section dynaudnorm
  2390. Dynamic Audio Normalizer.
  2391. This filter applies a certain amount of gain to the input audio in order
  2392. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2393. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2394. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2395. This allows for applying extra gain to the "quiet" sections of the audio
  2396. while avoiding distortions or clipping the "loud" sections. In other words:
  2397. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2398. sections, in the sense that the volume of each section is brought to the
  2399. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2400. this goal *without* applying "dynamic range compressing". It will retain 100%
  2401. of the dynamic range *within* each section of the audio file.
  2402. @table @option
  2403. @item framelen, f
  2404. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2405. Default is 500 milliseconds.
  2406. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2407. referred to as frames. This is required, because a peak magnitude has no
  2408. meaning for just a single sample value. Instead, we need to determine the
  2409. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2410. normalizer would simply use the peak magnitude of the complete file, the
  2411. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2412. frame. The length of a frame is specified in milliseconds. By default, the
  2413. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2414. been found to give good results with most files.
  2415. Note that the exact frame length, in number of samples, will be determined
  2416. automatically, based on the sampling rate of the individual input audio file.
  2417. @item gausssize, g
  2418. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2419. number. Default is 31.
  2420. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2421. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2422. is specified in frames, centered around the current frame. For the sake of
  2423. simplicity, this must be an odd number. Consequently, the default value of 31
  2424. takes into account the current frame, as well as the 15 preceding frames and
  2425. the 15 subsequent frames. Using a larger window results in a stronger
  2426. smoothing effect and thus in less gain variation, i.e. slower gain
  2427. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2428. effect and thus in more gain variation, i.e. faster gain adaptation.
  2429. In other words, the more you increase this value, the more the Dynamic Audio
  2430. Normalizer will behave like a "traditional" normalization filter. On the
  2431. contrary, the more you decrease this value, the more the Dynamic Audio
  2432. Normalizer will behave like a dynamic range compressor.
  2433. @item peak, p
  2434. Set the target peak value. This specifies the highest permissible magnitude
  2435. level for the normalized audio input. This filter will try to approach the
  2436. target peak magnitude as closely as possible, but at the same time it also
  2437. makes sure that the normalized signal will never exceed the peak magnitude.
  2438. A frame's maximum local gain factor is imposed directly by the target peak
  2439. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2440. It is not recommended to go above this value.
  2441. @item maxgain, m
  2442. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2443. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2444. factor for each input frame, i.e. the maximum gain factor that does not
  2445. result in clipping or distortion. The maximum gain factor is determined by
  2446. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2447. additionally bounds the frame's maximum gain factor by a predetermined
  2448. (global) maximum gain factor. This is done in order to avoid excessive gain
  2449. factors in "silent" or almost silent frames. By default, the maximum gain
  2450. factor is 10.0, For most inputs the default value should be sufficient and
  2451. it usually is not recommended to increase this value. Though, for input
  2452. with an extremely low overall volume level, it may be necessary to allow even
  2453. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2454. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2455. Instead, a "sigmoid" threshold function will be applied. This way, the
  2456. gain factors will smoothly approach the threshold value, but never exceed that
  2457. value.
  2458. @item targetrms, r
  2459. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2460. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2461. This means that the maximum local gain factor for each frame is defined
  2462. (only) by the frame's highest magnitude sample. This way, the samples can
  2463. be amplified as much as possible without exceeding the maximum signal
  2464. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2465. Normalizer can also take into account the frame's root mean square,
  2466. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2467. determine the power of a time-varying signal. It is therefore considered
  2468. that the RMS is a better approximation of the "perceived loudness" than
  2469. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2470. frames to a constant RMS value, a uniform "perceived loudness" can be
  2471. established. If a target RMS value has been specified, a frame's local gain
  2472. factor is defined as the factor that would result in exactly that RMS value.
  2473. Note, however, that the maximum local gain factor is still restricted by the
  2474. frame's highest magnitude sample, in order to prevent clipping.
  2475. @item coupling, n
  2476. Enable channels coupling. By default is enabled.
  2477. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2478. amount. This means the same gain factor will be applied to all channels, i.e.
  2479. the maximum possible gain factor is determined by the "loudest" channel.
  2480. However, in some recordings, it may happen that the volume of the different
  2481. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2482. In this case, this option can be used to disable the channel coupling. This way,
  2483. the gain factor will be determined independently for each channel, depending
  2484. only on the individual channel's highest magnitude sample. This allows for
  2485. harmonizing the volume of the different channels.
  2486. @item correctdc, c
  2487. Enable DC bias correction. By default is disabled.
  2488. An audio signal (in the time domain) is a sequence of sample values.
  2489. In the Dynamic Audio Normalizer these sample values are represented in the
  2490. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2491. audio signal, or "waveform", should be centered around the zero point.
  2492. That means if we calculate the mean value of all samples in a file, or in a
  2493. single frame, then the result should be 0.0 or at least very close to that
  2494. value. If, however, there is a significant deviation of the mean value from
  2495. 0.0, in either positive or negative direction, this is referred to as a
  2496. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2497. Audio Normalizer provides optional DC bias correction.
  2498. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2499. the mean value, or "DC correction" offset, of each input frame and subtract
  2500. that value from all of the frame's sample values which ensures those samples
  2501. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2502. boundaries, the DC correction offset values will be interpolated smoothly
  2503. between neighbouring frames.
  2504. @item altboundary, b
  2505. Enable alternative boundary mode. By default is disabled.
  2506. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2507. around each frame. This includes the preceding frames as well as the
  2508. subsequent frames. However, for the "boundary" frames, located at the very
  2509. beginning and at the very end of the audio file, not all neighbouring
  2510. frames are available. In particular, for the first few frames in the audio
  2511. file, the preceding frames are not known. And, similarly, for the last few
  2512. frames in the audio file, the subsequent frames are not known. Thus, the
  2513. question arises which gain factors should be assumed for the missing frames
  2514. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2515. to deal with this situation. The default boundary mode assumes a gain factor
  2516. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2517. "fade out" at the beginning and at the end of the input, respectively.
  2518. @item compress, s
  2519. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2520. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2521. compression. This means that signal peaks will not be pruned and thus the
  2522. full dynamic range will be retained within each local neighbourhood. However,
  2523. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2524. normalization algorithm with a more "traditional" compression.
  2525. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2526. (thresholding) function. If (and only if) the compression feature is enabled,
  2527. all input frames will be processed by a soft knee thresholding function prior
  2528. to the actual normalization process. Put simply, the thresholding function is
  2529. going to prune all samples whose magnitude exceeds a certain threshold value.
  2530. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2531. value. Instead, the threshold value will be adjusted for each individual
  2532. frame.
  2533. In general, smaller parameters result in stronger compression, and vice versa.
  2534. Values below 3.0 are not recommended, because audible distortion may appear.
  2535. @end table
  2536. @section earwax
  2537. Make audio easier to listen to on headphones.
  2538. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2539. so that when listened to on headphones the stereo image is moved from
  2540. inside your head (standard for headphones) to outside and in front of
  2541. the listener (standard for speakers).
  2542. Ported from SoX.
  2543. @section equalizer
  2544. Apply a two-pole peaking equalisation (EQ) filter. With this
  2545. filter, the signal-level at and around a selected frequency can
  2546. be increased or decreased, whilst (unlike bandpass and bandreject
  2547. filters) that at all other frequencies is unchanged.
  2548. In order to produce complex equalisation curves, this filter can
  2549. be given several times, each with a different central frequency.
  2550. The filter accepts the following options:
  2551. @table @option
  2552. @item frequency, f
  2553. Set the filter's central frequency in Hz.
  2554. @item width_type, t
  2555. Set method to specify band-width of filter.
  2556. @table @option
  2557. @item h
  2558. Hz
  2559. @item q
  2560. Q-Factor
  2561. @item o
  2562. octave
  2563. @item s
  2564. slope
  2565. @item k
  2566. kHz
  2567. @end table
  2568. @item width, w
  2569. Specify the band-width of a filter in width_type units.
  2570. @item gain, g
  2571. Set the required gain or attenuation in dB.
  2572. Beware of clipping when using a positive gain.
  2573. @item mix, m
  2574. How much to use filtered signal in output. Default is 1.
  2575. Range is between 0 and 1.
  2576. @item channels, c
  2577. Specify which channels to filter, by default all available are filtered.
  2578. @end table
  2579. @subsection Examples
  2580. @itemize
  2581. @item
  2582. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2583. @example
  2584. equalizer=f=1000:t=h:width=200:g=-10
  2585. @end example
  2586. @item
  2587. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2588. @example
  2589. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2590. @end example
  2591. @end itemize
  2592. @subsection Commands
  2593. This filter supports the following commands:
  2594. @table @option
  2595. @item frequency, f
  2596. Change equalizer frequency.
  2597. Syntax for the command is : "@var{frequency}"
  2598. @item width_type, t
  2599. Change equalizer width_type.
  2600. Syntax for the command is : "@var{width_type}"
  2601. @item width, w
  2602. Change equalizer width.
  2603. Syntax for the command is : "@var{width}"
  2604. @item gain, g
  2605. Change equalizer gain.
  2606. Syntax for the command is : "@var{gain}"
  2607. @item mix, m
  2608. Change equalizer mix.
  2609. Syntax for the command is : "@var{mix}"
  2610. @end table
  2611. @section extrastereo
  2612. Linearly increases the difference between left and right channels which
  2613. adds some sort of "live" effect to playback.
  2614. The filter accepts the following options:
  2615. @table @option
  2616. @item m
  2617. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2618. (average of both channels), with 1.0 sound will be unchanged, with
  2619. -1.0 left and right channels will be swapped.
  2620. @item c
  2621. Enable clipping. By default is enabled.
  2622. @end table
  2623. @section firequalizer
  2624. Apply FIR Equalization using arbitrary frequency response.
  2625. The filter accepts the following option:
  2626. @table @option
  2627. @item gain
  2628. Set gain curve equation (in dB). The expression can contain variables:
  2629. @table @option
  2630. @item f
  2631. the evaluated frequency
  2632. @item sr
  2633. sample rate
  2634. @item ch
  2635. channel number, set to 0 when multichannels evaluation is disabled
  2636. @item chid
  2637. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2638. multichannels evaluation is disabled
  2639. @item chs
  2640. number of channels
  2641. @item chlayout
  2642. channel_layout, see libavutil/channel_layout.h
  2643. @end table
  2644. and functions:
  2645. @table @option
  2646. @item gain_interpolate(f)
  2647. interpolate gain on frequency f based on gain_entry
  2648. @item cubic_interpolate(f)
  2649. same as gain_interpolate, but smoother
  2650. @end table
  2651. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2652. @item gain_entry
  2653. Set gain entry for gain_interpolate function. The expression can
  2654. contain functions:
  2655. @table @option
  2656. @item entry(f, g)
  2657. store gain entry at frequency f with value g
  2658. @end table
  2659. This option is also available as command.
  2660. @item delay
  2661. Set filter delay in seconds. Higher value means more accurate.
  2662. Default is @code{0.01}.
  2663. @item accuracy
  2664. Set filter accuracy in Hz. Lower value means more accurate.
  2665. Default is @code{5}.
  2666. @item wfunc
  2667. Set window function. Acceptable values are:
  2668. @table @option
  2669. @item rectangular
  2670. rectangular window, useful when gain curve is already smooth
  2671. @item hann
  2672. hann window (default)
  2673. @item hamming
  2674. hamming window
  2675. @item blackman
  2676. blackman window
  2677. @item nuttall3
  2678. 3-terms continuous 1st derivative nuttall window
  2679. @item mnuttall3
  2680. minimum 3-terms discontinuous nuttall window
  2681. @item nuttall
  2682. 4-terms continuous 1st derivative nuttall window
  2683. @item bnuttall
  2684. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2685. @item bharris
  2686. blackman-harris window
  2687. @item tukey
  2688. tukey window
  2689. @end table
  2690. @item fixed
  2691. If enabled, use fixed number of audio samples. This improves speed when
  2692. filtering with large delay. Default is disabled.
  2693. @item multi
  2694. Enable multichannels evaluation on gain. Default is disabled.
  2695. @item zero_phase
  2696. Enable zero phase mode by subtracting timestamp to compensate delay.
  2697. Default is disabled.
  2698. @item scale
  2699. Set scale used by gain. Acceptable values are:
  2700. @table @option
  2701. @item linlin
  2702. linear frequency, linear gain
  2703. @item linlog
  2704. linear frequency, logarithmic (in dB) gain (default)
  2705. @item loglin
  2706. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2707. @item loglog
  2708. logarithmic frequency, logarithmic gain
  2709. @end table
  2710. @item dumpfile
  2711. Set file for dumping, suitable for gnuplot.
  2712. @item dumpscale
  2713. Set scale for dumpfile. Acceptable values are same with scale option.
  2714. Default is linlog.
  2715. @item fft2
  2716. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2717. Default is disabled.
  2718. @item min_phase
  2719. Enable minimum phase impulse response. Default is disabled.
  2720. @end table
  2721. @subsection Examples
  2722. @itemize
  2723. @item
  2724. lowpass at 1000 Hz:
  2725. @example
  2726. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2727. @end example
  2728. @item
  2729. lowpass at 1000 Hz with gain_entry:
  2730. @example
  2731. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2732. @end example
  2733. @item
  2734. custom equalization:
  2735. @example
  2736. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2737. @end example
  2738. @item
  2739. higher delay with zero phase to compensate delay:
  2740. @example
  2741. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2742. @end example
  2743. @item
  2744. lowpass on left channel, highpass on right channel:
  2745. @example
  2746. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2747. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2748. @end example
  2749. @end itemize
  2750. @section flanger
  2751. Apply a flanging effect to the audio.
  2752. The filter accepts the following options:
  2753. @table @option
  2754. @item delay
  2755. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2756. @item depth
  2757. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2758. @item regen
  2759. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2760. Default value is 0.
  2761. @item width
  2762. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2763. Default value is 71.
  2764. @item speed
  2765. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2766. @item shape
  2767. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2768. Default value is @var{sinusoidal}.
  2769. @item phase
  2770. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2771. Default value is 25.
  2772. @item interp
  2773. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2774. Default is @var{linear}.
  2775. @end table
  2776. @section haas
  2777. Apply Haas effect to audio.
  2778. Note that this makes most sense to apply on mono signals.
  2779. With this filter applied to mono signals it give some directionality and
  2780. stretches its stereo image.
  2781. The filter accepts the following options:
  2782. @table @option
  2783. @item level_in
  2784. Set input level. By default is @var{1}, or 0dB
  2785. @item level_out
  2786. Set output level. By default is @var{1}, or 0dB.
  2787. @item side_gain
  2788. Set gain applied to side part of signal. By default is @var{1}.
  2789. @item middle_source
  2790. Set kind of middle source. Can be one of the following:
  2791. @table @samp
  2792. @item left
  2793. Pick left channel.
  2794. @item right
  2795. Pick right channel.
  2796. @item mid
  2797. Pick middle part signal of stereo image.
  2798. @item side
  2799. Pick side part signal of stereo image.
  2800. @end table
  2801. @item middle_phase
  2802. Change middle phase. By default is disabled.
  2803. @item left_delay
  2804. Set left channel delay. By default is @var{2.05} milliseconds.
  2805. @item left_balance
  2806. Set left channel balance. By default is @var{-1}.
  2807. @item left_gain
  2808. Set left channel gain. By default is @var{1}.
  2809. @item left_phase
  2810. Change left phase. By default is disabled.
  2811. @item right_delay
  2812. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2813. @item right_balance
  2814. Set right channel balance. By default is @var{1}.
  2815. @item right_gain
  2816. Set right channel gain. By default is @var{1}.
  2817. @item right_phase
  2818. Change right phase. By default is enabled.
  2819. @end table
  2820. @section hdcd
  2821. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2822. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2823. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2824. of HDCD, and detects the Transient Filter flag.
  2825. @example
  2826. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2827. @end example
  2828. When using the filter with wav, note the default encoding for wav is 16-bit,
  2829. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2830. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2831. @example
  2832. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2833. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2834. @end example
  2835. The filter accepts the following options:
  2836. @table @option
  2837. @item disable_autoconvert
  2838. Disable any automatic format conversion or resampling in the filter graph.
  2839. @item process_stereo
  2840. Process the stereo channels together. If target_gain does not match between
  2841. channels, consider it invalid and use the last valid target_gain.
  2842. @item cdt_ms
  2843. Set the code detect timer period in ms.
  2844. @item force_pe
  2845. Always extend peaks above -3dBFS even if PE isn't signaled.
  2846. @item analyze_mode
  2847. Replace audio with a solid tone and adjust the amplitude to signal some
  2848. specific aspect of the decoding process. The output file can be loaded in
  2849. an audio editor alongside the original to aid analysis.
  2850. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2851. Modes are:
  2852. @table @samp
  2853. @item 0, off
  2854. Disabled
  2855. @item 1, lle
  2856. Gain adjustment level at each sample
  2857. @item 2, pe
  2858. Samples where peak extend occurs
  2859. @item 3, cdt
  2860. Samples where the code detect timer is active
  2861. @item 4, tgm
  2862. Samples where the target gain does not match between channels
  2863. @end table
  2864. @end table
  2865. @section headphone
  2866. Apply head-related transfer functions (HRTFs) to create virtual
  2867. loudspeakers around the user for binaural listening via headphones.
  2868. The HRIRs are provided via additional streams, for each channel
  2869. one stereo input stream is needed.
  2870. The filter accepts the following options:
  2871. @table @option
  2872. @item map
  2873. Set mapping of input streams for convolution.
  2874. The argument is a '|'-separated list of channel names in order as they
  2875. are given as additional stream inputs for filter.
  2876. This also specify number of input streams. Number of input streams
  2877. must be not less than number of channels in first stream plus one.
  2878. @item gain
  2879. Set gain applied to audio. Value is in dB. Default is 0.
  2880. @item type
  2881. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2882. processing audio in time domain which is slow.
  2883. @var{freq} is processing audio in frequency domain which is fast.
  2884. Default is @var{freq}.
  2885. @item lfe
  2886. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2887. @item size
  2888. Set size of frame in number of samples which will be processed at once.
  2889. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2890. @item hrir
  2891. Set format of hrir stream.
  2892. Default value is @var{stereo}. Alternative value is @var{multich}.
  2893. If value is set to @var{stereo}, number of additional streams should
  2894. be greater or equal to number of input channels in first input stream.
  2895. Also each additional stream should have stereo number of channels.
  2896. If value is set to @var{multich}, number of additional streams should
  2897. be exactly one. Also number of input channels of additional stream
  2898. should be equal or greater than twice number of channels of first input
  2899. stream.
  2900. @end table
  2901. @subsection Examples
  2902. @itemize
  2903. @item
  2904. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2905. each amovie filter use stereo file with IR coefficients as input.
  2906. The files give coefficients for each position of virtual loudspeaker:
  2907. @example
  2908. ffmpeg -i input.wav
  2909. -filter_complex "amovie=azi_270_ele_0_DFC.wav[sr];amovie=azi_90_ele_0_DFC.wav[sl];amovie=azi_225_ele_0_DFC.wav[br];amovie=azi_135_ele_0_DFC.wav[bl];amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe];amovie=azi_35_ele_0_DFC.wav[fl];amovie=azi_325_ele_0_DFC.wav[fr];[0:a][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2910. output.wav
  2911. @end example
  2912. @item
  2913. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2914. but now in @var{multich} @var{hrir} format.
  2915. @example
  2916. ffmpeg -i input.wav -filter_complex "amovie=minp.wav[hrirs];[0:a][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  2917. output.wav
  2918. @end example
  2919. @end itemize
  2920. @section highpass
  2921. Apply a high-pass filter with 3dB point frequency.
  2922. The filter can be either single-pole, or double-pole (the default).
  2923. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2924. The filter accepts the following options:
  2925. @table @option
  2926. @item frequency, f
  2927. Set frequency in Hz. Default is 3000.
  2928. @item poles, p
  2929. Set number of poles. Default is 2.
  2930. @item width_type, t
  2931. Set method to specify band-width of filter.
  2932. @table @option
  2933. @item h
  2934. Hz
  2935. @item q
  2936. Q-Factor
  2937. @item o
  2938. octave
  2939. @item s
  2940. slope
  2941. @item k
  2942. kHz
  2943. @end table
  2944. @item width, w
  2945. Specify the band-width of a filter in width_type units.
  2946. Applies only to double-pole filter.
  2947. The default is 0.707q and gives a Butterworth response.
  2948. @item mix, m
  2949. How much to use filtered signal in output. Default is 1.
  2950. Range is between 0 and 1.
  2951. @item channels, c
  2952. Specify which channels to filter, by default all available are filtered.
  2953. @end table
  2954. @subsection Commands
  2955. This filter supports the following commands:
  2956. @table @option
  2957. @item frequency, f
  2958. Change highpass frequency.
  2959. Syntax for the command is : "@var{frequency}"
  2960. @item width_type, t
  2961. Change highpass width_type.
  2962. Syntax for the command is : "@var{width_type}"
  2963. @item width, w
  2964. Change highpass width.
  2965. Syntax for the command is : "@var{width}"
  2966. @item mix, m
  2967. Change highpass mix.
  2968. Syntax for the command is : "@var{mix}"
  2969. @end table
  2970. @section join
  2971. Join multiple input streams into one multi-channel stream.
  2972. It accepts the following parameters:
  2973. @table @option
  2974. @item inputs
  2975. The number of input streams. It defaults to 2.
  2976. @item channel_layout
  2977. The desired output channel layout. It defaults to stereo.
  2978. @item map
  2979. Map channels from inputs to output. The argument is a '|'-separated list of
  2980. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2981. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2982. can be either the name of the input channel (e.g. FL for front left) or its
  2983. index in the specified input stream. @var{out_channel} is the name of the output
  2984. channel.
  2985. @end table
  2986. The filter will attempt to guess the mappings when they are not specified
  2987. explicitly. It does so by first trying to find an unused matching input channel
  2988. and if that fails it picks the first unused input channel.
  2989. Join 3 inputs (with properly set channel layouts):
  2990. @example
  2991. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2992. @end example
  2993. Build a 5.1 output from 6 single-channel streams:
  2994. @example
  2995. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2996. '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'
  2997. out
  2998. @end example
  2999. @section ladspa
  3000. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3001. To enable compilation of this filter you need to configure FFmpeg with
  3002. @code{--enable-ladspa}.
  3003. @table @option
  3004. @item file, f
  3005. Specifies the name of LADSPA plugin library to load. If the environment
  3006. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3007. each one of the directories specified by the colon separated list in
  3008. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3009. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3010. @file{/usr/lib/ladspa/}.
  3011. @item plugin, p
  3012. Specifies the plugin within the library. Some libraries contain only
  3013. one plugin, but others contain many of them. If this is not set filter
  3014. will list all available plugins within the specified library.
  3015. @item controls, c
  3016. Set the '|' separated list of controls which are zero or more floating point
  3017. values that determine the behavior of the loaded plugin (for example delay,
  3018. threshold or gain).
  3019. Controls need to be defined using the following syntax:
  3020. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3021. @var{valuei} is the value set on the @var{i}-th control.
  3022. Alternatively they can be also defined using the following syntax:
  3023. @var{value0}|@var{value1}|@var{value2}|..., where
  3024. @var{valuei} is the value set on the @var{i}-th control.
  3025. If @option{controls} is set to @code{help}, all available controls and
  3026. their valid ranges are printed.
  3027. @item sample_rate, s
  3028. Specify the sample rate, default to 44100. Only used if plugin have
  3029. zero inputs.
  3030. @item nb_samples, n
  3031. Set the number of samples per channel per each output frame, default
  3032. is 1024. Only used if plugin have zero inputs.
  3033. @item duration, d
  3034. Set the minimum duration of the sourced audio. See
  3035. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3036. for the accepted syntax.
  3037. Note that the resulting duration may be greater than the specified duration,
  3038. as the generated audio is always cut at the end of a complete frame.
  3039. If not specified, or the expressed duration is negative, the audio is
  3040. supposed to be generated forever.
  3041. Only used if plugin have zero inputs.
  3042. @end table
  3043. @subsection Examples
  3044. @itemize
  3045. @item
  3046. List all available plugins within amp (LADSPA example plugin) library:
  3047. @example
  3048. ladspa=file=amp
  3049. @end example
  3050. @item
  3051. List all available controls and their valid ranges for @code{vcf_notch}
  3052. plugin from @code{VCF} library:
  3053. @example
  3054. ladspa=f=vcf:p=vcf_notch:c=help
  3055. @end example
  3056. @item
  3057. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3058. plugin library:
  3059. @example
  3060. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3061. @end example
  3062. @item
  3063. Add reverberation to the audio using TAP-plugins
  3064. (Tom's Audio Processing plugins):
  3065. @example
  3066. ladspa=file=tap_reverb:tap_reverb
  3067. @end example
  3068. @item
  3069. Generate white noise, with 0.2 amplitude:
  3070. @example
  3071. ladspa=file=cmt:noise_source_white:c=c0=.2
  3072. @end example
  3073. @item
  3074. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3075. @code{C* Audio Plugin Suite} (CAPS) library:
  3076. @example
  3077. ladspa=file=caps:Click:c=c1=20'
  3078. @end example
  3079. @item
  3080. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3081. @example
  3082. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3083. @end example
  3084. @item
  3085. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3086. @code{SWH Plugins} collection:
  3087. @example
  3088. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3089. @end example
  3090. @item
  3091. Attenuate low frequencies using Multiband EQ from Steve Harris
  3092. @code{SWH Plugins} collection:
  3093. @example
  3094. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3095. @end example
  3096. @item
  3097. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3098. (CAPS) library:
  3099. @example
  3100. ladspa=caps:Narrower
  3101. @end example
  3102. @item
  3103. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3104. @example
  3105. ladspa=caps:White:.2
  3106. @end example
  3107. @item
  3108. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3109. @example
  3110. ladspa=caps:Fractal:c=c1=1
  3111. @end example
  3112. @item
  3113. Dynamic volume normalization using @code{VLevel} plugin:
  3114. @example
  3115. ladspa=vlevel-ladspa:vlevel_mono
  3116. @end example
  3117. @end itemize
  3118. @subsection Commands
  3119. This filter supports the following commands:
  3120. @table @option
  3121. @item cN
  3122. Modify the @var{N}-th control value.
  3123. If the specified value is not valid, it is ignored and prior one is kept.
  3124. @end table
  3125. @section loudnorm
  3126. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3127. Support for both single pass (livestreams, files) and double pass (files) modes.
  3128. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3129. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3130. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3131. The filter accepts the following options:
  3132. @table @option
  3133. @item I, i
  3134. Set integrated loudness target.
  3135. Range is -70.0 - -5.0. Default value is -24.0.
  3136. @item LRA, lra
  3137. Set loudness range target.
  3138. Range is 1.0 - 20.0. Default value is 7.0.
  3139. @item TP, tp
  3140. Set maximum true peak.
  3141. Range is -9.0 - +0.0. Default value is -2.0.
  3142. @item measured_I, measured_i
  3143. Measured IL of input file.
  3144. Range is -99.0 - +0.0.
  3145. @item measured_LRA, measured_lra
  3146. Measured LRA of input file.
  3147. Range is 0.0 - 99.0.
  3148. @item measured_TP, measured_tp
  3149. Measured true peak of input file.
  3150. Range is -99.0 - +99.0.
  3151. @item measured_thresh
  3152. Measured threshold of input file.
  3153. Range is -99.0 - +0.0.
  3154. @item offset
  3155. Set offset gain. Gain is applied before the true-peak limiter.
  3156. Range is -99.0 - +99.0. Default is +0.0.
  3157. @item linear
  3158. Normalize linearly if possible.
  3159. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3160. to be specified in order to use this mode.
  3161. Options are true or false. Default is true.
  3162. @item dual_mono
  3163. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3164. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3165. If set to @code{true}, this option will compensate for this effect.
  3166. Multi-channel input files are not affected by this option.
  3167. Options are true or false. Default is false.
  3168. @item print_format
  3169. Set print format for stats. Options are summary, json, or none.
  3170. Default value is none.
  3171. @end table
  3172. @section lowpass
  3173. Apply a low-pass filter with 3dB point frequency.
  3174. The filter can be either single-pole or double-pole (the default).
  3175. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3176. The filter accepts the following options:
  3177. @table @option
  3178. @item frequency, f
  3179. Set frequency in Hz. Default is 500.
  3180. @item poles, p
  3181. Set number of poles. Default is 2.
  3182. @item width_type, t
  3183. Set method to specify band-width of filter.
  3184. @table @option
  3185. @item h
  3186. Hz
  3187. @item q
  3188. Q-Factor
  3189. @item o
  3190. octave
  3191. @item s
  3192. slope
  3193. @item k
  3194. kHz
  3195. @end table
  3196. @item width, w
  3197. Specify the band-width of a filter in width_type units.
  3198. Applies only to double-pole filter.
  3199. The default is 0.707q and gives a Butterworth response.
  3200. @item mix, m
  3201. How much to use filtered signal in output. Default is 1.
  3202. Range is between 0 and 1.
  3203. @item channels, c
  3204. Specify which channels to filter, by default all available are filtered.
  3205. @end table
  3206. @subsection Examples
  3207. @itemize
  3208. @item
  3209. Lowpass only LFE channel, it LFE is not present it does nothing:
  3210. @example
  3211. lowpass=c=LFE
  3212. @end example
  3213. @end itemize
  3214. @subsection Commands
  3215. This filter supports the following commands:
  3216. @table @option
  3217. @item frequency, f
  3218. Change lowpass frequency.
  3219. Syntax for the command is : "@var{frequency}"
  3220. @item width_type, t
  3221. Change lowpass width_type.
  3222. Syntax for the command is : "@var{width_type}"
  3223. @item width, w
  3224. Change lowpass width.
  3225. Syntax for the command is : "@var{width}"
  3226. @item mix, m
  3227. Change lowpass mix.
  3228. Syntax for the command is : "@var{mix}"
  3229. @end table
  3230. @section lv2
  3231. Load a LV2 (LADSPA Version 2) plugin.
  3232. To enable compilation of this filter you need to configure FFmpeg with
  3233. @code{--enable-lv2}.
  3234. @table @option
  3235. @item plugin, p
  3236. Specifies the plugin URI. You may need to escape ':'.
  3237. @item controls, c
  3238. Set the '|' separated list of controls which are zero or more floating point
  3239. values that determine the behavior of the loaded plugin (for example delay,
  3240. threshold or gain).
  3241. If @option{controls} is set to @code{help}, all available controls and
  3242. their valid ranges are printed.
  3243. @item sample_rate, s
  3244. Specify the sample rate, default to 44100. Only used if plugin have
  3245. zero inputs.
  3246. @item nb_samples, n
  3247. Set the number of samples per channel per each output frame, default
  3248. is 1024. Only used if plugin have zero inputs.
  3249. @item duration, d
  3250. Set the minimum duration of the sourced audio. See
  3251. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3252. for the accepted syntax.
  3253. Note that the resulting duration may be greater than the specified duration,
  3254. as the generated audio is always cut at the end of a complete frame.
  3255. If not specified, or the expressed duration is negative, the audio is
  3256. supposed to be generated forever.
  3257. Only used if plugin have zero inputs.
  3258. @end table
  3259. @subsection Examples
  3260. @itemize
  3261. @item
  3262. Apply bass enhancer plugin from Calf:
  3263. @example
  3264. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3265. @end example
  3266. @item
  3267. Apply vinyl plugin from Calf:
  3268. @example
  3269. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3270. @end example
  3271. @item
  3272. Apply bit crusher plugin from ArtyFX:
  3273. @example
  3274. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3275. @end example
  3276. @end itemize
  3277. @section mcompand
  3278. Multiband Compress or expand the audio's dynamic range.
  3279. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3280. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3281. response when absent compander action.
  3282. It accepts the following parameters:
  3283. @table @option
  3284. @item args
  3285. This option syntax is:
  3286. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3287. For explanation of each item refer to compand filter documentation.
  3288. @end table
  3289. @anchor{pan}
  3290. @section pan
  3291. Mix channels with specific gain levels. The filter accepts the output
  3292. channel layout followed by a set of channels definitions.
  3293. This filter is also designed to efficiently remap the channels of an audio
  3294. stream.
  3295. The filter accepts parameters of the form:
  3296. "@var{l}|@var{outdef}|@var{outdef}|..."
  3297. @table @option
  3298. @item l
  3299. output channel layout or number of channels
  3300. @item outdef
  3301. output channel specification, of the form:
  3302. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3303. @item out_name
  3304. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3305. number (c0, c1, etc.)
  3306. @item gain
  3307. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3308. @item in_name
  3309. input channel to use, see out_name for details; it is not possible to mix
  3310. named and numbered input channels
  3311. @end table
  3312. If the `=' in a channel specification is replaced by `<', then the gains for
  3313. that specification will be renormalized so that the total is 1, thus
  3314. avoiding clipping noise.
  3315. @subsection Mixing examples
  3316. For example, if you want to down-mix from stereo to mono, but with a bigger
  3317. factor for the left channel:
  3318. @example
  3319. pan=1c|c0=0.9*c0+0.1*c1
  3320. @end example
  3321. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3322. 7-channels surround:
  3323. @example
  3324. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3325. @end example
  3326. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3327. that should be preferred (see "-ac" option) unless you have very specific
  3328. needs.
  3329. @subsection Remapping examples
  3330. The channel remapping will be effective if, and only if:
  3331. @itemize
  3332. @item gain coefficients are zeroes or ones,
  3333. @item only one input per channel output,
  3334. @end itemize
  3335. If all these conditions are satisfied, the filter will notify the user ("Pure
  3336. channel mapping detected"), and use an optimized and lossless method to do the
  3337. remapping.
  3338. For example, if you have a 5.1 source and want a stereo audio stream by
  3339. dropping the extra channels:
  3340. @example
  3341. pan="stereo| c0=FL | c1=FR"
  3342. @end example
  3343. Given the same source, you can also switch front left and front right channels
  3344. and keep the input channel layout:
  3345. @example
  3346. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3347. @end example
  3348. If the input is a stereo audio stream, you can mute the front left channel (and
  3349. still keep the stereo channel layout) with:
  3350. @example
  3351. pan="stereo|c1=c1"
  3352. @end example
  3353. Still with a stereo audio stream input, you can copy the right channel in both
  3354. front left and right:
  3355. @example
  3356. pan="stereo| c0=FR | c1=FR"
  3357. @end example
  3358. @section replaygain
  3359. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3360. outputs it unchanged.
  3361. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3362. @section resample
  3363. Convert the audio sample format, sample rate and channel layout. It is
  3364. not meant to be used directly.
  3365. @section rubberband
  3366. Apply time-stretching and pitch-shifting with librubberband.
  3367. To enable compilation of this filter, you need to configure FFmpeg with
  3368. @code{--enable-librubberband}.
  3369. The filter accepts the following options:
  3370. @table @option
  3371. @item tempo
  3372. Set tempo scale factor.
  3373. @item pitch
  3374. Set pitch scale factor.
  3375. @item transients
  3376. Set transients detector.
  3377. Possible values are:
  3378. @table @var
  3379. @item crisp
  3380. @item mixed
  3381. @item smooth
  3382. @end table
  3383. @item detector
  3384. Set detector.
  3385. Possible values are:
  3386. @table @var
  3387. @item compound
  3388. @item percussive
  3389. @item soft
  3390. @end table
  3391. @item phase
  3392. Set phase.
  3393. Possible values are:
  3394. @table @var
  3395. @item laminar
  3396. @item independent
  3397. @end table
  3398. @item window
  3399. Set processing window size.
  3400. Possible values are:
  3401. @table @var
  3402. @item standard
  3403. @item short
  3404. @item long
  3405. @end table
  3406. @item smoothing
  3407. Set smoothing.
  3408. Possible values are:
  3409. @table @var
  3410. @item off
  3411. @item on
  3412. @end table
  3413. @item formant
  3414. Enable formant preservation when shift pitching.
  3415. Possible values are:
  3416. @table @var
  3417. @item shifted
  3418. @item preserved
  3419. @end table
  3420. @item pitchq
  3421. Set pitch quality.
  3422. Possible values are:
  3423. @table @var
  3424. @item quality
  3425. @item speed
  3426. @item consistency
  3427. @end table
  3428. @item channels
  3429. Set channels.
  3430. Possible values are:
  3431. @table @var
  3432. @item apart
  3433. @item together
  3434. @end table
  3435. @end table
  3436. @section sidechaincompress
  3437. This filter acts like normal compressor but has the ability to compress
  3438. detected signal using second input signal.
  3439. It needs two input streams and returns one output stream.
  3440. First input stream will be processed depending on second stream signal.
  3441. The filtered signal then can be filtered with other filters in later stages of
  3442. processing. See @ref{pan} and @ref{amerge} filter.
  3443. The filter accepts the following options:
  3444. @table @option
  3445. @item level_in
  3446. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3447. @item mode
  3448. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3449. Default is @code{downward}.
  3450. @item threshold
  3451. If a signal of second stream raises above this level it will affect the gain
  3452. reduction of first stream.
  3453. By default is 0.125. Range is between 0.00097563 and 1.
  3454. @item ratio
  3455. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3456. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3457. Default is 2. Range is between 1 and 20.
  3458. @item attack
  3459. Amount of milliseconds the signal has to rise above the threshold before gain
  3460. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3461. @item release
  3462. Amount of milliseconds the signal has to fall below the threshold before
  3463. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3464. @item makeup
  3465. Set the amount by how much signal will be amplified after processing.
  3466. Default is 1. Range is from 1 to 64.
  3467. @item knee
  3468. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3469. Default is 2.82843. Range is between 1 and 8.
  3470. @item link
  3471. Choose if the @code{average} level between all channels of side-chain stream
  3472. or the louder(@code{maximum}) channel of side-chain stream affects the
  3473. reduction. Default is @code{average}.
  3474. @item detection
  3475. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3476. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3477. @item level_sc
  3478. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3479. @item mix
  3480. How much to use compressed signal in output. Default is 1.
  3481. Range is between 0 and 1.
  3482. @end table
  3483. @subsection Examples
  3484. @itemize
  3485. @item
  3486. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3487. depending on the signal of 2nd input and later compressed signal to be
  3488. merged with 2nd input:
  3489. @example
  3490. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3491. @end example
  3492. @end itemize
  3493. @section sidechaingate
  3494. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3495. filter the detected signal before sending it to the gain reduction stage.
  3496. Normally a gate uses the full range signal to detect a level above the
  3497. threshold.
  3498. For example: If you cut all lower frequencies from your sidechain signal
  3499. the gate will decrease the volume of your track only if not enough highs
  3500. appear. With this technique you are able to reduce the resonation of a
  3501. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3502. guitar.
  3503. It needs two input streams and returns one output stream.
  3504. First input stream will be processed depending on second stream signal.
  3505. The filter accepts the following options:
  3506. @table @option
  3507. @item level_in
  3508. Set input level before filtering.
  3509. Default is 1. Allowed range is from 0.015625 to 64.
  3510. @item mode
  3511. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3512. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3513. will be amplified, expanding dynamic range in upward direction.
  3514. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3515. @item range
  3516. Set the level of gain reduction when the signal is below the threshold.
  3517. Default is 0.06125. Allowed range is from 0 to 1.
  3518. Setting this to 0 disables reduction and then filter behaves like expander.
  3519. @item threshold
  3520. If a signal rises above this level the gain reduction is released.
  3521. Default is 0.125. Allowed range is from 0 to 1.
  3522. @item ratio
  3523. Set a ratio about which the signal is reduced.
  3524. Default is 2. Allowed range is from 1 to 9000.
  3525. @item attack
  3526. Amount of milliseconds the signal has to rise above the threshold before gain
  3527. reduction stops.
  3528. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3529. @item release
  3530. Amount of milliseconds the signal has to fall below the threshold before the
  3531. reduction is increased again. Default is 250 milliseconds.
  3532. Allowed range is from 0.01 to 9000.
  3533. @item makeup
  3534. Set amount of amplification of signal after processing.
  3535. Default is 1. Allowed range is from 1 to 64.
  3536. @item knee
  3537. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3538. Default is 2.828427125. Allowed range is from 1 to 8.
  3539. @item detection
  3540. Choose if exact signal should be taken for detection or an RMS like one.
  3541. Default is rms. Can be peak or rms.
  3542. @item link
  3543. Choose if the average level between all channels or the louder channel affects
  3544. the reduction.
  3545. Default is average. Can be average or maximum.
  3546. @item level_sc
  3547. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3548. @end table
  3549. @section silencedetect
  3550. Detect silence in an audio stream.
  3551. This filter logs a message when it detects that the input audio volume is less
  3552. or equal to a noise tolerance value for a duration greater or equal to the
  3553. minimum detected noise duration.
  3554. The printed times and duration are expressed in seconds.
  3555. The filter accepts the following options:
  3556. @table @option
  3557. @item noise, n
  3558. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3559. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3560. @item duration, d
  3561. Set silence duration until notification (default is 2 seconds).
  3562. @item mono, m
  3563. Process each channel separately, instead of combined. By default is disabled.
  3564. @end table
  3565. @subsection Examples
  3566. @itemize
  3567. @item
  3568. Detect 5 seconds of silence with -50dB noise tolerance:
  3569. @example
  3570. silencedetect=n=-50dB:d=5
  3571. @end example
  3572. @item
  3573. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3574. tolerance in @file{silence.mp3}:
  3575. @example
  3576. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3577. @end example
  3578. @end itemize
  3579. @section silenceremove
  3580. Remove silence from the beginning, middle or end of the audio.
  3581. The filter accepts the following options:
  3582. @table @option
  3583. @item start_periods
  3584. This value is used to indicate if audio should be trimmed at beginning of
  3585. the audio. A value of zero indicates no silence should be trimmed from the
  3586. beginning. When specifying a non-zero value, it trims audio up until it
  3587. finds non-silence. Normally, when trimming silence from beginning of audio
  3588. the @var{start_periods} will be @code{1} but it can be increased to higher
  3589. values to trim all audio up to specific count of non-silence periods.
  3590. Default value is @code{0}.
  3591. @item start_duration
  3592. Specify the amount of time that non-silence must be detected before it stops
  3593. trimming audio. By increasing the duration, bursts of noises can be treated
  3594. as silence and trimmed off. Default value is @code{0}.
  3595. @item start_threshold
  3596. This indicates what sample value should be treated as silence. For digital
  3597. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3598. you may wish to increase the value to account for background noise.
  3599. Can be specified in dB (in case "dB" is appended to the specified value)
  3600. or amplitude ratio. Default value is @code{0}.
  3601. @item start_silence
  3602. Specify max duration of silence at beginning that will be kept after
  3603. trimming. Default is 0, which is equal to trimming all samples detected
  3604. as silence.
  3605. @item start_mode
  3606. Specify mode of detection of silence end in start of multi-channel audio.
  3607. Can be @var{any} or @var{all}. Default is @var{any}.
  3608. With @var{any}, any sample that is detected as non-silence will cause
  3609. stopped trimming of silence.
  3610. With @var{all}, only if all channels are detected as non-silence will cause
  3611. stopped trimming of silence.
  3612. @item stop_periods
  3613. Set the count for trimming silence from the end of audio.
  3614. To remove silence from the middle of a file, specify a @var{stop_periods}
  3615. that is negative. This value is then treated as a positive value and is
  3616. used to indicate the effect should restart processing as specified by
  3617. @var{start_periods}, making it suitable for removing periods of silence
  3618. in the middle of the audio.
  3619. Default value is @code{0}.
  3620. @item stop_duration
  3621. Specify a duration of silence that must exist before audio is not copied any
  3622. more. By specifying a higher duration, silence that is wanted can be left in
  3623. the audio.
  3624. Default value is @code{0}.
  3625. @item stop_threshold
  3626. This is the same as @option{start_threshold} but for trimming silence from
  3627. the end of audio.
  3628. Can be specified in dB (in case "dB" is appended to the specified value)
  3629. or amplitude ratio. Default value is @code{0}.
  3630. @item stop_silence
  3631. Specify max duration of silence at end that will be kept after
  3632. trimming. Default is 0, which is equal to trimming all samples detected
  3633. as silence.
  3634. @item stop_mode
  3635. Specify mode of detection of silence start in end of multi-channel audio.
  3636. Can be @var{any} or @var{all}. Default is @var{any}.
  3637. With @var{any}, any sample that is detected as non-silence will cause
  3638. stopped trimming of silence.
  3639. With @var{all}, only if all channels are detected as non-silence will cause
  3640. stopped trimming of silence.
  3641. @item detection
  3642. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3643. and works better with digital silence which is exactly 0.
  3644. Default value is @code{rms}.
  3645. @item window
  3646. Set duration in number of seconds used to calculate size of window in number
  3647. of samples for detecting silence.
  3648. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3649. @end table
  3650. @subsection Examples
  3651. @itemize
  3652. @item
  3653. The following example shows how this filter can be used to start a recording
  3654. that does not contain the delay at the start which usually occurs between
  3655. pressing the record button and the start of the performance:
  3656. @example
  3657. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3658. @end example
  3659. @item
  3660. Trim all silence encountered from beginning to end where there is more than 1
  3661. second of silence in audio:
  3662. @example
  3663. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3664. @end example
  3665. @item
  3666. Trim all digital silence samples, using peak detection, from beginning to end
  3667. where there is more than 0 samples of digital silence in audio and digital
  3668. silence is detected in all channels at same positions in stream:
  3669. @example
  3670. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  3671. @end example
  3672. @end itemize
  3673. @section sofalizer
  3674. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3675. loudspeakers around the user for binaural listening via headphones (audio
  3676. formats up to 9 channels supported).
  3677. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3678. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3679. Austrian Academy of Sciences.
  3680. To enable compilation of this filter you need to configure FFmpeg with
  3681. @code{--enable-libmysofa}.
  3682. The filter accepts the following options:
  3683. @table @option
  3684. @item sofa
  3685. Set the SOFA file used for rendering.
  3686. @item gain
  3687. Set gain applied to audio. Value is in dB. Default is 0.
  3688. @item rotation
  3689. Set rotation of virtual loudspeakers in deg. Default is 0.
  3690. @item elevation
  3691. Set elevation of virtual speakers in deg. Default is 0.
  3692. @item radius
  3693. Set distance in meters between loudspeakers and the listener with near-field
  3694. HRTFs. Default is 1.
  3695. @item type
  3696. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3697. processing audio in time domain which is slow.
  3698. @var{freq} is processing audio in frequency domain which is fast.
  3699. Default is @var{freq}.
  3700. @item speakers
  3701. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3702. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3703. Each virtual loudspeaker is described with short channel name following with
  3704. azimuth and elevation in degrees.
  3705. Each virtual loudspeaker description is separated by '|'.
  3706. For example to override front left and front right channel positions use:
  3707. 'speakers=FL 45 15|FR 345 15'.
  3708. Descriptions with unrecognised channel names are ignored.
  3709. @item lfegain
  3710. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3711. @item framesize
  3712. Set custom frame size in number of samples. Default is 1024.
  3713. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3714. is set to @var{freq}.
  3715. @item normalize
  3716. Should all IRs be normalized upon importing SOFA file.
  3717. By default is enabled.
  3718. @item interpolate
  3719. Should nearest IRs be interpolated with neighbor IRs if exact position
  3720. does not match. By default is disabled.
  3721. @item minphase
  3722. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3723. @item anglestep
  3724. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3725. @item radstep
  3726. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3727. @end table
  3728. @subsection Examples
  3729. @itemize
  3730. @item
  3731. Using ClubFritz6 sofa file:
  3732. @example
  3733. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3734. @end example
  3735. @item
  3736. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3737. @example
  3738. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3739. @end example
  3740. @item
  3741. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3742. and also with custom gain:
  3743. @example
  3744. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3745. @end example
  3746. @end itemize
  3747. @section stereotools
  3748. This filter has some handy utilities to manage stereo signals, for converting
  3749. M/S stereo recordings to L/R signal while having control over the parameters
  3750. or spreading the stereo image of master track.
  3751. The filter accepts the following options:
  3752. @table @option
  3753. @item level_in
  3754. Set input level before filtering for both channels. Defaults is 1.
  3755. Allowed range is from 0.015625 to 64.
  3756. @item level_out
  3757. Set output level after filtering for both channels. Defaults is 1.
  3758. Allowed range is from 0.015625 to 64.
  3759. @item balance_in
  3760. Set input balance between both channels. Default is 0.
  3761. Allowed range is from -1 to 1.
  3762. @item balance_out
  3763. Set output balance between both channels. Default is 0.
  3764. Allowed range is from -1 to 1.
  3765. @item softclip
  3766. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3767. clipping. Disabled by default.
  3768. @item mutel
  3769. Mute the left channel. Disabled by default.
  3770. @item muter
  3771. Mute the right channel. Disabled by default.
  3772. @item phasel
  3773. Change the phase of the left channel. Disabled by default.
  3774. @item phaser
  3775. Change the phase of the right channel. Disabled by default.
  3776. @item mode
  3777. Set stereo mode. Available values are:
  3778. @table @samp
  3779. @item lr>lr
  3780. Left/Right to Left/Right, this is default.
  3781. @item lr>ms
  3782. Left/Right to Mid/Side.
  3783. @item ms>lr
  3784. Mid/Side to Left/Right.
  3785. @item lr>ll
  3786. Left/Right to Left/Left.
  3787. @item lr>rr
  3788. Left/Right to Right/Right.
  3789. @item lr>l+r
  3790. Left/Right to Left + Right.
  3791. @item lr>rl
  3792. Left/Right to Right/Left.
  3793. @item ms>ll
  3794. Mid/Side to Left/Left.
  3795. @item ms>rr
  3796. Mid/Side to Right/Right.
  3797. @end table
  3798. @item slev
  3799. Set level of side signal. Default is 1.
  3800. Allowed range is from 0.015625 to 64.
  3801. @item sbal
  3802. Set balance of side signal. Default is 0.
  3803. Allowed range is from -1 to 1.
  3804. @item mlev
  3805. Set level of the middle signal. Default is 1.
  3806. Allowed range is from 0.015625 to 64.
  3807. @item mpan
  3808. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3809. @item base
  3810. Set stereo base between mono and inversed channels. Default is 0.
  3811. Allowed range is from -1 to 1.
  3812. @item delay
  3813. Set delay in milliseconds how much to delay left from right channel and
  3814. vice versa. Default is 0. Allowed range is from -20 to 20.
  3815. @item sclevel
  3816. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3817. @item phase
  3818. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3819. @item bmode_in, bmode_out
  3820. Set balance mode for balance_in/balance_out option.
  3821. Can be one of the following:
  3822. @table @samp
  3823. @item balance
  3824. Classic balance mode. Attenuate one channel at time.
  3825. Gain is raised up to 1.
  3826. @item amplitude
  3827. Similar as classic mode above but gain is raised up to 2.
  3828. @item power
  3829. Equal power distribution, from -6dB to +6dB range.
  3830. @end table
  3831. @end table
  3832. @subsection Examples
  3833. @itemize
  3834. @item
  3835. Apply karaoke like effect:
  3836. @example
  3837. stereotools=mlev=0.015625
  3838. @end example
  3839. @item
  3840. Convert M/S signal to L/R:
  3841. @example
  3842. "stereotools=mode=ms>lr"
  3843. @end example
  3844. @end itemize
  3845. @section stereowiden
  3846. This filter enhance the stereo effect by suppressing signal common to both
  3847. channels and by delaying the signal of left into right and vice versa,
  3848. thereby widening the stereo effect.
  3849. The filter accepts the following options:
  3850. @table @option
  3851. @item delay
  3852. Time in milliseconds of the delay of left signal into right and vice versa.
  3853. Default is 20 milliseconds.
  3854. @item feedback
  3855. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3856. effect of left signal in right output and vice versa which gives widening
  3857. effect. Default is 0.3.
  3858. @item crossfeed
  3859. Cross feed of left into right with inverted phase. This helps in suppressing
  3860. the mono. If the value is 1 it will cancel all the signal common to both
  3861. channels. Default is 0.3.
  3862. @item drymix
  3863. Set level of input signal of original channel. Default is 0.8.
  3864. @end table
  3865. @section superequalizer
  3866. Apply 18 band equalizer.
  3867. The filter accepts the following options:
  3868. @table @option
  3869. @item 1b
  3870. Set 65Hz band gain.
  3871. @item 2b
  3872. Set 92Hz band gain.
  3873. @item 3b
  3874. Set 131Hz band gain.
  3875. @item 4b
  3876. Set 185Hz band gain.
  3877. @item 5b
  3878. Set 262Hz band gain.
  3879. @item 6b
  3880. Set 370Hz band gain.
  3881. @item 7b
  3882. Set 523Hz band gain.
  3883. @item 8b
  3884. Set 740Hz band gain.
  3885. @item 9b
  3886. Set 1047Hz band gain.
  3887. @item 10b
  3888. Set 1480Hz band gain.
  3889. @item 11b
  3890. Set 2093Hz band gain.
  3891. @item 12b
  3892. Set 2960Hz band gain.
  3893. @item 13b
  3894. Set 4186Hz band gain.
  3895. @item 14b
  3896. Set 5920Hz band gain.
  3897. @item 15b
  3898. Set 8372Hz band gain.
  3899. @item 16b
  3900. Set 11840Hz band gain.
  3901. @item 17b
  3902. Set 16744Hz band gain.
  3903. @item 18b
  3904. Set 20000Hz band gain.
  3905. @end table
  3906. @section surround
  3907. Apply audio surround upmix filter.
  3908. This filter allows to produce multichannel output from audio stream.
  3909. The filter accepts the following options:
  3910. @table @option
  3911. @item chl_out
  3912. Set output channel layout. By default, this is @var{5.1}.
  3913. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3914. for the required syntax.
  3915. @item chl_in
  3916. Set input channel layout. By default, this is @var{stereo}.
  3917. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3918. for the required syntax.
  3919. @item level_in
  3920. Set input volume level. By default, this is @var{1}.
  3921. @item level_out
  3922. Set output volume level. By default, this is @var{1}.
  3923. @item lfe
  3924. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3925. @item lfe_low
  3926. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3927. @item lfe_high
  3928. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3929. @item lfe_mode
  3930. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  3931. In @var{add} mode, LFE channel is created from input audio and added to output.
  3932. In @var{sub} mode, LFE channel is created from input audio and added to output but
  3933. also all non-LFE output channels are subtracted with output LFE channel.
  3934. @item angle
  3935. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  3936. Default is @var{90}.
  3937. @item fc_in
  3938. Set front center input volume. By default, this is @var{1}.
  3939. @item fc_out
  3940. Set front center output volume. By default, this is @var{1}.
  3941. @item fl_in
  3942. Set front left input volume. By default, this is @var{1}.
  3943. @item fl_out
  3944. Set front left output volume. By default, this is @var{1}.
  3945. @item fr_in
  3946. Set front right input volume. By default, this is @var{1}.
  3947. @item fr_out
  3948. Set front right output volume. By default, this is @var{1}.
  3949. @item sl_in
  3950. Set side left input volume. By default, this is @var{1}.
  3951. @item sl_out
  3952. Set side left output volume. By default, this is @var{1}.
  3953. @item sr_in
  3954. Set side right input volume. By default, this is @var{1}.
  3955. @item sr_out
  3956. Set side right output volume. By default, this is @var{1}.
  3957. @item bl_in
  3958. Set back left input volume. By default, this is @var{1}.
  3959. @item bl_out
  3960. Set back left output volume. By default, this is @var{1}.
  3961. @item br_in
  3962. Set back right input volume. By default, this is @var{1}.
  3963. @item br_out
  3964. Set back right output volume. By default, this is @var{1}.
  3965. @item bc_in
  3966. Set back center input volume. By default, this is @var{1}.
  3967. @item bc_out
  3968. Set back center output volume. By default, this is @var{1}.
  3969. @item lfe_in
  3970. Set LFE input volume. By default, this is @var{1}.
  3971. @item lfe_out
  3972. Set LFE output volume. By default, this is @var{1}.
  3973. @item allx
  3974. Set spread usage of stereo image across X axis for all channels.
  3975. @item ally
  3976. Set spread usage of stereo image across Y axis for all channels.
  3977. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  3978. Set spread usage of stereo image across X axis for each channel.
  3979. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  3980. Set spread usage of stereo image across Y axis for each channel.
  3981. @item win_size
  3982. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  3983. @item win_func
  3984. Set window function.
  3985. It accepts the following values:
  3986. @table @samp
  3987. @item rect
  3988. @item bartlett
  3989. @item hann, hanning
  3990. @item hamming
  3991. @item blackman
  3992. @item welch
  3993. @item flattop
  3994. @item bharris
  3995. @item bnuttall
  3996. @item bhann
  3997. @item sine
  3998. @item nuttall
  3999. @item lanczos
  4000. @item gauss
  4001. @item tukey
  4002. @item dolph
  4003. @item cauchy
  4004. @item parzen
  4005. @item poisson
  4006. @item bohman
  4007. @end table
  4008. Default is @code{hann}.
  4009. @item overlap
  4010. Set window overlap. If set to 1, the recommended overlap for selected
  4011. window function will be picked. Default is @code{0.5}.
  4012. @end table
  4013. @section treble, highshelf
  4014. Boost or cut treble (upper) frequencies of the audio using a two-pole
  4015. shelving filter with a response similar to that of a standard
  4016. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  4017. The filter accepts the following options:
  4018. @table @option
  4019. @item gain, g
  4020. Give the gain at whichever is the lower of ~22 kHz and the
  4021. Nyquist frequency. Its useful range is about -20 (for a large cut)
  4022. to +20 (for a large boost). Beware of clipping when using a positive gain.
  4023. @item frequency, f
  4024. Set the filter's central frequency and so can be used
  4025. to extend or reduce the frequency range to be boosted or cut.
  4026. The default value is @code{3000} Hz.
  4027. @item width_type, t
  4028. Set method to specify band-width of filter.
  4029. @table @option
  4030. @item h
  4031. Hz
  4032. @item q
  4033. Q-Factor
  4034. @item o
  4035. octave
  4036. @item s
  4037. slope
  4038. @item k
  4039. kHz
  4040. @end table
  4041. @item width, w
  4042. Determine how steep is the filter's shelf transition.
  4043. @item mix, m
  4044. How much to use filtered signal in output. Default is 1.
  4045. Range is between 0 and 1.
  4046. @item channels, c
  4047. Specify which channels to filter, by default all available are filtered.
  4048. @end table
  4049. @subsection Commands
  4050. This filter supports the following commands:
  4051. @table @option
  4052. @item frequency, f
  4053. Change treble frequency.
  4054. Syntax for the command is : "@var{frequency}"
  4055. @item width_type, t
  4056. Change treble width_type.
  4057. Syntax for the command is : "@var{width_type}"
  4058. @item width, w
  4059. Change treble width.
  4060. Syntax for the command is : "@var{width}"
  4061. @item gain, g
  4062. Change treble gain.
  4063. Syntax for the command is : "@var{gain}"
  4064. @item mix, m
  4065. Change treble mix.
  4066. Syntax for the command is : "@var{mix}"
  4067. @end table
  4068. @section tremolo
  4069. Sinusoidal amplitude modulation.
  4070. The filter accepts the following options:
  4071. @table @option
  4072. @item f
  4073. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  4074. (20 Hz or lower) will result in a tremolo effect.
  4075. This filter may also be used as a ring modulator by specifying
  4076. a modulation frequency higher than 20 Hz.
  4077. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4078. @item d
  4079. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4080. Default value is 0.5.
  4081. @end table
  4082. @section vibrato
  4083. Sinusoidal phase modulation.
  4084. The filter accepts the following options:
  4085. @table @option
  4086. @item f
  4087. Modulation frequency in Hertz.
  4088. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  4089. @item d
  4090. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  4091. Default value is 0.5.
  4092. @end table
  4093. @section volume
  4094. Adjust the input audio volume.
  4095. It accepts the following parameters:
  4096. @table @option
  4097. @item volume
  4098. Set audio volume expression.
  4099. Output values are clipped to the maximum value.
  4100. The output audio volume is given by the relation:
  4101. @example
  4102. @var{output_volume} = @var{volume} * @var{input_volume}
  4103. @end example
  4104. The default value for @var{volume} is "1.0".
  4105. @item precision
  4106. This parameter represents the mathematical precision.
  4107. It determines which input sample formats will be allowed, which affects the
  4108. precision of the volume scaling.
  4109. @table @option
  4110. @item fixed
  4111. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  4112. @item float
  4113. 32-bit floating-point; this limits input sample format to FLT. (default)
  4114. @item double
  4115. 64-bit floating-point; this limits input sample format to DBL.
  4116. @end table
  4117. @item replaygain
  4118. Choose the behaviour on encountering ReplayGain side data in input frames.
  4119. @table @option
  4120. @item drop
  4121. Remove ReplayGain side data, ignoring its contents (the default).
  4122. @item ignore
  4123. Ignore ReplayGain side data, but leave it in the frame.
  4124. @item track
  4125. Prefer the track gain, if present.
  4126. @item album
  4127. Prefer the album gain, if present.
  4128. @end table
  4129. @item replaygain_preamp
  4130. Pre-amplification gain in dB to apply to the selected replaygain gain.
  4131. Default value for @var{replaygain_preamp} is 0.0.
  4132. @item eval
  4133. Set when the volume expression is evaluated.
  4134. It accepts the following values:
  4135. @table @samp
  4136. @item once
  4137. only evaluate expression once during the filter initialization, or
  4138. when the @samp{volume} command is sent
  4139. @item frame
  4140. evaluate expression for each incoming frame
  4141. @end table
  4142. Default value is @samp{once}.
  4143. @end table
  4144. The volume expression can contain the following parameters.
  4145. @table @option
  4146. @item n
  4147. frame number (starting at zero)
  4148. @item nb_channels
  4149. number of channels
  4150. @item nb_consumed_samples
  4151. number of samples consumed by the filter
  4152. @item nb_samples
  4153. number of samples in the current frame
  4154. @item pos
  4155. original frame position in the file
  4156. @item pts
  4157. frame PTS
  4158. @item sample_rate
  4159. sample rate
  4160. @item startpts
  4161. PTS at start of stream
  4162. @item startt
  4163. time at start of stream
  4164. @item t
  4165. frame time
  4166. @item tb
  4167. timestamp timebase
  4168. @item volume
  4169. last set volume value
  4170. @end table
  4171. Note that when @option{eval} is set to @samp{once} only the
  4172. @var{sample_rate} and @var{tb} variables are available, all other
  4173. variables will evaluate to NAN.
  4174. @subsection Commands
  4175. This filter supports the following commands:
  4176. @table @option
  4177. @item volume
  4178. Modify the volume expression.
  4179. The command accepts the same syntax of the corresponding option.
  4180. If the specified expression is not valid, it is kept at its current
  4181. value.
  4182. @item replaygain_noclip
  4183. Prevent clipping by limiting the gain applied.
  4184. Default value for @var{replaygain_noclip} is 1.
  4185. @end table
  4186. @subsection Examples
  4187. @itemize
  4188. @item
  4189. Halve the input audio volume:
  4190. @example
  4191. volume=volume=0.5
  4192. volume=volume=1/2
  4193. volume=volume=-6.0206dB
  4194. @end example
  4195. In all the above example the named key for @option{volume} can be
  4196. omitted, for example like in:
  4197. @example
  4198. volume=0.5
  4199. @end example
  4200. @item
  4201. Increase input audio power by 6 decibels using fixed-point precision:
  4202. @example
  4203. volume=volume=6dB:precision=fixed
  4204. @end example
  4205. @item
  4206. Fade volume after time 10 with an annihilation period of 5 seconds:
  4207. @example
  4208. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4209. @end example
  4210. @end itemize
  4211. @section volumedetect
  4212. Detect the volume of the input video.
  4213. The filter has no parameters. The input is not modified. Statistics about
  4214. the volume will be printed in the log when the input stream end is reached.
  4215. In particular it will show the mean volume (root mean square), maximum
  4216. volume (on a per-sample basis), and the beginning of a histogram of the
  4217. registered volume values (from the maximum value to a cumulated 1/1000 of
  4218. the samples).
  4219. All volumes are in decibels relative to the maximum PCM value.
  4220. @subsection Examples
  4221. Here is an excerpt of the output:
  4222. @example
  4223. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4224. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4225. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4226. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4227. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4228. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4229. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4230. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4231. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4232. @end example
  4233. It means that:
  4234. @itemize
  4235. @item
  4236. The mean square energy is approximately -27 dB, or 10^-2.7.
  4237. @item
  4238. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4239. @item
  4240. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4241. @end itemize
  4242. In other words, raising the volume by +4 dB does not cause any clipping,
  4243. raising it by +5 dB causes clipping for 6 samples, etc.
  4244. @c man end AUDIO FILTERS
  4245. @chapter Audio Sources
  4246. @c man begin AUDIO SOURCES
  4247. Below is a description of the currently available audio sources.
  4248. @section abuffer
  4249. Buffer audio frames, and make them available to the filter chain.
  4250. This source is mainly intended for a programmatic use, in particular
  4251. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4252. It accepts the following parameters:
  4253. @table @option
  4254. @item time_base
  4255. The timebase which will be used for timestamps of submitted frames. It must be
  4256. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4257. @item sample_rate
  4258. The sample rate of the incoming audio buffers.
  4259. @item sample_fmt
  4260. The sample format of the incoming audio buffers.
  4261. Either a sample format name or its corresponding integer representation from
  4262. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4263. @item channel_layout
  4264. The channel layout of the incoming audio buffers.
  4265. Either a channel layout name from channel_layout_map in
  4266. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4267. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4268. @item channels
  4269. The number of channels of the incoming audio buffers.
  4270. If both @var{channels} and @var{channel_layout} are specified, then they
  4271. must be consistent.
  4272. @end table
  4273. @subsection Examples
  4274. @example
  4275. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4276. @end example
  4277. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4278. Since the sample format with name "s16p" corresponds to the number
  4279. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4280. equivalent to:
  4281. @example
  4282. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4283. @end example
  4284. @section aevalsrc
  4285. Generate an audio signal specified by an expression.
  4286. This source accepts in input one or more expressions (one for each
  4287. channel), which are evaluated and used to generate a corresponding
  4288. audio signal.
  4289. This source accepts the following options:
  4290. @table @option
  4291. @item exprs
  4292. Set the '|'-separated expressions list for each separate channel. In case the
  4293. @option{channel_layout} option is not specified, the selected channel layout
  4294. depends on the number of provided expressions. Otherwise the last
  4295. specified expression is applied to the remaining output channels.
  4296. @item channel_layout, c
  4297. Set the channel layout. The number of channels in the specified layout
  4298. must be equal to the number of specified expressions.
  4299. @item duration, d
  4300. Set the minimum duration of the sourced audio. See
  4301. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4302. for the accepted syntax.
  4303. Note that the resulting duration may be greater than the specified
  4304. duration, as the generated audio is always cut at the end of a
  4305. complete frame.
  4306. If not specified, or the expressed duration is negative, the audio is
  4307. supposed to be generated forever.
  4308. @item nb_samples, n
  4309. Set the number of samples per channel per each output frame,
  4310. default to 1024.
  4311. @item sample_rate, s
  4312. Specify the sample rate, default to 44100.
  4313. @end table
  4314. Each expression in @var{exprs} can contain the following constants:
  4315. @table @option
  4316. @item n
  4317. number of the evaluated sample, starting from 0
  4318. @item t
  4319. time of the evaluated sample expressed in seconds, starting from 0
  4320. @item s
  4321. sample rate
  4322. @end table
  4323. @subsection Examples
  4324. @itemize
  4325. @item
  4326. Generate silence:
  4327. @example
  4328. aevalsrc=0
  4329. @end example
  4330. @item
  4331. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4332. 8000 Hz:
  4333. @example
  4334. aevalsrc="sin(440*2*PI*t):s=8000"
  4335. @end example
  4336. @item
  4337. Generate a two channels signal, specify the channel layout (Front
  4338. Center + Back Center) explicitly:
  4339. @example
  4340. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4341. @end example
  4342. @item
  4343. Generate white noise:
  4344. @example
  4345. aevalsrc="-2+random(0)"
  4346. @end example
  4347. @item
  4348. Generate an amplitude modulated signal:
  4349. @example
  4350. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4351. @end example
  4352. @item
  4353. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4354. @example
  4355. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4356. @end example
  4357. @end itemize
  4358. @section anullsrc
  4359. The null audio source, return unprocessed audio frames. It is mainly useful
  4360. as a template and to be employed in analysis / debugging tools, or as
  4361. the source for filters which ignore the input data (for example the sox
  4362. synth filter).
  4363. This source accepts the following options:
  4364. @table @option
  4365. @item channel_layout, cl
  4366. Specifies the channel layout, and can be either an integer or a string
  4367. representing a channel layout. The default value of @var{channel_layout}
  4368. is "stereo".
  4369. Check the channel_layout_map definition in
  4370. @file{libavutil/channel_layout.c} for the mapping between strings and
  4371. channel layout values.
  4372. @item sample_rate, r
  4373. Specifies the sample rate, and defaults to 44100.
  4374. @item nb_samples, n
  4375. Set the number of samples per requested frames.
  4376. @end table
  4377. @subsection Examples
  4378. @itemize
  4379. @item
  4380. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4381. @example
  4382. anullsrc=r=48000:cl=4
  4383. @end example
  4384. @item
  4385. Do the same operation with a more obvious syntax:
  4386. @example
  4387. anullsrc=r=48000:cl=mono
  4388. @end example
  4389. @end itemize
  4390. All the parameters need to be explicitly defined.
  4391. @section flite
  4392. Synthesize a voice utterance using the libflite library.
  4393. To enable compilation of this filter you need to configure FFmpeg with
  4394. @code{--enable-libflite}.
  4395. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4396. The filter accepts the following options:
  4397. @table @option
  4398. @item list_voices
  4399. If set to 1, list the names of the available voices and exit
  4400. immediately. Default value is 0.
  4401. @item nb_samples, n
  4402. Set the maximum number of samples per frame. Default value is 512.
  4403. @item textfile
  4404. Set the filename containing the text to speak.
  4405. @item text
  4406. Set the text to speak.
  4407. @item voice, v
  4408. Set the voice to use for the speech synthesis. Default value is
  4409. @code{kal}. See also the @var{list_voices} option.
  4410. @end table
  4411. @subsection Examples
  4412. @itemize
  4413. @item
  4414. Read from file @file{speech.txt}, and synthesize the text using the
  4415. standard flite voice:
  4416. @example
  4417. flite=textfile=speech.txt
  4418. @end example
  4419. @item
  4420. Read the specified text selecting the @code{slt} voice:
  4421. @example
  4422. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4423. @end example
  4424. @item
  4425. Input text to ffmpeg:
  4426. @example
  4427. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4428. @end example
  4429. @item
  4430. Make @file{ffplay} speak the specified text, using @code{flite} and
  4431. the @code{lavfi} device:
  4432. @example
  4433. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4434. @end example
  4435. @end itemize
  4436. For more information about libflite, check:
  4437. @url{http://www.festvox.org/flite/}
  4438. @section anoisesrc
  4439. Generate a noise audio signal.
  4440. The filter accepts the following options:
  4441. @table @option
  4442. @item sample_rate, r
  4443. Specify the sample rate. Default value is 48000 Hz.
  4444. @item amplitude, a
  4445. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4446. is 1.0.
  4447. @item duration, d
  4448. Specify the duration of the generated audio stream. Not specifying this option
  4449. results in noise with an infinite length.
  4450. @item color, colour, c
  4451. Specify the color of noise. Available noise colors are white, pink, brown,
  4452. blue and violet. Default color is white.
  4453. @item seed, s
  4454. Specify a value used to seed the PRNG.
  4455. @item nb_samples, n
  4456. Set the number of samples per each output frame, default is 1024.
  4457. @end table
  4458. @subsection Examples
  4459. @itemize
  4460. @item
  4461. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4462. @example
  4463. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4464. @end example
  4465. @end itemize
  4466. @section hilbert
  4467. Generate odd-tap Hilbert transform FIR coefficients.
  4468. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4469. the signal by 90 degrees.
  4470. This is used in many matrix coding schemes and for analytic signal generation.
  4471. The process is often written as a multiplication by i (or j), the imaginary unit.
  4472. The filter accepts the following options:
  4473. @table @option
  4474. @item sample_rate, s
  4475. Set sample rate, default is 44100.
  4476. @item taps, t
  4477. Set length of FIR filter, default is 22051.
  4478. @item nb_samples, n
  4479. Set number of samples per each frame.
  4480. @item win_func, w
  4481. Set window function to be used when generating FIR coefficients.
  4482. @end table
  4483. @section sinc
  4484. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4485. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4486. The filter accepts the following options:
  4487. @table @option
  4488. @item sample_rate, r
  4489. Set sample rate, default is 44100.
  4490. @item nb_samples, n
  4491. Set number of samples per each frame. Default is 1024.
  4492. @item hp
  4493. Set high-pass frequency. Default is 0.
  4494. @item lp
  4495. Set low-pass frequency. Default is 0.
  4496. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4497. is higher than 0 then filter will create band-pass filter coefficients,
  4498. otherwise band-reject filter coefficients.
  4499. @item phase
  4500. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4501. @item beta
  4502. Set Kaiser window beta.
  4503. @item att
  4504. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4505. @item round
  4506. Enable rounding, by default is disabled.
  4507. @item hptaps
  4508. Set number of taps for high-pass filter.
  4509. @item lptaps
  4510. Set number of taps for low-pass filter.
  4511. @end table
  4512. @section sine
  4513. Generate an audio signal made of a sine wave with amplitude 1/8.
  4514. The audio signal is bit-exact.
  4515. The filter accepts the following options:
  4516. @table @option
  4517. @item frequency, f
  4518. Set the carrier frequency. Default is 440 Hz.
  4519. @item beep_factor, b
  4520. Enable a periodic beep every second with frequency @var{beep_factor} times
  4521. the carrier frequency. Default is 0, meaning the beep is disabled.
  4522. @item sample_rate, r
  4523. Specify the sample rate, default is 44100.
  4524. @item duration, d
  4525. Specify the duration of the generated audio stream.
  4526. @item samples_per_frame
  4527. Set the number of samples per output frame.
  4528. The expression can contain the following constants:
  4529. @table @option
  4530. @item n
  4531. The (sequential) number of the output audio frame, starting from 0.
  4532. @item pts
  4533. The PTS (Presentation TimeStamp) of the output audio frame,
  4534. expressed in @var{TB} units.
  4535. @item t
  4536. The PTS of the output audio frame, expressed in seconds.
  4537. @item TB
  4538. The timebase of the output audio frames.
  4539. @end table
  4540. Default is @code{1024}.
  4541. @end table
  4542. @subsection Examples
  4543. @itemize
  4544. @item
  4545. Generate a simple 440 Hz sine wave:
  4546. @example
  4547. sine
  4548. @end example
  4549. @item
  4550. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4551. @example
  4552. sine=220:4:d=5
  4553. sine=f=220:b=4:d=5
  4554. sine=frequency=220:beep_factor=4:duration=5
  4555. @end example
  4556. @item
  4557. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4558. pattern:
  4559. @example
  4560. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4561. @end example
  4562. @end itemize
  4563. @c man end AUDIO SOURCES
  4564. @chapter Audio Sinks
  4565. @c man begin AUDIO SINKS
  4566. Below is a description of the currently available audio sinks.
  4567. @section abuffersink
  4568. Buffer audio frames, and make them available to the end of filter chain.
  4569. This sink is mainly intended for programmatic use, in particular
  4570. through the interface defined in @file{libavfilter/buffersink.h}
  4571. or the options system.
  4572. It accepts a pointer to an AVABufferSinkContext structure, which
  4573. defines the incoming buffers' formats, to be passed as the opaque
  4574. parameter to @code{avfilter_init_filter} for initialization.
  4575. @section anullsink
  4576. Null audio sink; do absolutely nothing with the input audio. It is
  4577. mainly useful as a template and for use in analysis / debugging
  4578. tools.
  4579. @c man end AUDIO SINKS
  4580. @chapter Video Filters
  4581. @c man begin VIDEO FILTERS
  4582. When you configure your FFmpeg build, you can disable any of the
  4583. existing filters using @code{--disable-filters}.
  4584. The configure output will show the video filters included in your
  4585. build.
  4586. Below is a description of the currently available video filters.
  4587. @section addroi
  4588. Mark a region of interest in a video frame.
  4589. The frame data is passed through unchanged, but metadata is attached
  4590. to the frame indicating regions of interest which can affect the
  4591. behaviour of later encoding. Multiple regions can be marked by
  4592. applying the filter multiple times.
  4593. @table @option
  4594. @item x
  4595. Region distance in pixels from the left edge of the frame.
  4596. @item y
  4597. Region distance in pixels from the top edge of the frame.
  4598. @item w
  4599. Region width in pixels.
  4600. @item h
  4601. Region height in pixels.
  4602. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  4603. and may contain the following variables:
  4604. @table @option
  4605. @item iw
  4606. Width of the input frame.
  4607. @item ih
  4608. Height of the input frame.
  4609. @end table
  4610. @item qoffset
  4611. Quantisation offset to apply within the region.
  4612. This must be a real value in the range -1 to +1. A value of zero
  4613. indicates no quality change. A negative value asks for better quality
  4614. (less quantisation), while a positive value asks for worse quality
  4615. (greater quantisation).
  4616. The range is calibrated so that the extreme values indicate the
  4617. largest possible offset - if the rest of the frame is encoded with the
  4618. worst possible quality, an offset of -1 indicates that this region
  4619. should be encoded with the best possible quality anyway. Intermediate
  4620. values are then interpolated in some codec-dependent way.
  4621. For example, in 10-bit H.264 the quantisation parameter varies between
  4622. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  4623. this region should be encoded with a QP around one-tenth of the full
  4624. range better than the rest of the frame. So, if most of the frame
  4625. were to be encoded with a QP of around 30, this region would get a QP
  4626. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  4627. An extreme value of -1 would indicate that this region should be
  4628. encoded with the best possible quality regardless of the treatment of
  4629. the rest of the frame - that is, should be encoded at a QP of -12.
  4630. @item clear
  4631. If set to true, remove any existing regions of interest marked on the
  4632. frame before adding the new one.
  4633. @end table
  4634. @subsection Examples
  4635. @itemize
  4636. @item
  4637. Mark the centre quarter of the frame as interesting.
  4638. @example
  4639. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  4640. @end example
  4641. @item
  4642. Mark the 100-pixel-wide region on the left edge of the frame as very
  4643. uninteresting (to be encoded at much lower quality than the rest of
  4644. the frame).
  4645. @example
  4646. addroi=0:0:100:ih:+1/5
  4647. @end example
  4648. @end itemize
  4649. @section alphaextract
  4650. Extract the alpha component from the input as a grayscale video. This
  4651. is especially useful with the @var{alphamerge} filter.
  4652. @section alphamerge
  4653. Add or replace the alpha component of the primary input with the
  4654. grayscale value of a second input. This is intended for use with
  4655. @var{alphaextract} to allow the transmission or storage of frame
  4656. sequences that have alpha in a format that doesn't support an alpha
  4657. channel.
  4658. For example, to reconstruct full frames from a normal YUV-encoded video
  4659. and a separate video created with @var{alphaextract}, you might use:
  4660. @example
  4661. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4662. @end example
  4663. Since this filter is designed for reconstruction, it operates on frame
  4664. sequences without considering timestamps, and terminates when either
  4665. input reaches end of stream. This will cause problems if your encoding
  4666. pipeline drops frames. If you're trying to apply an image as an
  4667. overlay to a video stream, consider the @var{overlay} filter instead.
  4668. @section amplify
  4669. Amplify differences between current pixel and pixels of adjacent frames in
  4670. same pixel location.
  4671. This filter accepts the following options:
  4672. @table @option
  4673. @item radius
  4674. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4675. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4676. @item factor
  4677. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4678. @item threshold
  4679. Set threshold for difference amplification. Any difference greater or equal to
  4680. this value will not alter source pixel. Default is 10.
  4681. Allowed range is from 0 to 65535.
  4682. @item tolerance
  4683. Set tolerance for difference amplification. Any difference lower to
  4684. this value will not alter source pixel. Default is 0.
  4685. Allowed range is from 0 to 65535.
  4686. @item low
  4687. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4688. This option controls maximum possible value that will decrease source pixel value.
  4689. @item high
  4690. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4691. This option controls maximum possible value that will increase source pixel value.
  4692. @item planes
  4693. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4694. @end table
  4695. @section ass
  4696. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4697. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4698. Substation Alpha) subtitles files.
  4699. This filter accepts the following option in addition to the common options from
  4700. the @ref{subtitles} filter:
  4701. @table @option
  4702. @item shaping
  4703. Set the shaping engine
  4704. Available values are:
  4705. @table @samp
  4706. @item auto
  4707. The default libass shaping engine, which is the best available.
  4708. @item simple
  4709. Fast, font-agnostic shaper that can do only substitutions
  4710. @item complex
  4711. Slower shaper using OpenType for substitutions and positioning
  4712. @end table
  4713. The default is @code{auto}.
  4714. @end table
  4715. @section atadenoise
  4716. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4717. The filter accepts the following options:
  4718. @table @option
  4719. @item 0a
  4720. Set threshold A for 1st plane. Default is 0.02.
  4721. Valid range is 0 to 0.3.
  4722. @item 0b
  4723. Set threshold B for 1st plane. Default is 0.04.
  4724. Valid range is 0 to 5.
  4725. @item 1a
  4726. Set threshold A for 2nd plane. Default is 0.02.
  4727. Valid range is 0 to 0.3.
  4728. @item 1b
  4729. Set threshold B for 2nd plane. Default is 0.04.
  4730. Valid range is 0 to 5.
  4731. @item 2a
  4732. Set threshold A for 3rd plane. Default is 0.02.
  4733. Valid range is 0 to 0.3.
  4734. @item 2b
  4735. Set threshold B for 3rd plane. Default is 0.04.
  4736. Valid range is 0 to 5.
  4737. Threshold A is designed to react on abrupt changes in the input signal and
  4738. threshold B is designed to react on continuous changes in the input signal.
  4739. @item s
  4740. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4741. number in range [5, 129].
  4742. @item p
  4743. Set what planes of frame filter will use for averaging. Default is all.
  4744. @end table
  4745. @section avgblur
  4746. Apply average blur filter.
  4747. The filter accepts the following options:
  4748. @table @option
  4749. @item sizeX
  4750. Set horizontal radius size.
  4751. @item planes
  4752. Set which planes to filter. By default all planes are filtered.
  4753. @item sizeY
  4754. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4755. Default is @code{0}.
  4756. @end table
  4757. @section bbox
  4758. Compute the bounding box for the non-black pixels in the input frame
  4759. luminance plane.
  4760. This filter computes the bounding box containing all the pixels with a
  4761. luminance value greater than the minimum allowed value.
  4762. The parameters describing the bounding box are printed on the filter
  4763. log.
  4764. The filter accepts the following option:
  4765. @table @option
  4766. @item min_val
  4767. Set the minimal luminance value. Default is @code{16}.
  4768. @end table
  4769. @section bitplanenoise
  4770. Show and measure bit plane noise.
  4771. The filter accepts the following options:
  4772. @table @option
  4773. @item bitplane
  4774. Set which plane to analyze. Default is @code{1}.
  4775. @item filter
  4776. Filter out noisy pixels from @code{bitplane} set above.
  4777. Default is disabled.
  4778. @end table
  4779. @section blackdetect
  4780. Detect video intervals that are (almost) completely black. Can be
  4781. useful to detect chapter transitions, commercials, or invalid
  4782. recordings. Output lines contains the time for the start, end and
  4783. duration of the detected black interval expressed in seconds.
  4784. In order to display the output lines, you need to set the loglevel at
  4785. least to the AV_LOG_INFO value.
  4786. The filter accepts the following options:
  4787. @table @option
  4788. @item black_min_duration, d
  4789. Set the minimum detected black duration expressed in seconds. It must
  4790. be a non-negative floating point number.
  4791. Default value is 2.0.
  4792. @item picture_black_ratio_th, pic_th
  4793. Set the threshold for considering a picture "black".
  4794. Express the minimum value for the ratio:
  4795. @example
  4796. @var{nb_black_pixels} / @var{nb_pixels}
  4797. @end example
  4798. for which a picture is considered black.
  4799. Default value is 0.98.
  4800. @item pixel_black_th, pix_th
  4801. Set the threshold for considering a pixel "black".
  4802. The threshold expresses the maximum pixel luminance value for which a
  4803. pixel is considered "black". The provided value is scaled according to
  4804. the following equation:
  4805. @example
  4806. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4807. @end example
  4808. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4809. the input video format, the range is [0-255] for YUV full-range
  4810. formats and [16-235] for YUV non full-range formats.
  4811. Default value is 0.10.
  4812. @end table
  4813. The following example sets the maximum pixel threshold to the minimum
  4814. value, and detects only black intervals of 2 or more seconds:
  4815. @example
  4816. blackdetect=d=2:pix_th=0.00
  4817. @end example
  4818. @section blackframe
  4819. Detect frames that are (almost) completely black. Can be useful to
  4820. detect chapter transitions or commercials. Output lines consist of
  4821. the frame number of the detected frame, the percentage of blackness,
  4822. the position in the file if known or -1 and the timestamp in seconds.
  4823. In order to display the output lines, you need to set the loglevel at
  4824. least to the AV_LOG_INFO value.
  4825. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4826. The value represents the percentage of pixels in the picture that
  4827. are below the threshold value.
  4828. It accepts the following parameters:
  4829. @table @option
  4830. @item amount
  4831. The percentage of the pixels that have to be below the threshold; it defaults to
  4832. @code{98}.
  4833. @item threshold, thresh
  4834. The threshold below which a pixel value is considered black; it defaults to
  4835. @code{32}.
  4836. @end table
  4837. @section blend, tblend
  4838. Blend two video frames into each other.
  4839. The @code{blend} filter takes two input streams and outputs one
  4840. stream, the first input is the "top" layer and second input is
  4841. "bottom" layer. By default, the output terminates when the longest input terminates.
  4842. The @code{tblend} (time blend) filter takes two consecutive frames
  4843. from one single stream, and outputs the result obtained by blending
  4844. the new frame on top of the old frame.
  4845. A description of the accepted options follows.
  4846. @table @option
  4847. @item c0_mode
  4848. @item c1_mode
  4849. @item c2_mode
  4850. @item c3_mode
  4851. @item all_mode
  4852. Set blend mode for specific pixel component or all pixel components in case
  4853. of @var{all_mode}. Default value is @code{normal}.
  4854. Available values for component modes are:
  4855. @table @samp
  4856. @item addition
  4857. @item grainmerge
  4858. @item and
  4859. @item average
  4860. @item burn
  4861. @item darken
  4862. @item difference
  4863. @item grainextract
  4864. @item divide
  4865. @item dodge
  4866. @item freeze
  4867. @item exclusion
  4868. @item extremity
  4869. @item glow
  4870. @item hardlight
  4871. @item hardmix
  4872. @item heat
  4873. @item lighten
  4874. @item linearlight
  4875. @item multiply
  4876. @item multiply128
  4877. @item negation
  4878. @item normal
  4879. @item or
  4880. @item overlay
  4881. @item phoenix
  4882. @item pinlight
  4883. @item reflect
  4884. @item screen
  4885. @item softlight
  4886. @item subtract
  4887. @item vividlight
  4888. @item xor
  4889. @end table
  4890. @item c0_opacity
  4891. @item c1_opacity
  4892. @item c2_opacity
  4893. @item c3_opacity
  4894. @item all_opacity
  4895. Set blend opacity for specific pixel component or all pixel components in case
  4896. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4897. @item c0_expr
  4898. @item c1_expr
  4899. @item c2_expr
  4900. @item c3_expr
  4901. @item all_expr
  4902. Set blend expression for specific pixel component or all pixel components in case
  4903. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4904. The expressions can use the following variables:
  4905. @table @option
  4906. @item N
  4907. The sequential number of the filtered frame, starting from @code{0}.
  4908. @item X
  4909. @item Y
  4910. the coordinates of the current sample
  4911. @item W
  4912. @item H
  4913. the width and height of currently filtered plane
  4914. @item SW
  4915. @item SH
  4916. Width and height scale for the plane being filtered. It is the
  4917. ratio between the dimensions of the current plane to the luma plane,
  4918. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4919. the luma plane and @code{0.5,0.5} for the chroma planes.
  4920. @item T
  4921. Time of the current frame, expressed in seconds.
  4922. @item TOP, A
  4923. Value of pixel component at current location for first video frame (top layer).
  4924. @item BOTTOM, B
  4925. Value of pixel component at current location for second video frame (bottom layer).
  4926. @end table
  4927. @end table
  4928. The @code{blend} filter also supports the @ref{framesync} options.
  4929. @subsection Examples
  4930. @itemize
  4931. @item
  4932. Apply transition from bottom layer to top layer in first 10 seconds:
  4933. @example
  4934. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4935. @end example
  4936. @item
  4937. Apply linear horizontal transition from top layer to bottom layer:
  4938. @example
  4939. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4940. @end example
  4941. @item
  4942. Apply 1x1 checkerboard effect:
  4943. @example
  4944. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4945. @end example
  4946. @item
  4947. Apply uncover left effect:
  4948. @example
  4949. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4950. @end example
  4951. @item
  4952. Apply uncover down effect:
  4953. @example
  4954. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4955. @end example
  4956. @item
  4957. Apply uncover up-left effect:
  4958. @example
  4959. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4960. @end example
  4961. @item
  4962. Split diagonally video and shows top and bottom layer on each side:
  4963. @example
  4964. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4965. @end example
  4966. @item
  4967. Display differences between the current and the previous frame:
  4968. @example
  4969. tblend=all_mode=grainextract
  4970. @end example
  4971. @end itemize
  4972. @section bm3d
  4973. Denoise frames using Block-Matching 3D algorithm.
  4974. The filter accepts the following options.
  4975. @table @option
  4976. @item sigma
  4977. Set denoising strength. Default value is 1.
  4978. Allowed range is from 0 to 999.9.
  4979. The denoising algorithm is very sensitive to sigma, so adjust it
  4980. according to the source.
  4981. @item block
  4982. Set local patch size. This sets dimensions in 2D.
  4983. @item bstep
  4984. Set sliding step for processing blocks. Default value is 4.
  4985. Allowed range is from 1 to 64.
  4986. Smaller values allows processing more reference blocks and is slower.
  4987. @item group
  4988. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4989. When set to 1, no block matching is done. Larger values allows more blocks
  4990. in single group.
  4991. Allowed range is from 1 to 256.
  4992. @item range
  4993. Set radius for search block matching. Default is 9.
  4994. Allowed range is from 1 to INT32_MAX.
  4995. @item mstep
  4996. Set step between two search locations for block matching. Default is 1.
  4997. Allowed range is from 1 to 64. Smaller is slower.
  4998. @item thmse
  4999. Set threshold of mean square error for block matching. Valid range is 0 to
  5000. INT32_MAX.
  5001. @item hdthr
  5002. Set thresholding parameter for hard thresholding in 3D transformed domain.
  5003. Larger values results in stronger hard-thresholding filtering in frequency
  5004. domain.
  5005. @item estim
  5006. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  5007. Default is @code{basic}.
  5008. @item ref
  5009. If enabled, filter will use 2nd stream for block matching.
  5010. Default is disabled for @code{basic} value of @var{estim} option,
  5011. and always enabled if value of @var{estim} is @code{final}.
  5012. @item planes
  5013. Set planes to filter. Default is all available except alpha.
  5014. @end table
  5015. @subsection Examples
  5016. @itemize
  5017. @item
  5018. Basic filtering with bm3d:
  5019. @example
  5020. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  5021. @end example
  5022. @item
  5023. Same as above, but filtering only luma:
  5024. @example
  5025. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  5026. @end example
  5027. @item
  5028. Same as above, but with both estimation modes:
  5029. @example
  5030. 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
  5031. @end example
  5032. @item
  5033. Same as above, but prefilter with @ref{nlmeans} filter instead:
  5034. @example
  5035. 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
  5036. @end example
  5037. @end itemize
  5038. @section boxblur
  5039. Apply a boxblur algorithm to the input video.
  5040. It accepts the following parameters:
  5041. @table @option
  5042. @item luma_radius, lr
  5043. @item luma_power, lp
  5044. @item chroma_radius, cr
  5045. @item chroma_power, cp
  5046. @item alpha_radius, ar
  5047. @item alpha_power, ap
  5048. @end table
  5049. A description of the accepted options follows.
  5050. @table @option
  5051. @item luma_radius, lr
  5052. @item chroma_radius, cr
  5053. @item alpha_radius, ar
  5054. Set an expression for the box radius in pixels used for blurring the
  5055. corresponding input plane.
  5056. The radius value must be a non-negative number, and must not be
  5057. greater than the value of the expression @code{min(w,h)/2} for the
  5058. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  5059. planes.
  5060. Default value for @option{luma_radius} is "2". If not specified,
  5061. @option{chroma_radius} and @option{alpha_radius} default to the
  5062. corresponding value set for @option{luma_radius}.
  5063. The expressions can contain the following constants:
  5064. @table @option
  5065. @item w
  5066. @item h
  5067. The input width and height in pixels.
  5068. @item cw
  5069. @item ch
  5070. The input chroma image width and height in pixels.
  5071. @item hsub
  5072. @item vsub
  5073. The horizontal and vertical chroma subsample values. For example, for the
  5074. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  5075. @end table
  5076. @item luma_power, lp
  5077. @item chroma_power, cp
  5078. @item alpha_power, ap
  5079. Specify how many times the boxblur filter is applied to the
  5080. corresponding plane.
  5081. Default value for @option{luma_power} is 2. If not specified,
  5082. @option{chroma_power} and @option{alpha_power} default to the
  5083. corresponding value set for @option{luma_power}.
  5084. A value of 0 will disable the effect.
  5085. @end table
  5086. @subsection Examples
  5087. @itemize
  5088. @item
  5089. Apply a boxblur filter with the luma, chroma, and alpha radii
  5090. set to 2:
  5091. @example
  5092. boxblur=luma_radius=2:luma_power=1
  5093. boxblur=2:1
  5094. @end example
  5095. @item
  5096. Set the luma radius to 2, and alpha and chroma radius to 0:
  5097. @example
  5098. boxblur=2:1:cr=0:ar=0
  5099. @end example
  5100. @item
  5101. Set the luma and chroma radii to a fraction of the video dimension:
  5102. @example
  5103. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  5104. @end example
  5105. @end itemize
  5106. @section bwdif
  5107. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  5108. Deinterlacing Filter").
  5109. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  5110. interpolation algorithms.
  5111. It accepts the following parameters:
  5112. @table @option
  5113. @item mode
  5114. The interlacing mode to adopt. It accepts one of the following values:
  5115. @table @option
  5116. @item 0, send_frame
  5117. Output one frame for each frame.
  5118. @item 1, send_field
  5119. Output one frame for each field.
  5120. @end table
  5121. The default value is @code{send_field}.
  5122. @item parity
  5123. The picture field parity assumed for the input interlaced video. It accepts one
  5124. of the following values:
  5125. @table @option
  5126. @item 0, tff
  5127. Assume the top field is first.
  5128. @item 1, bff
  5129. Assume the bottom field is first.
  5130. @item -1, auto
  5131. Enable automatic detection of field parity.
  5132. @end table
  5133. The default value is @code{auto}.
  5134. If the interlacing is unknown or the decoder does not export this information,
  5135. top field first will be assumed.
  5136. @item deint
  5137. Specify which frames to deinterlace. Accepts one of the following
  5138. values:
  5139. @table @option
  5140. @item 0, all
  5141. Deinterlace all frames.
  5142. @item 1, interlaced
  5143. Only deinterlace frames marked as interlaced.
  5144. @end table
  5145. The default value is @code{all}.
  5146. @end table
  5147. @section chromahold
  5148. Remove all color information for all colors except for certain one.
  5149. The filter accepts the following options:
  5150. @table @option
  5151. @item color
  5152. The color which will not be replaced with neutral chroma.
  5153. @item similarity
  5154. Similarity percentage with the above color.
  5155. 0.01 matches only the exact key color, while 1.0 matches everything.
  5156. @item blend
  5157. Blend percentage.
  5158. 0.0 makes pixels either fully gray, or not gray at all.
  5159. Higher values result in more preserved color.
  5160. @item yuv
  5161. Signals that the color passed is already in YUV instead of RGB.
  5162. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5163. This can be used to pass exact YUV values as hexadecimal numbers.
  5164. @end table
  5165. @section chromakey
  5166. YUV colorspace color/chroma keying.
  5167. The filter accepts the following options:
  5168. @table @option
  5169. @item color
  5170. The color which will be replaced with transparency.
  5171. @item similarity
  5172. Similarity percentage with the key color.
  5173. 0.01 matches only the exact key color, while 1.0 matches everything.
  5174. @item blend
  5175. Blend percentage.
  5176. 0.0 makes pixels either fully transparent, or not transparent at all.
  5177. Higher values result in semi-transparent pixels, with a higher transparency
  5178. the more similar the pixels color is to the key color.
  5179. @item yuv
  5180. Signals that the color passed is already in YUV instead of RGB.
  5181. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  5182. This can be used to pass exact YUV values as hexadecimal numbers.
  5183. @end table
  5184. @subsection Examples
  5185. @itemize
  5186. @item
  5187. Make every green pixel in the input image transparent:
  5188. @example
  5189. ffmpeg -i input.png -vf chromakey=green out.png
  5190. @end example
  5191. @item
  5192. Overlay a greenscreen-video on top of a static black background.
  5193. @example
  5194. 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
  5195. @end example
  5196. @end itemize
  5197. @section chromashift
  5198. Shift chroma pixels horizontally and/or vertically.
  5199. The filter accepts the following options:
  5200. @table @option
  5201. @item cbh
  5202. Set amount to shift chroma-blue horizontally.
  5203. @item cbv
  5204. Set amount to shift chroma-blue vertically.
  5205. @item crh
  5206. Set amount to shift chroma-red horizontally.
  5207. @item crv
  5208. Set amount to shift chroma-red vertically.
  5209. @item edge
  5210. Set edge mode, can be @var{smear}, default, or @var{warp}.
  5211. @end table
  5212. @section ciescope
  5213. Display CIE color diagram with pixels overlaid onto it.
  5214. The filter accepts the following options:
  5215. @table @option
  5216. @item system
  5217. Set color system.
  5218. @table @samp
  5219. @item ntsc, 470m
  5220. @item ebu, 470bg
  5221. @item smpte
  5222. @item 240m
  5223. @item apple
  5224. @item widergb
  5225. @item cie1931
  5226. @item rec709, hdtv
  5227. @item uhdtv, rec2020
  5228. @item dcip3
  5229. @end table
  5230. @item cie
  5231. Set CIE system.
  5232. @table @samp
  5233. @item xyy
  5234. @item ucs
  5235. @item luv
  5236. @end table
  5237. @item gamuts
  5238. Set what gamuts to draw.
  5239. See @code{system} option for available values.
  5240. @item size, s
  5241. Set ciescope size, by default set to 512.
  5242. @item intensity, i
  5243. Set intensity used to map input pixel values to CIE diagram.
  5244. @item contrast
  5245. Set contrast used to draw tongue colors that are out of active color system gamut.
  5246. @item corrgamma
  5247. Correct gamma displayed on scope, by default enabled.
  5248. @item showwhite
  5249. Show white point on CIE diagram, by default disabled.
  5250. @item gamma
  5251. Set input gamma. Used only with XYZ input color space.
  5252. @end table
  5253. @section codecview
  5254. Visualize information exported by some codecs.
  5255. Some codecs can export information through frames using side-data or other
  5256. means. For example, some MPEG based codecs export motion vectors through the
  5257. @var{export_mvs} flag in the codec @option{flags2} option.
  5258. The filter accepts the following option:
  5259. @table @option
  5260. @item mv
  5261. Set motion vectors to visualize.
  5262. Available flags for @var{mv} are:
  5263. @table @samp
  5264. @item pf
  5265. forward predicted MVs of P-frames
  5266. @item bf
  5267. forward predicted MVs of B-frames
  5268. @item bb
  5269. backward predicted MVs of B-frames
  5270. @end table
  5271. @item qp
  5272. Display quantization parameters using the chroma planes.
  5273. @item mv_type, mvt
  5274. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5275. Available flags for @var{mv_type} are:
  5276. @table @samp
  5277. @item fp
  5278. forward predicted MVs
  5279. @item bp
  5280. backward predicted MVs
  5281. @end table
  5282. @item frame_type, ft
  5283. Set frame type to visualize motion vectors of.
  5284. Available flags for @var{frame_type} are:
  5285. @table @samp
  5286. @item if
  5287. intra-coded frames (I-frames)
  5288. @item pf
  5289. predicted frames (P-frames)
  5290. @item bf
  5291. bi-directionally predicted frames (B-frames)
  5292. @end table
  5293. @end table
  5294. @subsection Examples
  5295. @itemize
  5296. @item
  5297. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5298. @example
  5299. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5300. @end example
  5301. @item
  5302. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5303. @example
  5304. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5305. @end example
  5306. @end itemize
  5307. @section colorbalance
  5308. Modify intensity of primary colors (red, green and blue) of input frames.
  5309. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5310. regions for the red-cyan, green-magenta or blue-yellow balance.
  5311. A positive adjustment value shifts the balance towards the primary color, a negative
  5312. value towards the complementary color.
  5313. The filter accepts the following options:
  5314. @table @option
  5315. @item rs
  5316. @item gs
  5317. @item bs
  5318. Adjust red, green and blue shadows (darkest pixels).
  5319. @item rm
  5320. @item gm
  5321. @item bm
  5322. Adjust red, green and blue midtones (medium pixels).
  5323. @item rh
  5324. @item gh
  5325. @item bh
  5326. Adjust red, green and blue highlights (brightest pixels).
  5327. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5328. @end table
  5329. @subsection Examples
  5330. @itemize
  5331. @item
  5332. Add red color cast to shadows:
  5333. @example
  5334. colorbalance=rs=.3
  5335. @end example
  5336. @end itemize
  5337. @section colorchannelmixer
  5338. Adjust video input frames by re-mixing color channels.
  5339. This filter modifies a color channel by adding the values associated to
  5340. the other channels of the same pixels. For example if the value to
  5341. modify is red, the output value will be:
  5342. @example
  5343. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5344. @end example
  5345. The filter accepts the following options:
  5346. @table @option
  5347. @item rr
  5348. @item rg
  5349. @item rb
  5350. @item ra
  5351. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5352. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5353. @item gr
  5354. @item gg
  5355. @item gb
  5356. @item ga
  5357. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5358. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5359. @item br
  5360. @item bg
  5361. @item bb
  5362. @item ba
  5363. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5364. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5365. @item ar
  5366. @item ag
  5367. @item ab
  5368. @item aa
  5369. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5370. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5371. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5372. @end table
  5373. @subsection Examples
  5374. @itemize
  5375. @item
  5376. Convert source to grayscale:
  5377. @example
  5378. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5379. @end example
  5380. @item
  5381. Simulate sepia tones:
  5382. @example
  5383. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5384. @end example
  5385. @end itemize
  5386. @section colorkey
  5387. RGB colorspace color keying.
  5388. The filter accepts the following options:
  5389. @table @option
  5390. @item color
  5391. The color which will be replaced with transparency.
  5392. @item similarity
  5393. Similarity percentage with the key color.
  5394. 0.01 matches only the exact key color, while 1.0 matches everything.
  5395. @item blend
  5396. Blend percentage.
  5397. 0.0 makes pixels either fully transparent, or not transparent at all.
  5398. Higher values result in semi-transparent pixels, with a higher transparency
  5399. the more similar the pixels color is to the key color.
  5400. @end table
  5401. @subsection Examples
  5402. @itemize
  5403. @item
  5404. Make every green pixel in the input image transparent:
  5405. @example
  5406. ffmpeg -i input.png -vf colorkey=green out.png
  5407. @end example
  5408. @item
  5409. Overlay a greenscreen-video on top of a static background image.
  5410. @example
  5411. 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
  5412. @end example
  5413. @end itemize
  5414. @section colorhold
  5415. Remove all color information for all RGB colors except for certain one.
  5416. The filter accepts the following options:
  5417. @table @option
  5418. @item color
  5419. The color which will not be replaced with neutral gray.
  5420. @item similarity
  5421. Similarity percentage with the above color.
  5422. 0.01 matches only the exact key color, while 1.0 matches everything.
  5423. @item blend
  5424. Blend percentage. 0.0 makes pixels fully gray.
  5425. Higher values result in more preserved color.
  5426. @end table
  5427. @section colorlevels
  5428. Adjust video input frames using levels.
  5429. The filter accepts the following options:
  5430. @table @option
  5431. @item rimin
  5432. @item gimin
  5433. @item bimin
  5434. @item aimin
  5435. Adjust red, green, blue and alpha input black point.
  5436. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5437. @item rimax
  5438. @item gimax
  5439. @item bimax
  5440. @item aimax
  5441. Adjust red, green, blue and alpha input white point.
  5442. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5443. Input levels are used to lighten highlights (bright tones), darken shadows
  5444. (dark tones), change the balance of bright and dark tones.
  5445. @item romin
  5446. @item gomin
  5447. @item bomin
  5448. @item aomin
  5449. Adjust red, green, blue and alpha output black point.
  5450. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5451. @item romax
  5452. @item gomax
  5453. @item bomax
  5454. @item aomax
  5455. Adjust red, green, blue and alpha output white point.
  5456. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5457. Output levels allows manual selection of a constrained output level range.
  5458. @end table
  5459. @subsection Examples
  5460. @itemize
  5461. @item
  5462. Make video output darker:
  5463. @example
  5464. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5465. @end example
  5466. @item
  5467. Increase contrast:
  5468. @example
  5469. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5470. @end example
  5471. @item
  5472. Make video output lighter:
  5473. @example
  5474. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5475. @end example
  5476. @item
  5477. Increase brightness:
  5478. @example
  5479. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5480. @end example
  5481. @end itemize
  5482. @section colormatrix
  5483. Convert color matrix.
  5484. The filter accepts the following options:
  5485. @table @option
  5486. @item src
  5487. @item dst
  5488. Specify the source and destination color matrix. Both values must be
  5489. specified.
  5490. The accepted values are:
  5491. @table @samp
  5492. @item bt709
  5493. BT.709
  5494. @item fcc
  5495. FCC
  5496. @item bt601
  5497. BT.601
  5498. @item bt470
  5499. BT.470
  5500. @item bt470bg
  5501. BT.470BG
  5502. @item smpte170m
  5503. SMPTE-170M
  5504. @item smpte240m
  5505. SMPTE-240M
  5506. @item bt2020
  5507. BT.2020
  5508. @end table
  5509. @end table
  5510. For example to convert from BT.601 to SMPTE-240M, use the command:
  5511. @example
  5512. colormatrix=bt601:smpte240m
  5513. @end example
  5514. @section colorspace
  5515. Convert colorspace, transfer characteristics or color primaries.
  5516. Input video needs to have an even size.
  5517. The filter accepts the following options:
  5518. @table @option
  5519. @anchor{all}
  5520. @item all
  5521. Specify all color properties at once.
  5522. The accepted values are:
  5523. @table @samp
  5524. @item bt470m
  5525. BT.470M
  5526. @item bt470bg
  5527. BT.470BG
  5528. @item bt601-6-525
  5529. BT.601-6 525
  5530. @item bt601-6-625
  5531. BT.601-6 625
  5532. @item bt709
  5533. BT.709
  5534. @item smpte170m
  5535. SMPTE-170M
  5536. @item smpte240m
  5537. SMPTE-240M
  5538. @item bt2020
  5539. BT.2020
  5540. @end table
  5541. @anchor{space}
  5542. @item space
  5543. Specify output colorspace.
  5544. The accepted values are:
  5545. @table @samp
  5546. @item bt709
  5547. BT.709
  5548. @item fcc
  5549. FCC
  5550. @item bt470bg
  5551. BT.470BG or BT.601-6 625
  5552. @item smpte170m
  5553. SMPTE-170M or BT.601-6 525
  5554. @item smpte240m
  5555. SMPTE-240M
  5556. @item ycgco
  5557. YCgCo
  5558. @item bt2020ncl
  5559. BT.2020 with non-constant luminance
  5560. @end table
  5561. @anchor{trc}
  5562. @item trc
  5563. Specify output transfer characteristics.
  5564. The accepted values are:
  5565. @table @samp
  5566. @item bt709
  5567. BT.709
  5568. @item bt470m
  5569. BT.470M
  5570. @item bt470bg
  5571. BT.470BG
  5572. @item gamma22
  5573. Constant gamma of 2.2
  5574. @item gamma28
  5575. Constant gamma of 2.8
  5576. @item smpte170m
  5577. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5578. @item smpte240m
  5579. SMPTE-240M
  5580. @item srgb
  5581. SRGB
  5582. @item iec61966-2-1
  5583. iec61966-2-1
  5584. @item iec61966-2-4
  5585. iec61966-2-4
  5586. @item xvycc
  5587. xvycc
  5588. @item bt2020-10
  5589. BT.2020 for 10-bits content
  5590. @item bt2020-12
  5591. BT.2020 for 12-bits content
  5592. @end table
  5593. @anchor{primaries}
  5594. @item primaries
  5595. Specify output color primaries.
  5596. The accepted values are:
  5597. @table @samp
  5598. @item bt709
  5599. BT.709
  5600. @item bt470m
  5601. BT.470M
  5602. @item bt470bg
  5603. BT.470BG or BT.601-6 625
  5604. @item smpte170m
  5605. SMPTE-170M or BT.601-6 525
  5606. @item smpte240m
  5607. SMPTE-240M
  5608. @item film
  5609. film
  5610. @item smpte431
  5611. SMPTE-431
  5612. @item smpte432
  5613. SMPTE-432
  5614. @item bt2020
  5615. BT.2020
  5616. @item jedec-p22
  5617. JEDEC P22 phosphors
  5618. @end table
  5619. @anchor{range}
  5620. @item range
  5621. Specify output color range.
  5622. The accepted values are:
  5623. @table @samp
  5624. @item tv
  5625. TV (restricted) range
  5626. @item mpeg
  5627. MPEG (restricted) range
  5628. @item pc
  5629. PC (full) range
  5630. @item jpeg
  5631. JPEG (full) range
  5632. @end table
  5633. @item format
  5634. Specify output color format.
  5635. The accepted values are:
  5636. @table @samp
  5637. @item yuv420p
  5638. YUV 4:2:0 planar 8-bits
  5639. @item yuv420p10
  5640. YUV 4:2:0 planar 10-bits
  5641. @item yuv420p12
  5642. YUV 4:2:0 planar 12-bits
  5643. @item yuv422p
  5644. YUV 4:2:2 planar 8-bits
  5645. @item yuv422p10
  5646. YUV 4:2:2 planar 10-bits
  5647. @item yuv422p12
  5648. YUV 4:2:2 planar 12-bits
  5649. @item yuv444p
  5650. YUV 4:4:4 planar 8-bits
  5651. @item yuv444p10
  5652. YUV 4:4:4 planar 10-bits
  5653. @item yuv444p12
  5654. YUV 4:4:4 planar 12-bits
  5655. @end table
  5656. @item fast
  5657. Do a fast conversion, which skips gamma/primary correction. This will take
  5658. significantly less CPU, but will be mathematically incorrect. To get output
  5659. compatible with that produced by the colormatrix filter, use fast=1.
  5660. @item dither
  5661. Specify dithering mode.
  5662. The accepted values are:
  5663. @table @samp
  5664. @item none
  5665. No dithering
  5666. @item fsb
  5667. Floyd-Steinberg dithering
  5668. @end table
  5669. @item wpadapt
  5670. Whitepoint adaptation mode.
  5671. The accepted values are:
  5672. @table @samp
  5673. @item bradford
  5674. Bradford whitepoint adaptation
  5675. @item vonkries
  5676. von Kries whitepoint adaptation
  5677. @item identity
  5678. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5679. @end table
  5680. @item iall
  5681. Override all input properties at once. Same accepted values as @ref{all}.
  5682. @item ispace
  5683. Override input colorspace. Same accepted values as @ref{space}.
  5684. @item iprimaries
  5685. Override input color primaries. Same accepted values as @ref{primaries}.
  5686. @item itrc
  5687. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5688. @item irange
  5689. Override input color range. Same accepted values as @ref{range}.
  5690. @end table
  5691. The filter converts the transfer characteristics, color space and color
  5692. primaries to the specified user values. The output value, if not specified,
  5693. is set to a default value based on the "all" property. If that property is
  5694. also not specified, the filter will log an error. The output color range and
  5695. format default to the same value as the input color range and format. The
  5696. input transfer characteristics, color space, color primaries and color range
  5697. should be set on the input data. If any of these are missing, the filter will
  5698. log an error and no conversion will take place.
  5699. For example to convert the input to SMPTE-240M, use the command:
  5700. @example
  5701. colorspace=smpte240m
  5702. @end example
  5703. @section convolution
  5704. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5705. The filter accepts the following options:
  5706. @table @option
  5707. @item 0m
  5708. @item 1m
  5709. @item 2m
  5710. @item 3m
  5711. Set matrix for each plane.
  5712. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5713. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5714. @item 0rdiv
  5715. @item 1rdiv
  5716. @item 2rdiv
  5717. @item 3rdiv
  5718. Set multiplier for calculated value for each plane.
  5719. If unset or 0, it will be sum of all matrix elements.
  5720. @item 0bias
  5721. @item 1bias
  5722. @item 2bias
  5723. @item 3bias
  5724. Set bias for each plane. This value is added to the result of the multiplication.
  5725. Useful for making the overall image brighter or darker. Default is 0.0.
  5726. @item 0mode
  5727. @item 1mode
  5728. @item 2mode
  5729. @item 3mode
  5730. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5731. Default is @var{square}.
  5732. @end table
  5733. @subsection Examples
  5734. @itemize
  5735. @item
  5736. Apply sharpen:
  5737. @example
  5738. 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"
  5739. @end example
  5740. @item
  5741. Apply blur:
  5742. @example
  5743. 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"
  5744. @end example
  5745. @item
  5746. Apply edge enhance:
  5747. @example
  5748. 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"
  5749. @end example
  5750. @item
  5751. Apply edge detect:
  5752. @example
  5753. 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"
  5754. @end example
  5755. @item
  5756. Apply laplacian edge detector which includes diagonals:
  5757. @example
  5758. 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"
  5759. @end example
  5760. @item
  5761. Apply emboss:
  5762. @example
  5763. 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"
  5764. @end example
  5765. @end itemize
  5766. @section convolve
  5767. Apply 2D convolution of video stream in frequency domain using second stream
  5768. as impulse.
  5769. The filter accepts the following options:
  5770. @table @option
  5771. @item planes
  5772. Set which planes to process.
  5773. @item impulse
  5774. Set which impulse video frames will be processed, can be @var{first}
  5775. or @var{all}. Default is @var{all}.
  5776. @end table
  5777. The @code{convolve} filter also supports the @ref{framesync} options.
  5778. @section copy
  5779. Copy the input video source unchanged to the output. This is mainly useful for
  5780. testing purposes.
  5781. @anchor{coreimage}
  5782. @section coreimage
  5783. Video filtering on GPU using Apple's CoreImage API on OSX.
  5784. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5785. processed by video hardware. However, software-based OpenGL implementations
  5786. exist which means there is no guarantee for hardware processing. It depends on
  5787. the respective OSX.
  5788. There are many filters and image generators provided by Apple that come with a
  5789. large variety of options. The filter has to be referenced by its name along
  5790. with its options.
  5791. The coreimage filter accepts the following options:
  5792. @table @option
  5793. @item list_filters
  5794. List all available filters and generators along with all their respective
  5795. options as well as possible minimum and maximum values along with the default
  5796. values.
  5797. @example
  5798. list_filters=true
  5799. @end example
  5800. @item filter
  5801. Specify all filters by their respective name and options.
  5802. Use @var{list_filters} to determine all valid filter names and options.
  5803. Numerical options are specified by a float value and are automatically clamped
  5804. to their respective value range. Vector and color options have to be specified
  5805. by a list of space separated float values. Character escaping has to be done.
  5806. A special option name @code{default} is available to use default options for a
  5807. filter.
  5808. It is required to specify either @code{default} or at least one of the filter options.
  5809. All omitted options are used with their default values.
  5810. The syntax of the filter string is as follows:
  5811. @example
  5812. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5813. @end example
  5814. @item output_rect
  5815. Specify a rectangle where the output of the filter chain is copied into the
  5816. input image. It is given by a list of space separated float values:
  5817. @example
  5818. output_rect=x\ y\ width\ height
  5819. @end example
  5820. If not given, the output rectangle equals the dimensions of the input image.
  5821. The output rectangle is automatically cropped at the borders of the input
  5822. image. Negative values are valid for each component.
  5823. @example
  5824. output_rect=25\ 25\ 100\ 100
  5825. @end example
  5826. @end table
  5827. Several filters can be chained for successive processing without GPU-HOST
  5828. transfers allowing for fast processing of complex filter chains.
  5829. Currently, only filters with zero (generators) or exactly one (filters) input
  5830. image and one output image are supported. Also, transition filters are not yet
  5831. usable as intended.
  5832. Some filters generate output images with additional padding depending on the
  5833. respective filter kernel. The padding is automatically removed to ensure the
  5834. filter output has the same size as the input image.
  5835. For image generators, the size of the output image is determined by the
  5836. previous output image of the filter chain or the input image of the whole
  5837. filterchain, respectively. The generators do not use the pixel information of
  5838. this image to generate their output. However, the generated output is
  5839. blended onto this image, resulting in partial or complete coverage of the
  5840. output image.
  5841. The @ref{coreimagesrc} video source can be used for generating input images
  5842. which are directly fed into the filter chain. By using it, providing input
  5843. images by another video source or an input video is not required.
  5844. @subsection Examples
  5845. @itemize
  5846. @item
  5847. List all filters available:
  5848. @example
  5849. coreimage=list_filters=true
  5850. @end example
  5851. @item
  5852. Use the CIBoxBlur filter with default options to blur an image:
  5853. @example
  5854. coreimage=filter=CIBoxBlur@@default
  5855. @end example
  5856. @item
  5857. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5858. its center at 100x100 and a radius of 50 pixels:
  5859. @example
  5860. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5861. @end example
  5862. @item
  5863. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5864. given as complete and escaped command-line for Apple's standard bash shell:
  5865. @example
  5866. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5867. @end example
  5868. @end itemize
  5869. @section cover_rect
  5870. Cover a rectangular object
  5871. It accepts the following options:
  5872. @table @option
  5873. @item cover
  5874. Filepath of the optional cover image, needs to be in yuv420.
  5875. @item mode
  5876. Set covering mode.
  5877. It accepts the following values:
  5878. @table @samp
  5879. @item cover
  5880. cover it by the supplied image
  5881. @item blur
  5882. cover it by interpolating the surrounding pixels
  5883. @end table
  5884. Default value is @var{blur}.
  5885. @end table
  5886. @subsection Examples
  5887. @itemize
  5888. @item
  5889. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  5890. @example
  5891. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5892. @end example
  5893. @end itemize
  5894. @section crop
  5895. Crop the input video to given dimensions.
  5896. It accepts the following parameters:
  5897. @table @option
  5898. @item w, out_w
  5899. The width of the output video. It defaults to @code{iw}.
  5900. This expression is evaluated only once during the filter
  5901. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5902. @item h, out_h
  5903. The height of the output video. It defaults to @code{ih}.
  5904. This expression is evaluated only once during the filter
  5905. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5906. @item x
  5907. The horizontal position, in the input video, of the left edge of the output
  5908. video. It defaults to @code{(in_w-out_w)/2}.
  5909. This expression is evaluated per-frame.
  5910. @item y
  5911. The vertical position, in the input video, of the top edge of the output video.
  5912. It defaults to @code{(in_h-out_h)/2}.
  5913. This expression is evaluated per-frame.
  5914. @item keep_aspect
  5915. If set to 1 will force the output display aspect ratio
  5916. to be the same of the input, by changing the output sample aspect
  5917. ratio. It defaults to 0.
  5918. @item exact
  5919. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5920. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5921. It defaults to 0.
  5922. @end table
  5923. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5924. expressions containing the following constants:
  5925. @table @option
  5926. @item x
  5927. @item y
  5928. The computed values for @var{x} and @var{y}. They are evaluated for
  5929. each new frame.
  5930. @item in_w
  5931. @item in_h
  5932. The input width and height.
  5933. @item iw
  5934. @item ih
  5935. These are the same as @var{in_w} and @var{in_h}.
  5936. @item out_w
  5937. @item out_h
  5938. The output (cropped) width and height.
  5939. @item ow
  5940. @item oh
  5941. These are the same as @var{out_w} and @var{out_h}.
  5942. @item a
  5943. same as @var{iw} / @var{ih}
  5944. @item sar
  5945. input sample aspect ratio
  5946. @item dar
  5947. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5948. @item hsub
  5949. @item vsub
  5950. horizontal and vertical chroma subsample values. For example for the
  5951. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5952. @item n
  5953. The number of the input frame, starting from 0.
  5954. @item pos
  5955. the position in the file of the input frame, NAN if unknown
  5956. @item t
  5957. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5958. @end table
  5959. The expression for @var{out_w} may depend on the value of @var{out_h},
  5960. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5961. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5962. evaluated after @var{out_w} and @var{out_h}.
  5963. The @var{x} and @var{y} parameters specify the expressions for the
  5964. position of the top-left corner of the output (non-cropped) area. They
  5965. are evaluated for each frame. If the evaluated value is not valid, it
  5966. is approximated to the nearest valid value.
  5967. The expression for @var{x} may depend on @var{y}, and the expression
  5968. for @var{y} may depend on @var{x}.
  5969. @subsection Examples
  5970. @itemize
  5971. @item
  5972. Crop area with size 100x100 at position (12,34).
  5973. @example
  5974. crop=100:100:12:34
  5975. @end example
  5976. Using named options, the example above becomes:
  5977. @example
  5978. crop=w=100:h=100:x=12:y=34
  5979. @end example
  5980. @item
  5981. Crop the central input area with size 100x100:
  5982. @example
  5983. crop=100:100
  5984. @end example
  5985. @item
  5986. Crop the central input area with size 2/3 of the input video:
  5987. @example
  5988. crop=2/3*in_w:2/3*in_h
  5989. @end example
  5990. @item
  5991. Crop the input video central square:
  5992. @example
  5993. crop=out_w=in_h
  5994. crop=in_h
  5995. @end example
  5996. @item
  5997. Delimit the rectangle with the top-left corner placed at position
  5998. 100:100 and the right-bottom corner corresponding to the right-bottom
  5999. corner of the input image.
  6000. @example
  6001. crop=in_w-100:in_h-100:100:100
  6002. @end example
  6003. @item
  6004. Crop 10 pixels from the left and right borders, and 20 pixels from
  6005. the top and bottom borders
  6006. @example
  6007. crop=in_w-2*10:in_h-2*20
  6008. @end example
  6009. @item
  6010. Keep only the bottom right quarter of the input image:
  6011. @example
  6012. crop=in_w/2:in_h/2:in_w/2:in_h/2
  6013. @end example
  6014. @item
  6015. Crop height for getting Greek harmony:
  6016. @example
  6017. crop=in_w:1/PHI*in_w
  6018. @end example
  6019. @item
  6020. Apply trembling effect:
  6021. @example
  6022. 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)
  6023. @end example
  6024. @item
  6025. Apply erratic camera effect depending on timestamp:
  6026. @example
  6027. 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)"
  6028. @end example
  6029. @item
  6030. Set x depending on the value of y:
  6031. @example
  6032. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  6033. @end example
  6034. @end itemize
  6035. @subsection Commands
  6036. This filter supports the following commands:
  6037. @table @option
  6038. @item w, out_w
  6039. @item h, out_h
  6040. @item x
  6041. @item y
  6042. Set width/height of the output video and the horizontal/vertical position
  6043. in the input video.
  6044. The command accepts the same syntax of the corresponding option.
  6045. If the specified expression is not valid, it is kept at its current
  6046. value.
  6047. @end table
  6048. @section cropdetect
  6049. Auto-detect the crop size.
  6050. It calculates the necessary cropping parameters and prints the
  6051. recommended parameters via the logging system. The detected dimensions
  6052. correspond to the non-black area of the input video.
  6053. It accepts the following parameters:
  6054. @table @option
  6055. @item limit
  6056. Set higher black value threshold, which can be optionally specified
  6057. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  6058. value greater to the set value is considered non-black. It defaults to 24.
  6059. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  6060. on the bitdepth of the pixel format.
  6061. @item round
  6062. The value which the width/height should be divisible by. It defaults to
  6063. 16. The offset is automatically adjusted to center the video. Use 2 to
  6064. get only even dimensions (needed for 4:2:2 video). 16 is best when
  6065. encoding to most video codecs.
  6066. @item reset_count, reset
  6067. Set the counter that determines after how many frames cropdetect will
  6068. reset the previously detected largest video area and start over to
  6069. detect the current optimal crop area. Default value is 0.
  6070. This can be useful when channel logos distort the video area. 0
  6071. indicates 'never reset', and returns the largest area encountered during
  6072. playback.
  6073. @end table
  6074. @anchor{cue}
  6075. @section cue
  6076. Delay video filtering until a given wallclock timestamp. The filter first
  6077. passes on @option{preroll} amount of frames, then it buffers at most
  6078. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  6079. it forwards the buffered frames and also any subsequent frames coming in its
  6080. input.
  6081. The filter can be used synchronize the output of multiple ffmpeg processes for
  6082. realtime output devices like decklink. By putting the delay in the filtering
  6083. chain and pre-buffering frames the process can pass on data to output almost
  6084. immediately after the target wallclock timestamp is reached.
  6085. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  6086. some use cases.
  6087. @table @option
  6088. @item cue
  6089. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  6090. @item preroll
  6091. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  6092. @item buffer
  6093. The maximum duration of content to buffer before waiting for the cue expressed
  6094. in seconds. Default is 0.
  6095. @end table
  6096. @anchor{curves}
  6097. @section curves
  6098. Apply color adjustments using curves.
  6099. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  6100. component (red, green and blue) has its values defined by @var{N} key points
  6101. tied from each other using a smooth curve. The x-axis represents the pixel
  6102. values from the input frame, and the y-axis the new pixel values to be set for
  6103. the output frame.
  6104. By default, a component curve is defined by the two points @var{(0;0)} and
  6105. @var{(1;1)}. This creates a straight line where each original pixel value is
  6106. "adjusted" to its own value, which means no change to the image.
  6107. The filter allows you to redefine these two points and add some more. A new
  6108. curve (using a natural cubic spline interpolation) will be define to pass
  6109. smoothly through all these new coordinates. The new defined points needs to be
  6110. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  6111. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  6112. the vector spaces, the values will be clipped accordingly.
  6113. The filter accepts the following options:
  6114. @table @option
  6115. @item preset
  6116. Select one of the available color presets. This option can be used in addition
  6117. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  6118. options takes priority on the preset values.
  6119. Available presets are:
  6120. @table @samp
  6121. @item none
  6122. @item color_negative
  6123. @item cross_process
  6124. @item darker
  6125. @item increase_contrast
  6126. @item lighter
  6127. @item linear_contrast
  6128. @item medium_contrast
  6129. @item negative
  6130. @item strong_contrast
  6131. @item vintage
  6132. @end table
  6133. Default is @code{none}.
  6134. @item master, m
  6135. Set the master key points. These points will define a second pass mapping. It
  6136. is sometimes called a "luminance" or "value" mapping. It can be used with
  6137. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  6138. post-processing LUT.
  6139. @item red, r
  6140. Set the key points for the red component.
  6141. @item green, g
  6142. Set the key points for the green component.
  6143. @item blue, b
  6144. Set the key points for the blue component.
  6145. @item all
  6146. Set the key points for all components (not including master).
  6147. Can be used in addition to the other key points component
  6148. options. In this case, the unset component(s) will fallback on this
  6149. @option{all} setting.
  6150. @item psfile
  6151. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  6152. @item plot
  6153. Save Gnuplot script of the curves in specified file.
  6154. @end table
  6155. To avoid some filtergraph syntax conflicts, each key points list need to be
  6156. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  6157. @subsection Examples
  6158. @itemize
  6159. @item
  6160. Increase slightly the middle level of blue:
  6161. @example
  6162. curves=blue='0/0 0.5/0.58 1/1'
  6163. @end example
  6164. @item
  6165. Vintage effect:
  6166. @example
  6167. 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'
  6168. @end example
  6169. Here we obtain the following coordinates for each components:
  6170. @table @var
  6171. @item red
  6172. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  6173. @item green
  6174. @code{(0;0) (0.50;0.48) (1;1)}
  6175. @item blue
  6176. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  6177. @end table
  6178. @item
  6179. The previous example can also be achieved with the associated built-in preset:
  6180. @example
  6181. curves=preset=vintage
  6182. @end example
  6183. @item
  6184. Or simply:
  6185. @example
  6186. curves=vintage
  6187. @end example
  6188. @item
  6189. Use a Photoshop preset and redefine the points of the green component:
  6190. @example
  6191. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  6192. @end example
  6193. @item
  6194. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  6195. and @command{gnuplot}:
  6196. @example
  6197. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  6198. gnuplot -p /tmp/curves.plt
  6199. @end example
  6200. @end itemize
  6201. @section datascope
  6202. Video data analysis filter.
  6203. This filter shows hexadecimal pixel values of part of video.
  6204. The filter accepts the following options:
  6205. @table @option
  6206. @item size, s
  6207. Set output video size.
  6208. @item x
  6209. Set x offset from where to pick pixels.
  6210. @item y
  6211. Set y offset from where to pick pixels.
  6212. @item mode
  6213. Set scope mode, can be one of the following:
  6214. @table @samp
  6215. @item mono
  6216. Draw hexadecimal pixel values with white color on black background.
  6217. @item color
  6218. Draw hexadecimal pixel values with input video pixel color on black
  6219. background.
  6220. @item color2
  6221. Draw hexadecimal pixel values on color background picked from input video,
  6222. the text color is picked in such way so its always visible.
  6223. @end table
  6224. @item axis
  6225. Draw rows and columns numbers on left and top of video.
  6226. @item opacity
  6227. Set background opacity.
  6228. @end table
  6229. @section dctdnoiz
  6230. Denoise frames using 2D DCT (frequency domain filtering).
  6231. This filter is not designed for real time.
  6232. The filter accepts the following options:
  6233. @table @option
  6234. @item sigma, s
  6235. Set the noise sigma constant.
  6236. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  6237. coefficient (absolute value) below this threshold with be dropped.
  6238. If you need a more advanced filtering, see @option{expr}.
  6239. Default is @code{0}.
  6240. @item overlap
  6241. Set number overlapping pixels for each block. Since the filter can be slow, you
  6242. may want to reduce this value, at the cost of a less effective filter and the
  6243. risk of various artefacts.
  6244. If the overlapping value doesn't permit processing the whole input width or
  6245. height, a warning will be displayed and according borders won't be denoised.
  6246. Default value is @var{blocksize}-1, which is the best possible setting.
  6247. @item expr, e
  6248. Set the coefficient factor expression.
  6249. For each coefficient of a DCT block, this expression will be evaluated as a
  6250. multiplier value for the coefficient.
  6251. If this is option is set, the @option{sigma} option will be ignored.
  6252. The absolute value of the coefficient can be accessed through the @var{c}
  6253. variable.
  6254. @item n
  6255. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  6256. @var{blocksize}, which is the width and height of the processed blocks.
  6257. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  6258. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  6259. on the speed processing. Also, a larger block size does not necessarily means a
  6260. better de-noising.
  6261. @end table
  6262. @subsection Examples
  6263. Apply a denoise with a @option{sigma} of @code{4.5}:
  6264. @example
  6265. dctdnoiz=4.5
  6266. @end example
  6267. The same operation can be achieved using the expression system:
  6268. @example
  6269. dctdnoiz=e='gte(c, 4.5*3)'
  6270. @end example
  6271. Violent denoise using a block size of @code{16x16}:
  6272. @example
  6273. dctdnoiz=15:n=4
  6274. @end example
  6275. @section deband
  6276. Remove banding artifacts from input video.
  6277. It works by replacing banded pixels with average value of referenced pixels.
  6278. The filter accepts the following options:
  6279. @table @option
  6280. @item 1thr
  6281. @item 2thr
  6282. @item 3thr
  6283. @item 4thr
  6284. Set banding detection threshold for each plane. Default is 0.02.
  6285. Valid range is 0.00003 to 0.5.
  6286. If difference between current pixel and reference pixel is less than threshold,
  6287. it will be considered as banded.
  6288. @item range, r
  6289. Banding detection range in pixels. Default is 16. If positive, random number
  6290. in range 0 to set value will be used. If negative, exact absolute value
  6291. will be used.
  6292. The range defines square of four pixels around current pixel.
  6293. @item direction, d
  6294. Set direction in radians from which four pixel will be compared. If positive,
  6295. random direction from 0 to set direction will be picked. If negative, exact of
  6296. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6297. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6298. column.
  6299. @item blur, b
  6300. If enabled, current pixel is compared with average value of all four
  6301. surrounding pixels. The default is enabled. If disabled current pixel is
  6302. compared with all four surrounding pixels. The pixel is considered banded
  6303. if only all four differences with surrounding pixels are less than threshold.
  6304. @item coupling, c
  6305. If enabled, current pixel is changed if and only if all pixel components are banded,
  6306. e.g. banding detection threshold is triggered for all color components.
  6307. The default is disabled.
  6308. @end table
  6309. @section deblock
  6310. Remove blocking artifacts from input video.
  6311. The filter accepts the following options:
  6312. @table @option
  6313. @item filter
  6314. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6315. This controls what kind of deblocking is applied.
  6316. @item block
  6317. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6318. @item alpha
  6319. @item beta
  6320. @item gamma
  6321. @item delta
  6322. Set blocking detection thresholds. Allowed range is 0 to 1.
  6323. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6324. Using higher threshold gives more deblocking strength.
  6325. Setting @var{alpha} controls threshold detection at exact edge of block.
  6326. Remaining options controls threshold detection near the edge. Each one for
  6327. below/above or left/right. Setting any of those to @var{0} disables
  6328. deblocking.
  6329. @item planes
  6330. Set planes to filter. Default is to filter all available planes.
  6331. @end table
  6332. @subsection Examples
  6333. @itemize
  6334. @item
  6335. Deblock using weak filter and block size of 4 pixels.
  6336. @example
  6337. deblock=filter=weak:block=4
  6338. @end example
  6339. @item
  6340. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6341. deblocking more edges.
  6342. @example
  6343. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6344. @end example
  6345. @item
  6346. Similar as above, but filter only first plane.
  6347. @example
  6348. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6349. @end example
  6350. @item
  6351. Similar as above, but filter only second and third plane.
  6352. @example
  6353. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6354. @end example
  6355. @end itemize
  6356. @anchor{decimate}
  6357. @section decimate
  6358. Drop duplicated frames at regular intervals.
  6359. The filter accepts the following options:
  6360. @table @option
  6361. @item cycle
  6362. Set the number of frames from which one will be dropped. Setting this to
  6363. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6364. Default is @code{5}.
  6365. @item dupthresh
  6366. Set the threshold for duplicate detection. If the difference metric for a frame
  6367. is less than or equal to this value, then it is declared as duplicate. Default
  6368. is @code{1.1}
  6369. @item scthresh
  6370. Set scene change threshold. Default is @code{15}.
  6371. @item blockx
  6372. @item blocky
  6373. Set the size of the x and y-axis blocks used during metric calculations.
  6374. Larger blocks give better noise suppression, but also give worse detection of
  6375. small movements. Must be a power of two. Default is @code{32}.
  6376. @item ppsrc
  6377. Mark main input as a pre-processed input and activate clean source input
  6378. stream. This allows the input to be pre-processed with various filters to help
  6379. the metrics calculation while keeping the frame selection lossless. When set to
  6380. @code{1}, the first stream is for the pre-processed input, and the second
  6381. stream is the clean source from where the kept frames are chosen. Default is
  6382. @code{0}.
  6383. @item chroma
  6384. Set whether or not chroma is considered in the metric calculations. Default is
  6385. @code{1}.
  6386. @end table
  6387. @section deconvolve
  6388. Apply 2D deconvolution of video stream in frequency domain using second stream
  6389. as impulse.
  6390. The filter accepts the following options:
  6391. @table @option
  6392. @item planes
  6393. Set which planes to process.
  6394. @item impulse
  6395. Set which impulse video frames will be processed, can be @var{first}
  6396. or @var{all}. Default is @var{all}.
  6397. @item noise
  6398. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6399. and height are not same and not power of 2 or if stream prior to convolving
  6400. had noise.
  6401. @end table
  6402. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6403. @section dedot
  6404. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6405. It accepts the following options:
  6406. @table @option
  6407. @item m
  6408. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6409. @var{rainbows} for cross-color reduction.
  6410. @item lt
  6411. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6412. @item tl
  6413. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6414. @item tc
  6415. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6416. @item ct
  6417. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6418. @end table
  6419. @section deflate
  6420. Apply deflate effect to the video.
  6421. This filter replaces the pixel by the local(3x3) average by taking into account
  6422. only values lower than the pixel.
  6423. It accepts the following options:
  6424. @table @option
  6425. @item threshold0
  6426. @item threshold1
  6427. @item threshold2
  6428. @item threshold3
  6429. Limit the maximum change for each plane, default is 65535.
  6430. If 0, plane will remain unchanged.
  6431. @end table
  6432. @section deflicker
  6433. Remove temporal frame luminance variations.
  6434. It accepts the following options:
  6435. @table @option
  6436. @item size, s
  6437. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6438. @item mode, m
  6439. Set averaging mode to smooth temporal luminance variations.
  6440. Available values are:
  6441. @table @samp
  6442. @item am
  6443. Arithmetic mean
  6444. @item gm
  6445. Geometric mean
  6446. @item hm
  6447. Harmonic mean
  6448. @item qm
  6449. Quadratic mean
  6450. @item cm
  6451. Cubic mean
  6452. @item pm
  6453. Power mean
  6454. @item median
  6455. Median
  6456. @end table
  6457. @item bypass
  6458. Do not actually modify frame. Useful when one only wants metadata.
  6459. @end table
  6460. @section dejudder
  6461. Remove judder produced by partially interlaced telecined content.
  6462. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6463. source was partially telecined content then the output of @code{pullup,dejudder}
  6464. will have a variable frame rate. May change the recorded frame rate of the
  6465. container. Aside from that change, this filter will not affect constant frame
  6466. rate video.
  6467. The option available in this filter is:
  6468. @table @option
  6469. @item cycle
  6470. Specify the length of the window over which the judder repeats.
  6471. Accepts any integer greater than 1. Useful values are:
  6472. @table @samp
  6473. @item 4
  6474. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6475. @item 5
  6476. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6477. @item 20
  6478. If a mixture of the two.
  6479. @end table
  6480. The default is @samp{4}.
  6481. @end table
  6482. @section delogo
  6483. Suppress a TV station logo by a simple interpolation of the surrounding
  6484. pixels. Just set a rectangle covering the logo and watch it disappear
  6485. (and sometimes something even uglier appear - your mileage may vary).
  6486. It accepts the following parameters:
  6487. @table @option
  6488. @item x
  6489. @item y
  6490. Specify the top left corner coordinates of the logo. They must be
  6491. specified.
  6492. @item w
  6493. @item h
  6494. Specify the width and height of the logo to clear. They must be
  6495. specified.
  6496. @item band, t
  6497. Specify the thickness of the fuzzy edge of the rectangle (added to
  6498. @var{w} and @var{h}). The default value is 1. This option is
  6499. deprecated, setting higher values should no longer be necessary and
  6500. is not recommended.
  6501. @item show
  6502. When set to 1, a green rectangle is drawn on the screen to simplify
  6503. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6504. The default value is 0.
  6505. The rectangle is drawn on the outermost pixels which will be (partly)
  6506. replaced with interpolated values. The values of the next pixels
  6507. immediately outside this rectangle in each direction will be used to
  6508. compute the interpolated pixel values inside the rectangle.
  6509. @end table
  6510. @subsection Examples
  6511. @itemize
  6512. @item
  6513. Set a rectangle covering the area with top left corner coordinates 0,0
  6514. and size 100x77, and a band of size 10:
  6515. @example
  6516. delogo=x=0:y=0:w=100:h=77:band=10
  6517. @end example
  6518. @end itemize
  6519. @section derain
  6520. Remove the rain in the input image/video by applying the derain methods based on
  6521. convolutional neural networks. Supported models:
  6522. @itemize
  6523. @item
  6524. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  6525. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  6526. @end itemize
  6527. Training as well as model generation scripts are provided in
  6528. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  6529. Native model files (.model) can be generated from TensorFlow model
  6530. files (.pb) by using tools/python/convert.py
  6531. The filter accepts the following options:
  6532. @table @option
  6533. @item filter_type
  6534. Specify which filter to use. This option accepts the following values:
  6535. @table @samp
  6536. @item derain
  6537. Derain filter. To conduct derain filter, you need to use a derain model.
  6538. @item dehaze
  6539. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  6540. @end table
  6541. Default value is @samp{derain}.
  6542. @item dnn_backend
  6543. Specify which DNN backend to use for model loading and execution. This option accepts
  6544. the following values:
  6545. @table @samp
  6546. @item native
  6547. Native implementation of DNN loading and execution.
  6548. @item tensorflow
  6549. TensorFlow backend. To enable this backend you
  6550. need to install the TensorFlow for C library (see
  6551. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  6552. @code{--enable-libtensorflow}
  6553. @end table
  6554. Default value is @samp{native}.
  6555. @item model
  6556. Set path to model file specifying network architecture and its parameters.
  6557. Note that different backends use different file formats. TensorFlow and native
  6558. backend can load files for only its format.
  6559. @end table
  6560. @section deshake
  6561. Attempt to fix small changes in horizontal and/or vertical shift. This
  6562. filter helps remove camera shake from hand-holding a camera, bumping a
  6563. tripod, moving on a vehicle, etc.
  6564. The filter accepts the following options:
  6565. @table @option
  6566. @item x
  6567. @item y
  6568. @item w
  6569. @item h
  6570. Specify a rectangular area where to limit the search for motion
  6571. vectors.
  6572. If desired the search for motion vectors can be limited to a
  6573. rectangular area of the frame defined by its top left corner, width
  6574. and height. These parameters have the same meaning as the drawbox
  6575. filter which can be used to visualise the position of the bounding
  6576. box.
  6577. This is useful when simultaneous movement of subjects within the frame
  6578. might be confused for camera motion by the motion vector search.
  6579. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6580. then the full frame is used. This allows later options to be set
  6581. without specifying the bounding box for the motion vector search.
  6582. Default - search the whole frame.
  6583. @item rx
  6584. @item ry
  6585. Specify the maximum extent of movement in x and y directions in the
  6586. range 0-64 pixels. Default 16.
  6587. @item edge
  6588. Specify how to generate pixels to fill blanks at the edge of the
  6589. frame. Available values are:
  6590. @table @samp
  6591. @item blank, 0
  6592. Fill zeroes at blank locations
  6593. @item original, 1
  6594. Original image at blank locations
  6595. @item clamp, 2
  6596. Extruded edge value at blank locations
  6597. @item mirror, 3
  6598. Mirrored edge at blank locations
  6599. @end table
  6600. Default value is @samp{mirror}.
  6601. @item blocksize
  6602. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6603. default 8.
  6604. @item contrast
  6605. Specify the contrast threshold for blocks. Only blocks with more than
  6606. the specified contrast (difference between darkest and lightest
  6607. pixels) will be considered. Range 1-255, default 125.
  6608. @item search
  6609. Specify the search strategy. Available values are:
  6610. @table @samp
  6611. @item exhaustive, 0
  6612. Set exhaustive search
  6613. @item less, 1
  6614. Set less exhaustive search.
  6615. @end table
  6616. Default value is @samp{exhaustive}.
  6617. @item filename
  6618. If set then a detailed log of the motion search is written to the
  6619. specified file.
  6620. @end table
  6621. @section despill
  6622. Remove unwanted contamination of foreground colors, caused by reflected color of
  6623. greenscreen or bluescreen.
  6624. This filter accepts the following options:
  6625. @table @option
  6626. @item type
  6627. Set what type of despill to use.
  6628. @item mix
  6629. Set how spillmap will be generated.
  6630. @item expand
  6631. Set how much to get rid of still remaining spill.
  6632. @item red
  6633. Controls amount of red in spill area.
  6634. @item green
  6635. Controls amount of green in spill area.
  6636. Should be -1 for greenscreen.
  6637. @item blue
  6638. Controls amount of blue in spill area.
  6639. Should be -1 for bluescreen.
  6640. @item brightness
  6641. Controls brightness of spill area, preserving colors.
  6642. @item alpha
  6643. Modify alpha from generated spillmap.
  6644. @end table
  6645. @section detelecine
  6646. Apply an exact inverse of the telecine operation. It requires a predefined
  6647. pattern specified using the pattern option which must be the same as that passed
  6648. to the telecine filter.
  6649. This filter accepts the following options:
  6650. @table @option
  6651. @item first_field
  6652. @table @samp
  6653. @item top, t
  6654. top field first
  6655. @item bottom, b
  6656. bottom field first
  6657. The default value is @code{top}.
  6658. @end table
  6659. @item pattern
  6660. A string of numbers representing the pulldown pattern you wish to apply.
  6661. The default value is @code{23}.
  6662. @item start_frame
  6663. A number representing position of the first frame with respect to the telecine
  6664. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6665. @end table
  6666. @section dilation
  6667. Apply dilation effect to the video.
  6668. This filter replaces the pixel by the local(3x3) maximum.
  6669. It accepts the following options:
  6670. @table @option
  6671. @item threshold0
  6672. @item threshold1
  6673. @item threshold2
  6674. @item threshold3
  6675. Limit the maximum change for each plane, default is 65535.
  6676. If 0, plane will remain unchanged.
  6677. @item coordinates
  6678. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6679. pixels are used.
  6680. Flags to local 3x3 coordinates maps like this:
  6681. 1 2 3
  6682. 4 5
  6683. 6 7 8
  6684. @end table
  6685. @section displace
  6686. Displace pixels as indicated by second and third input stream.
  6687. It takes three input streams and outputs one stream, the first input is the
  6688. source, and second and third input are displacement maps.
  6689. The second input specifies how much to displace pixels along the
  6690. x-axis, while the third input specifies how much to displace pixels
  6691. along the y-axis.
  6692. If one of displacement map streams terminates, last frame from that
  6693. displacement map will be used.
  6694. Note that once generated, displacements maps can be reused over and over again.
  6695. A description of the accepted options follows.
  6696. @table @option
  6697. @item edge
  6698. Set displace behavior for pixels that are out of range.
  6699. Available values are:
  6700. @table @samp
  6701. @item blank
  6702. Missing pixels are replaced by black pixels.
  6703. @item smear
  6704. Adjacent pixels will spread out to replace missing pixels.
  6705. @item wrap
  6706. Out of range pixels are wrapped so they point to pixels of other side.
  6707. @item mirror
  6708. Out of range pixels will be replaced with mirrored pixels.
  6709. @end table
  6710. Default is @samp{smear}.
  6711. @end table
  6712. @subsection Examples
  6713. @itemize
  6714. @item
  6715. Add ripple effect to rgb input of video size hd720:
  6716. @example
  6717. 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
  6718. @end example
  6719. @item
  6720. Add wave effect to rgb input of video size hd720:
  6721. @example
  6722. 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
  6723. @end example
  6724. @end itemize
  6725. @section drawbox
  6726. Draw a colored box on the input image.
  6727. It accepts the following parameters:
  6728. @table @option
  6729. @item x
  6730. @item y
  6731. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6732. @item width, w
  6733. @item height, h
  6734. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6735. the input width and height. It defaults to 0.
  6736. @item color, c
  6737. Specify the color of the box to write. For the general syntax of this option,
  6738. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6739. value @code{invert} is used, the box edge color is the same as the
  6740. video with inverted luma.
  6741. @item thickness, t
  6742. The expression which sets the thickness of the box edge.
  6743. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6744. See below for the list of accepted constants.
  6745. @item replace
  6746. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6747. will overwrite the video's color and alpha pixels.
  6748. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6749. @end table
  6750. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6751. following constants:
  6752. @table @option
  6753. @item dar
  6754. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6755. @item hsub
  6756. @item vsub
  6757. horizontal and vertical chroma subsample values. For example for the
  6758. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6759. @item in_h, ih
  6760. @item in_w, iw
  6761. The input width and height.
  6762. @item sar
  6763. The input sample aspect ratio.
  6764. @item x
  6765. @item y
  6766. The x and y offset coordinates where the box is drawn.
  6767. @item w
  6768. @item h
  6769. The width and height of the drawn box.
  6770. @item t
  6771. The thickness of the drawn box.
  6772. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6773. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6774. @end table
  6775. @subsection Examples
  6776. @itemize
  6777. @item
  6778. Draw a black box around the edge of the input image:
  6779. @example
  6780. drawbox
  6781. @end example
  6782. @item
  6783. Draw a box with color red and an opacity of 50%:
  6784. @example
  6785. drawbox=10:20:200:60:red@@0.5
  6786. @end example
  6787. The previous example can be specified as:
  6788. @example
  6789. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6790. @end example
  6791. @item
  6792. Fill the box with pink color:
  6793. @example
  6794. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6795. @end example
  6796. @item
  6797. Draw a 2-pixel red 2.40:1 mask:
  6798. @example
  6799. 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
  6800. @end example
  6801. @end itemize
  6802. @subsection Commands
  6803. This filter supports same commands as options.
  6804. The command accepts the same syntax of the corresponding option.
  6805. If the specified expression is not valid, it is kept at its current
  6806. value.
  6807. @section drawgrid
  6808. Draw a grid on the input image.
  6809. It accepts the following parameters:
  6810. @table @option
  6811. @item x
  6812. @item y
  6813. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6814. @item width, w
  6815. @item height, h
  6816. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6817. input width and height, respectively, minus @code{thickness}, so image gets
  6818. framed. Default to 0.
  6819. @item color, c
  6820. Specify the color of the grid. For the general syntax of this option,
  6821. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6822. value @code{invert} is used, the grid color is the same as the
  6823. video with inverted luma.
  6824. @item thickness, t
  6825. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6826. See below for the list of accepted constants.
  6827. @item replace
  6828. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6829. will overwrite the video's color and alpha pixels.
  6830. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6831. @end table
  6832. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6833. following constants:
  6834. @table @option
  6835. @item dar
  6836. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6837. @item hsub
  6838. @item vsub
  6839. horizontal and vertical chroma subsample values. For example for the
  6840. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6841. @item in_h, ih
  6842. @item in_w, iw
  6843. The input grid cell width and height.
  6844. @item sar
  6845. The input sample aspect ratio.
  6846. @item x
  6847. @item y
  6848. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6849. @item w
  6850. @item h
  6851. The width and height of the drawn cell.
  6852. @item t
  6853. The thickness of the drawn cell.
  6854. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6855. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6856. @end table
  6857. @subsection Examples
  6858. @itemize
  6859. @item
  6860. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6861. @example
  6862. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6863. @end example
  6864. @item
  6865. Draw a white 3x3 grid with an opacity of 50%:
  6866. @example
  6867. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6868. @end example
  6869. @end itemize
  6870. @subsection Commands
  6871. This filter supports same commands as options.
  6872. The command accepts the same syntax of the corresponding option.
  6873. If the specified expression is not valid, it is kept at its current
  6874. value.
  6875. @anchor{drawtext}
  6876. @section drawtext
  6877. Draw a text string or text from a specified file on top of a video, using the
  6878. libfreetype library.
  6879. To enable compilation of this filter, you need to configure FFmpeg with
  6880. @code{--enable-libfreetype}.
  6881. To enable default font fallback and the @var{font} option you need to
  6882. configure FFmpeg with @code{--enable-libfontconfig}.
  6883. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6884. @code{--enable-libfribidi}.
  6885. @subsection Syntax
  6886. It accepts the following parameters:
  6887. @table @option
  6888. @item box
  6889. Used to draw a box around text using the background color.
  6890. The value must be either 1 (enable) or 0 (disable).
  6891. The default value of @var{box} is 0.
  6892. @item boxborderw
  6893. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6894. The default value of @var{boxborderw} is 0.
  6895. @item boxcolor
  6896. The color to be used for drawing box around text. For the syntax of this
  6897. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6898. The default value of @var{boxcolor} is "white".
  6899. @item line_spacing
  6900. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6901. The default value of @var{line_spacing} is 0.
  6902. @item borderw
  6903. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6904. The default value of @var{borderw} is 0.
  6905. @item bordercolor
  6906. Set the color to be used for drawing border around text. For the syntax of this
  6907. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6908. The default value of @var{bordercolor} is "black".
  6909. @item expansion
  6910. Select how the @var{text} is expanded. Can be either @code{none},
  6911. @code{strftime} (deprecated) or
  6912. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6913. below for details.
  6914. @item basetime
  6915. Set a start time for the count. Value is in microseconds. Only applied
  6916. in the deprecated strftime expansion mode. To emulate in normal expansion
  6917. mode use the @code{pts} function, supplying the start time (in seconds)
  6918. as the second argument.
  6919. @item fix_bounds
  6920. If true, check and fix text coords to avoid clipping.
  6921. @item fontcolor
  6922. The color to be used for drawing fonts. For the syntax of this option, check
  6923. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6924. The default value of @var{fontcolor} is "black".
  6925. @item fontcolor_expr
  6926. String which is expanded the same way as @var{text} to obtain dynamic
  6927. @var{fontcolor} value. By default this option has empty value and is not
  6928. processed. When this option is set, it overrides @var{fontcolor} option.
  6929. @item font
  6930. The font family to be used for drawing text. By default Sans.
  6931. @item fontfile
  6932. The font file to be used for drawing text. The path must be included.
  6933. This parameter is mandatory if the fontconfig support is disabled.
  6934. @item alpha
  6935. Draw the text applying alpha blending. The value can
  6936. be a number between 0.0 and 1.0.
  6937. The expression accepts the same variables @var{x, y} as well.
  6938. The default value is 1.
  6939. Please see @var{fontcolor_expr}.
  6940. @item fontsize
  6941. The font size to be used for drawing text.
  6942. The default value of @var{fontsize} is 16.
  6943. @item text_shaping
  6944. If set to 1, attempt to shape the text (for example, reverse the order of
  6945. right-to-left text and join Arabic characters) before drawing it.
  6946. Otherwise, just draw the text exactly as given.
  6947. By default 1 (if supported).
  6948. @item ft_load_flags
  6949. The flags to be used for loading the fonts.
  6950. The flags map the corresponding flags supported by libfreetype, and are
  6951. a combination of the following values:
  6952. @table @var
  6953. @item default
  6954. @item no_scale
  6955. @item no_hinting
  6956. @item render
  6957. @item no_bitmap
  6958. @item vertical_layout
  6959. @item force_autohint
  6960. @item crop_bitmap
  6961. @item pedantic
  6962. @item ignore_global_advance_width
  6963. @item no_recurse
  6964. @item ignore_transform
  6965. @item monochrome
  6966. @item linear_design
  6967. @item no_autohint
  6968. @end table
  6969. Default value is "default".
  6970. For more information consult the documentation for the FT_LOAD_*
  6971. libfreetype flags.
  6972. @item shadowcolor
  6973. The color to be used for drawing a shadow behind the drawn text. For the
  6974. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6975. ffmpeg-utils manual,ffmpeg-utils}.
  6976. The default value of @var{shadowcolor} is "black".
  6977. @item shadowx
  6978. @item shadowy
  6979. The x and y offsets for the text shadow position with respect to the
  6980. position of the text. They can be either positive or negative
  6981. values. The default value for both is "0".
  6982. @item start_number
  6983. The starting frame number for the n/frame_num variable. The default value
  6984. is "0".
  6985. @item tabsize
  6986. The size in number of spaces to use for rendering the tab.
  6987. Default value is 4.
  6988. @item timecode
  6989. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6990. format. It can be used with or without text parameter. @var{timecode_rate}
  6991. option must be specified.
  6992. @item timecode_rate, rate, r
  6993. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6994. integer. Minimum value is "1".
  6995. Drop-frame timecode is supported for frame rates 30 & 60.
  6996. @item tc24hmax
  6997. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6998. Default is 0 (disabled).
  6999. @item text
  7000. The text string to be drawn. The text must be a sequence of UTF-8
  7001. encoded characters.
  7002. This parameter is mandatory if no file is specified with the parameter
  7003. @var{textfile}.
  7004. @item textfile
  7005. A text file containing text to be drawn. The text must be a sequence
  7006. of UTF-8 encoded characters.
  7007. This parameter is mandatory if no text string is specified with the
  7008. parameter @var{text}.
  7009. If both @var{text} and @var{textfile} are specified, an error is thrown.
  7010. @item reload
  7011. If set to 1, the @var{textfile} will be reloaded before each frame.
  7012. Be sure to update it atomically, or it may be read partially, or even fail.
  7013. @item x
  7014. @item y
  7015. The expressions which specify the offsets where text will be drawn
  7016. within the video frame. They are relative to the top/left border of the
  7017. output image.
  7018. The default value of @var{x} and @var{y} is "0".
  7019. See below for the list of accepted constants and functions.
  7020. @end table
  7021. The parameters for @var{x} and @var{y} are expressions containing the
  7022. following constants and functions:
  7023. @table @option
  7024. @item dar
  7025. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  7026. @item hsub
  7027. @item vsub
  7028. horizontal and vertical chroma subsample values. For example for the
  7029. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7030. @item line_h, lh
  7031. the height of each text line
  7032. @item main_h, h, H
  7033. the input height
  7034. @item main_w, w, W
  7035. the input width
  7036. @item max_glyph_a, ascent
  7037. the maximum distance from the baseline to the highest/upper grid
  7038. coordinate used to place a glyph outline point, for all the rendered
  7039. glyphs.
  7040. It is a positive value, due to the grid's orientation with the Y axis
  7041. upwards.
  7042. @item max_glyph_d, descent
  7043. the maximum distance from the baseline to the lowest grid coordinate
  7044. used to place a glyph outline point, for all the rendered glyphs.
  7045. This is a negative value, due to the grid's orientation, with the Y axis
  7046. upwards.
  7047. @item max_glyph_h
  7048. maximum glyph height, that is the maximum height for all the glyphs
  7049. contained in the rendered text, it is equivalent to @var{ascent} -
  7050. @var{descent}.
  7051. @item max_glyph_w
  7052. maximum glyph width, that is the maximum width for all the glyphs
  7053. contained in the rendered text
  7054. @item n
  7055. the number of input frame, starting from 0
  7056. @item rand(min, max)
  7057. return a random number included between @var{min} and @var{max}
  7058. @item sar
  7059. The input sample aspect ratio.
  7060. @item t
  7061. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7062. @item text_h, th
  7063. the height of the rendered text
  7064. @item text_w, tw
  7065. the width of the rendered text
  7066. @item x
  7067. @item y
  7068. the x and y offset coordinates where the text is drawn.
  7069. These parameters allow the @var{x} and @var{y} expressions to refer
  7070. to each other, so you can for example specify @code{y=x/dar}.
  7071. @item pict_type
  7072. A one character description of the current frame's picture type.
  7073. @item pkt_pos
  7074. The current packet's position in the input file or stream
  7075. (in bytes, from the start of the input). A value of -1 indicates
  7076. this info is not available.
  7077. @item pkt_duration
  7078. The current packet's duration, in seconds.
  7079. @item pkt_size
  7080. The current packet's size (in bytes).
  7081. @end table
  7082. @anchor{drawtext_expansion}
  7083. @subsection Text expansion
  7084. If @option{expansion} is set to @code{strftime},
  7085. the filter recognizes strftime() sequences in the provided text and
  7086. expands them accordingly. Check the documentation of strftime(). This
  7087. feature is deprecated.
  7088. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  7089. If @option{expansion} is set to @code{normal} (which is the default),
  7090. the following expansion mechanism is used.
  7091. The backslash character @samp{\}, followed by any character, always expands to
  7092. the second character.
  7093. Sequences of the form @code{%@{...@}} are expanded. The text between the
  7094. braces is a function name, possibly followed by arguments separated by ':'.
  7095. If the arguments contain special characters or delimiters (':' or '@}'),
  7096. they should be escaped.
  7097. Note that they probably must also be escaped as the value for the
  7098. @option{text} option in the filter argument string and as the filter
  7099. argument in the filtergraph description, and possibly also for the shell,
  7100. that makes up to four levels of escaping; using a text file avoids these
  7101. problems.
  7102. The following functions are available:
  7103. @table @command
  7104. @item expr, e
  7105. The expression evaluation result.
  7106. It must take one argument specifying the expression to be evaluated,
  7107. which accepts the same constants and functions as the @var{x} and
  7108. @var{y} values. Note that not all constants should be used, for
  7109. example the text size is not known when evaluating the expression, so
  7110. the constants @var{text_w} and @var{text_h} will have an undefined
  7111. value.
  7112. @item expr_int_format, eif
  7113. Evaluate the expression's value and output as formatted integer.
  7114. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  7115. The second argument specifies the output format. Allowed values are @samp{x},
  7116. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  7117. @code{printf} function.
  7118. The third parameter is optional and sets the number of positions taken by the output.
  7119. It can be used to add padding with zeros from the left.
  7120. @item gmtime
  7121. The time at which the filter is running, expressed in UTC.
  7122. It can accept an argument: a strftime() format string.
  7123. @item localtime
  7124. The time at which the filter is running, expressed in the local time zone.
  7125. It can accept an argument: a strftime() format string.
  7126. @item metadata
  7127. Frame metadata. Takes one or two arguments.
  7128. The first argument is mandatory and specifies the metadata key.
  7129. The second argument is optional and specifies a default value, used when the
  7130. metadata key is not found or empty.
  7131. Available metadata can be identified by inspecting entries
  7132. starting with TAG included within each frame section
  7133. printed by running @code{ffprobe -show_frames}.
  7134. String metadata generated in filters leading to
  7135. the drawtext filter are also available.
  7136. @item n, frame_num
  7137. The frame number, starting from 0.
  7138. @item pict_type
  7139. A one character description of the current picture type.
  7140. @item pts
  7141. The timestamp of the current frame.
  7142. It can take up to three arguments.
  7143. The first argument is the format of the timestamp; it defaults to @code{flt}
  7144. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  7145. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  7146. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  7147. @code{localtime} stands for the timestamp of the frame formatted as
  7148. local time zone time.
  7149. The second argument is an offset added to the timestamp.
  7150. If the format is set to @code{hms}, a third argument @code{24HH} may be
  7151. supplied to present the hour part of the formatted timestamp in 24h format
  7152. (00-23).
  7153. If the format is set to @code{localtime} or @code{gmtime},
  7154. a third argument may be supplied: a strftime() format string.
  7155. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  7156. @end table
  7157. @subsection Commands
  7158. This filter supports altering parameters via commands:
  7159. @table @option
  7160. @item reinit
  7161. Alter existing filter parameters.
  7162. Syntax for the argument is the same as for filter invocation, e.g.
  7163. @example
  7164. fontsize=56:fontcolor=green:text='Hello World'
  7165. @end example
  7166. Full filter invocation with sendcmd would look like this:
  7167. @example
  7168. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  7169. @end example
  7170. @end table
  7171. If the entire argument can't be parsed or applied as valid values then the filter will
  7172. continue with its existing parameters.
  7173. @subsection Examples
  7174. @itemize
  7175. @item
  7176. Draw "Test Text" with font FreeSerif, using the default values for the
  7177. optional parameters.
  7178. @example
  7179. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  7180. @end example
  7181. @item
  7182. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  7183. and y=50 (counting from the top-left corner of the screen), text is
  7184. yellow with a red box around it. Both the text and the box have an
  7185. opacity of 20%.
  7186. @example
  7187. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  7188. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  7189. @end example
  7190. Note that the double quotes are not necessary if spaces are not used
  7191. within the parameter list.
  7192. @item
  7193. Show the text at the center of the video frame:
  7194. @example
  7195. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  7196. @end example
  7197. @item
  7198. Show the text at a random position, switching to a new position every 30 seconds:
  7199. @example
  7200. 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)"
  7201. @end example
  7202. @item
  7203. Show a text line sliding from right to left in the last row of the video
  7204. frame. The file @file{LONG_LINE} is assumed to contain a single line
  7205. with no newlines.
  7206. @example
  7207. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  7208. @end example
  7209. @item
  7210. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  7211. @example
  7212. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  7213. @end example
  7214. @item
  7215. Draw a single green letter "g", at the center of the input video.
  7216. The glyph baseline is placed at half screen height.
  7217. @example
  7218. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  7219. @end example
  7220. @item
  7221. Show text for 1 second every 3 seconds:
  7222. @example
  7223. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  7224. @end example
  7225. @item
  7226. Use fontconfig to set the font. Note that the colons need to be escaped.
  7227. @example
  7228. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  7229. @end example
  7230. @item
  7231. Print the date of a real-time encoding (see strftime(3)):
  7232. @example
  7233. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  7234. @end example
  7235. @item
  7236. Show text fading in and out (appearing/disappearing):
  7237. @example
  7238. #!/bin/sh
  7239. DS=1.0 # display start
  7240. DE=10.0 # display end
  7241. FID=1.5 # fade in duration
  7242. FOD=5 # fade out duration
  7243. 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 @}"
  7244. @end example
  7245. @item
  7246. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  7247. and the @option{fontsize} value are included in the @option{y} offset.
  7248. @example
  7249. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  7250. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  7251. @end example
  7252. @end itemize
  7253. For more information about libfreetype, check:
  7254. @url{http://www.freetype.org/}.
  7255. For more information about fontconfig, check:
  7256. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  7257. For more information about libfribidi, check:
  7258. @url{http://fribidi.org/}.
  7259. @section edgedetect
  7260. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  7261. The filter accepts the following options:
  7262. @table @option
  7263. @item low
  7264. @item high
  7265. Set low and high threshold values used by the Canny thresholding
  7266. algorithm.
  7267. The high threshold selects the "strong" edge pixels, which are then
  7268. connected through 8-connectivity with the "weak" edge pixels selected
  7269. by the low threshold.
  7270. @var{low} and @var{high} threshold values must be chosen in the range
  7271. [0,1], and @var{low} should be lesser or equal to @var{high}.
  7272. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  7273. is @code{50/255}.
  7274. @item mode
  7275. Define the drawing mode.
  7276. @table @samp
  7277. @item wires
  7278. Draw white/gray wires on black background.
  7279. @item colormix
  7280. Mix the colors to create a paint/cartoon effect.
  7281. @item canny
  7282. Apply Canny edge detector on all selected planes.
  7283. @end table
  7284. Default value is @var{wires}.
  7285. @item planes
  7286. Select planes for filtering. By default all available planes are filtered.
  7287. @end table
  7288. @subsection Examples
  7289. @itemize
  7290. @item
  7291. Standard edge detection with custom values for the hysteresis thresholding:
  7292. @example
  7293. edgedetect=low=0.1:high=0.4
  7294. @end example
  7295. @item
  7296. Painting effect without thresholding:
  7297. @example
  7298. edgedetect=mode=colormix:high=0
  7299. @end example
  7300. @end itemize
  7301. @section elbg
  7302. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7303. For each input image, the filter will compute the optimal mapping from
  7304. the input to the output given the codebook length, that is the number
  7305. of distinct output colors.
  7306. This filter accepts the following options.
  7307. @table @option
  7308. @item codebook_length, l
  7309. Set codebook length. The value must be a positive integer, and
  7310. represents the number of distinct output colors. Default value is 256.
  7311. @item nb_steps, n
  7312. Set the maximum number of iterations to apply for computing the optimal
  7313. mapping. The higher the value the better the result and the higher the
  7314. computation time. Default value is 1.
  7315. @item seed, s
  7316. Set a random seed, must be an integer included between 0 and
  7317. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7318. will try to use a good random seed on a best effort basis.
  7319. @item pal8
  7320. Set pal8 output pixel format. This option does not work with codebook
  7321. length greater than 256.
  7322. @end table
  7323. @section entropy
  7324. Measure graylevel entropy in histogram of color channels of video frames.
  7325. It accepts the following parameters:
  7326. @table @option
  7327. @item mode
  7328. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7329. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7330. between neighbour histogram values.
  7331. @end table
  7332. @section eq
  7333. Set brightness, contrast, saturation and approximate gamma adjustment.
  7334. The filter accepts the following options:
  7335. @table @option
  7336. @item contrast
  7337. Set the contrast expression. The value must be a float value in range
  7338. @code{-1000.0} to @code{1000.0}. The default value is "1".
  7339. @item brightness
  7340. Set the brightness expression. The value must be a float value in
  7341. range @code{-1.0} to @code{1.0}. The default value is "0".
  7342. @item saturation
  7343. Set the saturation expression. The value must be a float in
  7344. range @code{0.0} to @code{3.0}. The default value is "1".
  7345. @item gamma
  7346. Set the gamma expression. The value must be a float in range
  7347. @code{0.1} to @code{10.0}. The default value is "1".
  7348. @item gamma_r
  7349. Set the gamma expression for red. The value must be a float in
  7350. range @code{0.1} to @code{10.0}. The default value is "1".
  7351. @item gamma_g
  7352. Set the gamma expression for green. The value must be a float in range
  7353. @code{0.1} to @code{10.0}. The default value is "1".
  7354. @item gamma_b
  7355. Set the gamma expression for blue. The value must be a float in range
  7356. @code{0.1} to @code{10.0}. The default value is "1".
  7357. @item gamma_weight
  7358. Set the gamma weight expression. It can be used to reduce the effect
  7359. of a high gamma value on bright image areas, e.g. keep them from
  7360. getting overamplified and just plain white. The value must be a float
  7361. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  7362. gamma correction all the way down while @code{1.0} leaves it at its
  7363. full strength. Default is "1".
  7364. @item eval
  7365. Set when the expressions for brightness, contrast, saturation and
  7366. gamma expressions are evaluated.
  7367. It accepts the following values:
  7368. @table @samp
  7369. @item init
  7370. only evaluate expressions once during the filter initialization or
  7371. when a command is processed
  7372. @item frame
  7373. evaluate expressions for each incoming frame
  7374. @end table
  7375. Default value is @samp{init}.
  7376. @end table
  7377. The expressions accept the following parameters:
  7378. @table @option
  7379. @item n
  7380. frame count of the input frame starting from 0
  7381. @item pos
  7382. byte position of the corresponding packet in the input file, NAN if
  7383. unspecified
  7384. @item r
  7385. frame rate of the input video, NAN if the input frame rate is unknown
  7386. @item t
  7387. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7388. @end table
  7389. @subsection Commands
  7390. The filter supports the following commands:
  7391. @table @option
  7392. @item contrast
  7393. Set the contrast expression.
  7394. @item brightness
  7395. Set the brightness expression.
  7396. @item saturation
  7397. Set the saturation expression.
  7398. @item gamma
  7399. Set the gamma expression.
  7400. @item gamma_r
  7401. Set the gamma_r expression.
  7402. @item gamma_g
  7403. Set gamma_g expression.
  7404. @item gamma_b
  7405. Set gamma_b expression.
  7406. @item gamma_weight
  7407. Set gamma_weight expression.
  7408. The command accepts the same syntax of the corresponding option.
  7409. If the specified expression is not valid, it is kept at its current
  7410. value.
  7411. @end table
  7412. @section erosion
  7413. Apply erosion effect to the video.
  7414. This filter replaces the pixel by the local(3x3) minimum.
  7415. It accepts the following options:
  7416. @table @option
  7417. @item threshold0
  7418. @item threshold1
  7419. @item threshold2
  7420. @item threshold3
  7421. Limit the maximum change for each plane, default is 65535.
  7422. If 0, plane will remain unchanged.
  7423. @item coordinates
  7424. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7425. pixels are used.
  7426. Flags to local 3x3 coordinates maps like this:
  7427. 1 2 3
  7428. 4 5
  7429. 6 7 8
  7430. @end table
  7431. @section extractplanes
  7432. Extract color channel components from input video stream into
  7433. separate grayscale video streams.
  7434. The filter accepts the following option:
  7435. @table @option
  7436. @item planes
  7437. Set plane(s) to extract.
  7438. Available values for planes are:
  7439. @table @samp
  7440. @item y
  7441. @item u
  7442. @item v
  7443. @item a
  7444. @item r
  7445. @item g
  7446. @item b
  7447. @end table
  7448. Choosing planes not available in the input will result in an error.
  7449. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7450. with @code{y}, @code{u}, @code{v} planes at same time.
  7451. @end table
  7452. @subsection Examples
  7453. @itemize
  7454. @item
  7455. Extract luma, u and v color channel component from input video frame
  7456. into 3 grayscale outputs:
  7457. @example
  7458. 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
  7459. @end example
  7460. @end itemize
  7461. @section fade
  7462. Apply a fade-in/out effect to the input video.
  7463. It accepts the following parameters:
  7464. @table @option
  7465. @item type, t
  7466. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7467. effect.
  7468. Default is @code{in}.
  7469. @item start_frame, s
  7470. Specify the number of the frame to start applying the fade
  7471. effect at. Default is 0.
  7472. @item nb_frames, n
  7473. The number of frames that the fade effect lasts. At the end of the
  7474. fade-in effect, the output video will have the same intensity as the input video.
  7475. At the end of the fade-out transition, the output video will be filled with the
  7476. selected @option{color}.
  7477. Default is 25.
  7478. @item alpha
  7479. If set to 1, fade only alpha channel, if one exists on the input.
  7480. Default value is 0.
  7481. @item start_time, st
  7482. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7483. effect. If both start_frame and start_time are specified, the fade will start at
  7484. whichever comes last. Default is 0.
  7485. @item duration, d
  7486. The number of seconds for which the fade effect has to last. At the end of the
  7487. fade-in effect the output video will have the same intensity as the input video,
  7488. at the end of the fade-out transition the output video will be filled with the
  7489. selected @option{color}.
  7490. If both duration and nb_frames are specified, duration is used. Default is 0
  7491. (nb_frames is used by default).
  7492. @item color, c
  7493. Specify the color of the fade. Default is "black".
  7494. @end table
  7495. @subsection Examples
  7496. @itemize
  7497. @item
  7498. Fade in the first 30 frames of video:
  7499. @example
  7500. fade=in:0:30
  7501. @end example
  7502. The command above is equivalent to:
  7503. @example
  7504. fade=t=in:s=0:n=30
  7505. @end example
  7506. @item
  7507. Fade out the last 45 frames of a 200-frame video:
  7508. @example
  7509. fade=out:155:45
  7510. fade=type=out:start_frame=155:nb_frames=45
  7511. @end example
  7512. @item
  7513. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7514. @example
  7515. fade=in:0:25, fade=out:975:25
  7516. @end example
  7517. @item
  7518. Make the first 5 frames yellow, then fade in from frame 5-24:
  7519. @example
  7520. fade=in:5:20:color=yellow
  7521. @end example
  7522. @item
  7523. Fade in alpha over first 25 frames of video:
  7524. @example
  7525. fade=in:0:25:alpha=1
  7526. @end example
  7527. @item
  7528. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7529. @example
  7530. fade=t=in:st=5.5:d=0.5
  7531. @end example
  7532. @end itemize
  7533. @section fftdnoiz
  7534. Denoise frames using 3D FFT (frequency domain filtering).
  7535. The filter accepts the following options:
  7536. @table @option
  7537. @item sigma
  7538. Set the noise sigma constant. This sets denoising strength.
  7539. Default value is 1. Allowed range is from 0 to 30.
  7540. Using very high sigma with low overlap may give blocking artifacts.
  7541. @item amount
  7542. Set amount of denoising. By default all detected noise is reduced.
  7543. Default value is 1. Allowed range is from 0 to 1.
  7544. @item block
  7545. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7546. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7547. block size in pixels is 2^4 which is 16.
  7548. @item overlap
  7549. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7550. @item prev
  7551. Set number of previous frames to use for denoising. By default is set to 0.
  7552. @item next
  7553. Set number of next frames to to use for denoising. By default is set to 0.
  7554. @item planes
  7555. Set planes which will be filtered, by default are all available filtered
  7556. except alpha.
  7557. @end table
  7558. @section fftfilt
  7559. Apply arbitrary expressions to samples in frequency domain
  7560. @table @option
  7561. @item dc_Y
  7562. Adjust the dc value (gain) of the luma plane of the image. The filter
  7563. accepts an integer value in range @code{0} to @code{1000}. The default
  7564. value is set to @code{0}.
  7565. @item dc_U
  7566. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7567. filter accepts an integer value in range @code{0} to @code{1000}. The
  7568. default value is set to @code{0}.
  7569. @item dc_V
  7570. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7571. filter accepts an integer value in range @code{0} to @code{1000}. The
  7572. default value is set to @code{0}.
  7573. @item weight_Y
  7574. Set the frequency domain weight expression for the luma plane.
  7575. @item weight_U
  7576. Set the frequency domain weight expression for the 1st chroma plane.
  7577. @item weight_V
  7578. Set the frequency domain weight expression for the 2nd chroma plane.
  7579. @item eval
  7580. Set when the expressions are evaluated.
  7581. It accepts the following values:
  7582. @table @samp
  7583. @item init
  7584. Only evaluate expressions once during the filter initialization.
  7585. @item frame
  7586. Evaluate expressions for each incoming frame.
  7587. @end table
  7588. Default value is @samp{init}.
  7589. The filter accepts the following variables:
  7590. @item X
  7591. @item Y
  7592. The coordinates of the current sample.
  7593. @item W
  7594. @item H
  7595. The width and height of the image.
  7596. @item N
  7597. The number of input frame, starting from 0.
  7598. @end table
  7599. @subsection Examples
  7600. @itemize
  7601. @item
  7602. High-pass:
  7603. @example
  7604. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7605. @end example
  7606. @item
  7607. Low-pass:
  7608. @example
  7609. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7610. @end example
  7611. @item
  7612. Sharpen:
  7613. @example
  7614. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7615. @end example
  7616. @item
  7617. Blur:
  7618. @example
  7619. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7620. @end example
  7621. @end itemize
  7622. @section field
  7623. Extract a single field from an interlaced image using stride
  7624. arithmetic to avoid wasting CPU time. The output frames are marked as
  7625. non-interlaced.
  7626. The filter accepts the following options:
  7627. @table @option
  7628. @item type
  7629. Specify whether to extract the top (if the value is @code{0} or
  7630. @code{top}) or the bottom field (if the value is @code{1} or
  7631. @code{bottom}).
  7632. @end table
  7633. @section fieldhint
  7634. Create new frames by copying the top and bottom fields from surrounding frames
  7635. supplied as numbers by the hint file.
  7636. @table @option
  7637. @item hint
  7638. Set file containing hints: absolute/relative frame numbers.
  7639. There must be one line for each frame in a clip. Each line must contain two
  7640. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7641. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7642. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7643. for @code{relative} mode. First number tells from which frame to pick up top
  7644. field and second number tells from which frame to pick up bottom field.
  7645. If optionally followed by @code{+} output frame will be marked as interlaced,
  7646. else if followed by @code{-} output frame will be marked as progressive, else
  7647. it will be marked same as input frame.
  7648. If line starts with @code{#} or @code{;} that line is skipped.
  7649. @item mode
  7650. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7651. @end table
  7652. Example of first several lines of @code{hint} file for @code{relative} mode:
  7653. @example
  7654. 0,0 - # first frame
  7655. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7656. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7657. 1,0 -
  7658. 0,0 -
  7659. 0,0 -
  7660. 1,0 -
  7661. 1,0 -
  7662. 1,0 -
  7663. 0,0 -
  7664. 0,0 -
  7665. 1,0 -
  7666. 1,0 -
  7667. 1,0 -
  7668. 0,0 -
  7669. @end example
  7670. @section fieldmatch
  7671. Field matching filter for inverse telecine. It is meant to reconstruct the
  7672. progressive frames from a telecined stream. The filter does not drop duplicated
  7673. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7674. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7675. The separation of the field matching and the decimation is notably motivated by
  7676. the possibility of inserting a de-interlacing filter fallback between the two.
  7677. If the source has mixed telecined and real interlaced content,
  7678. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7679. But these remaining combed frames will be marked as interlaced, and thus can be
  7680. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7681. In addition to the various configuration options, @code{fieldmatch} can take an
  7682. optional second stream, activated through the @option{ppsrc} option. If
  7683. enabled, the frames reconstruction will be based on the fields and frames from
  7684. this second stream. This allows the first input to be pre-processed in order to
  7685. help the various algorithms of the filter, while keeping the output lossless
  7686. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7687. or brightness/contrast adjustments can help.
  7688. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7689. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7690. which @code{fieldmatch} is based on. While the semantic and usage are very
  7691. close, some behaviour and options names can differ.
  7692. The @ref{decimate} filter currently only works for constant frame rate input.
  7693. If your input has mixed telecined (30fps) and progressive content with a lower
  7694. framerate like 24fps use the following filterchain to produce the necessary cfr
  7695. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7696. The filter accepts the following options:
  7697. @table @option
  7698. @item order
  7699. Specify the assumed field order of the input stream. Available values are:
  7700. @table @samp
  7701. @item auto
  7702. Auto detect parity (use FFmpeg's internal parity value).
  7703. @item bff
  7704. Assume bottom field first.
  7705. @item tff
  7706. Assume top field first.
  7707. @end table
  7708. Note that it is sometimes recommended not to trust the parity announced by the
  7709. stream.
  7710. Default value is @var{auto}.
  7711. @item mode
  7712. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7713. sense that it won't risk creating jerkiness due to duplicate frames when
  7714. possible, but if there are bad edits or blended fields it will end up
  7715. outputting combed frames when a good match might actually exist. On the other
  7716. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7717. but will almost always find a good frame if there is one. The other values are
  7718. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7719. jerkiness and creating duplicate frames versus finding good matches in sections
  7720. with bad edits, orphaned fields, blended fields, etc.
  7721. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7722. Available values are:
  7723. @table @samp
  7724. @item pc
  7725. 2-way matching (p/c)
  7726. @item pc_n
  7727. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7728. @item pc_u
  7729. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7730. @item pc_n_ub
  7731. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7732. still combed (p/c + n + u/b)
  7733. @item pcn
  7734. 3-way matching (p/c/n)
  7735. @item pcn_ub
  7736. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7737. detected as combed (p/c/n + u/b)
  7738. @end table
  7739. The parenthesis at the end indicate the matches that would be used for that
  7740. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7741. @var{top}).
  7742. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7743. the slowest.
  7744. Default value is @var{pc_n}.
  7745. @item ppsrc
  7746. Mark the main input stream as a pre-processed input, and enable the secondary
  7747. input stream as the clean source to pick the fields from. See the filter
  7748. introduction for more details. It is similar to the @option{clip2} feature from
  7749. VFM/TFM.
  7750. Default value is @code{0} (disabled).
  7751. @item field
  7752. Set the field to match from. It is recommended to set this to the same value as
  7753. @option{order} unless you experience matching failures with that setting. In
  7754. certain circumstances changing the field that is used to match from can have a
  7755. large impact on matching performance. Available values are:
  7756. @table @samp
  7757. @item auto
  7758. Automatic (same value as @option{order}).
  7759. @item bottom
  7760. Match from the bottom field.
  7761. @item top
  7762. Match from the top field.
  7763. @end table
  7764. Default value is @var{auto}.
  7765. @item mchroma
  7766. Set whether or not chroma is included during the match comparisons. In most
  7767. cases it is recommended to leave this enabled. You should set this to @code{0}
  7768. only if your clip has bad chroma problems such as heavy rainbowing or other
  7769. artifacts. Setting this to @code{0} could also be used to speed things up at
  7770. the cost of some accuracy.
  7771. Default value is @code{1}.
  7772. @item y0
  7773. @item y1
  7774. These define an exclusion band which excludes the lines between @option{y0} and
  7775. @option{y1} from being included in the field matching decision. An exclusion
  7776. band can be used to ignore subtitles, a logo, or other things that may
  7777. interfere with the matching. @option{y0} sets the starting scan line and
  7778. @option{y1} sets the ending line; all lines in between @option{y0} and
  7779. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7780. @option{y0} and @option{y1} to the same value will disable the feature.
  7781. @option{y0} and @option{y1} defaults to @code{0}.
  7782. @item scthresh
  7783. Set the scene change detection threshold as a percentage of maximum change on
  7784. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7785. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7786. @option{scthresh} is @code{[0.0, 100.0]}.
  7787. Default value is @code{12.0}.
  7788. @item combmatch
  7789. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7790. account the combed scores of matches when deciding what match to use as the
  7791. final match. Available values are:
  7792. @table @samp
  7793. @item none
  7794. No final matching based on combed scores.
  7795. @item sc
  7796. Combed scores are only used when a scene change is detected.
  7797. @item full
  7798. Use combed scores all the time.
  7799. @end table
  7800. Default is @var{sc}.
  7801. @item combdbg
  7802. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7803. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7804. Available values are:
  7805. @table @samp
  7806. @item none
  7807. No forced calculation.
  7808. @item pcn
  7809. Force p/c/n calculations.
  7810. @item pcnub
  7811. Force p/c/n/u/b calculations.
  7812. @end table
  7813. Default value is @var{none}.
  7814. @item cthresh
  7815. This is the area combing threshold used for combed frame detection. This
  7816. essentially controls how "strong" or "visible" combing must be to be detected.
  7817. Larger values mean combing must be more visible and smaller values mean combing
  7818. can be less visible or strong and still be detected. Valid settings are from
  7819. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7820. be detected as combed). This is basically a pixel difference value. A good
  7821. range is @code{[8, 12]}.
  7822. Default value is @code{9}.
  7823. @item chroma
  7824. Sets whether or not chroma is considered in the combed frame decision. Only
  7825. disable this if your source has chroma problems (rainbowing, etc.) that are
  7826. causing problems for the combed frame detection with chroma enabled. Actually,
  7827. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7828. where there is chroma only combing in the source.
  7829. Default value is @code{0}.
  7830. @item blockx
  7831. @item blocky
  7832. Respectively set the x-axis and y-axis size of the window used during combed
  7833. frame detection. This has to do with the size of the area in which
  7834. @option{combpel} pixels are required to be detected as combed for a frame to be
  7835. declared combed. See the @option{combpel} parameter description for more info.
  7836. Possible values are any number that is a power of 2 starting at 4 and going up
  7837. to 512.
  7838. Default value is @code{16}.
  7839. @item combpel
  7840. The number of combed pixels inside any of the @option{blocky} by
  7841. @option{blockx} size blocks on the frame for the frame to be detected as
  7842. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7843. setting controls "how much" combing there must be in any localized area (a
  7844. window defined by the @option{blockx} and @option{blocky} settings) on the
  7845. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7846. which point no frames will ever be detected as combed). This setting is known
  7847. as @option{MI} in TFM/VFM vocabulary.
  7848. Default value is @code{80}.
  7849. @end table
  7850. @anchor{p/c/n/u/b meaning}
  7851. @subsection p/c/n/u/b meaning
  7852. @subsubsection p/c/n
  7853. We assume the following telecined stream:
  7854. @example
  7855. Top fields: 1 2 2 3 4
  7856. Bottom fields: 1 2 3 4 4
  7857. @end example
  7858. The numbers correspond to the progressive frame the fields relate to. Here, the
  7859. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7860. When @code{fieldmatch} is configured to run a matching from bottom
  7861. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7862. @example
  7863. Input stream:
  7864. T 1 2 2 3 4
  7865. B 1 2 3 4 4 <-- matching reference
  7866. Matches: c c n n c
  7867. Output stream:
  7868. T 1 2 3 4 4
  7869. B 1 2 3 4 4
  7870. @end example
  7871. As a result of the field matching, we can see that some frames get duplicated.
  7872. To perform a complete inverse telecine, you need to rely on a decimation filter
  7873. after this operation. See for instance the @ref{decimate} filter.
  7874. The same operation now matching from top fields (@option{field}=@var{top})
  7875. looks like this:
  7876. @example
  7877. Input stream:
  7878. T 1 2 2 3 4 <-- matching reference
  7879. B 1 2 3 4 4
  7880. Matches: c c p p c
  7881. Output stream:
  7882. T 1 2 2 3 4
  7883. B 1 2 2 3 4
  7884. @end example
  7885. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7886. basically, they refer to the frame and field of the opposite parity:
  7887. @itemize
  7888. @item @var{p} matches the field of the opposite parity in the previous frame
  7889. @item @var{c} matches the field of the opposite parity in the current frame
  7890. @item @var{n} matches the field of the opposite parity in the next frame
  7891. @end itemize
  7892. @subsubsection u/b
  7893. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7894. from the opposite parity flag. In the following examples, we assume that we are
  7895. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7896. 'x' is placed above and below each matched fields.
  7897. With bottom matching (@option{field}=@var{bottom}):
  7898. @example
  7899. Match: c p n b u
  7900. x x x x x
  7901. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7902. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7903. x x x x x
  7904. Output frames:
  7905. 2 1 2 2 2
  7906. 2 2 2 1 3
  7907. @end example
  7908. With top matching (@option{field}=@var{top}):
  7909. @example
  7910. Match: c p n b u
  7911. x x x x x
  7912. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7913. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7914. x x x x x
  7915. Output frames:
  7916. 2 2 2 1 2
  7917. 2 1 3 2 2
  7918. @end example
  7919. @subsection Examples
  7920. Simple IVTC of a top field first telecined stream:
  7921. @example
  7922. fieldmatch=order=tff:combmatch=none, decimate
  7923. @end example
  7924. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7925. @example
  7926. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7927. @end example
  7928. @section fieldorder
  7929. Transform the field order of the input video.
  7930. It accepts the following parameters:
  7931. @table @option
  7932. @item order
  7933. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7934. for bottom field first.
  7935. @end table
  7936. The default value is @samp{tff}.
  7937. The transformation is done by shifting the picture content up or down
  7938. by one line, and filling the remaining line with appropriate picture content.
  7939. This method is consistent with most broadcast field order converters.
  7940. If the input video is not flagged as being interlaced, or it is already
  7941. flagged as being of the required output field order, then this filter does
  7942. not alter the incoming video.
  7943. It is very useful when converting to or from PAL DV material,
  7944. which is bottom field first.
  7945. For example:
  7946. @example
  7947. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7948. @end example
  7949. @section fifo, afifo
  7950. Buffer input images and send them when they are requested.
  7951. It is mainly useful when auto-inserted by the libavfilter
  7952. framework.
  7953. It does not take parameters.
  7954. @section fillborders
  7955. Fill borders of the input video, without changing video stream dimensions.
  7956. Sometimes video can have garbage at the four edges and you may not want to
  7957. crop video input to keep size multiple of some number.
  7958. This filter accepts the following options:
  7959. @table @option
  7960. @item left
  7961. Number of pixels to fill from left border.
  7962. @item right
  7963. Number of pixels to fill from right border.
  7964. @item top
  7965. Number of pixels to fill from top border.
  7966. @item bottom
  7967. Number of pixels to fill from bottom border.
  7968. @item mode
  7969. Set fill mode.
  7970. It accepts the following values:
  7971. @table @samp
  7972. @item smear
  7973. fill pixels using outermost pixels
  7974. @item mirror
  7975. fill pixels using mirroring
  7976. @item fixed
  7977. fill pixels with constant value
  7978. @end table
  7979. Default is @var{smear}.
  7980. @item color
  7981. Set color for pixels in fixed mode. Default is @var{black}.
  7982. @end table
  7983. @section find_rect
  7984. Find a rectangular object
  7985. It accepts the following options:
  7986. @table @option
  7987. @item object
  7988. Filepath of the object image, needs to be in gray8.
  7989. @item threshold
  7990. Detection threshold, default is 0.5.
  7991. @item mipmaps
  7992. Number of mipmaps, default is 3.
  7993. @item xmin, ymin, xmax, ymax
  7994. Specifies the rectangle in which to search.
  7995. @end table
  7996. @subsection Examples
  7997. @itemize
  7998. @item
  7999. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8000. @example
  8001. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8002. @end example
  8003. @end itemize
  8004. @section floodfill
  8005. Flood area with values of same pixel components with another values.
  8006. It accepts the following options:
  8007. @table @option
  8008. @item x
  8009. Set pixel x coordinate.
  8010. @item y
  8011. Set pixel y coordinate.
  8012. @item s0
  8013. Set source #0 component value.
  8014. @item s1
  8015. Set source #1 component value.
  8016. @item s2
  8017. Set source #2 component value.
  8018. @item s3
  8019. Set source #3 component value.
  8020. @item d0
  8021. Set destination #0 component value.
  8022. @item d1
  8023. Set destination #1 component value.
  8024. @item d2
  8025. Set destination #2 component value.
  8026. @item d3
  8027. Set destination #3 component value.
  8028. @end table
  8029. @anchor{format}
  8030. @section format
  8031. Convert the input video to one of the specified pixel formats.
  8032. Libavfilter will try to pick one that is suitable as input to
  8033. the next filter.
  8034. It accepts the following parameters:
  8035. @table @option
  8036. @item pix_fmts
  8037. A '|'-separated list of pixel format names, such as
  8038. "pix_fmts=yuv420p|monow|rgb24".
  8039. @end table
  8040. @subsection Examples
  8041. @itemize
  8042. @item
  8043. Convert the input video to the @var{yuv420p} format
  8044. @example
  8045. format=pix_fmts=yuv420p
  8046. @end example
  8047. Convert the input video to any of the formats in the list
  8048. @example
  8049. format=pix_fmts=yuv420p|yuv444p|yuv410p
  8050. @end example
  8051. @end itemize
  8052. @anchor{fps}
  8053. @section fps
  8054. Convert the video to specified constant frame rate by duplicating or dropping
  8055. frames as necessary.
  8056. It accepts the following parameters:
  8057. @table @option
  8058. @item fps
  8059. The desired output frame rate. The default is @code{25}.
  8060. @item start_time
  8061. Assume the first PTS should be the given value, in seconds. This allows for
  8062. padding/trimming at the start of stream. By default, no assumption is made
  8063. about the first frame's expected PTS, so no padding or trimming is done.
  8064. For example, this could be set to 0 to pad the beginning with duplicates of
  8065. the first frame if a video stream starts after the audio stream or to trim any
  8066. frames with a negative PTS.
  8067. @item round
  8068. Timestamp (PTS) rounding method.
  8069. Possible values are:
  8070. @table @option
  8071. @item zero
  8072. round towards 0
  8073. @item inf
  8074. round away from 0
  8075. @item down
  8076. round towards -infinity
  8077. @item up
  8078. round towards +infinity
  8079. @item near
  8080. round to nearest
  8081. @end table
  8082. The default is @code{near}.
  8083. @item eof_action
  8084. Action performed when reading the last frame.
  8085. Possible values are:
  8086. @table @option
  8087. @item round
  8088. Use same timestamp rounding method as used for other frames.
  8089. @item pass
  8090. Pass through last frame if input duration has not been reached yet.
  8091. @end table
  8092. The default is @code{round}.
  8093. @end table
  8094. Alternatively, the options can be specified as a flat string:
  8095. @var{fps}[:@var{start_time}[:@var{round}]].
  8096. See also the @ref{setpts} filter.
  8097. @subsection Examples
  8098. @itemize
  8099. @item
  8100. A typical usage in order to set the fps to 25:
  8101. @example
  8102. fps=fps=25
  8103. @end example
  8104. @item
  8105. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  8106. @example
  8107. fps=fps=film:round=near
  8108. @end example
  8109. @end itemize
  8110. @section framepack
  8111. Pack two different video streams into a stereoscopic video, setting proper
  8112. metadata on supported codecs. The two views should have the same size and
  8113. framerate and processing will stop when the shorter video ends. Please note
  8114. that you may conveniently adjust view properties with the @ref{scale} and
  8115. @ref{fps} filters.
  8116. It accepts the following parameters:
  8117. @table @option
  8118. @item format
  8119. The desired packing format. Supported values are:
  8120. @table @option
  8121. @item sbs
  8122. The views are next to each other (default).
  8123. @item tab
  8124. The views are on top of each other.
  8125. @item lines
  8126. The views are packed by line.
  8127. @item columns
  8128. The views are packed by column.
  8129. @item frameseq
  8130. The views are temporally interleaved.
  8131. @end table
  8132. @end table
  8133. Some examples:
  8134. @example
  8135. # Convert left and right views into a frame-sequential video
  8136. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  8137. # Convert views into a side-by-side video with the same output resolution as the input
  8138. 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
  8139. @end example
  8140. @section framerate
  8141. Change the frame rate by interpolating new video output frames from the source
  8142. frames.
  8143. This filter is not designed to function correctly with interlaced media. If
  8144. you wish to change the frame rate of interlaced media then you are required
  8145. to deinterlace before this filter and re-interlace after this filter.
  8146. A description of the accepted options follows.
  8147. @table @option
  8148. @item fps
  8149. Specify the output frames per second. This option can also be specified
  8150. as a value alone. The default is @code{50}.
  8151. @item interp_start
  8152. Specify the start of a range where the output frame will be created as a
  8153. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8154. the default is @code{15}.
  8155. @item interp_end
  8156. Specify the end of a range where the output frame will be created as a
  8157. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  8158. the default is @code{240}.
  8159. @item scene
  8160. Specify the level at which a scene change is detected as a value between
  8161. 0 and 100 to indicate a new scene; a low value reflects a low
  8162. probability for the current frame to introduce a new scene, while a higher
  8163. value means the current frame is more likely to be one.
  8164. The default is @code{8.2}.
  8165. @item flags
  8166. Specify flags influencing the filter process.
  8167. Available value for @var{flags} is:
  8168. @table @option
  8169. @item scene_change_detect, scd
  8170. Enable scene change detection using the value of the option @var{scene}.
  8171. This flag is enabled by default.
  8172. @end table
  8173. @end table
  8174. @section framestep
  8175. Select one frame every N-th frame.
  8176. This filter accepts the following option:
  8177. @table @option
  8178. @item step
  8179. Select frame after every @code{step} frames.
  8180. Allowed values are positive integers higher than 0. Default value is @code{1}.
  8181. @end table
  8182. @section freezedetect
  8183. Detect frozen video.
  8184. This filter logs a message and sets frame metadata when it detects that the
  8185. input video has no significant change in content during a specified duration.
  8186. Video freeze detection calculates the mean average absolute difference of all
  8187. the components of video frames and compares it to a noise floor.
  8188. The printed times and duration are expressed in seconds. The
  8189. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  8190. whose timestamp equals or exceeds the detection duration and it contains the
  8191. timestamp of the first frame of the freeze. The
  8192. @code{lavfi.freezedetect.freeze_duration} and
  8193. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  8194. after the freeze.
  8195. The filter accepts the following options:
  8196. @table @option
  8197. @item noise, n
  8198. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  8199. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  8200. 0.001.
  8201. @item duration, d
  8202. Set freeze duration until notification (default is 2 seconds).
  8203. @end table
  8204. @anchor{frei0r}
  8205. @section frei0r
  8206. Apply a frei0r effect to the input video.
  8207. To enable the compilation of this filter, you need to install the frei0r
  8208. header and configure FFmpeg with @code{--enable-frei0r}.
  8209. It accepts the following parameters:
  8210. @table @option
  8211. @item filter_name
  8212. The name of the frei0r effect to load. If the environment variable
  8213. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  8214. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  8215. Otherwise, the standard frei0r paths are searched, in this order:
  8216. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  8217. @file{/usr/lib/frei0r-1/}.
  8218. @item filter_params
  8219. A '|'-separated list of parameters to pass to the frei0r effect.
  8220. @end table
  8221. A frei0r effect parameter can be a boolean (its value is either
  8222. "y" or "n"), a double, a color (specified as
  8223. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  8224. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  8225. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  8226. a position (specified as @var{X}/@var{Y}, where
  8227. @var{X} and @var{Y} are floating point numbers) and/or a string.
  8228. The number and types of parameters depend on the loaded effect. If an
  8229. effect parameter is not specified, the default value is set.
  8230. @subsection Examples
  8231. @itemize
  8232. @item
  8233. Apply the distort0r effect, setting the first two double parameters:
  8234. @example
  8235. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  8236. @end example
  8237. @item
  8238. Apply the colordistance effect, taking a color as the first parameter:
  8239. @example
  8240. frei0r=colordistance:0.2/0.3/0.4
  8241. frei0r=colordistance:violet
  8242. frei0r=colordistance:0x112233
  8243. @end example
  8244. @item
  8245. Apply the perspective effect, specifying the top left and top right image
  8246. positions:
  8247. @example
  8248. frei0r=perspective:0.2/0.2|0.8/0.2
  8249. @end example
  8250. @end itemize
  8251. For more information, see
  8252. @url{http://frei0r.dyne.org}
  8253. @section fspp
  8254. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  8255. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  8256. processing filter, one of them is performed once per block, not per pixel.
  8257. This allows for much higher speed.
  8258. The filter accepts the following options:
  8259. @table @option
  8260. @item quality
  8261. Set quality. This option defines the number of levels for averaging. It accepts
  8262. an integer in the range 4-5. Default value is @code{4}.
  8263. @item qp
  8264. Force a constant quantization parameter. It accepts an integer in range 0-63.
  8265. If not set, the filter will use the QP from the video stream (if available).
  8266. @item strength
  8267. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  8268. more details but also more artifacts, while higher values make the image smoother
  8269. but also blurrier. Default value is @code{0} − PSNR optimal.
  8270. @item use_bframe_qp
  8271. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8272. option may cause flicker since the B-Frames have often larger QP. Default is
  8273. @code{0} (not enabled).
  8274. @end table
  8275. @section gblur
  8276. Apply Gaussian blur filter.
  8277. The filter accepts the following options:
  8278. @table @option
  8279. @item sigma
  8280. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  8281. @item steps
  8282. Set number of steps for Gaussian approximation. Default is @code{1}.
  8283. @item planes
  8284. Set which planes to filter. By default all planes are filtered.
  8285. @item sigmaV
  8286. Set vertical sigma, if negative it will be same as @code{sigma}.
  8287. Default is @code{-1}.
  8288. @end table
  8289. @section geq
  8290. Apply generic equation to each pixel.
  8291. The filter accepts the following options:
  8292. @table @option
  8293. @item lum_expr, lum
  8294. Set the luminance expression.
  8295. @item cb_expr, cb
  8296. Set the chrominance blue expression.
  8297. @item cr_expr, cr
  8298. Set the chrominance red expression.
  8299. @item alpha_expr, a
  8300. Set the alpha expression.
  8301. @item red_expr, r
  8302. Set the red expression.
  8303. @item green_expr, g
  8304. Set the green expression.
  8305. @item blue_expr, b
  8306. Set the blue expression.
  8307. @end table
  8308. The colorspace is selected according to the specified options. If one
  8309. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  8310. options is specified, the filter will automatically select a YCbCr
  8311. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  8312. @option{blue_expr} options is specified, it will select an RGB
  8313. colorspace.
  8314. If one of the chrominance expression is not defined, it falls back on the other
  8315. one. If no alpha expression is specified it will evaluate to opaque value.
  8316. If none of chrominance expressions are specified, they will evaluate
  8317. to the luminance expression.
  8318. The expressions can use the following variables and functions:
  8319. @table @option
  8320. @item N
  8321. The sequential number of the filtered frame, starting from @code{0}.
  8322. @item X
  8323. @item Y
  8324. The coordinates of the current sample.
  8325. @item W
  8326. @item H
  8327. The width and height of the image.
  8328. @item SW
  8329. @item SH
  8330. Width and height scale depending on the currently filtered plane. It is the
  8331. ratio between the corresponding luma plane number of pixels and the current
  8332. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8333. @code{0.5,0.5} for chroma planes.
  8334. @item T
  8335. Time of the current frame, expressed in seconds.
  8336. @item p(x, y)
  8337. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8338. plane.
  8339. @item lum(x, y)
  8340. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8341. plane.
  8342. @item cb(x, y)
  8343. Return the value of the pixel at location (@var{x},@var{y}) of the
  8344. blue-difference chroma plane. Return 0 if there is no such plane.
  8345. @item cr(x, y)
  8346. Return the value of the pixel at location (@var{x},@var{y}) of the
  8347. red-difference chroma plane. Return 0 if there is no such plane.
  8348. @item r(x, y)
  8349. @item g(x, y)
  8350. @item b(x, y)
  8351. Return the value of the pixel at location (@var{x},@var{y}) of the
  8352. red/green/blue component. Return 0 if there is no such component.
  8353. @item alpha(x, y)
  8354. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8355. plane. Return 0 if there is no such plane.
  8356. @end table
  8357. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8358. automatically clipped to the closer edge.
  8359. @subsection Examples
  8360. @itemize
  8361. @item
  8362. Flip the image horizontally:
  8363. @example
  8364. geq=p(W-X\,Y)
  8365. @end example
  8366. @item
  8367. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8368. wavelength of 100 pixels:
  8369. @example
  8370. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8371. @end example
  8372. @item
  8373. Generate a fancy enigmatic moving light:
  8374. @example
  8375. 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
  8376. @end example
  8377. @item
  8378. Generate a quick emboss effect:
  8379. @example
  8380. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8381. @end example
  8382. @item
  8383. Modify RGB components depending on pixel position:
  8384. @example
  8385. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8386. @end example
  8387. @item
  8388. Create a radial gradient that is the same size as the input (also see
  8389. the @ref{vignette} filter):
  8390. @example
  8391. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8392. @end example
  8393. @end itemize
  8394. @section gradfun
  8395. Fix the banding artifacts that are sometimes introduced into nearly flat
  8396. regions by truncation to 8-bit color depth.
  8397. Interpolate the gradients that should go where the bands are, and
  8398. dither them.
  8399. It is designed for playback only. Do not use it prior to
  8400. lossy compression, because compression tends to lose the dither and
  8401. bring back the bands.
  8402. It accepts the following parameters:
  8403. @table @option
  8404. @item strength
  8405. The maximum amount by which the filter will change any one pixel. This is also
  8406. the threshold for detecting nearly flat regions. Acceptable values range from
  8407. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8408. valid range.
  8409. @item radius
  8410. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8411. gradients, but also prevents the filter from modifying the pixels near detailed
  8412. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8413. values will be clipped to the valid range.
  8414. @end table
  8415. Alternatively, the options can be specified as a flat string:
  8416. @var{strength}[:@var{radius}]
  8417. @subsection Examples
  8418. @itemize
  8419. @item
  8420. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8421. @example
  8422. gradfun=3.5:8
  8423. @end example
  8424. @item
  8425. Specify radius, omitting the strength (which will fall-back to the default
  8426. value):
  8427. @example
  8428. gradfun=radius=8
  8429. @end example
  8430. @end itemize
  8431. @section graphmonitor, agraphmonitor
  8432. Show various filtergraph stats.
  8433. With this filter one can debug complete filtergraph.
  8434. Especially issues with links filling with queued frames.
  8435. The filter accepts the following options:
  8436. @table @option
  8437. @item size, s
  8438. Set video output size. Default is @var{hd720}.
  8439. @item opacity, o
  8440. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8441. @item mode, m
  8442. Set output mode, can be @var{fulll} or @var{compact}.
  8443. In @var{compact} mode only filters with some queued frames have displayed stats.
  8444. @item flags, f
  8445. Set flags which enable which stats are shown in video.
  8446. Available values for flags are:
  8447. @table @samp
  8448. @item queue
  8449. Display number of queued frames in each link.
  8450. @item frame_count_in
  8451. Display number of frames taken from filter.
  8452. @item frame_count_out
  8453. Display number of frames given out from filter.
  8454. @item pts
  8455. Display current filtered frame pts.
  8456. @item time
  8457. Display current filtered frame time.
  8458. @item timebase
  8459. Display time base for filter link.
  8460. @item format
  8461. Display used format for filter link.
  8462. @item size
  8463. Display video size or number of audio channels in case of audio used by filter link.
  8464. @item rate
  8465. Display video frame rate or sample rate in case of audio used by filter link.
  8466. @end table
  8467. @item rate, r
  8468. Set upper limit for video rate of output stream, Default value is @var{25}.
  8469. This guarantee that output video frame rate will not be higher than this value.
  8470. @end table
  8471. @section greyedge
  8472. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8473. and corrects the scene colors accordingly.
  8474. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8475. The filter accepts the following options:
  8476. @table @option
  8477. @item difford
  8478. The order of differentiation to be applied on the scene. Must be chosen in the range
  8479. [0,2] and default value is 1.
  8480. @item minknorm
  8481. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8482. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8483. max value instead of calculating Minkowski distance.
  8484. @item sigma
  8485. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8486. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8487. can't be equal to 0 if @var{difford} is greater than 0.
  8488. @end table
  8489. @subsection Examples
  8490. @itemize
  8491. @item
  8492. Grey Edge:
  8493. @example
  8494. greyedge=difford=1:minknorm=5:sigma=2
  8495. @end example
  8496. @item
  8497. Max Edge:
  8498. @example
  8499. greyedge=difford=1:minknorm=0:sigma=2
  8500. @end example
  8501. @end itemize
  8502. @anchor{haldclut}
  8503. @section haldclut
  8504. Apply a Hald CLUT to a video stream.
  8505. First input is the video stream to process, and second one is the Hald CLUT.
  8506. The Hald CLUT input can be a simple picture or a complete video stream.
  8507. The filter accepts the following options:
  8508. @table @option
  8509. @item shortest
  8510. Force termination when the shortest input terminates. Default is @code{0}.
  8511. @item repeatlast
  8512. Continue applying the last CLUT after the end of the stream. A value of
  8513. @code{0} disable the filter after the last frame of the CLUT is reached.
  8514. Default is @code{1}.
  8515. @end table
  8516. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8517. filters share the same internals).
  8518. This filter also supports the @ref{framesync} options.
  8519. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8520. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8521. @subsection Workflow examples
  8522. @subsubsection Hald CLUT video stream
  8523. Generate an identity Hald CLUT stream altered with various effects:
  8524. @example
  8525. 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
  8526. @end example
  8527. Note: make sure you use a lossless codec.
  8528. Then use it with @code{haldclut} to apply it on some random stream:
  8529. @example
  8530. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8531. @end example
  8532. The Hald CLUT will be applied to the 10 first seconds (duration of
  8533. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8534. to the remaining frames of the @code{mandelbrot} stream.
  8535. @subsubsection Hald CLUT with preview
  8536. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8537. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8538. biggest possible square starting at the top left of the picture. The remaining
  8539. padding pixels (bottom or right) will be ignored. This area can be used to add
  8540. a preview of the Hald CLUT.
  8541. Typically, the following generated Hald CLUT will be supported by the
  8542. @code{haldclut} filter:
  8543. @example
  8544. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8545. pad=iw+320 [padded_clut];
  8546. smptebars=s=320x256, split [a][b];
  8547. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8548. [main][b] overlay=W-320" -frames:v 1 clut.png
  8549. @end example
  8550. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8551. bars are displayed on the right-top, and below the same color bars processed by
  8552. the color changes.
  8553. Then, the effect of this Hald CLUT can be visualized with:
  8554. @example
  8555. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8556. @end example
  8557. @section hflip
  8558. Flip the input video horizontally.
  8559. For example, to horizontally flip the input video with @command{ffmpeg}:
  8560. @example
  8561. ffmpeg -i in.avi -vf "hflip" out.avi
  8562. @end example
  8563. @section histeq
  8564. This filter applies a global color histogram equalization on a
  8565. per-frame basis.
  8566. It can be used to correct video that has a compressed range of pixel
  8567. intensities. The filter redistributes the pixel intensities to
  8568. equalize their distribution across the intensity range. It may be
  8569. viewed as an "automatically adjusting contrast filter". This filter is
  8570. useful only for correcting degraded or poorly captured source
  8571. video.
  8572. The filter accepts the following options:
  8573. @table @option
  8574. @item strength
  8575. Determine the amount of equalization to be applied. As the strength
  8576. is reduced, the distribution of pixel intensities more-and-more
  8577. approaches that of the input frame. The value must be a float number
  8578. in the range [0,1] and defaults to 0.200.
  8579. @item intensity
  8580. Set the maximum intensity that can generated and scale the output
  8581. values appropriately. The strength should be set as desired and then
  8582. the intensity can be limited if needed to avoid washing-out. The value
  8583. must be a float number in the range [0,1] and defaults to 0.210.
  8584. @item antibanding
  8585. Set the antibanding level. If enabled the filter will randomly vary
  8586. the luminance of output pixels by a small amount to avoid banding of
  8587. the histogram. Possible values are @code{none}, @code{weak} or
  8588. @code{strong}. It defaults to @code{none}.
  8589. @end table
  8590. @section histogram
  8591. Compute and draw a color distribution histogram for the input video.
  8592. The computed histogram is a representation of the color component
  8593. distribution in an image.
  8594. Standard histogram displays the color components distribution in an image.
  8595. Displays color graph for each color component. Shows distribution of
  8596. the Y, U, V, A or R, G, B components, depending on input format, in the
  8597. current frame. Below each graph a color component scale meter is shown.
  8598. The filter accepts the following options:
  8599. @table @option
  8600. @item level_height
  8601. Set height of level. Default value is @code{200}.
  8602. Allowed range is [50, 2048].
  8603. @item scale_height
  8604. Set height of color scale. Default value is @code{12}.
  8605. Allowed range is [0, 40].
  8606. @item display_mode
  8607. Set display mode.
  8608. It accepts the following values:
  8609. @table @samp
  8610. @item stack
  8611. Per color component graphs are placed below each other.
  8612. @item parade
  8613. Per color component graphs are placed side by side.
  8614. @item overlay
  8615. Presents information identical to that in the @code{parade}, except
  8616. that the graphs representing color components are superimposed directly
  8617. over one another.
  8618. @end table
  8619. Default is @code{stack}.
  8620. @item levels_mode
  8621. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8622. Default is @code{linear}.
  8623. @item components
  8624. Set what color components to display.
  8625. Default is @code{7}.
  8626. @item fgopacity
  8627. Set foreground opacity. Default is @code{0.7}.
  8628. @item bgopacity
  8629. Set background opacity. Default is @code{0.5}.
  8630. @end table
  8631. @subsection Examples
  8632. @itemize
  8633. @item
  8634. Calculate and draw histogram:
  8635. @example
  8636. ffplay -i input -vf histogram
  8637. @end example
  8638. @end itemize
  8639. @anchor{hqdn3d}
  8640. @section hqdn3d
  8641. This is a high precision/quality 3d denoise filter. It aims to reduce
  8642. image noise, producing smooth images and making still images really
  8643. still. It should enhance compressibility.
  8644. It accepts the following optional parameters:
  8645. @table @option
  8646. @item luma_spatial
  8647. A non-negative floating point number which specifies spatial luma strength.
  8648. It defaults to 4.0.
  8649. @item chroma_spatial
  8650. A non-negative floating point number which specifies spatial chroma strength.
  8651. It defaults to 3.0*@var{luma_spatial}/4.0.
  8652. @item luma_tmp
  8653. A floating point number which specifies luma temporal strength. It defaults to
  8654. 6.0*@var{luma_spatial}/4.0.
  8655. @item chroma_tmp
  8656. A floating point number which specifies chroma temporal strength. It defaults to
  8657. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8658. @end table
  8659. @anchor{hwdownload}
  8660. @section hwdownload
  8661. Download hardware frames to system memory.
  8662. The input must be in hardware frames, and the output a non-hardware format.
  8663. Not all formats will be supported on the output - it may be necessary to insert
  8664. an additional @option{format} filter immediately following in the graph to get
  8665. the output in a supported format.
  8666. @section hwmap
  8667. Map hardware frames to system memory or to another device.
  8668. This filter has several different modes of operation; which one is used depends
  8669. on the input and output formats:
  8670. @itemize
  8671. @item
  8672. Hardware frame input, normal frame output
  8673. Map the input frames to system memory and pass them to the output. If the
  8674. original hardware frame is later required (for example, after overlaying
  8675. something else on part of it), the @option{hwmap} filter can be used again
  8676. in the next mode to retrieve it.
  8677. @item
  8678. Normal frame input, hardware frame output
  8679. If the input is actually a software-mapped hardware frame, then unmap it -
  8680. that is, return the original hardware frame.
  8681. Otherwise, a device must be provided. Create new hardware surfaces on that
  8682. device for the output, then map them back to the software format at the input
  8683. and give those frames to the preceding filter. This will then act like the
  8684. @option{hwupload} filter, but may be able to avoid an additional copy when
  8685. the input is already in a compatible format.
  8686. @item
  8687. Hardware frame input and output
  8688. A device must be supplied for the output, either directly or with the
  8689. @option{derive_device} option. The input and output devices must be of
  8690. different types and compatible - the exact meaning of this is
  8691. system-dependent, but typically it means that they must refer to the same
  8692. underlying hardware context (for example, refer to the same graphics card).
  8693. If the input frames were originally created on the output device, then unmap
  8694. to retrieve the original frames.
  8695. Otherwise, map the frames to the output device - create new hardware frames
  8696. on the output corresponding to the frames on the input.
  8697. @end itemize
  8698. The following additional parameters are accepted:
  8699. @table @option
  8700. @item mode
  8701. Set the frame mapping mode. Some combination of:
  8702. @table @var
  8703. @item read
  8704. The mapped frame should be readable.
  8705. @item write
  8706. The mapped frame should be writeable.
  8707. @item overwrite
  8708. The mapping will always overwrite the entire frame.
  8709. This may improve performance in some cases, as the original contents of the
  8710. frame need not be loaded.
  8711. @item direct
  8712. The mapping must not involve any copying.
  8713. Indirect mappings to copies of frames are created in some cases where either
  8714. direct mapping is not possible or it would have unexpected properties.
  8715. Setting this flag ensures that the mapping is direct and will fail if that is
  8716. not possible.
  8717. @end table
  8718. Defaults to @var{read+write} if not specified.
  8719. @item derive_device @var{type}
  8720. Rather than using the device supplied at initialisation, instead derive a new
  8721. device of type @var{type} from the device the input frames exist on.
  8722. @item reverse
  8723. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8724. and map them back to the source. This may be necessary in some cases where
  8725. a mapping in one direction is required but only the opposite direction is
  8726. supported by the devices being used.
  8727. This option is dangerous - it may break the preceding filter in undefined
  8728. ways if there are any additional constraints on that filter's output.
  8729. Do not use it without fully understanding the implications of its use.
  8730. @end table
  8731. @anchor{hwupload}
  8732. @section hwupload
  8733. Upload system memory frames to hardware surfaces.
  8734. The device to upload to must be supplied when the filter is initialised. If
  8735. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8736. option.
  8737. @anchor{hwupload_cuda}
  8738. @section hwupload_cuda
  8739. Upload system memory frames to a CUDA device.
  8740. It accepts the following optional parameters:
  8741. @table @option
  8742. @item device
  8743. The number of the CUDA device to use
  8744. @end table
  8745. @section hqx
  8746. Apply a high-quality magnification filter designed for pixel art. This filter
  8747. was originally created by Maxim Stepin.
  8748. It accepts the following option:
  8749. @table @option
  8750. @item n
  8751. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8752. @code{hq3x} and @code{4} for @code{hq4x}.
  8753. Default is @code{3}.
  8754. @end table
  8755. @section hstack
  8756. Stack input videos horizontally.
  8757. All streams must be of same pixel format and of same height.
  8758. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8759. to create same output.
  8760. The filter accepts the following option:
  8761. @table @option
  8762. @item inputs
  8763. Set number of input streams. Default is 2.
  8764. @item shortest
  8765. If set to 1, force the output to terminate when the shortest input
  8766. terminates. Default value is 0.
  8767. @end table
  8768. @section hue
  8769. Modify the hue and/or the saturation of the input.
  8770. It accepts the following parameters:
  8771. @table @option
  8772. @item h
  8773. Specify the hue angle as a number of degrees. It accepts an expression,
  8774. and defaults to "0".
  8775. @item s
  8776. Specify the saturation in the [-10,10] range. It accepts an expression and
  8777. defaults to "1".
  8778. @item H
  8779. Specify the hue angle as a number of radians. It accepts an
  8780. expression, and defaults to "0".
  8781. @item b
  8782. Specify the brightness in the [-10,10] range. It accepts an expression and
  8783. defaults to "0".
  8784. @end table
  8785. @option{h} and @option{H} are mutually exclusive, and can't be
  8786. specified at the same time.
  8787. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8788. expressions containing the following constants:
  8789. @table @option
  8790. @item n
  8791. frame count of the input frame starting from 0
  8792. @item pts
  8793. presentation timestamp of the input frame expressed in time base units
  8794. @item r
  8795. frame rate of the input video, NAN if the input frame rate is unknown
  8796. @item t
  8797. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8798. @item tb
  8799. time base of the input video
  8800. @end table
  8801. @subsection Examples
  8802. @itemize
  8803. @item
  8804. Set the hue to 90 degrees and the saturation to 1.0:
  8805. @example
  8806. hue=h=90:s=1
  8807. @end example
  8808. @item
  8809. Same command but expressing the hue in radians:
  8810. @example
  8811. hue=H=PI/2:s=1
  8812. @end example
  8813. @item
  8814. Rotate hue and make the saturation swing between 0
  8815. and 2 over a period of 1 second:
  8816. @example
  8817. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8818. @end example
  8819. @item
  8820. Apply a 3 seconds saturation fade-in effect starting at 0:
  8821. @example
  8822. hue="s=min(t/3\,1)"
  8823. @end example
  8824. The general fade-in expression can be written as:
  8825. @example
  8826. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8827. @end example
  8828. @item
  8829. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8830. @example
  8831. hue="s=max(0\, min(1\, (8-t)/3))"
  8832. @end example
  8833. The general fade-out expression can be written as:
  8834. @example
  8835. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8836. @end example
  8837. @end itemize
  8838. @subsection Commands
  8839. This filter supports the following commands:
  8840. @table @option
  8841. @item b
  8842. @item s
  8843. @item h
  8844. @item H
  8845. Modify the hue and/or the saturation and/or brightness of the input video.
  8846. The command accepts the same syntax of the corresponding option.
  8847. If the specified expression is not valid, it is kept at its current
  8848. value.
  8849. @end table
  8850. @section hysteresis
  8851. Grow first stream into second stream by connecting components.
  8852. This makes it possible to build more robust edge masks.
  8853. This filter accepts the following options:
  8854. @table @option
  8855. @item planes
  8856. Set which planes will be processed as bitmap, unprocessed planes will be
  8857. copied from first stream.
  8858. By default value 0xf, all planes will be processed.
  8859. @item threshold
  8860. Set threshold which is used in filtering. If pixel component value is higher than
  8861. this value filter algorithm for connecting components is activated.
  8862. By default value is 0.
  8863. @end table
  8864. @section idet
  8865. Detect video interlacing type.
  8866. This filter tries to detect if the input frames are interlaced, progressive,
  8867. top or bottom field first. It will also try to detect fields that are
  8868. repeated between adjacent frames (a sign of telecine).
  8869. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8870. Multiple frame detection incorporates the classification history of previous frames.
  8871. The filter will log these metadata values:
  8872. @table @option
  8873. @item single.current_frame
  8874. Detected type of current frame using single-frame detection. One of:
  8875. ``tff'' (top field first), ``bff'' (bottom field first),
  8876. ``progressive'', or ``undetermined''
  8877. @item single.tff
  8878. Cumulative number of frames detected as top field first using single-frame detection.
  8879. @item multiple.tff
  8880. Cumulative number of frames detected as top field first using multiple-frame detection.
  8881. @item single.bff
  8882. Cumulative number of frames detected as bottom field first using single-frame detection.
  8883. @item multiple.current_frame
  8884. Detected type of current frame using multiple-frame detection. One of:
  8885. ``tff'' (top field first), ``bff'' (bottom field first),
  8886. ``progressive'', or ``undetermined''
  8887. @item multiple.bff
  8888. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8889. @item single.progressive
  8890. Cumulative number of frames detected as progressive using single-frame detection.
  8891. @item multiple.progressive
  8892. Cumulative number of frames detected as progressive using multiple-frame detection.
  8893. @item single.undetermined
  8894. Cumulative number of frames that could not be classified using single-frame detection.
  8895. @item multiple.undetermined
  8896. Cumulative number of frames that could not be classified using multiple-frame detection.
  8897. @item repeated.current_frame
  8898. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8899. @item repeated.neither
  8900. Cumulative number of frames with no repeated field.
  8901. @item repeated.top
  8902. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8903. @item repeated.bottom
  8904. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8905. @end table
  8906. The filter accepts the following options:
  8907. @table @option
  8908. @item intl_thres
  8909. Set interlacing threshold.
  8910. @item prog_thres
  8911. Set progressive threshold.
  8912. @item rep_thres
  8913. Threshold for repeated field detection.
  8914. @item half_life
  8915. Number of frames after which a given frame's contribution to the
  8916. statistics is halved (i.e., it contributes only 0.5 to its
  8917. classification). The default of 0 means that all frames seen are given
  8918. full weight of 1.0 forever.
  8919. @item analyze_interlaced_flag
  8920. When this is not 0 then idet will use the specified number of frames to determine
  8921. if the interlaced flag is accurate, it will not count undetermined frames.
  8922. If the flag is found to be accurate it will be used without any further
  8923. computations, if it is found to be inaccurate it will be cleared without any
  8924. further computations. This allows inserting the idet filter as a low computational
  8925. method to clean up the interlaced flag
  8926. @end table
  8927. @section il
  8928. Deinterleave or interleave fields.
  8929. This filter allows one to process interlaced images fields without
  8930. deinterlacing them. Deinterleaving splits the input frame into 2
  8931. fields (so called half pictures). Odd lines are moved to the top
  8932. half of the output image, even lines to the bottom half.
  8933. You can process (filter) them independently and then re-interleave them.
  8934. The filter accepts the following options:
  8935. @table @option
  8936. @item luma_mode, l
  8937. @item chroma_mode, c
  8938. @item alpha_mode, a
  8939. Available values for @var{luma_mode}, @var{chroma_mode} and
  8940. @var{alpha_mode} are:
  8941. @table @samp
  8942. @item none
  8943. Do nothing.
  8944. @item deinterleave, d
  8945. Deinterleave fields, placing one above the other.
  8946. @item interleave, i
  8947. Interleave fields. Reverse the effect of deinterleaving.
  8948. @end table
  8949. Default value is @code{none}.
  8950. @item luma_swap, ls
  8951. @item chroma_swap, cs
  8952. @item alpha_swap, as
  8953. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8954. @end table
  8955. @section inflate
  8956. Apply inflate effect to the video.
  8957. This filter replaces the pixel by the local(3x3) average by taking into account
  8958. only values higher than the pixel.
  8959. It accepts the following options:
  8960. @table @option
  8961. @item threshold0
  8962. @item threshold1
  8963. @item threshold2
  8964. @item threshold3
  8965. Limit the maximum change for each plane, default is 65535.
  8966. If 0, plane will remain unchanged.
  8967. @end table
  8968. @section interlace
  8969. Simple interlacing filter from progressive contents. This interleaves upper (or
  8970. lower) lines from odd frames with lower (or upper) lines from even frames,
  8971. halving the frame rate and preserving image height.
  8972. @example
  8973. Original Original New Frame
  8974. Frame 'j' Frame 'j+1' (tff)
  8975. ========== =========== ==================
  8976. Line 0 --------------------> Frame 'j' Line 0
  8977. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8978. Line 2 ---------------------> Frame 'j' Line 2
  8979. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8980. ... ... ...
  8981. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8982. @end example
  8983. It accepts the following optional parameters:
  8984. @table @option
  8985. @item scan
  8986. This determines whether the interlaced frame is taken from the even
  8987. (tff - default) or odd (bff) lines of the progressive frame.
  8988. @item lowpass
  8989. Vertical lowpass filter to avoid twitter interlacing and
  8990. reduce moire patterns.
  8991. @table @samp
  8992. @item 0, off
  8993. Disable vertical lowpass filter
  8994. @item 1, linear
  8995. Enable linear filter (default)
  8996. @item 2, complex
  8997. Enable complex filter. This will slightly less reduce twitter and moire
  8998. but better retain detail and subjective sharpness impression.
  8999. @end table
  9000. @end table
  9001. @section kerndeint
  9002. Deinterlace input video by applying Donald Graft's adaptive kernel
  9003. deinterling. Work on interlaced parts of a video to produce
  9004. progressive frames.
  9005. The description of the accepted parameters follows.
  9006. @table @option
  9007. @item thresh
  9008. Set the threshold which affects the filter's tolerance when
  9009. determining if a pixel line must be processed. It must be an integer
  9010. in the range [0,255] and defaults to 10. A value of 0 will result in
  9011. applying the process on every pixels.
  9012. @item map
  9013. Paint pixels exceeding the threshold value to white if set to 1.
  9014. Default is 0.
  9015. @item order
  9016. Set the fields order. Swap fields if set to 1, leave fields alone if
  9017. 0. Default is 0.
  9018. @item sharp
  9019. Enable additional sharpening if set to 1. Default is 0.
  9020. @item twoway
  9021. Enable twoway sharpening if set to 1. Default is 0.
  9022. @end table
  9023. @subsection Examples
  9024. @itemize
  9025. @item
  9026. Apply default values:
  9027. @example
  9028. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  9029. @end example
  9030. @item
  9031. Enable additional sharpening:
  9032. @example
  9033. kerndeint=sharp=1
  9034. @end example
  9035. @item
  9036. Paint processed pixels in white:
  9037. @example
  9038. kerndeint=map=1
  9039. @end example
  9040. @end itemize
  9041. @section lagfun
  9042. Slowly update darker pixels.
  9043. This filter makes short flashes of light appear longer.
  9044. This filter accepts the following options:
  9045. @table @option
  9046. @item decay
  9047. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  9048. @item planes
  9049. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  9050. @end table
  9051. @section lenscorrection
  9052. Correct radial lens distortion
  9053. This filter can be used to correct for radial distortion as can result from the use
  9054. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  9055. one can use tools available for example as part of opencv or simply trial-and-error.
  9056. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  9057. and extract the k1 and k2 coefficients from the resulting matrix.
  9058. Note that effectively the same filter is available in the open-source tools Krita and
  9059. Digikam from the KDE project.
  9060. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  9061. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  9062. brightness distribution, so you may want to use both filters together in certain
  9063. cases, though you will have to take care of ordering, i.e. whether vignetting should
  9064. be applied before or after lens correction.
  9065. @subsection Options
  9066. The filter accepts the following options:
  9067. @table @option
  9068. @item cx
  9069. Relative x-coordinate of the focal point of the image, and thereby the center of the
  9070. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9071. width. Default is 0.5.
  9072. @item cy
  9073. Relative y-coordinate of the focal point of the image, and thereby the center of the
  9074. distortion. This value has a range [0,1] and is expressed as fractions of the image
  9075. height. Default is 0.5.
  9076. @item k1
  9077. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  9078. no correction. Default is 0.
  9079. @item k2
  9080. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  9081. 0 means no correction. Default is 0.
  9082. @end table
  9083. The formula that generates the correction is:
  9084. @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)
  9085. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  9086. distances from the focal point in the source and target images, respectively.
  9087. @section lensfun
  9088. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  9089. The @code{lensfun} filter requires the camera make, camera model, and lens model
  9090. to apply the lens correction. The filter will load the lensfun database and
  9091. query it to find the corresponding camera and lens entries in the database. As
  9092. long as these entries can be found with the given options, the filter can
  9093. perform corrections on frames. Note that incomplete strings will result in the
  9094. filter choosing the best match with the given options, and the filter will
  9095. output the chosen camera and lens models (logged with level "info"). You must
  9096. provide the make, camera model, and lens model as they are required.
  9097. The filter accepts the following options:
  9098. @table @option
  9099. @item make
  9100. The make of the camera (for example, "Canon"). This option is required.
  9101. @item model
  9102. The model of the camera (for example, "Canon EOS 100D"). This option is
  9103. required.
  9104. @item lens_model
  9105. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  9106. option is required.
  9107. @item mode
  9108. The type of correction to apply. The following values are valid options:
  9109. @table @samp
  9110. @item vignetting
  9111. Enables fixing lens vignetting.
  9112. @item geometry
  9113. Enables fixing lens geometry. This is the default.
  9114. @item subpixel
  9115. Enables fixing chromatic aberrations.
  9116. @item vig_geo
  9117. Enables fixing lens vignetting and lens geometry.
  9118. @item vig_subpixel
  9119. Enables fixing lens vignetting and chromatic aberrations.
  9120. @item distortion
  9121. Enables fixing both lens geometry and chromatic aberrations.
  9122. @item all
  9123. Enables all possible corrections.
  9124. @end table
  9125. @item focal_length
  9126. The focal length of the image/video (zoom; expected constant for video). For
  9127. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  9128. range should be chosen when using that lens. Default 18.
  9129. @item aperture
  9130. The aperture of the image/video (expected constant for video). Note that
  9131. aperture is only used for vignetting correction. Default 3.5.
  9132. @item focus_distance
  9133. The focus distance of the image/video (expected constant for video). Note that
  9134. focus distance is only used for vignetting and only slightly affects the
  9135. vignetting correction process. If unknown, leave it at the default value (which
  9136. is 1000).
  9137. @item scale
  9138. The scale factor which is applied after transformation. After correction the
  9139. video is no longer necessarily rectangular. This parameter controls how much of
  9140. the resulting image is visible. The value 0 means that a value will be chosen
  9141. automatically such that there is little or no unmapped area in the output
  9142. image. 1.0 means that no additional scaling is done. Lower values may result
  9143. in more of the corrected image being visible, while higher values may avoid
  9144. unmapped areas in the output.
  9145. @item target_geometry
  9146. The target geometry of the output image/video. The following values are valid
  9147. options:
  9148. @table @samp
  9149. @item rectilinear (default)
  9150. @item fisheye
  9151. @item panoramic
  9152. @item equirectangular
  9153. @item fisheye_orthographic
  9154. @item fisheye_stereographic
  9155. @item fisheye_equisolid
  9156. @item fisheye_thoby
  9157. @end table
  9158. @item reverse
  9159. Apply the reverse of image correction (instead of correcting distortion, apply
  9160. it).
  9161. @item interpolation
  9162. The type of interpolation used when correcting distortion. The following values
  9163. are valid options:
  9164. @table @samp
  9165. @item nearest
  9166. @item linear (default)
  9167. @item lanczos
  9168. @end table
  9169. @end table
  9170. @subsection Examples
  9171. @itemize
  9172. @item
  9173. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  9174. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  9175. aperture of "8.0".
  9176. @example
  9177. 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
  9178. @end example
  9179. @item
  9180. Apply the same as before, but only for the first 5 seconds of video.
  9181. @example
  9182. 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
  9183. @end example
  9184. @end itemize
  9185. @section libvmaf
  9186. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  9187. score between two input videos.
  9188. The obtained VMAF score is printed through the logging system.
  9189. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  9190. After installing the library it can be enabled using:
  9191. @code{./configure --enable-libvmaf --enable-version3}.
  9192. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  9193. The filter has following options:
  9194. @table @option
  9195. @item model_path
  9196. Set the model path which is to be used for SVM.
  9197. Default value: @code{"vmaf_v0.6.1.pkl"}
  9198. @item log_path
  9199. Set the file path to be used to store logs.
  9200. @item log_fmt
  9201. Set the format of the log file (xml or json).
  9202. @item enable_transform
  9203. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  9204. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  9205. Default value: @code{false}
  9206. @item phone_model
  9207. Invokes the phone model which will generate VMAF scores higher than in the
  9208. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  9209. @item psnr
  9210. Enables computing psnr along with vmaf.
  9211. @item ssim
  9212. Enables computing ssim along with vmaf.
  9213. @item ms_ssim
  9214. Enables computing ms_ssim along with vmaf.
  9215. @item pool
  9216. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  9217. @item n_threads
  9218. Set number of threads to be used when computing vmaf.
  9219. @item n_subsample
  9220. Set interval for frame subsampling used when computing vmaf.
  9221. @item enable_conf_interval
  9222. Enables confidence interval.
  9223. @end table
  9224. This filter also supports the @ref{framesync} options.
  9225. On the below examples the input file @file{main.mpg} being processed is
  9226. compared with the reference file @file{ref.mpg}.
  9227. @example
  9228. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  9229. @end example
  9230. Example with options:
  9231. @example
  9232. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  9233. @end example
  9234. @section limiter
  9235. Limits the pixel components values to the specified range [min, max].
  9236. The filter accepts the following options:
  9237. @table @option
  9238. @item min
  9239. Lower bound. Defaults to the lowest allowed value for the input.
  9240. @item max
  9241. Upper bound. Defaults to the highest allowed value for the input.
  9242. @item planes
  9243. Specify which planes will be processed. Defaults to all available.
  9244. @end table
  9245. @section loop
  9246. Loop video frames.
  9247. The filter accepts the following options:
  9248. @table @option
  9249. @item loop
  9250. Set the number of loops. Setting this value to -1 will result in infinite loops.
  9251. Default is 0.
  9252. @item size
  9253. Set maximal size in number of frames. Default is 0.
  9254. @item start
  9255. Set first frame of loop. Default is 0.
  9256. @end table
  9257. @subsection Examples
  9258. @itemize
  9259. @item
  9260. Loop single first frame infinitely:
  9261. @example
  9262. loop=loop=-1:size=1:start=0
  9263. @end example
  9264. @item
  9265. Loop single first frame 10 times:
  9266. @example
  9267. loop=loop=10:size=1:start=0
  9268. @end example
  9269. @item
  9270. Loop 10 first frames 5 times:
  9271. @example
  9272. loop=loop=5:size=10:start=0
  9273. @end example
  9274. @end itemize
  9275. @section lut1d
  9276. Apply a 1D LUT to an input video.
  9277. The filter accepts the following options:
  9278. @table @option
  9279. @item file
  9280. Set the 1D LUT file name.
  9281. Currently supported formats:
  9282. @table @samp
  9283. @item cube
  9284. Iridas
  9285. @item csp
  9286. cineSpace
  9287. @end table
  9288. @item interp
  9289. Select interpolation mode.
  9290. Available values are:
  9291. @table @samp
  9292. @item nearest
  9293. Use values from the nearest defined point.
  9294. @item linear
  9295. Interpolate values using the linear interpolation.
  9296. @item cosine
  9297. Interpolate values using the cosine interpolation.
  9298. @item cubic
  9299. Interpolate values using the cubic interpolation.
  9300. @item spline
  9301. Interpolate values using the spline interpolation.
  9302. @end table
  9303. @end table
  9304. @anchor{lut3d}
  9305. @section lut3d
  9306. Apply a 3D LUT to an input video.
  9307. The filter accepts the following options:
  9308. @table @option
  9309. @item file
  9310. Set the 3D LUT file name.
  9311. Currently supported formats:
  9312. @table @samp
  9313. @item 3dl
  9314. AfterEffects
  9315. @item cube
  9316. Iridas
  9317. @item dat
  9318. DaVinci
  9319. @item m3d
  9320. Pandora
  9321. @item csp
  9322. cineSpace
  9323. @end table
  9324. @item interp
  9325. Select interpolation mode.
  9326. Available values are:
  9327. @table @samp
  9328. @item nearest
  9329. Use values from the nearest defined point.
  9330. @item trilinear
  9331. Interpolate values using the 8 points defining a cube.
  9332. @item tetrahedral
  9333. Interpolate values using a tetrahedron.
  9334. @end table
  9335. @end table
  9336. @section lumakey
  9337. Turn certain luma values into transparency.
  9338. The filter accepts the following options:
  9339. @table @option
  9340. @item threshold
  9341. Set the luma which will be used as base for transparency.
  9342. Default value is @code{0}.
  9343. @item tolerance
  9344. Set the range of luma values to be keyed out.
  9345. Default value is @code{0}.
  9346. @item softness
  9347. Set the range of softness. Default value is @code{0}.
  9348. Use this to control gradual transition from zero to full transparency.
  9349. @end table
  9350. @section lut, lutrgb, lutyuv
  9351. Compute a look-up table for binding each pixel component input value
  9352. to an output value, and apply it to the input video.
  9353. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9354. to an RGB input video.
  9355. These filters accept the following parameters:
  9356. @table @option
  9357. @item c0
  9358. set first pixel component expression
  9359. @item c1
  9360. set second pixel component expression
  9361. @item c2
  9362. set third pixel component expression
  9363. @item c3
  9364. set fourth pixel component expression, corresponds to the alpha component
  9365. @item r
  9366. set red component expression
  9367. @item g
  9368. set green component expression
  9369. @item b
  9370. set blue component expression
  9371. @item a
  9372. alpha component expression
  9373. @item y
  9374. set Y/luminance component expression
  9375. @item u
  9376. set U/Cb component expression
  9377. @item v
  9378. set V/Cr component expression
  9379. @end table
  9380. Each of them specifies the expression to use for computing the lookup table for
  9381. the corresponding pixel component values.
  9382. The exact component associated to each of the @var{c*} options depends on the
  9383. format in input.
  9384. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9385. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9386. The expressions can contain the following constants and functions:
  9387. @table @option
  9388. @item w
  9389. @item h
  9390. The input width and height.
  9391. @item val
  9392. The input value for the pixel component.
  9393. @item clipval
  9394. The input value, clipped to the @var{minval}-@var{maxval} range.
  9395. @item maxval
  9396. The maximum value for the pixel component.
  9397. @item minval
  9398. The minimum value for the pixel component.
  9399. @item negval
  9400. The negated value for the pixel component value, clipped to the
  9401. @var{minval}-@var{maxval} range; it corresponds to the expression
  9402. "maxval-clipval+minval".
  9403. @item clip(val)
  9404. The computed value in @var{val}, clipped to the
  9405. @var{minval}-@var{maxval} range.
  9406. @item gammaval(gamma)
  9407. The computed gamma correction value of the pixel component value,
  9408. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9409. expression
  9410. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9411. @end table
  9412. All expressions default to "val".
  9413. @subsection Examples
  9414. @itemize
  9415. @item
  9416. Negate input video:
  9417. @example
  9418. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9419. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9420. @end example
  9421. The above is the same as:
  9422. @example
  9423. lutrgb="r=negval:g=negval:b=negval"
  9424. lutyuv="y=negval:u=negval:v=negval"
  9425. @end example
  9426. @item
  9427. Negate luminance:
  9428. @example
  9429. lutyuv=y=negval
  9430. @end example
  9431. @item
  9432. Remove chroma components, turning the video into a graytone image:
  9433. @example
  9434. lutyuv="u=128:v=128"
  9435. @end example
  9436. @item
  9437. Apply a luma burning effect:
  9438. @example
  9439. lutyuv="y=2*val"
  9440. @end example
  9441. @item
  9442. Remove green and blue components:
  9443. @example
  9444. lutrgb="g=0:b=0"
  9445. @end example
  9446. @item
  9447. Set a constant alpha channel value on input:
  9448. @example
  9449. format=rgba,lutrgb=a="maxval-minval/2"
  9450. @end example
  9451. @item
  9452. Correct luminance gamma by a factor of 0.5:
  9453. @example
  9454. lutyuv=y=gammaval(0.5)
  9455. @end example
  9456. @item
  9457. Discard least significant bits of luma:
  9458. @example
  9459. lutyuv=y='bitand(val, 128+64+32)'
  9460. @end example
  9461. @item
  9462. Technicolor like effect:
  9463. @example
  9464. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9465. @end example
  9466. @end itemize
  9467. @section lut2, tlut2
  9468. The @code{lut2} filter takes two input streams and outputs one
  9469. stream.
  9470. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9471. from one single stream.
  9472. This filter accepts the following parameters:
  9473. @table @option
  9474. @item c0
  9475. set first pixel component expression
  9476. @item c1
  9477. set second pixel component expression
  9478. @item c2
  9479. set third pixel component expression
  9480. @item c3
  9481. set fourth pixel component expression, corresponds to the alpha component
  9482. @item d
  9483. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9484. which means bit depth is automatically picked from first input format.
  9485. @end table
  9486. Each of them specifies the expression to use for computing the lookup table for
  9487. the corresponding pixel component values.
  9488. The exact component associated to each of the @var{c*} options depends on the
  9489. format in inputs.
  9490. The expressions can contain the following constants:
  9491. @table @option
  9492. @item w
  9493. @item h
  9494. The input width and height.
  9495. @item x
  9496. The first input value for the pixel component.
  9497. @item y
  9498. The second input value for the pixel component.
  9499. @item bdx
  9500. The first input video bit depth.
  9501. @item bdy
  9502. The second input video bit depth.
  9503. @end table
  9504. All expressions default to "x".
  9505. @subsection Examples
  9506. @itemize
  9507. @item
  9508. Highlight differences between two RGB video streams:
  9509. @example
  9510. 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)'
  9511. @end example
  9512. @item
  9513. Highlight differences between two YUV video streams:
  9514. @example
  9515. 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)'
  9516. @end example
  9517. @item
  9518. Show max difference between two video streams:
  9519. @example
  9520. 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)))'
  9521. @end example
  9522. @end itemize
  9523. @section maskedclamp
  9524. Clamp the first input stream with the second input and third input stream.
  9525. Returns the value of first stream to be between second input
  9526. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9527. This filter accepts the following options:
  9528. @table @option
  9529. @item undershoot
  9530. Default value is @code{0}.
  9531. @item overshoot
  9532. Default value is @code{0}.
  9533. @item planes
  9534. Set which planes will be processed as bitmap, unprocessed planes will be
  9535. copied from first stream.
  9536. By default value 0xf, all planes will be processed.
  9537. @end table
  9538. @section maskedmerge
  9539. Merge the first input stream with the second input stream using per pixel
  9540. weights in the third input stream.
  9541. A value of 0 in the third stream pixel component means that pixel component
  9542. from first stream is returned unchanged, while maximum value (eg. 255 for
  9543. 8-bit videos) means that pixel component from second stream is returned
  9544. unchanged. Intermediate values define the amount of merging between both
  9545. input stream's pixel components.
  9546. This filter accepts the following options:
  9547. @table @option
  9548. @item planes
  9549. Set which planes will be processed as bitmap, unprocessed planes will be
  9550. copied from first stream.
  9551. By default value 0xf, all planes will be processed.
  9552. @end table
  9553. @section maskfun
  9554. Create mask from input video.
  9555. For example it is useful to create motion masks after @code{tblend} filter.
  9556. This filter accepts the following options:
  9557. @table @option
  9558. @item low
  9559. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9560. @item high
  9561. Set high threshold. Any pixel component higher than this value will be set to max value
  9562. allowed for current pixel format.
  9563. @item planes
  9564. Set planes to filter, by default all available planes are filtered.
  9565. @item fill
  9566. Fill all frame pixels with this value.
  9567. @item sum
  9568. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9569. average, output frame will be completely filled with value set by @var{fill} option.
  9570. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9571. @end table
  9572. @section mcdeint
  9573. Apply motion-compensation deinterlacing.
  9574. It needs one field per frame as input and must thus be used together
  9575. with yadif=1/3 or equivalent.
  9576. This filter accepts the following options:
  9577. @table @option
  9578. @item mode
  9579. Set the deinterlacing mode.
  9580. It accepts one of the following values:
  9581. @table @samp
  9582. @item fast
  9583. @item medium
  9584. @item slow
  9585. use iterative motion estimation
  9586. @item extra_slow
  9587. like @samp{slow}, but use multiple reference frames.
  9588. @end table
  9589. Default value is @samp{fast}.
  9590. @item parity
  9591. Set the picture field parity assumed for the input video. It must be
  9592. one of the following values:
  9593. @table @samp
  9594. @item 0, tff
  9595. assume top field first
  9596. @item 1, bff
  9597. assume bottom field first
  9598. @end table
  9599. Default value is @samp{bff}.
  9600. @item qp
  9601. Set per-block quantization parameter (QP) used by the internal
  9602. encoder.
  9603. Higher values should result in a smoother motion vector field but less
  9604. optimal individual vectors. Default value is 1.
  9605. @end table
  9606. @section mergeplanes
  9607. Merge color channel components from several video streams.
  9608. The filter accepts up to 4 input streams, and merge selected input
  9609. planes to the output video.
  9610. This filter accepts the following options:
  9611. @table @option
  9612. @item mapping
  9613. Set input to output plane mapping. Default is @code{0}.
  9614. The mappings is specified as a bitmap. It should be specified as a
  9615. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9616. mapping for the first plane of the output stream. 'A' sets the number of
  9617. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9618. corresponding input to use (from 0 to 3). The rest of the mappings is
  9619. similar, 'Bb' describes the mapping for the output stream second
  9620. plane, 'Cc' describes the mapping for the output stream third plane and
  9621. 'Dd' describes the mapping for the output stream fourth plane.
  9622. @item format
  9623. Set output pixel format. Default is @code{yuva444p}.
  9624. @end table
  9625. @subsection Examples
  9626. @itemize
  9627. @item
  9628. Merge three gray video streams of same width and height into single video stream:
  9629. @example
  9630. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9631. @end example
  9632. @item
  9633. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9634. @example
  9635. [a0][a1]mergeplanes=0x00010210:yuva444p
  9636. @end example
  9637. @item
  9638. Swap Y and A plane in yuva444p stream:
  9639. @example
  9640. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9641. @end example
  9642. @item
  9643. Swap U and V plane in yuv420p stream:
  9644. @example
  9645. format=yuv420p,mergeplanes=0x000201:yuv420p
  9646. @end example
  9647. @item
  9648. Cast a rgb24 clip to yuv444p:
  9649. @example
  9650. format=rgb24,mergeplanes=0x000102:yuv444p
  9651. @end example
  9652. @end itemize
  9653. @section mestimate
  9654. Estimate and export motion vectors using block matching algorithms.
  9655. Motion vectors are stored in frame side data to be used by other filters.
  9656. This filter accepts the following options:
  9657. @table @option
  9658. @item method
  9659. Specify the motion estimation method. Accepts one of the following values:
  9660. @table @samp
  9661. @item esa
  9662. Exhaustive search algorithm.
  9663. @item tss
  9664. Three step search algorithm.
  9665. @item tdls
  9666. Two dimensional logarithmic search algorithm.
  9667. @item ntss
  9668. New three step search algorithm.
  9669. @item fss
  9670. Four step search algorithm.
  9671. @item ds
  9672. Diamond search algorithm.
  9673. @item hexbs
  9674. Hexagon-based search algorithm.
  9675. @item epzs
  9676. Enhanced predictive zonal search algorithm.
  9677. @item umh
  9678. Uneven multi-hexagon search algorithm.
  9679. @end table
  9680. Default value is @samp{esa}.
  9681. @item mb_size
  9682. Macroblock size. Default @code{16}.
  9683. @item search_param
  9684. Search parameter. Default @code{7}.
  9685. @end table
  9686. @section midequalizer
  9687. Apply Midway Image Equalization effect using two video streams.
  9688. Midway Image Equalization adjusts a pair of images to have the same
  9689. histogram, while maintaining their dynamics as much as possible. It's
  9690. useful for e.g. matching exposures from a pair of stereo cameras.
  9691. This filter has two inputs and one output, which must be of same pixel format, but
  9692. may be of different sizes. The output of filter is first input adjusted with
  9693. midway histogram of both inputs.
  9694. This filter accepts the following option:
  9695. @table @option
  9696. @item planes
  9697. Set which planes to process. Default is @code{15}, which is all available planes.
  9698. @end table
  9699. @section minterpolate
  9700. Convert the video to specified frame rate using motion interpolation.
  9701. This filter accepts the following options:
  9702. @table @option
  9703. @item fps
  9704. 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}.
  9705. @item mi_mode
  9706. Motion interpolation mode. Following values are accepted:
  9707. @table @samp
  9708. @item dup
  9709. Duplicate previous or next frame for interpolating new ones.
  9710. @item blend
  9711. Blend source frames. Interpolated frame is mean of previous and next frames.
  9712. @item mci
  9713. Motion compensated interpolation. Following options are effective when this mode is selected:
  9714. @table @samp
  9715. @item mc_mode
  9716. Motion compensation mode. Following values are accepted:
  9717. @table @samp
  9718. @item obmc
  9719. Overlapped block motion compensation.
  9720. @item aobmc
  9721. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9722. @end table
  9723. Default mode is @samp{obmc}.
  9724. @item me_mode
  9725. Motion estimation mode. Following values are accepted:
  9726. @table @samp
  9727. @item bidir
  9728. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9729. @item bilat
  9730. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9731. @end table
  9732. Default mode is @samp{bilat}.
  9733. @item me
  9734. The algorithm to be used for motion estimation. Following values are accepted:
  9735. @table @samp
  9736. @item esa
  9737. Exhaustive search algorithm.
  9738. @item tss
  9739. Three step search algorithm.
  9740. @item tdls
  9741. Two dimensional logarithmic search algorithm.
  9742. @item ntss
  9743. New three step search algorithm.
  9744. @item fss
  9745. Four step search algorithm.
  9746. @item ds
  9747. Diamond search algorithm.
  9748. @item hexbs
  9749. Hexagon-based search algorithm.
  9750. @item epzs
  9751. Enhanced predictive zonal search algorithm.
  9752. @item umh
  9753. Uneven multi-hexagon search algorithm.
  9754. @end table
  9755. Default algorithm is @samp{epzs}.
  9756. @item mb_size
  9757. Macroblock size. Default @code{16}.
  9758. @item search_param
  9759. Motion estimation search parameter. Default @code{32}.
  9760. @item vsbmc
  9761. 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).
  9762. @end table
  9763. @end table
  9764. @item scd
  9765. 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:
  9766. @table @samp
  9767. @item none
  9768. Disable scene change detection.
  9769. @item fdiff
  9770. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9771. @end table
  9772. Default method is @samp{fdiff}.
  9773. @item scd_threshold
  9774. Scene change detection threshold. Default is @code{5.0}.
  9775. @end table
  9776. @section mix
  9777. Mix several video input streams into one video stream.
  9778. A description of the accepted options follows.
  9779. @table @option
  9780. @item nb_inputs
  9781. The number of inputs. If unspecified, it defaults to 2.
  9782. @item weights
  9783. Specify weight of each input video stream as sequence.
  9784. Each weight is separated by space. If number of weights
  9785. is smaller than number of @var{frames} last specified
  9786. weight will be used for all remaining unset weights.
  9787. @item scale
  9788. Specify scale, if it is set it will be multiplied with sum
  9789. of each weight multiplied with pixel values to give final destination
  9790. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9791. @item duration
  9792. Specify how end of stream is determined.
  9793. @table @samp
  9794. @item longest
  9795. The duration of the longest input. (default)
  9796. @item shortest
  9797. The duration of the shortest input.
  9798. @item first
  9799. The duration of the first input.
  9800. @end table
  9801. @end table
  9802. @section mpdecimate
  9803. Drop frames that do not differ greatly from the previous frame in
  9804. order to reduce frame rate.
  9805. The main use of this filter is for very-low-bitrate encoding
  9806. (e.g. streaming over dialup modem), but it could in theory be used for
  9807. fixing movies that were inverse-telecined incorrectly.
  9808. A description of the accepted options follows.
  9809. @table @option
  9810. @item max
  9811. Set the maximum number of consecutive frames which can be dropped (if
  9812. positive), or the minimum interval between dropped frames (if
  9813. negative). If the value is 0, the frame is dropped disregarding the
  9814. number of previous sequentially dropped frames.
  9815. Default value is 0.
  9816. @item hi
  9817. @item lo
  9818. @item frac
  9819. Set the dropping threshold values.
  9820. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9821. represent actual pixel value differences, so a threshold of 64
  9822. corresponds to 1 unit of difference for each pixel, or the same spread
  9823. out differently over the block.
  9824. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9825. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9826. meaning the whole image) differ by more than a threshold of @option{lo}.
  9827. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9828. 64*5, and default value for @option{frac} is 0.33.
  9829. @end table
  9830. @section negate
  9831. Negate (invert) the input video.
  9832. It accepts the following option:
  9833. @table @option
  9834. @item negate_alpha
  9835. With value 1, it negates the alpha component, if present. Default value is 0.
  9836. @end table
  9837. @anchor{nlmeans}
  9838. @section nlmeans
  9839. Denoise frames using Non-Local Means algorithm.
  9840. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9841. context similarity is defined by comparing their surrounding patches of size
  9842. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9843. around the pixel.
  9844. Note that the research area defines centers for patches, which means some
  9845. patches will be made of pixels outside that research area.
  9846. The filter accepts the following options.
  9847. @table @option
  9848. @item s
  9849. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9850. @item p
  9851. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9852. @item pc
  9853. Same as @option{p} but for chroma planes.
  9854. The default value is @var{0} and means automatic.
  9855. @item r
  9856. Set research size. Default is 15. Must be odd number in range [0, 99].
  9857. @item rc
  9858. Same as @option{r} but for chroma planes.
  9859. The default value is @var{0} and means automatic.
  9860. @end table
  9861. @section nnedi
  9862. Deinterlace video using neural network edge directed interpolation.
  9863. This filter accepts the following options:
  9864. @table @option
  9865. @item weights
  9866. Mandatory option, without binary file filter can not work.
  9867. Currently file can be found here:
  9868. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9869. @item deint
  9870. Set which frames to deinterlace, by default it is @code{all}.
  9871. Can be @code{all} or @code{interlaced}.
  9872. @item field
  9873. Set mode of operation.
  9874. Can be one of the following:
  9875. @table @samp
  9876. @item af
  9877. Use frame flags, both fields.
  9878. @item a
  9879. Use frame flags, single field.
  9880. @item t
  9881. Use top field only.
  9882. @item b
  9883. Use bottom field only.
  9884. @item tf
  9885. Use both fields, top first.
  9886. @item bf
  9887. Use both fields, bottom first.
  9888. @end table
  9889. @item planes
  9890. Set which planes to process, by default filter process all frames.
  9891. @item nsize
  9892. Set size of local neighborhood around each pixel, used by the predictor neural
  9893. network.
  9894. Can be one of the following:
  9895. @table @samp
  9896. @item s8x6
  9897. @item s16x6
  9898. @item s32x6
  9899. @item s48x6
  9900. @item s8x4
  9901. @item s16x4
  9902. @item s32x4
  9903. @end table
  9904. @item nns
  9905. Set the number of neurons in predictor neural network.
  9906. Can be one of the following:
  9907. @table @samp
  9908. @item n16
  9909. @item n32
  9910. @item n64
  9911. @item n128
  9912. @item n256
  9913. @end table
  9914. @item qual
  9915. Controls the number of different neural network predictions that are blended
  9916. together to compute the final output value. Can be @code{fast}, default or
  9917. @code{slow}.
  9918. @item etype
  9919. Set which set of weights to use in the predictor.
  9920. Can be one of the following:
  9921. @table @samp
  9922. @item a
  9923. weights trained to minimize absolute error
  9924. @item s
  9925. weights trained to minimize squared error
  9926. @end table
  9927. @item pscrn
  9928. Controls whether or not the prescreener neural network is used to decide
  9929. which pixels should be processed by the predictor neural network and which
  9930. can be handled by simple cubic interpolation.
  9931. The prescreener is trained to know whether cubic interpolation will be
  9932. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9933. The computational complexity of the prescreener nn is much less than that of
  9934. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9935. using the prescreener generally results in much faster processing.
  9936. The prescreener is pretty accurate, so the difference between using it and not
  9937. using it is almost always unnoticeable.
  9938. Can be one of the following:
  9939. @table @samp
  9940. @item none
  9941. @item original
  9942. @item new
  9943. @end table
  9944. Default is @code{new}.
  9945. @item fapprox
  9946. Set various debugging flags.
  9947. @end table
  9948. @section noformat
  9949. Force libavfilter not to use any of the specified pixel formats for the
  9950. input to the next filter.
  9951. It accepts the following parameters:
  9952. @table @option
  9953. @item pix_fmts
  9954. A '|'-separated list of pixel format names, such as
  9955. pix_fmts=yuv420p|monow|rgb24".
  9956. @end table
  9957. @subsection Examples
  9958. @itemize
  9959. @item
  9960. Force libavfilter to use a format different from @var{yuv420p} for the
  9961. input to the vflip filter:
  9962. @example
  9963. noformat=pix_fmts=yuv420p,vflip
  9964. @end example
  9965. @item
  9966. Convert the input video to any of the formats not contained in the list:
  9967. @example
  9968. noformat=yuv420p|yuv444p|yuv410p
  9969. @end example
  9970. @end itemize
  9971. @section noise
  9972. Add noise on video input frame.
  9973. The filter accepts the following options:
  9974. @table @option
  9975. @item all_seed
  9976. @item c0_seed
  9977. @item c1_seed
  9978. @item c2_seed
  9979. @item c3_seed
  9980. Set noise seed for specific pixel component or all pixel components in case
  9981. of @var{all_seed}. Default value is @code{123457}.
  9982. @item all_strength, alls
  9983. @item c0_strength, c0s
  9984. @item c1_strength, c1s
  9985. @item c2_strength, c2s
  9986. @item c3_strength, c3s
  9987. Set noise strength for specific pixel component or all pixel components in case
  9988. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9989. @item all_flags, allf
  9990. @item c0_flags, c0f
  9991. @item c1_flags, c1f
  9992. @item c2_flags, c2f
  9993. @item c3_flags, c3f
  9994. Set pixel component flags or set flags for all components if @var{all_flags}.
  9995. Available values for component flags are:
  9996. @table @samp
  9997. @item a
  9998. averaged temporal noise (smoother)
  9999. @item p
  10000. mix random noise with a (semi)regular pattern
  10001. @item t
  10002. temporal noise (noise pattern changes between frames)
  10003. @item u
  10004. uniform noise (gaussian otherwise)
  10005. @end table
  10006. @end table
  10007. @subsection Examples
  10008. Add temporal and uniform noise to input video:
  10009. @example
  10010. noise=alls=20:allf=t+u
  10011. @end example
  10012. @section normalize
  10013. Normalize RGB video (aka histogram stretching, contrast stretching).
  10014. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  10015. For each channel of each frame, the filter computes the input range and maps
  10016. it linearly to the user-specified output range. The output range defaults
  10017. to the full dynamic range from pure black to pure white.
  10018. Temporal smoothing can be used on the input range to reduce flickering (rapid
  10019. changes in brightness) caused when small dark or bright objects enter or leave
  10020. the scene. This is similar to the auto-exposure (automatic gain control) on a
  10021. video camera, and, like a video camera, it may cause a period of over- or
  10022. under-exposure of the video.
  10023. The R,G,B channels can be normalized independently, which may cause some
  10024. color shifting, or linked together as a single channel, which prevents
  10025. color shifting. Linked normalization preserves hue. Independent normalization
  10026. does not, so it can be used to remove some color casts. Independent and linked
  10027. normalization can be combined in any ratio.
  10028. The normalize filter accepts the following options:
  10029. @table @option
  10030. @item blackpt
  10031. @item whitept
  10032. Colors which define the output range. The minimum input value is mapped to
  10033. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  10034. The defaults are black and white respectively. Specifying white for
  10035. @var{blackpt} and black for @var{whitept} will give color-inverted,
  10036. normalized video. Shades of grey can be used to reduce the dynamic range
  10037. (contrast). Specifying saturated colors here can create some interesting
  10038. effects.
  10039. @item smoothing
  10040. The number of previous frames to use for temporal smoothing. The input range
  10041. of each channel is smoothed using a rolling average over the current frame
  10042. and the @var{smoothing} previous frames. The default is 0 (no temporal
  10043. smoothing).
  10044. @item independence
  10045. Controls the ratio of independent (color shifting) channel normalization to
  10046. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  10047. independent. Defaults to 1.0 (fully independent).
  10048. @item strength
  10049. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  10050. expensive no-op. Defaults to 1.0 (full strength).
  10051. @end table
  10052. @subsection Examples
  10053. Stretch video contrast to use the full dynamic range, with no temporal
  10054. smoothing; may flicker depending on the source content:
  10055. @example
  10056. normalize=blackpt=black:whitept=white:smoothing=0
  10057. @end example
  10058. As above, but with 50 frames of temporal smoothing; flicker should be
  10059. reduced, depending on the source content:
  10060. @example
  10061. normalize=blackpt=black:whitept=white:smoothing=50
  10062. @end example
  10063. As above, but with hue-preserving linked channel normalization:
  10064. @example
  10065. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  10066. @end example
  10067. As above, but with half strength:
  10068. @example
  10069. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  10070. @end example
  10071. Map the darkest input color to red, the brightest input color to cyan:
  10072. @example
  10073. normalize=blackpt=red:whitept=cyan
  10074. @end example
  10075. @section null
  10076. Pass the video source unchanged to the output.
  10077. @section ocr
  10078. Optical Character Recognition
  10079. This filter uses Tesseract for optical character recognition. To enable
  10080. compilation of this filter, you need to configure FFmpeg with
  10081. @code{--enable-libtesseract}.
  10082. It accepts the following options:
  10083. @table @option
  10084. @item datapath
  10085. Set datapath to tesseract data. Default is to use whatever was
  10086. set at installation.
  10087. @item language
  10088. Set language, default is "eng".
  10089. @item whitelist
  10090. Set character whitelist.
  10091. @item blacklist
  10092. Set character blacklist.
  10093. @end table
  10094. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  10095. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  10096. @section ocv
  10097. Apply a video transform using libopencv.
  10098. To enable this filter, install the libopencv library and headers and
  10099. configure FFmpeg with @code{--enable-libopencv}.
  10100. It accepts the following parameters:
  10101. @table @option
  10102. @item filter_name
  10103. The name of the libopencv filter to apply.
  10104. @item filter_params
  10105. The parameters to pass to the libopencv filter. If not specified, the default
  10106. values are assumed.
  10107. @end table
  10108. Refer to the official libopencv documentation for more precise
  10109. information:
  10110. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  10111. Several libopencv filters are supported; see the following subsections.
  10112. @anchor{dilate}
  10113. @subsection dilate
  10114. Dilate an image by using a specific structuring element.
  10115. It corresponds to the libopencv function @code{cvDilate}.
  10116. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  10117. @var{struct_el} represents a structuring element, and has the syntax:
  10118. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  10119. @var{cols} and @var{rows} represent the number of columns and rows of
  10120. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  10121. point, and @var{shape} the shape for the structuring element. @var{shape}
  10122. must be "rect", "cross", "ellipse", or "custom".
  10123. If the value for @var{shape} is "custom", it must be followed by a
  10124. string of the form "=@var{filename}". The file with name
  10125. @var{filename} is assumed to represent a binary image, with each
  10126. printable character corresponding to a bright pixel. When a custom
  10127. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  10128. or columns and rows of the read file are assumed instead.
  10129. The default value for @var{struct_el} is "3x3+0x0/rect".
  10130. @var{nb_iterations} specifies the number of times the transform is
  10131. applied to the image, and defaults to 1.
  10132. Some examples:
  10133. @example
  10134. # Use the default values
  10135. ocv=dilate
  10136. # Dilate using a structuring element with a 5x5 cross, iterating two times
  10137. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  10138. # Read the shape from the file diamond.shape, iterating two times.
  10139. # The file diamond.shape may contain a pattern of characters like this
  10140. # *
  10141. # ***
  10142. # *****
  10143. # ***
  10144. # *
  10145. # The specified columns and rows are ignored
  10146. # but the anchor point coordinates are not
  10147. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  10148. @end example
  10149. @subsection erode
  10150. Erode an image by using a specific structuring element.
  10151. It corresponds to the libopencv function @code{cvErode}.
  10152. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  10153. with the same syntax and semantics as the @ref{dilate} filter.
  10154. @subsection smooth
  10155. Smooth the input video.
  10156. The filter takes the following parameters:
  10157. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  10158. @var{type} is the type of smooth filter to apply, and must be one of
  10159. the following values: "blur", "blur_no_scale", "median", "gaussian",
  10160. or "bilateral". The default value is "gaussian".
  10161. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  10162. depends on the smooth type. @var{param1} and
  10163. @var{param2} accept integer positive values or 0. @var{param3} and
  10164. @var{param4} accept floating point values.
  10165. The default value for @var{param1} is 3. The default value for the
  10166. other parameters is 0.
  10167. These parameters correspond to the parameters assigned to the
  10168. libopencv function @code{cvSmooth}.
  10169. @section oscilloscope
  10170. 2D Video Oscilloscope.
  10171. Useful to measure spatial impulse, step responses, chroma delays, etc.
  10172. It accepts the following parameters:
  10173. @table @option
  10174. @item x
  10175. Set scope center x position.
  10176. @item y
  10177. Set scope center y position.
  10178. @item s
  10179. Set scope size, relative to frame diagonal.
  10180. @item t
  10181. Set scope tilt/rotation.
  10182. @item o
  10183. Set trace opacity.
  10184. @item tx
  10185. Set trace center x position.
  10186. @item ty
  10187. Set trace center y position.
  10188. @item tw
  10189. Set trace width, relative to width of frame.
  10190. @item th
  10191. Set trace height, relative to height of frame.
  10192. @item c
  10193. Set which components to trace. By default it traces first three components.
  10194. @item g
  10195. Draw trace grid. By default is enabled.
  10196. @item st
  10197. Draw some statistics. By default is enabled.
  10198. @item sc
  10199. Draw scope. By default is enabled.
  10200. @end table
  10201. @subsection Examples
  10202. @itemize
  10203. @item
  10204. Inspect full first row of video frame.
  10205. @example
  10206. oscilloscope=x=0.5:y=0:s=1
  10207. @end example
  10208. @item
  10209. Inspect full last row of video frame.
  10210. @example
  10211. oscilloscope=x=0.5:y=1:s=1
  10212. @end example
  10213. @item
  10214. Inspect full 5th line of video frame of height 1080.
  10215. @example
  10216. oscilloscope=x=0.5:y=5/1080:s=1
  10217. @end example
  10218. @item
  10219. Inspect full last column of video frame.
  10220. @example
  10221. oscilloscope=x=1:y=0.5:s=1:t=1
  10222. @end example
  10223. @end itemize
  10224. @anchor{overlay}
  10225. @section overlay
  10226. Overlay one video on top of another.
  10227. It takes two inputs and has one output. The first input is the "main"
  10228. video on which the second input is overlaid.
  10229. It accepts the following parameters:
  10230. A description of the accepted options follows.
  10231. @table @option
  10232. @item x
  10233. @item y
  10234. Set the expression for the x and y coordinates of the overlaid video
  10235. on the main video. Default value is "0" for both expressions. In case
  10236. the expression is invalid, it is set to a huge value (meaning that the
  10237. overlay will not be displayed within the output visible area).
  10238. @item eof_action
  10239. See @ref{framesync}.
  10240. @item eval
  10241. Set when the expressions for @option{x}, and @option{y} are evaluated.
  10242. It accepts the following values:
  10243. @table @samp
  10244. @item init
  10245. only evaluate expressions once during the filter initialization or
  10246. when a command is processed
  10247. @item frame
  10248. evaluate expressions for each incoming frame
  10249. @end table
  10250. Default value is @samp{frame}.
  10251. @item shortest
  10252. See @ref{framesync}.
  10253. @item format
  10254. Set the format for the output video.
  10255. It accepts the following values:
  10256. @table @samp
  10257. @item yuv420
  10258. force YUV420 output
  10259. @item yuv422
  10260. force YUV422 output
  10261. @item yuv444
  10262. force YUV444 output
  10263. @item rgb
  10264. force packed RGB output
  10265. @item gbrp
  10266. force planar RGB output
  10267. @item auto
  10268. automatically pick format
  10269. @end table
  10270. Default value is @samp{yuv420}.
  10271. @item repeatlast
  10272. See @ref{framesync}.
  10273. @item alpha
  10274. Set format of alpha of the overlaid video, it can be @var{straight} or
  10275. @var{premultiplied}. Default is @var{straight}.
  10276. @end table
  10277. The @option{x}, and @option{y} expressions can contain the following
  10278. parameters.
  10279. @table @option
  10280. @item main_w, W
  10281. @item main_h, H
  10282. The main input width and height.
  10283. @item overlay_w, w
  10284. @item overlay_h, h
  10285. The overlay input width and height.
  10286. @item x
  10287. @item y
  10288. The computed values for @var{x} and @var{y}. They are evaluated for
  10289. each new frame.
  10290. @item hsub
  10291. @item vsub
  10292. horizontal and vertical chroma subsample values of the output
  10293. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  10294. @var{vsub} is 1.
  10295. @item n
  10296. the number of input frame, starting from 0
  10297. @item pos
  10298. the position in the file of the input frame, NAN if unknown
  10299. @item t
  10300. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  10301. @end table
  10302. This filter also supports the @ref{framesync} options.
  10303. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  10304. when evaluation is done @emph{per frame}, and will evaluate to NAN
  10305. when @option{eval} is set to @samp{init}.
  10306. Be aware that frames are taken from each input video in timestamp
  10307. order, hence, if their initial timestamps differ, it is a good idea
  10308. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  10309. have them begin in the same zero timestamp, as the example for
  10310. the @var{movie} filter does.
  10311. You can chain together more overlays but you should test the
  10312. efficiency of such approach.
  10313. @subsection Commands
  10314. This filter supports the following commands:
  10315. @table @option
  10316. @item x
  10317. @item y
  10318. Modify the x and y of the overlay input.
  10319. The command accepts the same syntax of the corresponding option.
  10320. If the specified expression is not valid, it is kept at its current
  10321. value.
  10322. @end table
  10323. @subsection Examples
  10324. @itemize
  10325. @item
  10326. Draw the overlay at 10 pixels from the bottom right corner of the main
  10327. video:
  10328. @example
  10329. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10330. @end example
  10331. Using named options the example above becomes:
  10332. @example
  10333. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10334. @end example
  10335. @item
  10336. Insert a transparent PNG logo in the bottom left corner of the input,
  10337. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10338. @example
  10339. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10340. @end example
  10341. @item
  10342. Insert 2 different transparent PNG logos (second logo on bottom
  10343. right corner) using the @command{ffmpeg} tool:
  10344. @example
  10345. 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
  10346. @end example
  10347. @item
  10348. Add a transparent color layer on top of the main video; @code{WxH}
  10349. must specify the size of the main input to the overlay filter:
  10350. @example
  10351. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10352. @end example
  10353. @item
  10354. Play an original video and a filtered version (here with the deshake
  10355. filter) side by side using the @command{ffplay} tool:
  10356. @example
  10357. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10358. @end example
  10359. The above command is the same as:
  10360. @example
  10361. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10362. @end example
  10363. @item
  10364. Make a sliding overlay appearing from the left to the right top part of the
  10365. screen starting since time 2:
  10366. @example
  10367. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10368. @end example
  10369. @item
  10370. Compose output by putting two input videos side to side:
  10371. @example
  10372. ffmpeg -i left.avi -i right.avi -filter_complex "
  10373. nullsrc=size=200x100 [background];
  10374. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10375. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10376. [background][left] overlay=shortest=1 [background+left];
  10377. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10378. "
  10379. @end example
  10380. @item
  10381. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10382. @example
  10383. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10384. -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]'
  10385. masked.avi
  10386. @end example
  10387. @item
  10388. Chain several overlays in cascade:
  10389. @example
  10390. nullsrc=s=200x200 [bg];
  10391. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10392. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10393. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10394. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10395. [in3] null, [mid2] overlay=100:100 [out0]
  10396. @end example
  10397. @end itemize
  10398. @section owdenoise
  10399. Apply Overcomplete Wavelet denoiser.
  10400. The filter accepts the following options:
  10401. @table @option
  10402. @item depth
  10403. Set depth.
  10404. Larger depth values will denoise lower frequency components more, but
  10405. slow down filtering.
  10406. Must be an int in the range 8-16, default is @code{8}.
  10407. @item luma_strength, ls
  10408. Set luma strength.
  10409. Must be a double value in the range 0-1000, default is @code{1.0}.
  10410. @item chroma_strength, cs
  10411. Set chroma strength.
  10412. Must be a double value in the range 0-1000, default is @code{1.0}.
  10413. @end table
  10414. @anchor{pad}
  10415. @section pad
  10416. Add paddings to the input image, and place the original input at the
  10417. provided @var{x}, @var{y} coordinates.
  10418. It accepts the following parameters:
  10419. @table @option
  10420. @item width, w
  10421. @item height, h
  10422. Specify an expression for the size of the output image with the
  10423. paddings added. If the value for @var{width} or @var{height} is 0, the
  10424. corresponding input size is used for the output.
  10425. The @var{width} expression can reference the value set by the
  10426. @var{height} expression, and vice versa.
  10427. The default value of @var{width} and @var{height} is 0.
  10428. @item x
  10429. @item y
  10430. Specify the offsets to place the input image at within the padded area,
  10431. with respect to the top/left border of the output image.
  10432. The @var{x} expression can reference the value set by the @var{y}
  10433. expression, and vice versa.
  10434. The default value of @var{x} and @var{y} is 0.
  10435. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10436. so the input image is centered on the padded area.
  10437. @item color
  10438. Specify the color of the padded area. For the syntax of this option,
  10439. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10440. manual,ffmpeg-utils}.
  10441. The default value of @var{color} is "black".
  10442. @item eval
  10443. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10444. It accepts the following values:
  10445. @table @samp
  10446. @item init
  10447. Only evaluate expressions once during the filter initialization or when
  10448. a command is processed.
  10449. @item frame
  10450. Evaluate expressions for each incoming frame.
  10451. @end table
  10452. Default value is @samp{init}.
  10453. @item aspect
  10454. Pad to aspect instead to a resolution.
  10455. @end table
  10456. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10457. options are expressions containing the following constants:
  10458. @table @option
  10459. @item in_w
  10460. @item in_h
  10461. The input video width and height.
  10462. @item iw
  10463. @item ih
  10464. These are the same as @var{in_w} and @var{in_h}.
  10465. @item out_w
  10466. @item out_h
  10467. The output width and height (the size of the padded area), as
  10468. specified by the @var{width} and @var{height} expressions.
  10469. @item ow
  10470. @item oh
  10471. These are the same as @var{out_w} and @var{out_h}.
  10472. @item x
  10473. @item y
  10474. The x and y offsets as specified by the @var{x} and @var{y}
  10475. expressions, or NAN if not yet specified.
  10476. @item a
  10477. same as @var{iw} / @var{ih}
  10478. @item sar
  10479. input sample aspect ratio
  10480. @item dar
  10481. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10482. @item hsub
  10483. @item vsub
  10484. The horizontal and vertical chroma subsample values. For example for the
  10485. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10486. @end table
  10487. @subsection Examples
  10488. @itemize
  10489. @item
  10490. Add paddings with the color "violet" to the input video. The output video
  10491. size is 640x480, and the top-left corner of the input video is placed at
  10492. column 0, row 40
  10493. @example
  10494. pad=640:480:0:40:violet
  10495. @end example
  10496. The example above is equivalent to the following command:
  10497. @example
  10498. pad=width=640:height=480:x=0:y=40:color=violet
  10499. @end example
  10500. @item
  10501. Pad the input to get an output with dimensions increased by 3/2,
  10502. and put the input video at the center of the padded area:
  10503. @example
  10504. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10505. @end example
  10506. @item
  10507. Pad the input to get a squared output with size equal to the maximum
  10508. value between the input width and height, and put the input video at
  10509. the center of the padded area:
  10510. @example
  10511. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10512. @end example
  10513. @item
  10514. Pad the input to get a final w/h ratio of 16:9:
  10515. @example
  10516. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10517. @end example
  10518. @item
  10519. In case of anamorphic video, in order to set the output display aspect
  10520. correctly, it is necessary to use @var{sar} in the expression,
  10521. according to the relation:
  10522. @example
  10523. (ih * X / ih) * sar = output_dar
  10524. X = output_dar / sar
  10525. @end example
  10526. Thus the previous example needs to be modified to:
  10527. @example
  10528. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10529. @end example
  10530. @item
  10531. Double the output size and put the input video in the bottom-right
  10532. corner of the output padded area:
  10533. @example
  10534. pad="2*iw:2*ih:ow-iw:oh-ih"
  10535. @end example
  10536. @end itemize
  10537. @anchor{palettegen}
  10538. @section palettegen
  10539. Generate one palette for a whole video stream.
  10540. It accepts the following options:
  10541. @table @option
  10542. @item max_colors
  10543. Set the maximum number of colors to quantize in the palette.
  10544. Note: the palette will still contain 256 colors; the unused palette entries
  10545. will be black.
  10546. @item reserve_transparent
  10547. Create a palette of 255 colors maximum and reserve the last one for
  10548. transparency. Reserving the transparency color is useful for GIF optimization.
  10549. If not set, the maximum of colors in the palette will be 256. You probably want
  10550. to disable this option for a standalone image.
  10551. Set by default.
  10552. @item transparency_color
  10553. Set the color that will be used as background for transparency.
  10554. @item stats_mode
  10555. Set statistics mode.
  10556. It accepts the following values:
  10557. @table @samp
  10558. @item full
  10559. Compute full frame histograms.
  10560. @item diff
  10561. Compute histograms only for the part that differs from previous frame. This
  10562. might be relevant to give more importance to the moving part of your input if
  10563. the background is static.
  10564. @item single
  10565. Compute new histogram for each frame.
  10566. @end table
  10567. Default value is @var{full}.
  10568. @end table
  10569. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10570. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10571. color quantization of the palette. This information is also visible at
  10572. @var{info} logging level.
  10573. @subsection Examples
  10574. @itemize
  10575. @item
  10576. Generate a representative palette of a given video using @command{ffmpeg}:
  10577. @example
  10578. ffmpeg -i input.mkv -vf palettegen palette.png
  10579. @end example
  10580. @end itemize
  10581. @section paletteuse
  10582. Use a palette to downsample an input video stream.
  10583. The filter takes two inputs: one video stream and a palette. The palette must
  10584. be a 256 pixels image.
  10585. It accepts the following options:
  10586. @table @option
  10587. @item dither
  10588. Select dithering mode. Available algorithms are:
  10589. @table @samp
  10590. @item bayer
  10591. Ordered 8x8 bayer dithering (deterministic)
  10592. @item heckbert
  10593. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10594. Note: this dithering is sometimes considered "wrong" and is included as a
  10595. reference.
  10596. @item floyd_steinberg
  10597. Floyd and Steingberg dithering (error diffusion)
  10598. @item sierra2
  10599. Frankie Sierra dithering v2 (error diffusion)
  10600. @item sierra2_4a
  10601. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10602. @end table
  10603. Default is @var{sierra2_4a}.
  10604. @item bayer_scale
  10605. When @var{bayer} dithering is selected, this option defines the scale of the
  10606. pattern (how much the crosshatch pattern is visible). A low value means more
  10607. visible pattern for less banding, and higher value means less visible pattern
  10608. at the cost of more banding.
  10609. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10610. @item diff_mode
  10611. If set, define the zone to process
  10612. @table @samp
  10613. @item rectangle
  10614. Only the changing rectangle will be reprocessed. This is similar to GIF
  10615. cropping/offsetting compression mechanism. This option can be useful for speed
  10616. if only a part of the image is changing, and has use cases such as limiting the
  10617. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10618. moving scene (it leads to more deterministic output if the scene doesn't change
  10619. much, and as a result less moving noise and better GIF compression).
  10620. @end table
  10621. Default is @var{none}.
  10622. @item new
  10623. Take new palette for each output frame.
  10624. @item alpha_threshold
  10625. Sets the alpha threshold for transparency. Alpha values above this threshold
  10626. will be treated as completely opaque, and values below this threshold will be
  10627. treated as completely transparent.
  10628. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10629. @end table
  10630. @subsection Examples
  10631. @itemize
  10632. @item
  10633. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10634. using @command{ffmpeg}:
  10635. @example
  10636. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10637. @end example
  10638. @end itemize
  10639. @section perspective
  10640. Correct perspective of video not recorded perpendicular to the screen.
  10641. A description of the accepted parameters follows.
  10642. @table @option
  10643. @item x0
  10644. @item y0
  10645. @item x1
  10646. @item y1
  10647. @item x2
  10648. @item y2
  10649. @item x3
  10650. @item y3
  10651. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10652. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10653. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10654. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10655. then the corners of the source will be sent to the specified coordinates.
  10656. The expressions can use the following variables:
  10657. @table @option
  10658. @item W
  10659. @item H
  10660. the width and height of video frame.
  10661. @item in
  10662. Input frame count.
  10663. @item on
  10664. Output frame count.
  10665. @end table
  10666. @item interpolation
  10667. Set interpolation for perspective correction.
  10668. It accepts the following values:
  10669. @table @samp
  10670. @item linear
  10671. @item cubic
  10672. @end table
  10673. Default value is @samp{linear}.
  10674. @item sense
  10675. Set interpretation of coordinate options.
  10676. It accepts the following values:
  10677. @table @samp
  10678. @item 0, source
  10679. Send point in the source specified by the given coordinates to
  10680. the corners of the destination.
  10681. @item 1, destination
  10682. Send the corners of the source to the point in the destination specified
  10683. by the given coordinates.
  10684. Default value is @samp{source}.
  10685. @end table
  10686. @item eval
  10687. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10688. It accepts the following values:
  10689. @table @samp
  10690. @item init
  10691. only evaluate expressions once during the filter initialization or
  10692. when a command is processed
  10693. @item frame
  10694. evaluate expressions for each incoming frame
  10695. @end table
  10696. Default value is @samp{init}.
  10697. @end table
  10698. @section phase
  10699. Delay interlaced video by one field time so that the field order changes.
  10700. The intended use is to fix PAL movies that have been captured with the
  10701. opposite field order to the film-to-video transfer.
  10702. A description of the accepted parameters follows.
  10703. @table @option
  10704. @item mode
  10705. Set phase mode.
  10706. It accepts the following values:
  10707. @table @samp
  10708. @item t
  10709. Capture field order top-first, transfer bottom-first.
  10710. Filter will delay the bottom field.
  10711. @item b
  10712. Capture field order bottom-first, transfer top-first.
  10713. Filter will delay the top field.
  10714. @item p
  10715. Capture and transfer with the same field order. This mode only exists
  10716. for the documentation of the other options to refer to, but if you
  10717. actually select it, the filter will faithfully do nothing.
  10718. @item a
  10719. Capture field order determined automatically by field flags, transfer
  10720. opposite.
  10721. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10722. basis using field flags. If no field information is available,
  10723. then this works just like @samp{u}.
  10724. @item u
  10725. Capture unknown or varying, transfer opposite.
  10726. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10727. analyzing the images and selecting the alternative that produces best
  10728. match between the fields.
  10729. @item T
  10730. Capture top-first, transfer unknown or varying.
  10731. Filter selects among @samp{t} and @samp{p} using image analysis.
  10732. @item B
  10733. Capture bottom-first, transfer unknown or varying.
  10734. Filter selects among @samp{b} and @samp{p} using image analysis.
  10735. @item A
  10736. Capture determined by field flags, transfer unknown or varying.
  10737. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10738. image analysis. If no field information is available, then this works just
  10739. like @samp{U}. This is the default mode.
  10740. @item U
  10741. Both capture and transfer unknown or varying.
  10742. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10743. @end table
  10744. @end table
  10745. @section photosensitivity
  10746. Reduce various flashes in video, so to help users with epilepsy.
  10747. It accepts the following options:
  10748. @table @option
  10749. @item frames, f
  10750. Set how many frames to use when filtering. Default is 30.
  10751. @item threshold, t
  10752. Set detection threshold factor. Default is 1.
  10753. Lower is stricter.
  10754. @item skip
  10755. Set how many pixels to skip when sampling frames. Defalt is 1.
  10756. Allowed range is from 1 to 1024.
  10757. @item bypass
  10758. Leave frames unchanged. Default is disabled.
  10759. @end table
  10760. @section pixdesctest
  10761. Pixel format descriptor test filter, mainly useful for internal
  10762. testing. The output video should be equal to the input video.
  10763. For example:
  10764. @example
  10765. format=monow, pixdesctest
  10766. @end example
  10767. can be used to test the monowhite pixel format descriptor definition.
  10768. @section pixscope
  10769. Display sample values of color channels. Mainly useful for checking color
  10770. and levels. Minimum supported resolution is 640x480.
  10771. The filters accept the following options:
  10772. @table @option
  10773. @item x
  10774. Set scope X position, relative offset on X axis.
  10775. @item y
  10776. Set scope Y position, relative offset on Y axis.
  10777. @item w
  10778. Set scope width.
  10779. @item h
  10780. Set scope height.
  10781. @item o
  10782. Set window opacity. This window also holds statistics about pixel area.
  10783. @item wx
  10784. Set window X position, relative offset on X axis.
  10785. @item wy
  10786. Set window Y position, relative offset on Y axis.
  10787. @end table
  10788. @section pp
  10789. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10790. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10791. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10792. Each subfilter and some options have a short and a long name that can be used
  10793. interchangeably, i.e. dr/dering are the same.
  10794. The filters accept the following options:
  10795. @table @option
  10796. @item subfilters
  10797. Set postprocessing subfilters string.
  10798. @end table
  10799. All subfilters share common options to determine their scope:
  10800. @table @option
  10801. @item a/autoq
  10802. Honor the quality commands for this subfilter.
  10803. @item c/chrom
  10804. Do chrominance filtering, too (default).
  10805. @item y/nochrom
  10806. Do luminance filtering only (no chrominance).
  10807. @item n/noluma
  10808. Do chrominance filtering only (no luminance).
  10809. @end table
  10810. These options can be appended after the subfilter name, separated by a '|'.
  10811. Available subfilters are:
  10812. @table @option
  10813. @item hb/hdeblock[|difference[|flatness]]
  10814. Horizontal deblocking filter
  10815. @table @option
  10816. @item difference
  10817. Difference factor where higher values mean more deblocking (default: @code{32}).
  10818. @item flatness
  10819. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10820. @end table
  10821. @item vb/vdeblock[|difference[|flatness]]
  10822. Vertical deblocking filter
  10823. @table @option
  10824. @item difference
  10825. Difference factor where higher values mean more deblocking (default: @code{32}).
  10826. @item flatness
  10827. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10828. @end table
  10829. @item ha/hadeblock[|difference[|flatness]]
  10830. Accurate horizontal deblocking filter
  10831. @table @option
  10832. @item difference
  10833. Difference factor where higher values mean more deblocking (default: @code{32}).
  10834. @item flatness
  10835. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10836. @end table
  10837. @item va/vadeblock[|difference[|flatness]]
  10838. Accurate vertical deblocking filter
  10839. @table @option
  10840. @item difference
  10841. Difference factor where higher values mean more deblocking (default: @code{32}).
  10842. @item flatness
  10843. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10844. @end table
  10845. @end table
  10846. The horizontal and vertical deblocking filters share the difference and
  10847. flatness values so you cannot set different horizontal and vertical
  10848. thresholds.
  10849. @table @option
  10850. @item h1/x1hdeblock
  10851. Experimental horizontal deblocking filter
  10852. @item v1/x1vdeblock
  10853. Experimental vertical deblocking filter
  10854. @item dr/dering
  10855. Deringing filter
  10856. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10857. @table @option
  10858. @item threshold1
  10859. larger -> stronger filtering
  10860. @item threshold2
  10861. larger -> stronger filtering
  10862. @item threshold3
  10863. larger -> stronger filtering
  10864. @end table
  10865. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10866. @table @option
  10867. @item f/fullyrange
  10868. Stretch luminance to @code{0-255}.
  10869. @end table
  10870. @item lb/linblenddeint
  10871. Linear blend deinterlacing filter that deinterlaces the given block by
  10872. filtering all lines with a @code{(1 2 1)} filter.
  10873. @item li/linipoldeint
  10874. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10875. linearly interpolating every second line.
  10876. @item ci/cubicipoldeint
  10877. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10878. cubically interpolating every second line.
  10879. @item md/mediandeint
  10880. Median deinterlacing filter that deinterlaces the given block by applying a
  10881. median filter to every second line.
  10882. @item fd/ffmpegdeint
  10883. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10884. second line with a @code{(-1 4 2 4 -1)} filter.
  10885. @item l5/lowpass5
  10886. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10887. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10888. @item fq/forceQuant[|quantizer]
  10889. Overrides the quantizer table from the input with the constant quantizer you
  10890. specify.
  10891. @table @option
  10892. @item quantizer
  10893. Quantizer to use
  10894. @end table
  10895. @item de/default
  10896. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10897. @item fa/fast
  10898. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10899. @item ac
  10900. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10901. @end table
  10902. @subsection Examples
  10903. @itemize
  10904. @item
  10905. Apply horizontal and vertical deblocking, deringing and automatic
  10906. brightness/contrast:
  10907. @example
  10908. pp=hb/vb/dr/al
  10909. @end example
  10910. @item
  10911. Apply default filters without brightness/contrast correction:
  10912. @example
  10913. pp=de/-al
  10914. @end example
  10915. @item
  10916. Apply default filters and temporal denoiser:
  10917. @example
  10918. pp=default/tmpnoise|1|2|3
  10919. @end example
  10920. @item
  10921. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10922. automatically depending on available CPU time:
  10923. @example
  10924. pp=hb|y/vb|a
  10925. @end example
  10926. @end itemize
  10927. @section pp7
  10928. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10929. similar to spp = 6 with 7 point DCT, where only the center sample is
  10930. used after IDCT.
  10931. The filter accepts the following options:
  10932. @table @option
  10933. @item qp
  10934. Force a constant quantization parameter. It accepts an integer in range
  10935. 0 to 63. If not set, the filter will use the QP from the video stream
  10936. (if available).
  10937. @item mode
  10938. Set thresholding mode. Available modes are:
  10939. @table @samp
  10940. @item hard
  10941. Set hard thresholding.
  10942. @item soft
  10943. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10944. @item medium
  10945. Set medium thresholding (good results, default).
  10946. @end table
  10947. @end table
  10948. @section premultiply
  10949. Apply alpha premultiply effect to input video stream using first plane
  10950. of second stream as alpha.
  10951. Both streams must have same dimensions and same pixel format.
  10952. The filter accepts the following option:
  10953. @table @option
  10954. @item planes
  10955. Set which planes will be processed, unprocessed planes will be copied.
  10956. By default value 0xf, all planes will be processed.
  10957. @item inplace
  10958. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10959. @end table
  10960. @section prewitt
  10961. Apply prewitt operator to input video stream.
  10962. The filter accepts the following option:
  10963. @table @option
  10964. @item planes
  10965. Set which planes will be processed, unprocessed planes will be copied.
  10966. By default value 0xf, all planes will be processed.
  10967. @item scale
  10968. Set value which will be multiplied with filtered result.
  10969. @item delta
  10970. Set value which will be added to filtered result.
  10971. @end table
  10972. @anchor{program_opencl}
  10973. @section program_opencl
  10974. Filter video using an OpenCL program.
  10975. @table @option
  10976. @item source
  10977. OpenCL program source file.
  10978. @item kernel
  10979. Kernel name in program.
  10980. @item inputs
  10981. Number of inputs to the filter. Defaults to 1.
  10982. @item size, s
  10983. Size of output frames. Defaults to the same as the first input.
  10984. @end table
  10985. The program source file must contain a kernel function with the given name,
  10986. which will be run once for each plane of the output. Each run on a plane
  10987. gets enqueued as a separate 2D global NDRange with one work-item for each
  10988. pixel to be generated. The global ID offset for each work-item is therefore
  10989. the coordinates of a pixel in the destination image.
  10990. The kernel function needs to take the following arguments:
  10991. @itemize
  10992. @item
  10993. Destination image, @var{__write_only image2d_t}.
  10994. This image will become the output; the kernel should write all of it.
  10995. @item
  10996. Frame index, @var{unsigned int}.
  10997. This is a counter starting from zero and increasing by one for each frame.
  10998. @item
  10999. Source images, @var{__read_only image2d_t}.
  11000. These are the most recent images on each input. The kernel may read from
  11001. them to generate the output, but they can't be written to.
  11002. @end itemize
  11003. Example programs:
  11004. @itemize
  11005. @item
  11006. Copy the input to the output (output must be the same size as the input).
  11007. @verbatim
  11008. __kernel void copy(__write_only image2d_t destination,
  11009. unsigned int index,
  11010. __read_only image2d_t source)
  11011. {
  11012. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  11013. int2 location = (int2)(get_global_id(0), get_global_id(1));
  11014. float4 value = read_imagef(source, sampler, location);
  11015. write_imagef(destination, location, value);
  11016. }
  11017. @end verbatim
  11018. @item
  11019. Apply a simple transformation, rotating the input by an amount increasing
  11020. with the index counter. Pixel values are linearly interpolated by the
  11021. sampler, and the output need not have the same dimensions as the input.
  11022. @verbatim
  11023. __kernel void rotate_image(__write_only image2d_t dst,
  11024. unsigned int index,
  11025. __read_only image2d_t src)
  11026. {
  11027. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11028. CLK_FILTER_LINEAR);
  11029. float angle = (float)index / 100.0f;
  11030. float2 dst_dim = convert_float2(get_image_dim(dst));
  11031. float2 src_dim = convert_float2(get_image_dim(src));
  11032. float2 dst_cen = dst_dim / 2.0f;
  11033. float2 src_cen = src_dim / 2.0f;
  11034. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11035. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  11036. float2 src_pos = {
  11037. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  11038. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  11039. };
  11040. src_pos = src_pos * src_dim / dst_dim;
  11041. float2 src_loc = src_pos + src_cen;
  11042. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  11043. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  11044. write_imagef(dst, dst_loc, 0.5f);
  11045. else
  11046. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  11047. }
  11048. @end verbatim
  11049. @item
  11050. Blend two inputs together, with the amount of each input used varying
  11051. with the index counter.
  11052. @verbatim
  11053. __kernel void blend_images(__write_only image2d_t dst,
  11054. unsigned int index,
  11055. __read_only image2d_t src1,
  11056. __read_only image2d_t src2)
  11057. {
  11058. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  11059. CLK_FILTER_LINEAR);
  11060. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  11061. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  11062. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  11063. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  11064. float4 val1 = read_imagef(src1, sampler, src1_loc);
  11065. float4 val2 = read_imagef(src2, sampler, src2_loc);
  11066. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  11067. }
  11068. @end verbatim
  11069. @end itemize
  11070. @section pseudocolor
  11071. Alter frame colors in video with pseudocolors.
  11072. This filter accepts the following options:
  11073. @table @option
  11074. @item c0
  11075. set pixel first component expression
  11076. @item c1
  11077. set pixel second component expression
  11078. @item c2
  11079. set pixel third component expression
  11080. @item c3
  11081. set pixel fourth component expression, corresponds to the alpha component
  11082. @item i
  11083. set component to use as base for altering colors
  11084. @end table
  11085. Each of them specifies the expression to use for computing the lookup table for
  11086. the corresponding pixel component values.
  11087. The expressions can contain the following constants and functions:
  11088. @table @option
  11089. @item w
  11090. @item h
  11091. The input width and height.
  11092. @item val
  11093. The input value for the pixel component.
  11094. @item ymin, umin, vmin, amin
  11095. The minimum allowed component value.
  11096. @item ymax, umax, vmax, amax
  11097. The maximum allowed component value.
  11098. @end table
  11099. All expressions default to "val".
  11100. @subsection Examples
  11101. @itemize
  11102. @item
  11103. Change too high luma values to gradient:
  11104. @example
  11105. 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'"
  11106. @end example
  11107. @end itemize
  11108. @section psnr
  11109. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  11110. Ratio) between two input videos.
  11111. This filter takes in input two input videos, the first input is
  11112. considered the "main" source and is passed unchanged to the
  11113. output. The second input is used as a "reference" video for computing
  11114. the PSNR.
  11115. Both video inputs must have the same resolution and pixel format for
  11116. this filter to work correctly. Also it assumes that both inputs
  11117. have the same number of frames, which are compared one by one.
  11118. The obtained average PSNR is printed through the logging system.
  11119. The filter stores the accumulated MSE (mean squared error) of each
  11120. frame, and at the end of the processing it is averaged across all frames
  11121. equally, and the following formula is applied to obtain the PSNR:
  11122. @example
  11123. PSNR = 10*log10(MAX^2/MSE)
  11124. @end example
  11125. Where MAX is the average of the maximum values of each component of the
  11126. image.
  11127. The description of the accepted parameters follows.
  11128. @table @option
  11129. @item stats_file, f
  11130. If specified the filter will use the named file to save the PSNR of
  11131. each individual frame. When filename equals "-" the data is sent to
  11132. standard output.
  11133. @item stats_version
  11134. Specifies which version of the stats file format to use. Details of
  11135. each format are written below.
  11136. Default value is 1.
  11137. @item stats_add_max
  11138. Determines whether the max value is output to the stats log.
  11139. Default value is 0.
  11140. Requires stats_version >= 2. If this is set and stats_version < 2,
  11141. the filter will return an error.
  11142. @end table
  11143. This filter also supports the @ref{framesync} options.
  11144. The file printed if @var{stats_file} is selected, contains a sequence of
  11145. key/value pairs of the form @var{key}:@var{value} for each compared
  11146. couple of frames.
  11147. If a @var{stats_version} greater than 1 is specified, a header line precedes
  11148. the list of per-frame-pair stats, with key value pairs following the frame
  11149. format with the following parameters:
  11150. @table @option
  11151. @item psnr_log_version
  11152. The version of the log file format. Will match @var{stats_version}.
  11153. @item fields
  11154. A comma separated list of the per-frame-pair parameters included in
  11155. the log.
  11156. @end table
  11157. A description of each shown per-frame-pair parameter follows:
  11158. @table @option
  11159. @item n
  11160. sequential number of the input frame, starting from 1
  11161. @item mse_avg
  11162. Mean Square Error pixel-by-pixel average difference of the compared
  11163. frames, averaged over all the image components.
  11164. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  11165. Mean Square Error pixel-by-pixel average difference of the compared
  11166. frames for the component specified by the suffix.
  11167. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  11168. Peak Signal to Noise ratio of the compared frames for the component
  11169. specified by the suffix.
  11170. @item max_avg, max_y, max_u, max_v
  11171. Maximum allowed value for each channel, and average over all
  11172. channels.
  11173. @end table
  11174. For example:
  11175. @example
  11176. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11177. [main][ref] psnr="stats_file=stats.log" [out]
  11178. @end example
  11179. On this example the input file being processed is compared with the
  11180. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  11181. is stored in @file{stats.log}.
  11182. @anchor{pullup}
  11183. @section pullup
  11184. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  11185. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  11186. content.
  11187. The pullup filter is designed to take advantage of future context in making
  11188. its decisions. This filter is stateless in the sense that it does not lock
  11189. onto a pattern to follow, but it instead looks forward to the following
  11190. fields in order to identify matches and rebuild progressive frames.
  11191. To produce content with an even framerate, insert the fps filter after
  11192. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  11193. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  11194. The filter accepts the following options:
  11195. @table @option
  11196. @item jl
  11197. @item jr
  11198. @item jt
  11199. @item jb
  11200. These options set the amount of "junk" to ignore at the left, right, top, and
  11201. bottom of the image, respectively. Left and right are in units of 8 pixels,
  11202. while top and bottom are in units of 2 lines.
  11203. The default is 8 pixels on each side.
  11204. @item sb
  11205. Set the strict breaks. Setting this option to 1 will reduce the chances of
  11206. filter generating an occasional mismatched frame, but it may also cause an
  11207. excessive number of frames to be dropped during high motion sequences.
  11208. Conversely, setting it to -1 will make filter match fields more easily.
  11209. This may help processing of video where there is slight blurring between
  11210. the fields, but may also cause there to be interlaced frames in the output.
  11211. Default value is @code{0}.
  11212. @item mp
  11213. Set the metric plane to use. It accepts the following values:
  11214. @table @samp
  11215. @item l
  11216. Use luma plane.
  11217. @item u
  11218. Use chroma blue plane.
  11219. @item v
  11220. Use chroma red plane.
  11221. @end table
  11222. This option may be set to use chroma plane instead of the default luma plane
  11223. for doing filter's computations. This may improve accuracy on very clean
  11224. source material, but more likely will decrease accuracy, especially if there
  11225. is chroma noise (rainbow effect) or any grayscale video.
  11226. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  11227. load and make pullup usable in realtime on slow machines.
  11228. @end table
  11229. For best results (without duplicated frames in the output file) it is
  11230. necessary to change the output frame rate. For example, to inverse
  11231. telecine NTSC input:
  11232. @example
  11233. ffmpeg -i input -vf pullup -r 24000/1001 ...
  11234. @end example
  11235. @section qp
  11236. Change video quantization parameters (QP).
  11237. The filter accepts the following option:
  11238. @table @option
  11239. @item qp
  11240. Set expression for quantization parameter.
  11241. @end table
  11242. The expression is evaluated through the eval API and can contain, among others,
  11243. the following constants:
  11244. @table @var
  11245. @item known
  11246. 1 if index is not 129, 0 otherwise.
  11247. @item qp
  11248. Sequential index starting from -129 to 128.
  11249. @end table
  11250. @subsection Examples
  11251. @itemize
  11252. @item
  11253. Some equation like:
  11254. @example
  11255. qp=2+2*sin(PI*qp)
  11256. @end example
  11257. @end itemize
  11258. @section random
  11259. Flush video frames from internal cache of frames into a random order.
  11260. No frame is discarded.
  11261. Inspired by @ref{frei0r} nervous filter.
  11262. @table @option
  11263. @item frames
  11264. Set size in number of frames of internal cache, in range from @code{2} to
  11265. @code{512}. Default is @code{30}.
  11266. @item seed
  11267. Set seed for random number generator, must be an integer included between
  11268. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11269. less than @code{0}, the filter will try to use a good random seed on a
  11270. best effort basis.
  11271. @end table
  11272. @section readeia608
  11273. Read closed captioning (EIA-608) information from the top lines of a video frame.
  11274. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  11275. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  11276. with EIA-608 data (starting from 0). A description of each metadata value follows:
  11277. @table @option
  11278. @item lavfi.readeia608.X.cc
  11279. The two bytes stored as EIA-608 data (printed in hexadecimal).
  11280. @item lavfi.readeia608.X.line
  11281. The number of the line on which the EIA-608 data was identified and read.
  11282. @end table
  11283. This filter accepts the following options:
  11284. @table @option
  11285. @item scan_min
  11286. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  11287. @item scan_max
  11288. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  11289. @item mac
  11290. Set minimal acceptable amplitude change for sync codes detection.
  11291. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  11292. @item spw
  11293. Set the ratio of width reserved for sync code detection.
  11294. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  11295. @item mhd
  11296. Set the max peaks height difference for sync code detection.
  11297. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11298. @item mpd
  11299. Set max peaks period difference for sync code detection.
  11300. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  11301. @item msd
  11302. Set the first two max start code bits differences.
  11303. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  11304. @item bhd
  11305. Set the minimum ratio of bits height compared to 3rd start code bit.
  11306. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  11307. @item th_w
  11308. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  11309. @item th_b
  11310. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  11311. @item chp
  11312. Enable checking the parity bit. In the event of a parity error, the filter will output
  11313. @code{0x00} for that character. Default is false.
  11314. @item lp
  11315. Lowpass lines prior to further processing. Default is disabled.
  11316. @end table
  11317. @subsection Examples
  11318. @itemize
  11319. @item
  11320. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  11321. @example
  11322. 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
  11323. @end example
  11324. @end itemize
  11325. @section readvitc
  11326. Read vertical interval timecode (VITC) information from the top lines of a
  11327. video frame.
  11328. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  11329. timecode value, if a valid timecode has been detected. Further metadata key
  11330. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  11331. timecode data has been found or not.
  11332. This filter accepts the following options:
  11333. @table @option
  11334. @item scan_max
  11335. Set the maximum number of lines to scan for VITC data. If the value is set to
  11336. @code{-1} the full video frame is scanned. Default is @code{45}.
  11337. @item thr_b
  11338. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  11339. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  11340. @item thr_w
  11341. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  11342. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  11343. @end table
  11344. @subsection Examples
  11345. @itemize
  11346. @item
  11347. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11348. draw @code{--:--:--:--} as a placeholder:
  11349. @example
  11350. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11351. @end example
  11352. @end itemize
  11353. @section remap
  11354. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11355. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11356. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11357. value for pixel will be used for destination pixel.
  11358. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11359. will have Xmap/Ymap video stream dimensions.
  11360. Xmap and Ymap input video streams are 16bit depth, single channel.
  11361. @table @option
  11362. @item format
  11363. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  11364. Default is @code{color}.
  11365. @end table
  11366. @section removegrain
  11367. The removegrain filter is a spatial denoiser for progressive video.
  11368. @table @option
  11369. @item m0
  11370. Set mode for the first plane.
  11371. @item m1
  11372. Set mode for the second plane.
  11373. @item m2
  11374. Set mode for the third plane.
  11375. @item m3
  11376. Set mode for the fourth plane.
  11377. @end table
  11378. Range of mode is from 0 to 24. Description of each mode follows:
  11379. @table @var
  11380. @item 0
  11381. Leave input plane unchanged. Default.
  11382. @item 1
  11383. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11384. @item 2
  11385. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11386. @item 3
  11387. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11388. @item 4
  11389. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11390. This is equivalent to a median filter.
  11391. @item 5
  11392. Line-sensitive clipping giving the minimal change.
  11393. @item 6
  11394. Line-sensitive clipping, intermediate.
  11395. @item 7
  11396. Line-sensitive clipping, intermediate.
  11397. @item 8
  11398. Line-sensitive clipping, intermediate.
  11399. @item 9
  11400. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11401. @item 10
  11402. Replaces the target pixel with the closest neighbour.
  11403. @item 11
  11404. [1 2 1] horizontal and vertical kernel blur.
  11405. @item 12
  11406. Same as mode 11.
  11407. @item 13
  11408. Bob mode, interpolates top field from the line where the neighbours
  11409. pixels are the closest.
  11410. @item 14
  11411. Bob mode, interpolates bottom field from the line where the neighbours
  11412. pixels are the closest.
  11413. @item 15
  11414. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11415. interpolation formula.
  11416. @item 16
  11417. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11418. interpolation formula.
  11419. @item 17
  11420. Clips the pixel with the minimum and maximum of respectively the maximum and
  11421. minimum of each pair of opposite neighbour pixels.
  11422. @item 18
  11423. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11424. the current pixel is minimal.
  11425. @item 19
  11426. Replaces the pixel with the average of its 8 neighbours.
  11427. @item 20
  11428. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11429. @item 21
  11430. Clips pixels using the averages of opposite neighbour.
  11431. @item 22
  11432. Same as mode 21 but simpler and faster.
  11433. @item 23
  11434. Small edge and halo removal, but reputed useless.
  11435. @item 24
  11436. Similar as 23.
  11437. @end table
  11438. @section removelogo
  11439. Suppress a TV station logo, using an image file to determine which
  11440. pixels comprise the logo. It works by filling in the pixels that
  11441. comprise the logo with neighboring pixels.
  11442. The filter accepts the following options:
  11443. @table @option
  11444. @item filename, f
  11445. Set the filter bitmap file, which can be any image format supported by
  11446. libavformat. The width and height of the image file must match those of the
  11447. video stream being processed.
  11448. @end table
  11449. Pixels in the provided bitmap image with a value of zero are not
  11450. considered part of the logo, non-zero pixels are considered part of
  11451. the logo. If you use white (255) for the logo and black (0) for the
  11452. rest, you will be safe. For making the filter bitmap, it is
  11453. recommended to take a screen capture of a black frame with the logo
  11454. visible, and then using a threshold filter followed by the erode
  11455. filter once or twice.
  11456. If needed, little splotches can be fixed manually. Remember that if
  11457. logo pixels are not covered, the filter quality will be much
  11458. reduced. Marking too many pixels as part of the logo does not hurt as
  11459. much, but it will increase the amount of blurring needed to cover over
  11460. the image and will destroy more information than necessary, and extra
  11461. pixels will slow things down on a large logo.
  11462. @section repeatfields
  11463. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11464. fields based on its value.
  11465. @section reverse
  11466. Reverse a video clip.
  11467. Warning: This filter requires memory to buffer the entire clip, so trimming
  11468. is suggested.
  11469. @subsection Examples
  11470. @itemize
  11471. @item
  11472. Take the first 5 seconds of a clip, and reverse it.
  11473. @example
  11474. trim=end=5,reverse
  11475. @end example
  11476. @end itemize
  11477. @section rgbashift
  11478. Shift R/G/B/A pixels horizontally and/or vertically.
  11479. The filter accepts the following options:
  11480. @table @option
  11481. @item rh
  11482. Set amount to shift red horizontally.
  11483. @item rv
  11484. Set amount to shift red vertically.
  11485. @item gh
  11486. Set amount to shift green horizontally.
  11487. @item gv
  11488. Set amount to shift green vertically.
  11489. @item bh
  11490. Set amount to shift blue horizontally.
  11491. @item bv
  11492. Set amount to shift blue vertically.
  11493. @item ah
  11494. Set amount to shift alpha horizontally.
  11495. @item av
  11496. Set amount to shift alpha vertically.
  11497. @item edge
  11498. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11499. @end table
  11500. @section roberts
  11501. Apply roberts cross operator to input video stream.
  11502. The filter accepts the following option:
  11503. @table @option
  11504. @item planes
  11505. Set which planes will be processed, unprocessed planes will be copied.
  11506. By default value 0xf, all planes will be processed.
  11507. @item scale
  11508. Set value which will be multiplied with filtered result.
  11509. @item delta
  11510. Set value which will be added to filtered result.
  11511. @end table
  11512. @section rotate
  11513. Rotate video by an arbitrary angle expressed in radians.
  11514. The filter accepts the following options:
  11515. A description of the optional parameters follows.
  11516. @table @option
  11517. @item angle, a
  11518. Set an expression for the angle by which to rotate the input video
  11519. clockwise, expressed as a number of radians. A negative value will
  11520. result in a counter-clockwise rotation. By default it is set to "0".
  11521. This expression is evaluated for each frame.
  11522. @item out_w, ow
  11523. Set the output width expression, default value is "iw".
  11524. This expression is evaluated just once during configuration.
  11525. @item out_h, oh
  11526. Set the output height expression, default value is "ih".
  11527. This expression is evaluated just once during configuration.
  11528. @item bilinear
  11529. Enable bilinear interpolation if set to 1, a value of 0 disables
  11530. it. Default value is 1.
  11531. @item fillcolor, c
  11532. Set the color used to fill the output area not covered by the rotated
  11533. image. For the general syntax of this option, check the
  11534. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11535. If the special value "none" is selected then no
  11536. background is printed (useful for example if the background is never shown).
  11537. Default value is "black".
  11538. @end table
  11539. The expressions for the angle and the output size can contain the
  11540. following constants and functions:
  11541. @table @option
  11542. @item n
  11543. sequential number of the input frame, starting from 0. It is always NAN
  11544. before the first frame is filtered.
  11545. @item t
  11546. time in seconds of the input frame, it is set to 0 when the filter is
  11547. configured. It is always NAN before the first frame is filtered.
  11548. @item hsub
  11549. @item vsub
  11550. horizontal and vertical chroma subsample values. For example for the
  11551. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11552. @item in_w, iw
  11553. @item in_h, ih
  11554. the input video width and height
  11555. @item out_w, ow
  11556. @item out_h, oh
  11557. the output width and height, that is the size of the padded area as
  11558. specified by the @var{width} and @var{height} expressions
  11559. @item rotw(a)
  11560. @item roth(a)
  11561. the minimal width/height required for completely containing the input
  11562. video rotated by @var{a} radians.
  11563. These are only available when computing the @option{out_w} and
  11564. @option{out_h} expressions.
  11565. @end table
  11566. @subsection Examples
  11567. @itemize
  11568. @item
  11569. Rotate the input by PI/6 radians clockwise:
  11570. @example
  11571. rotate=PI/6
  11572. @end example
  11573. @item
  11574. Rotate the input by PI/6 radians counter-clockwise:
  11575. @example
  11576. rotate=-PI/6
  11577. @end example
  11578. @item
  11579. Rotate the input by 45 degrees clockwise:
  11580. @example
  11581. rotate=45*PI/180
  11582. @end example
  11583. @item
  11584. Apply a constant rotation with period T, starting from an angle of PI/3:
  11585. @example
  11586. rotate=PI/3+2*PI*t/T
  11587. @end example
  11588. @item
  11589. Make the input video rotation oscillating with a period of T
  11590. seconds and an amplitude of A radians:
  11591. @example
  11592. rotate=A*sin(2*PI/T*t)
  11593. @end example
  11594. @item
  11595. Rotate the video, output size is chosen so that the whole rotating
  11596. input video is always completely contained in the output:
  11597. @example
  11598. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11599. @end example
  11600. @item
  11601. Rotate the video, reduce the output size so that no background is ever
  11602. shown:
  11603. @example
  11604. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11605. @end example
  11606. @end itemize
  11607. @subsection Commands
  11608. The filter supports the following commands:
  11609. @table @option
  11610. @item a, angle
  11611. Set the angle expression.
  11612. The command accepts the same syntax of the corresponding option.
  11613. If the specified expression is not valid, it is kept at its current
  11614. value.
  11615. @end table
  11616. @section sab
  11617. Apply Shape Adaptive Blur.
  11618. The filter accepts the following options:
  11619. @table @option
  11620. @item luma_radius, lr
  11621. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11622. value is 1.0. A greater value will result in a more blurred image, and
  11623. in slower processing.
  11624. @item luma_pre_filter_radius, lpfr
  11625. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11626. value is 1.0.
  11627. @item luma_strength, ls
  11628. Set luma maximum difference between pixels to still be considered, must
  11629. be a value in the 0.1-100.0 range, default value is 1.0.
  11630. @item chroma_radius, cr
  11631. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11632. greater value will result in a more blurred image, and in slower
  11633. processing.
  11634. @item chroma_pre_filter_radius, cpfr
  11635. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11636. @item chroma_strength, cs
  11637. Set chroma maximum difference between pixels to still be considered,
  11638. must be a value in the -0.9-100.0 range.
  11639. @end table
  11640. Each chroma option value, if not explicitly specified, is set to the
  11641. corresponding luma option value.
  11642. @anchor{scale}
  11643. @section scale
  11644. Scale (resize) the input video, using the libswscale library.
  11645. The scale filter forces the output display aspect ratio to be the same
  11646. of the input, by changing the output sample aspect ratio.
  11647. If the input image format is different from the format requested by
  11648. the next filter, the scale filter will convert the input to the
  11649. requested format.
  11650. @subsection Options
  11651. The filter accepts the following options, or any of the options
  11652. supported by the libswscale scaler.
  11653. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11654. the complete list of scaler options.
  11655. @table @option
  11656. @item width, w
  11657. @item height, h
  11658. Set the output video dimension expression. Default value is the input
  11659. dimension.
  11660. If the @var{width} or @var{w} value is 0, the input width is used for
  11661. the output. If the @var{height} or @var{h} value is 0, the input height
  11662. is used for the output.
  11663. If one and only one of the values is -n with n >= 1, the scale filter
  11664. will use a value that maintains the aspect ratio of the input image,
  11665. calculated from the other specified dimension. After that it will,
  11666. however, make sure that the calculated dimension is divisible by n and
  11667. adjust the value if necessary.
  11668. If both values are -n with n >= 1, the behavior will be identical to
  11669. both values being set to 0 as previously detailed.
  11670. See below for the list of accepted constants for use in the dimension
  11671. expression.
  11672. @item eval
  11673. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11674. @table @samp
  11675. @item init
  11676. Only evaluate expressions once during the filter initialization or when a command is processed.
  11677. @item frame
  11678. Evaluate expressions for each incoming frame.
  11679. @end table
  11680. Default value is @samp{init}.
  11681. @item interl
  11682. Set the interlacing mode. It accepts the following values:
  11683. @table @samp
  11684. @item 1
  11685. Force interlaced aware scaling.
  11686. @item 0
  11687. Do not apply interlaced scaling.
  11688. @item -1
  11689. Select interlaced aware scaling depending on whether the source frames
  11690. are flagged as interlaced or not.
  11691. @end table
  11692. Default value is @samp{0}.
  11693. @item flags
  11694. Set libswscale scaling flags. See
  11695. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11696. complete list of values. If not explicitly specified the filter applies
  11697. the default flags.
  11698. @item param0, param1
  11699. Set libswscale input parameters for scaling algorithms that need them. See
  11700. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11701. complete documentation. If not explicitly specified the filter applies
  11702. empty parameters.
  11703. @item size, s
  11704. Set the video size. For the syntax of this option, check the
  11705. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11706. @item in_color_matrix
  11707. @item out_color_matrix
  11708. Set in/output YCbCr color space type.
  11709. This allows the autodetected value to be overridden as well as allows forcing
  11710. a specific value used for the output and encoder.
  11711. If not specified, the color space type depends on the pixel format.
  11712. Possible values:
  11713. @table @samp
  11714. @item auto
  11715. Choose automatically.
  11716. @item bt709
  11717. Format conforming to International Telecommunication Union (ITU)
  11718. Recommendation BT.709.
  11719. @item fcc
  11720. Set color space conforming to the United States Federal Communications
  11721. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11722. @item bt601
  11723. @item bt470
  11724. @item smpte170m
  11725. Set color space conforming to:
  11726. @itemize
  11727. @item
  11728. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11729. @item
  11730. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11731. @item
  11732. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11733. @end itemize
  11734. @item smpte240m
  11735. Set color space conforming to SMPTE ST 240:1999.
  11736. @item bt2020
  11737. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  11738. @end table
  11739. @item in_range
  11740. @item out_range
  11741. Set in/output YCbCr sample range.
  11742. This allows the autodetected value to be overridden as well as allows forcing
  11743. a specific value used for the output and encoder. If not specified, the
  11744. range depends on the pixel format. Possible values:
  11745. @table @samp
  11746. @item auto/unknown
  11747. Choose automatically.
  11748. @item jpeg/full/pc
  11749. Set full range (0-255 in case of 8-bit luma).
  11750. @item mpeg/limited/tv
  11751. Set "MPEG" range (16-235 in case of 8-bit luma).
  11752. @end table
  11753. @item force_original_aspect_ratio
  11754. Enable decreasing or increasing output video width or height if necessary to
  11755. keep the original aspect ratio. Possible values:
  11756. @table @samp
  11757. @item disable
  11758. Scale the video as specified and disable this feature.
  11759. @item decrease
  11760. The output video dimensions will automatically be decreased if needed.
  11761. @item increase
  11762. The output video dimensions will automatically be increased if needed.
  11763. @end table
  11764. One useful instance of this option is that when you know a specific device's
  11765. maximum allowed resolution, you can use this to limit the output video to
  11766. that, while retaining the aspect ratio. For example, device A allows
  11767. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11768. decrease) and specifying 1280x720 to the command line makes the output
  11769. 1280x533.
  11770. Please note that this is a different thing than specifying -1 for @option{w}
  11771. or @option{h}, you still need to specify the output resolution for this option
  11772. to work.
  11773. @item force_divisible_by Ensures that the output resolution is divisible by the
  11774. given integer when used together with @option{force_original_aspect_ratio}. This
  11775. works similar to using -n in the @option{w} and @option{h} options.
  11776. This option respects the value set for @option{force_original_aspect_ratio},
  11777. increasing or decreasing the resolution accordingly. This may slightly modify
  11778. the video's aspect ration.
  11779. This can be handy, for example, if you want to have a video fit within a defined
  11780. resolution using the @option{force_original_aspect_ratio} option but have
  11781. encoder restrictions when it comes to width or height.
  11782. @end table
  11783. The values of the @option{w} and @option{h} options are expressions
  11784. containing the following constants:
  11785. @table @var
  11786. @item in_w
  11787. @item in_h
  11788. The input width and height
  11789. @item iw
  11790. @item ih
  11791. These are the same as @var{in_w} and @var{in_h}.
  11792. @item out_w
  11793. @item out_h
  11794. The output (scaled) width and height
  11795. @item ow
  11796. @item oh
  11797. These are the same as @var{out_w} and @var{out_h}
  11798. @item a
  11799. The same as @var{iw} / @var{ih}
  11800. @item sar
  11801. input sample aspect ratio
  11802. @item dar
  11803. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11804. @item hsub
  11805. @item vsub
  11806. horizontal and vertical input chroma subsample values. For example for the
  11807. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11808. @item ohsub
  11809. @item ovsub
  11810. horizontal and vertical output chroma subsample values. For example for the
  11811. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11812. @end table
  11813. @subsection Examples
  11814. @itemize
  11815. @item
  11816. Scale the input video to a size of 200x100
  11817. @example
  11818. scale=w=200:h=100
  11819. @end example
  11820. This is equivalent to:
  11821. @example
  11822. scale=200:100
  11823. @end example
  11824. or:
  11825. @example
  11826. scale=200x100
  11827. @end example
  11828. @item
  11829. Specify a size abbreviation for the output size:
  11830. @example
  11831. scale=qcif
  11832. @end example
  11833. which can also be written as:
  11834. @example
  11835. scale=size=qcif
  11836. @end example
  11837. @item
  11838. Scale the input to 2x:
  11839. @example
  11840. scale=w=2*iw:h=2*ih
  11841. @end example
  11842. @item
  11843. The above is the same as:
  11844. @example
  11845. scale=2*in_w:2*in_h
  11846. @end example
  11847. @item
  11848. Scale the input to 2x with forced interlaced scaling:
  11849. @example
  11850. scale=2*iw:2*ih:interl=1
  11851. @end example
  11852. @item
  11853. Scale the input to half size:
  11854. @example
  11855. scale=w=iw/2:h=ih/2
  11856. @end example
  11857. @item
  11858. Increase the width, and set the height to the same size:
  11859. @example
  11860. scale=3/2*iw:ow
  11861. @end example
  11862. @item
  11863. Seek Greek harmony:
  11864. @example
  11865. scale=iw:1/PHI*iw
  11866. scale=ih*PHI:ih
  11867. @end example
  11868. @item
  11869. Increase the height, and set the width to 3/2 of the height:
  11870. @example
  11871. scale=w=3/2*oh:h=3/5*ih
  11872. @end example
  11873. @item
  11874. Increase the size, making the size a multiple of the chroma
  11875. subsample values:
  11876. @example
  11877. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11878. @end example
  11879. @item
  11880. Increase the width to a maximum of 500 pixels,
  11881. keeping the same aspect ratio as the input:
  11882. @example
  11883. scale=w='min(500\, iw*3/2):h=-1'
  11884. @end example
  11885. @item
  11886. Make pixels square by combining scale and setsar:
  11887. @example
  11888. scale='trunc(ih*dar):ih',setsar=1/1
  11889. @end example
  11890. @item
  11891. Make pixels square by combining scale and setsar,
  11892. making sure the resulting resolution is even (required by some codecs):
  11893. @example
  11894. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11895. @end example
  11896. @end itemize
  11897. @subsection Commands
  11898. This filter supports the following commands:
  11899. @table @option
  11900. @item width, w
  11901. @item height, h
  11902. Set the output video dimension expression.
  11903. The command accepts the same syntax of the corresponding option.
  11904. If the specified expression is not valid, it is kept at its current
  11905. value.
  11906. @end table
  11907. @section scale_npp
  11908. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11909. format conversion on CUDA video frames. Setting the output width and height
  11910. works in the same way as for the @var{scale} filter.
  11911. The following additional options are accepted:
  11912. @table @option
  11913. @item format
  11914. The pixel format of the output CUDA frames. If set to the string "same" (the
  11915. default), the input format will be kept. Note that automatic format negotiation
  11916. and conversion is not yet supported for hardware frames
  11917. @item interp_algo
  11918. The interpolation algorithm used for resizing. One of the following:
  11919. @table @option
  11920. @item nn
  11921. Nearest neighbour.
  11922. @item linear
  11923. @item cubic
  11924. @item cubic2p_bspline
  11925. 2-parameter cubic (B=1, C=0)
  11926. @item cubic2p_catmullrom
  11927. 2-parameter cubic (B=0, C=1/2)
  11928. @item cubic2p_b05c03
  11929. 2-parameter cubic (B=1/2, C=3/10)
  11930. @item super
  11931. Supersampling
  11932. @item lanczos
  11933. @end table
  11934. @end table
  11935. @section scale2ref
  11936. Scale (resize) the input video, based on a reference video.
  11937. See the scale filter for available options, scale2ref supports the same but
  11938. uses the reference video instead of the main input as basis. scale2ref also
  11939. supports the following additional constants for the @option{w} and
  11940. @option{h} options:
  11941. @table @var
  11942. @item main_w
  11943. @item main_h
  11944. The main input video's width and height
  11945. @item main_a
  11946. The same as @var{main_w} / @var{main_h}
  11947. @item main_sar
  11948. The main input video's sample aspect ratio
  11949. @item main_dar, mdar
  11950. The main input video's display aspect ratio. Calculated from
  11951. @code{(main_w / main_h) * main_sar}.
  11952. @item main_hsub
  11953. @item main_vsub
  11954. The main input video's horizontal and vertical chroma subsample values.
  11955. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11956. is 1.
  11957. @end table
  11958. @subsection Examples
  11959. @itemize
  11960. @item
  11961. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11962. @example
  11963. 'scale2ref[b][a];[a][b]overlay'
  11964. @end example
  11965. @item
  11966. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  11967. @example
  11968. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  11969. @end example
  11970. @end itemize
  11971. @section scroll
  11972. Scroll input video horizontally and/or vertically by constant speed.
  11973. The filter accepts the following options:
  11974. @table @option
  11975. @item horizontal, h
  11976. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  11977. Negative values changes scrolling direction.
  11978. @item vertical, v
  11979. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  11980. Negative values changes scrolling direction.
  11981. @item hpos
  11982. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  11983. @item vpos
  11984. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  11985. @end table
  11986. @anchor{selectivecolor}
  11987. @section selectivecolor
  11988. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11989. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11990. by the "purity" of the color (that is, how saturated it already is).
  11991. This filter is similar to the Adobe Photoshop Selective Color tool.
  11992. The filter accepts the following options:
  11993. @table @option
  11994. @item correction_method
  11995. Select color correction method.
  11996. Available values are:
  11997. @table @samp
  11998. @item absolute
  11999. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  12000. component value).
  12001. @item relative
  12002. Specified adjustments are relative to the original component value.
  12003. @end table
  12004. Default is @code{absolute}.
  12005. @item reds
  12006. Adjustments for red pixels (pixels where the red component is the maximum)
  12007. @item yellows
  12008. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  12009. @item greens
  12010. Adjustments for green pixels (pixels where the green component is the maximum)
  12011. @item cyans
  12012. Adjustments for cyan pixels (pixels where the red component is the minimum)
  12013. @item blues
  12014. Adjustments for blue pixels (pixels where the blue component is the maximum)
  12015. @item magentas
  12016. Adjustments for magenta pixels (pixels where the green component is the minimum)
  12017. @item whites
  12018. Adjustments for white pixels (pixels where all components are greater than 128)
  12019. @item neutrals
  12020. Adjustments for all pixels except pure black and pure white
  12021. @item blacks
  12022. Adjustments for black pixels (pixels where all components are lesser than 128)
  12023. @item psfile
  12024. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  12025. @end table
  12026. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  12027. 4 space separated floating point adjustment values in the [-1,1] range,
  12028. respectively to adjust the amount of cyan, magenta, yellow and black for the
  12029. pixels of its range.
  12030. @subsection Examples
  12031. @itemize
  12032. @item
  12033. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  12034. increase magenta by 27% in blue areas:
  12035. @example
  12036. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  12037. @end example
  12038. @item
  12039. Use a Photoshop selective color preset:
  12040. @example
  12041. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  12042. @end example
  12043. @end itemize
  12044. @anchor{separatefields}
  12045. @section separatefields
  12046. The @code{separatefields} takes a frame-based video input and splits
  12047. each frame into its components fields, producing a new half height clip
  12048. with twice the frame rate and twice the frame count.
  12049. This filter use field-dominance information in frame to decide which
  12050. of each pair of fields to place first in the output.
  12051. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  12052. @section setdar, setsar
  12053. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  12054. output video.
  12055. This is done by changing the specified Sample (aka Pixel) Aspect
  12056. Ratio, according to the following equation:
  12057. @example
  12058. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  12059. @end example
  12060. Keep in mind that the @code{setdar} filter does not modify the pixel
  12061. dimensions of the video frame. Also, the display aspect ratio set by
  12062. this filter may be changed by later filters in the filterchain,
  12063. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  12064. applied.
  12065. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  12066. the filter output video.
  12067. Note that as a consequence of the application of this filter, the
  12068. output display aspect ratio will change according to the equation
  12069. above.
  12070. Keep in mind that the sample aspect ratio set by the @code{setsar}
  12071. filter may be changed by later filters in the filterchain, e.g. if
  12072. another "setsar" or a "setdar" filter is applied.
  12073. It accepts the following parameters:
  12074. @table @option
  12075. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  12076. Set the aspect ratio used by the filter.
  12077. The parameter can be a floating point number string, an expression, or
  12078. a string of the form @var{num}:@var{den}, where @var{num} and
  12079. @var{den} are the numerator and denominator of the aspect ratio. If
  12080. the parameter is not specified, it is assumed the value "0".
  12081. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  12082. should be escaped.
  12083. @item max
  12084. Set the maximum integer value to use for expressing numerator and
  12085. denominator when reducing the expressed aspect ratio to a rational.
  12086. Default value is @code{100}.
  12087. @end table
  12088. The parameter @var{sar} is an expression containing
  12089. the following constants:
  12090. @table @option
  12091. @item E, PI, PHI
  12092. These are approximated values for the mathematical constants e
  12093. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  12094. @item w, h
  12095. The input width and height.
  12096. @item a
  12097. These are the same as @var{w} / @var{h}.
  12098. @item sar
  12099. The input sample aspect ratio.
  12100. @item dar
  12101. The input display aspect ratio. It is the same as
  12102. (@var{w} / @var{h}) * @var{sar}.
  12103. @item hsub, vsub
  12104. Horizontal and vertical chroma subsample values. For example, for the
  12105. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12106. @end table
  12107. @subsection Examples
  12108. @itemize
  12109. @item
  12110. To change the display aspect ratio to 16:9, specify one of the following:
  12111. @example
  12112. setdar=dar=1.77777
  12113. setdar=dar=16/9
  12114. @end example
  12115. @item
  12116. To change the sample aspect ratio to 10:11, specify:
  12117. @example
  12118. setsar=sar=10/11
  12119. @end example
  12120. @item
  12121. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  12122. 1000 in the aspect ratio reduction, use the command:
  12123. @example
  12124. setdar=ratio=16/9:max=1000
  12125. @end example
  12126. @end itemize
  12127. @anchor{setfield}
  12128. @section setfield
  12129. Force field for the output video frame.
  12130. The @code{setfield} filter marks the interlace type field for the
  12131. output frames. It does not change the input frame, but only sets the
  12132. corresponding property, which affects how the frame is treated by
  12133. following filters (e.g. @code{fieldorder} or @code{yadif}).
  12134. The filter accepts the following options:
  12135. @table @option
  12136. @item mode
  12137. Available values are:
  12138. @table @samp
  12139. @item auto
  12140. Keep the same field property.
  12141. @item bff
  12142. Mark the frame as bottom-field-first.
  12143. @item tff
  12144. Mark the frame as top-field-first.
  12145. @item prog
  12146. Mark the frame as progressive.
  12147. @end table
  12148. @end table
  12149. @anchor{setparams}
  12150. @section setparams
  12151. Force frame parameter for the output video frame.
  12152. The @code{setparams} filter marks interlace and color range for the
  12153. output frames. It does not change the input frame, but only sets the
  12154. corresponding property, which affects how the frame is treated by
  12155. filters/encoders.
  12156. @table @option
  12157. @item field_mode
  12158. Available values are:
  12159. @table @samp
  12160. @item auto
  12161. Keep the same field property (default).
  12162. @item bff
  12163. Mark the frame as bottom-field-first.
  12164. @item tff
  12165. Mark the frame as top-field-first.
  12166. @item prog
  12167. Mark the frame as progressive.
  12168. @end table
  12169. @item range
  12170. Available values are:
  12171. @table @samp
  12172. @item auto
  12173. Keep the same color range property (default).
  12174. @item unspecified, unknown
  12175. Mark the frame as unspecified color range.
  12176. @item limited, tv, mpeg
  12177. Mark the frame as limited range.
  12178. @item full, pc, jpeg
  12179. Mark the frame as full range.
  12180. @end table
  12181. @item color_primaries
  12182. Set the color primaries.
  12183. Available values are:
  12184. @table @samp
  12185. @item auto
  12186. Keep the same color primaries property (default).
  12187. @item bt709
  12188. @item unknown
  12189. @item bt470m
  12190. @item bt470bg
  12191. @item smpte170m
  12192. @item smpte240m
  12193. @item film
  12194. @item bt2020
  12195. @item smpte428
  12196. @item smpte431
  12197. @item smpte432
  12198. @item jedec-p22
  12199. @end table
  12200. @item color_trc
  12201. Set the color transfer.
  12202. Available values are:
  12203. @table @samp
  12204. @item auto
  12205. Keep the same color trc property (default).
  12206. @item bt709
  12207. @item unknown
  12208. @item bt470m
  12209. @item bt470bg
  12210. @item smpte170m
  12211. @item smpte240m
  12212. @item linear
  12213. @item log100
  12214. @item log316
  12215. @item iec61966-2-4
  12216. @item bt1361e
  12217. @item iec61966-2-1
  12218. @item bt2020-10
  12219. @item bt2020-12
  12220. @item smpte2084
  12221. @item smpte428
  12222. @item arib-std-b67
  12223. @end table
  12224. @item colorspace
  12225. Set the colorspace.
  12226. Available values are:
  12227. @table @samp
  12228. @item auto
  12229. Keep the same colorspace property (default).
  12230. @item gbr
  12231. @item bt709
  12232. @item unknown
  12233. @item fcc
  12234. @item bt470bg
  12235. @item smpte170m
  12236. @item smpte240m
  12237. @item ycgco
  12238. @item bt2020nc
  12239. @item bt2020c
  12240. @item smpte2085
  12241. @item chroma-derived-nc
  12242. @item chroma-derived-c
  12243. @item ictcp
  12244. @end table
  12245. @end table
  12246. @section showinfo
  12247. Show a line containing various information for each input video frame.
  12248. The input video is not modified.
  12249. This filter supports the following options:
  12250. @table @option
  12251. @item checksum
  12252. Calculate checksums of each plane. By default enabled.
  12253. @end table
  12254. The shown line contains a sequence of key/value pairs of the form
  12255. @var{key}:@var{value}.
  12256. The following values are shown in the output:
  12257. @table @option
  12258. @item n
  12259. The (sequential) number of the input frame, starting from 0.
  12260. @item pts
  12261. The Presentation TimeStamp of the input frame, expressed as a number of
  12262. time base units. The time base unit depends on the filter input pad.
  12263. @item pts_time
  12264. The Presentation TimeStamp of the input frame, expressed as a number of
  12265. seconds.
  12266. @item pos
  12267. The position of the frame in the input stream, or -1 if this information is
  12268. unavailable and/or meaningless (for example in case of synthetic video).
  12269. @item fmt
  12270. The pixel format name.
  12271. @item sar
  12272. The sample aspect ratio of the input frame, expressed in the form
  12273. @var{num}/@var{den}.
  12274. @item s
  12275. The size of the input frame. For the syntax of this option, check the
  12276. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12277. @item i
  12278. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  12279. for bottom field first).
  12280. @item iskey
  12281. This is 1 if the frame is a key frame, 0 otherwise.
  12282. @item type
  12283. The picture type of the input frame ("I" for an I-frame, "P" for a
  12284. P-frame, "B" for a B-frame, or "?" for an unknown type).
  12285. Also refer to the documentation of the @code{AVPictureType} enum and of
  12286. the @code{av_get_picture_type_char} function defined in
  12287. @file{libavutil/avutil.h}.
  12288. @item checksum
  12289. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  12290. @item plane_checksum
  12291. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  12292. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  12293. @end table
  12294. @section showpalette
  12295. Displays the 256 colors palette of each frame. This filter is only relevant for
  12296. @var{pal8} pixel format frames.
  12297. It accepts the following option:
  12298. @table @option
  12299. @item s
  12300. Set the size of the box used to represent one palette color entry. Default is
  12301. @code{30} (for a @code{30x30} pixel box).
  12302. @end table
  12303. @section shuffleframes
  12304. Reorder and/or duplicate and/or drop video frames.
  12305. It accepts the following parameters:
  12306. @table @option
  12307. @item mapping
  12308. Set the destination indexes of input frames.
  12309. This is space or '|' separated list of indexes that maps input frames to output
  12310. frames. Number of indexes also sets maximal value that each index may have.
  12311. '-1' index have special meaning and that is to drop frame.
  12312. @end table
  12313. The first frame has the index 0. The default is to keep the input unchanged.
  12314. @subsection Examples
  12315. @itemize
  12316. @item
  12317. Swap second and third frame of every three frames of the input:
  12318. @example
  12319. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  12320. @end example
  12321. @item
  12322. Swap 10th and 1st frame of every ten frames of the input:
  12323. @example
  12324. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  12325. @end example
  12326. @end itemize
  12327. @section shuffleplanes
  12328. Reorder and/or duplicate video planes.
  12329. It accepts the following parameters:
  12330. @table @option
  12331. @item map0
  12332. The index of the input plane to be used as the first output plane.
  12333. @item map1
  12334. The index of the input plane to be used as the second output plane.
  12335. @item map2
  12336. The index of the input plane to be used as the third output plane.
  12337. @item map3
  12338. The index of the input plane to be used as the fourth output plane.
  12339. @end table
  12340. The first plane has the index 0. The default is to keep the input unchanged.
  12341. @subsection Examples
  12342. @itemize
  12343. @item
  12344. Swap the second and third planes of the input:
  12345. @example
  12346. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  12347. @end example
  12348. @end itemize
  12349. @anchor{signalstats}
  12350. @section signalstats
  12351. Evaluate various visual metrics that assist in determining issues associated
  12352. with the digitization of analog video media.
  12353. By default the filter will log these metadata values:
  12354. @table @option
  12355. @item YMIN
  12356. Display the minimal Y value contained within the input frame. Expressed in
  12357. range of [0-255].
  12358. @item YLOW
  12359. Display the Y value at the 10% percentile within the input frame. Expressed in
  12360. range of [0-255].
  12361. @item YAVG
  12362. Display the average Y value within the input frame. Expressed in range of
  12363. [0-255].
  12364. @item YHIGH
  12365. Display the Y value at the 90% percentile within the input frame. Expressed in
  12366. range of [0-255].
  12367. @item YMAX
  12368. Display the maximum Y value contained within the input frame. Expressed in
  12369. range of [0-255].
  12370. @item UMIN
  12371. Display the minimal U value contained within the input frame. Expressed in
  12372. range of [0-255].
  12373. @item ULOW
  12374. Display the U value at the 10% percentile within the input frame. Expressed in
  12375. range of [0-255].
  12376. @item UAVG
  12377. Display the average U value within the input frame. Expressed in range of
  12378. [0-255].
  12379. @item UHIGH
  12380. Display the U value at the 90% percentile within the input frame. Expressed in
  12381. range of [0-255].
  12382. @item UMAX
  12383. Display the maximum U value contained within the input frame. Expressed in
  12384. range of [0-255].
  12385. @item VMIN
  12386. Display the minimal V value contained within the input frame. Expressed in
  12387. range of [0-255].
  12388. @item VLOW
  12389. Display the V value at the 10% percentile within the input frame. Expressed in
  12390. range of [0-255].
  12391. @item VAVG
  12392. Display the average V value within the input frame. Expressed in range of
  12393. [0-255].
  12394. @item VHIGH
  12395. Display the V value at the 90% percentile within the input frame. Expressed in
  12396. range of [0-255].
  12397. @item VMAX
  12398. Display the maximum V value contained within the input frame. Expressed in
  12399. range of [0-255].
  12400. @item SATMIN
  12401. Display the minimal saturation value contained within the input frame.
  12402. Expressed in range of [0-~181.02].
  12403. @item SATLOW
  12404. Display the saturation value at the 10% percentile within the input frame.
  12405. Expressed in range of [0-~181.02].
  12406. @item SATAVG
  12407. Display the average saturation value within the input frame. Expressed in range
  12408. of [0-~181.02].
  12409. @item SATHIGH
  12410. Display the saturation value at the 90% percentile within the input frame.
  12411. Expressed in range of [0-~181.02].
  12412. @item SATMAX
  12413. Display the maximum saturation value contained within the input frame.
  12414. Expressed in range of [0-~181.02].
  12415. @item HUEMED
  12416. Display the median value for hue within the input frame. Expressed in range of
  12417. [0-360].
  12418. @item HUEAVG
  12419. Display the average value for hue within the input frame. Expressed in range of
  12420. [0-360].
  12421. @item YDIF
  12422. Display the average of sample value difference between all values of the Y
  12423. plane in the current frame and corresponding values of the previous input frame.
  12424. Expressed in range of [0-255].
  12425. @item UDIF
  12426. Display the average of sample value difference between all values of the U
  12427. plane in the current frame and corresponding values of the previous input frame.
  12428. Expressed in range of [0-255].
  12429. @item VDIF
  12430. Display the average of sample value difference between all values of the V
  12431. plane in the current frame and corresponding values of the previous input frame.
  12432. Expressed in range of [0-255].
  12433. @item YBITDEPTH
  12434. Display bit depth of Y plane in current frame.
  12435. Expressed in range of [0-16].
  12436. @item UBITDEPTH
  12437. Display bit depth of U plane in current frame.
  12438. Expressed in range of [0-16].
  12439. @item VBITDEPTH
  12440. Display bit depth of V plane in current frame.
  12441. Expressed in range of [0-16].
  12442. @end table
  12443. The filter accepts the following options:
  12444. @table @option
  12445. @item stat
  12446. @item out
  12447. @option{stat} specify an additional form of image analysis.
  12448. @option{out} output video with the specified type of pixel highlighted.
  12449. Both options accept the following values:
  12450. @table @samp
  12451. @item tout
  12452. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12453. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12454. include the results of video dropouts, head clogs, or tape tracking issues.
  12455. @item vrep
  12456. Identify @var{vertical line repetition}. Vertical line repetition includes
  12457. similar rows of pixels within a frame. In born-digital video vertical line
  12458. repetition is common, but this pattern is uncommon in video digitized from an
  12459. analog source. When it occurs in video that results from the digitization of an
  12460. analog source it can indicate concealment from a dropout compensator.
  12461. @item brng
  12462. Identify pixels that fall outside of legal broadcast range.
  12463. @end table
  12464. @item color, c
  12465. Set the highlight color for the @option{out} option. The default color is
  12466. yellow.
  12467. @end table
  12468. @subsection Examples
  12469. @itemize
  12470. @item
  12471. Output data of various video metrics:
  12472. @example
  12473. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12474. @end example
  12475. @item
  12476. Output specific data about the minimum and maximum values of the Y plane per frame:
  12477. @example
  12478. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12479. @end example
  12480. @item
  12481. Playback video while highlighting pixels that are outside of broadcast range in red.
  12482. @example
  12483. ffplay example.mov -vf signalstats="out=brng:color=red"
  12484. @end example
  12485. @item
  12486. Playback video with signalstats metadata drawn over the frame.
  12487. @example
  12488. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12489. @end example
  12490. The contents of signalstat_drawtext.txt used in the command are:
  12491. @example
  12492. time %@{pts:hms@}
  12493. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12494. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12495. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12496. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12497. @end example
  12498. @end itemize
  12499. @anchor{signature}
  12500. @section signature
  12501. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12502. input. In this case the matching between the inputs can be calculated additionally.
  12503. The filter always passes through the first input. The signature of each stream can
  12504. be written into a file.
  12505. It accepts the following options:
  12506. @table @option
  12507. @item detectmode
  12508. Enable or disable the matching process.
  12509. Available values are:
  12510. @table @samp
  12511. @item off
  12512. Disable the calculation of a matching (default).
  12513. @item full
  12514. Calculate the matching for the whole video and output whether the whole video
  12515. matches or only parts.
  12516. @item fast
  12517. Calculate only until a matching is found or the video ends. Should be faster in
  12518. some cases.
  12519. @end table
  12520. @item nb_inputs
  12521. Set the number of inputs. The option value must be a non negative integer.
  12522. Default value is 1.
  12523. @item filename
  12524. Set the path to which the output is written. If there is more than one input,
  12525. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12526. integer), that will be replaced with the input number. If no filename is
  12527. specified, no output will be written. This is the default.
  12528. @item format
  12529. Choose the output format.
  12530. Available values are:
  12531. @table @samp
  12532. @item binary
  12533. Use the specified binary representation (default).
  12534. @item xml
  12535. Use the specified xml representation.
  12536. @end table
  12537. @item th_d
  12538. Set threshold to detect one word as similar. The option value must be an integer
  12539. greater than zero. The default value is 9000.
  12540. @item th_dc
  12541. Set threshold to detect all words as similar. The option value must be an integer
  12542. greater than zero. The default value is 60000.
  12543. @item th_xh
  12544. Set threshold to detect frames as similar. The option value must be an integer
  12545. greater than zero. The default value is 116.
  12546. @item th_di
  12547. Set the minimum length of a sequence in frames to recognize it as matching
  12548. sequence. The option value must be a non negative integer value.
  12549. The default value is 0.
  12550. @item th_it
  12551. Set the minimum relation, that matching frames to all frames must have.
  12552. The option value must be a double value between 0 and 1. The default value is 0.5.
  12553. @end table
  12554. @subsection Examples
  12555. @itemize
  12556. @item
  12557. To calculate the signature of an input video and store it in signature.bin:
  12558. @example
  12559. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12560. @end example
  12561. @item
  12562. To detect whether two videos match and store the signatures in XML format in
  12563. signature0.xml and signature1.xml:
  12564. @example
  12565. 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 -
  12566. @end example
  12567. @end itemize
  12568. @anchor{smartblur}
  12569. @section smartblur
  12570. Blur the input video without impacting the outlines.
  12571. It accepts the following options:
  12572. @table @option
  12573. @item luma_radius, lr
  12574. Set the luma radius. The option value must be a float number in
  12575. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12576. used to blur the image (slower if larger). Default value is 1.0.
  12577. @item luma_strength, ls
  12578. Set the luma strength. The option value must be a float number
  12579. in the range [-1.0,1.0] that configures the blurring. A value included
  12580. in [0.0,1.0] will blur the image whereas a value included in
  12581. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12582. @item luma_threshold, lt
  12583. Set the luma threshold used as a coefficient to determine
  12584. whether a pixel should be blurred or not. The option value must be an
  12585. integer in the range [-30,30]. A value of 0 will filter all the image,
  12586. a value included in [0,30] will filter flat areas and a value included
  12587. in [-30,0] will filter edges. Default value is 0.
  12588. @item chroma_radius, cr
  12589. Set the chroma radius. The option value must be a float number in
  12590. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12591. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12592. @item chroma_strength, cs
  12593. Set the chroma strength. The option value must be a float number
  12594. in the range [-1.0,1.0] that configures the blurring. A value included
  12595. in [0.0,1.0] will blur the image whereas a value included in
  12596. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12597. @item chroma_threshold, ct
  12598. Set the chroma threshold used as a coefficient to determine
  12599. whether a pixel should be blurred or not. The option value must be an
  12600. integer in the range [-30,30]. A value of 0 will filter all the image,
  12601. a value included in [0,30] will filter flat areas and a value included
  12602. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12603. @end table
  12604. If a chroma option is not explicitly set, the corresponding luma value
  12605. is set.
  12606. @section sobel
  12607. Apply sobel operator to input video stream.
  12608. The filter accepts the following option:
  12609. @table @option
  12610. @item planes
  12611. Set which planes will be processed, unprocessed planes will be copied.
  12612. By default value 0xf, all planes will be processed.
  12613. @item scale
  12614. Set value which will be multiplied with filtered result.
  12615. @item delta
  12616. Set value which will be added to filtered result.
  12617. @end table
  12618. @anchor{spp}
  12619. @section spp
  12620. Apply a simple postprocessing filter that compresses and decompresses the image
  12621. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12622. and average the results.
  12623. The filter accepts the following options:
  12624. @table @option
  12625. @item quality
  12626. Set quality. This option defines the number of levels for averaging. It accepts
  12627. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12628. effect. A value of @code{6} means the higher quality. For each increment of
  12629. that value the speed drops by a factor of approximately 2. Default value is
  12630. @code{3}.
  12631. @item qp
  12632. Force a constant quantization parameter. If not set, the filter will use the QP
  12633. from the video stream (if available).
  12634. @item mode
  12635. Set thresholding mode. Available modes are:
  12636. @table @samp
  12637. @item hard
  12638. Set hard thresholding (default).
  12639. @item soft
  12640. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12641. @end table
  12642. @item use_bframe_qp
  12643. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12644. option may cause flicker since the B-Frames have often larger QP. Default is
  12645. @code{0} (not enabled).
  12646. @end table
  12647. @section sr
  12648. Scale the input by applying one of the super-resolution methods based on
  12649. convolutional neural networks. Supported models:
  12650. @itemize
  12651. @item
  12652. Super-Resolution Convolutional Neural Network model (SRCNN).
  12653. See @url{https://arxiv.org/abs/1501.00092}.
  12654. @item
  12655. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12656. See @url{https://arxiv.org/abs/1609.05158}.
  12657. @end itemize
  12658. Training scripts as well as scripts for model file (.pb) saving can be found at
  12659. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  12660. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12661. Native model files (.model) can be generated from TensorFlow model
  12662. files (.pb) by using tools/python/convert.py
  12663. The filter accepts the following options:
  12664. @table @option
  12665. @item dnn_backend
  12666. Specify which DNN backend to use for model loading and execution. This option accepts
  12667. the following values:
  12668. @table @samp
  12669. @item native
  12670. Native implementation of DNN loading and execution.
  12671. @item tensorflow
  12672. TensorFlow backend. To enable this backend you
  12673. need to install the TensorFlow for C library (see
  12674. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12675. @code{--enable-libtensorflow}
  12676. @end table
  12677. Default value is @samp{native}.
  12678. @item model
  12679. Set path to model file specifying network architecture and its parameters.
  12680. Note that different backends use different file formats. TensorFlow backend
  12681. can load files for both formats, while native backend can load files for only
  12682. its format.
  12683. @item scale_factor
  12684. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12685. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12686. input upscaled using bicubic upscaling with proper scale factor.
  12687. @end table
  12688. @section ssim
  12689. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12690. This filter takes in input two input videos, the first input is
  12691. considered the "main" source and is passed unchanged to the
  12692. output. The second input is used as a "reference" video for computing
  12693. the SSIM.
  12694. Both video inputs must have the same resolution and pixel format for
  12695. this filter to work correctly. Also it assumes that both inputs
  12696. have the same number of frames, which are compared one by one.
  12697. The filter stores the calculated SSIM of each frame.
  12698. The description of the accepted parameters follows.
  12699. @table @option
  12700. @item stats_file, f
  12701. If specified the filter will use the named file to save the SSIM of
  12702. each individual frame. When filename equals "-" the data is sent to
  12703. standard output.
  12704. @end table
  12705. The file printed if @var{stats_file} is selected, contains a sequence of
  12706. key/value pairs of the form @var{key}:@var{value} for each compared
  12707. couple of frames.
  12708. A description of each shown parameter follows:
  12709. @table @option
  12710. @item n
  12711. sequential number of the input frame, starting from 1
  12712. @item Y, U, V, R, G, B
  12713. SSIM of the compared frames for the component specified by the suffix.
  12714. @item All
  12715. SSIM of the compared frames for the whole frame.
  12716. @item dB
  12717. Same as above but in dB representation.
  12718. @end table
  12719. This filter also supports the @ref{framesync} options.
  12720. For example:
  12721. @example
  12722. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12723. [main][ref] ssim="stats_file=stats.log" [out]
  12724. @end example
  12725. On this example the input file being processed is compared with the
  12726. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12727. is stored in @file{stats.log}.
  12728. Another example with both psnr and ssim at same time:
  12729. @example
  12730. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12731. @end example
  12732. @section stereo3d
  12733. Convert between different stereoscopic image formats.
  12734. The filters accept the following options:
  12735. @table @option
  12736. @item in
  12737. Set stereoscopic image format of input.
  12738. Available values for input image formats are:
  12739. @table @samp
  12740. @item sbsl
  12741. side by side parallel (left eye left, right eye right)
  12742. @item sbsr
  12743. side by side crosseye (right eye left, left eye right)
  12744. @item sbs2l
  12745. side by side parallel with half width resolution
  12746. (left eye left, right eye right)
  12747. @item sbs2r
  12748. side by side crosseye with half width resolution
  12749. (right eye left, left eye right)
  12750. @item abl
  12751. @item tbl
  12752. above-below (left eye above, right eye below)
  12753. @item abr
  12754. @item tbr
  12755. above-below (right eye above, left eye below)
  12756. @item ab2l
  12757. @item tb2l
  12758. above-below with half height resolution
  12759. (left eye above, right eye below)
  12760. @item ab2r
  12761. @item tb2r
  12762. above-below with half height resolution
  12763. (right eye above, left eye below)
  12764. @item al
  12765. alternating frames (left eye first, right eye second)
  12766. @item ar
  12767. alternating frames (right eye first, left eye second)
  12768. @item irl
  12769. interleaved rows (left eye has top row, right eye starts on next row)
  12770. @item irr
  12771. interleaved rows (right eye has top row, left eye starts on next row)
  12772. @item icl
  12773. interleaved columns, left eye first
  12774. @item icr
  12775. interleaved columns, right eye first
  12776. Default value is @samp{sbsl}.
  12777. @end table
  12778. @item out
  12779. Set stereoscopic image format of output.
  12780. @table @samp
  12781. @item sbsl
  12782. side by side parallel (left eye left, right eye right)
  12783. @item sbsr
  12784. side by side crosseye (right eye left, left eye right)
  12785. @item sbs2l
  12786. side by side parallel with half width resolution
  12787. (left eye left, right eye right)
  12788. @item sbs2r
  12789. side by side crosseye with half width resolution
  12790. (right eye left, left eye right)
  12791. @item abl
  12792. @item tbl
  12793. above-below (left eye above, right eye below)
  12794. @item abr
  12795. @item tbr
  12796. above-below (right eye above, left eye below)
  12797. @item ab2l
  12798. @item tb2l
  12799. above-below with half height resolution
  12800. (left eye above, right eye below)
  12801. @item ab2r
  12802. @item tb2r
  12803. above-below with half height resolution
  12804. (right eye above, left eye below)
  12805. @item al
  12806. alternating frames (left eye first, right eye second)
  12807. @item ar
  12808. alternating frames (right eye first, left eye second)
  12809. @item irl
  12810. interleaved rows (left eye has top row, right eye starts on next row)
  12811. @item irr
  12812. interleaved rows (right eye has top row, left eye starts on next row)
  12813. @item arbg
  12814. anaglyph red/blue gray
  12815. (red filter on left eye, blue filter on right eye)
  12816. @item argg
  12817. anaglyph red/green gray
  12818. (red filter on left eye, green filter on right eye)
  12819. @item arcg
  12820. anaglyph red/cyan gray
  12821. (red filter on left eye, cyan filter on right eye)
  12822. @item arch
  12823. anaglyph red/cyan half colored
  12824. (red filter on left eye, cyan filter on right eye)
  12825. @item arcc
  12826. anaglyph red/cyan color
  12827. (red filter on left eye, cyan filter on right eye)
  12828. @item arcd
  12829. anaglyph red/cyan color optimized with the least squares projection of dubois
  12830. (red filter on left eye, cyan filter on right eye)
  12831. @item agmg
  12832. anaglyph green/magenta gray
  12833. (green filter on left eye, magenta filter on right eye)
  12834. @item agmh
  12835. anaglyph green/magenta half colored
  12836. (green filter on left eye, magenta filter on right eye)
  12837. @item agmc
  12838. anaglyph green/magenta colored
  12839. (green filter on left eye, magenta filter on right eye)
  12840. @item agmd
  12841. anaglyph green/magenta color optimized with the least squares projection of dubois
  12842. (green filter on left eye, magenta filter on right eye)
  12843. @item aybg
  12844. anaglyph yellow/blue gray
  12845. (yellow filter on left eye, blue filter on right eye)
  12846. @item aybh
  12847. anaglyph yellow/blue half colored
  12848. (yellow filter on left eye, blue filter on right eye)
  12849. @item aybc
  12850. anaglyph yellow/blue colored
  12851. (yellow filter on left eye, blue filter on right eye)
  12852. @item aybd
  12853. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12854. (yellow filter on left eye, blue filter on right eye)
  12855. @item ml
  12856. mono output (left eye only)
  12857. @item mr
  12858. mono output (right eye only)
  12859. @item chl
  12860. checkerboard, left eye first
  12861. @item chr
  12862. checkerboard, right eye first
  12863. @item icl
  12864. interleaved columns, left eye first
  12865. @item icr
  12866. interleaved columns, right eye first
  12867. @item hdmi
  12868. HDMI frame pack
  12869. @end table
  12870. Default value is @samp{arcd}.
  12871. @end table
  12872. @subsection Examples
  12873. @itemize
  12874. @item
  12875. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12876. @example
  12877. stereo3d=sbsl:aybd
  12878. @end example
  12879. @item
  12880. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12881. @example
  12882. stereo3d=abl:sbsr
  12883. @end example
  12884. @end itemize
  12885. @section streamselect, astreamselect
  12886. Select video or audio streams.
  12887. The filter accepts the following options:
  12888. @table @option
  12889. @item inputs
  12890. Set number of inputs. Default is 2.
  12891. @item map
  12892. Set input indexes to remap to outputs.
  12893. @end table
  12894. @subsection Commands
  12895. The @code{streamselect} and @code{astreamselect} filter supports the following
  12896. commands:
  12897. @table @option
  12898. @item map
  12899. Set input indexes to remap to outputs.
  12900. @end table
  12901. @subsection Examples
  12902. @itemize
  12903. @item
  12904. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12905. @example
  12906. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12907. @end example
  12908. @item
  12909. Same as above, but for audio:
  12910. @example
  12911. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12912. @end example
  12913. @end itemize
  12914. @anchor{subtitles}
  12915. @section subtitles
  12916. Draw subtitles on top of input video using the libass library.
  12917. To enable compilation of this filter you need to configure FFmpeg with
  12918. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12919. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12920. Alpha) subtitles format.
  12921. The filter accepts the following options:
  12922. @table @option
  12923. @item filename, f
  12924. Set the filename of the subtitle file to read. It must be specified.
  12925. @item original_size
  12926. Specify the size of the original video, the video for which the ASS file
  12927. was composed. For the syntax of this option, check the
  12928. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12929. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12930. correctly scale the fonts if the aspect ratio has been changed.
  12931. @item fontsdir
  12932. Set a directory path containing fonts that can be used by the filter.
  12933. These fonts will be used in addition to whatever the font provider uses.
  12934. @item alpha
  12935. Process alpha channel, by default alpha channel is untouched.
  12936. @item charenc
  12937. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12938. useful if not UTF-8.
  12939. @item stream_index, si
  12940. Set subtitles stream index. @code{subtitles} filter only.
  12941. @item force_style
  12942. Override default style or script info parameters of the subtitles. It accepts a
  12943. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12944. @end table
  12945. If the first key is not specified, it is assumed that the first value
  12946. specifies the @option{filename}.
  12947. For example, to render the file @file{sub.srt} on top of the input
  12948. video, use the command:
  12949. @example
  12950. subtitles=sub.srt
  12951. @end example
  12952. which is equivalent to:
  12953. @example
  12954. subtitles=filename=sub.srt
  12955. @end example
  12956. To render the default subtitles stream from file @file{video.mkv}, use:
  12957. @example
  12958. subtitles=video.mkv
  12959. @end example
  12960. To render the second subtitles stream from that file, use:
  12961. @example
  12962. subtitles=video.mkv:si=1
  12963. @end example
  12964. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12965. @code{DejaVu Serif}, use:
  12966. @example
  12967. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12968. @end example
  12969. @section super2xsai
  12970. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12971. Interpolate) pixel art scaling algorithm.
  12972. Useful for enlarging pixel art images without reducing sharpness.
  12973. @section swaprect
  12974. Swap two rectangular objects in video.
  12975. This filter accepts the following options:
  12976. @table @option
  12977. @item w
  12978. Set object width.
  12979. @item h
  12980. Set object height.
  12981. @item x1
  12982. Set 1st rect x coordinate.
  12983. @item y1
  12984. Set 1st rect y coordinate.
  12985. @item x2
  12986. Set 2nd rect x coordinate.
  12987. @item y2
  12988. Set 2nd rect y coordinate.
  12989. All expressions are evaluated once for each frame.
  12990. @end table
  12991. The all options are expressions containing the following constants:
  12992. @table @option
  12993. @item w
  12994. @item h
  12995. The input width and height.
  12996. @item a
  12997. same as @var{w} / @var{h}
  12998. @item sar
  12999. input sample aspect ratio
  13000. @item dar
  13001. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  13002. @item n
  13003. The number of the input frame, starting from 0.
  13004. @item t
  13005. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  13006. @item pos
  13007. the position in the file of the input frame, NAN if unknown
  13008. @end table
  13009. @section swapuv
  13010. Swap U & V plane.
  13011. @section telecine
  13012. Apply telecine process to the video.
  13013. This filter accepts the following options:
  13014. @table @option
  13015. @item first_field
  13016. @table @samp
  13017. @item top, t
  13018. top field first
  13019. @item bottom, b
  13020. bottom field first
  13021. The default value is @code{top}.
  13022. @end table
  13023. @item pattern
  13024. A string of numbers representing the pulldown pattern you wish to apply.
  13025. The default value is @code{23}.
  13026. @end table
  13027. @example
  13028. Some typical patterns:
  13029. NTSC output (30i):
  13030. 27.5p: 32222
  13031. 24p: 23 (classic)
  13032. 24p: 2332 (preferred)
  13033. 20p: 33
  13034. 18p: 334
  13035. 16p: 3444
  13036. PAL output (25i):
  13037. 27.5p: 12222
  13038. 24p: 222222222223 ("Euro pulldown")
  13039. 16.67p: 33
  13040. 16p: 33333334
  13041. @end example
  13042. @section threshold
  13043. Apply threshold effect to video stream.
  13044. This filter needs four video streams to perform thresholding.
  13045. First stream is stream we are filtering.
  13046. Second stream is holding threshold values, third stream is holding min values,
  13047. and last, fourth stream is holding max values.
  13048. The filter accepts the following option:
  13049. @table @option
  13050. @item planes
  13051. Set which planes will be processed, unprocessed planes will be copied.
  13052. By default value 0xf, all planes will be processed.
  13053. @end table
  13054. For example if first stream pixel's component value is less then threshold value
  13055. of pixel component from 2nd threshold stream, third stream value will picked,
  13056. otherwise fourth stream pixel component value will be picked.
  13057. Using color source filter one can perform various types of thresholding:
  13058. @subsection Examples
  13059. @itemize
  13060. @item
  13061. Binary threshold, using gray color as threshold:
  13062. @example
  13063. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  13064. @end example
  13065. @item
  13066. Inverted binary threshold, using gray color as threshold:
  13067. @example
  13068. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  13069. @end example
  13070. @item
  13071. Truncate binary threshold, using gray color as threshold:
  13072. @example
  13073. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  13074. @end example
  13075. @item
  13076. Threshold to zero, using gray color as threshold:
  13077. @example
  13078. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  13079. @end example
  13080. @item
  13081. Inverted threshold to zero, using gray color as threshold:
  13082. @example
  13083. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  13084. @end example
  13085. @end itemize
  13086. @section thumbnail
  13087. Select the most representative frame in a given sequence of consecutive frames.
  13088. The filter accepts the following options:
  13089. @table @option
  13090. @item n
  13091. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  13092. will pick one of them, and then handle the next batch of @var{n} frames until
  13093. the end. Default is @code{100}.
  13094. @end table
  13095. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  13096. value will result in a higher memory usage, so a high value is not recommended.
  13097. @subsection Examples
  13098. @itemize
  13099. @item
  13100. Extract one picture each 50 frames:
  13101. @example
  13102. thumbnail=50
  13103. @end example
  13104. @item
  13105. Complete example of a thumbnail creation with @command{ffmpeg}:
  13106. @example
  13107. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  13108. @end example
  13109. @end itemize
  13110. @section tile
  13111. Tile several successive frames together.
  13112. The filter accepts the following options:
  13113. @table @option
  13114. @item layout
  13115. Set the grid size (i.e. the number of lines and columns). For the syntax of
  13116. this option, check the
  13117. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13118. @item nb_frames
  13119. Set the maximum number of frames to render in the given area. It must be less
  13120. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  13121. the area will be used.
  13122. @item margin
  13123. Set the outer border margin in pixels.
  13124. @item padding
  13125. Set the inner border thickness (i.e. the number of pixels between frames). For
  13126. more advanced padding options (such as having different values for the edges),
  13127. refer to the pad video filter.
  13128. @item color
  13129. Specify the color of the unused area. For the syntax of this option, check the
  13130. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13131. The default value of @var{color} is "black".
  13132. @item overlap
  13133. Set the number of frames to overlap when tiling several successive frames together.
  13134. The value must be between @code{0} and @var{nb_frames - 1}.
  13135. @item init_padding
  13136. Set the number of frames to initially be empty before displaying first output frame.
  13137. This controls how soon will one get first output frame.
  13138. The value must be between @code{0} and @var{nb_frames - 1}.
  13139. @end table
  13140. @subsection Examples
  13141. @itemize
  13142. @item
  13143. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  13144. @example
  13145. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  13146. @end example
  13147. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  13148. duplicating each output frame to accommodate the originally detected frame
  13149. rate.
  13150. @item
  13151. Display @code{5} pictures in an area of @code{3x2} frames,
  13152. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  13153. mixed flat and named options:
  13154. @example
  13155. tile=3x2:nb_frames=5:padding=7:margin=2
  13156. @end example
  13157. @end itemize
  13158. @section tinterlace
  13159. Perform various types of temporal field interlacing.
  13160. Frames are counted starting from 1, so the first input frame is
  13161. considered odd.
  13162. The filter accepts the following options:
  13163. @table @option
  13164. @item mode
  13165. Specify the mode of the interlacing. This option can also be specified
  13166. as a value alone. See below for a list of values for this option.
  13167. Available values are:
  13168. @table @samp
  13169. @item merge, 0
  13170. Move odd frames into the upper field, even into the lower field,
  13171. generating a double height frame at half frame rate.
  13172. @example
  13173. ------> time
  13174. Input:
  13175. Frame 1 Frame 2 Frame 3 Frame 4
  13176. 11111 22222 33333 44444
  13177. 11111 22222 33333 44444
  13178. 11111 22222 33333 44444
  13179. 11111 22222 33333 44444
  13180. Output:
  13181. 11111 33333
  13182. 22222 44444
  13183. 11111 33333
  13184. 22222 44444
  13185. 11111 33333
  13186. 22222 44444
  13187. 11111 33333
  13188. 22222 44444
  13189. @end example
  13190. @item drop_even, 1
  13191. Only output odd frames, even frames are dropped, generating a frame with
  13192. unchanged height at half frame rate.
  13193. @example
  13194. ------> time
  13195. Input:
  13196. Frame 1 Frame 2 Frame 3 Frame 4
  13197. 11111 22222 33333 44444
  13198. 11111 22222 33333 44444
  13199. 11111 22222 33333 44444
  13200. 11111 22222 33333 44444
  13201. Output:
  13202. 11111 33333
  13203. 11111 33333
  13204. 11111 33333
  13205. 11111 33333
  13206. @end example
  13207. @item drop_odd, 2
  13208. Only output even frames, odd frames are dropped, generating a frame with
  13209. unchanged height at half frame rate.
  13210. @example
  13211. ------> time
  13212. Input:
  13213. Frame 1 Frame 2 Frame 3 Frame 4
  13214. 11111 22222 33333 44444
  13215. 11111 22222 33333 44444
  13216. 11111 22222 33333 44444
  13217. 11111 22222 33333 44444
  13218. Output:
  13219. 22222 44444
  13220. 22222 44444
  13221. 22222 44444
  13222. 22222 44444
  13223. @end example
  13224. @item pad, 3
  13225. Expand each frame to full height, but pad alternate lines with black,
  13226. generating a frame with double height at the same input frame rate.
  13227. @example
  13228. ------> time
  13229. Input:
  13230. Frame 1 Frame 2 Frame 3 Frame 4
  13231. 11111 22222 33333 44444
  13232. 11111 22222 33333 44444
  13233. 11111 22222 33333 44444
  13234. 11111 22222 33333 44444
  13235. Output:
  13236. 11111 ..... 33333 .....
  13237. ..... 22222 ..... 44444
  13238. 11111 ..... 33333 .....
  13239. ..... 22222 ..... 44444
  13240. 11111 ..... 33333 .....
  13241. ..... 22222 ..... 44444
  13242. 11111 ..... 33333 .....
  13243. ..... 22222 ..... 44444
  13244. @end example
  13245. @item interleave_top, 4
  13246. Interleave the upper field from odd frames with the lower field from
  13247. even frames, generating a frame with unchanged height at half frame rate.
  13248. @example
  13249. ------> time
  13250. Input:
  13251. Frame 1 Frame 2 Frame 3 Frame 4
  13252. 11111<- 22222 33333<- 44444
  13253. 11111 22222<- 33333 44444<-
  13254. 11111<- 22222 33333<- 44444
  13255. 11111 22222<- 33333 44444<-
  13256. Output:
  13257. 11111 33333
  13258. 22222 44444
  13259. 11111 33333
  13260. 22222 44444
  13261. @end example
  13262. @item interleave_bottom, 5
  13263. Interleave the lower field from odd frames with the upper field from
  13264. even frames, generating a frame with unchanged height at half frame rate.
  13265. @example
  13266. ------> time
  13267. Input:
  13268. Frame 1 Frame 2 Frame 3 Frame 4
  13269. 11111 22222<- 33333 44444<-
  13270. 11111<- 22222 33333<- 44444
  13271. 11111 22222<- 33333 44444<-
  13272. 11111<- 22222 33333<- 44444
  13273. Output:
  13274. 22222 44444
  13275. 11111 33333
  13276. 22222 44444
  13277. 11111 33333
  13278. @end example
  13279. @item interlacex2, 6
  13280. Double frame rate with unchanged height. Frames are inserted each
  13281. containing the second temporal field from the previous input frame and
  13282. the first temporal field from the next input frame. This mode relies on
  13283. the top_field_first flag. Useful for interlaced video displays with no
  13284. field synchronisation.
  13285. @example
  13286. ------> time
  13287. Input:
  13288. Frame 1 Frame 2 Frame 3 Frame 4
  13289. 11111 22222 33333 44444
  13290. 11111 22222 33333 44444
  13291. 11111 22222 33333 44444
  13292. 11111 22222 33333 44444
  13293. Output:
  13294. 11111 22222 22222 33333 33333 44444 44444
  13295. 11111 11111 22222 22222 33333 33333 44444
  13296. 11111 22222 22222 33333 33333 44444 44444
  13297. 11111 11111 22222 22222 33333 33333 44444
  13298. @end example
  13299. @item mergex2, 7
  13300. Move odd frames into the upper field, even into the lower field,
  13301. generating a double height frame at same frame rate.
  13302. @example
  13303. ------> time
  13304. Input:
  13305. Frame 1 Frame 2 Frame 3 Frame 4
  13306. 11111 22222 33333 44444
  13307. 11111 22222 33333 44444
  13308. 11111 22222 33333 44444
  13309. 11111 22222 33333 44444
  13310. Output:
  13311. 11111 33333 33333 55555
  13312. 22222 22222 44444 44444
  13313. 11111 33333 33333 55555
  13314. 22222 22222 44444 44444
  13315. 11111 33333 33333 55555
  13316. 22222 22222 44444 44444
  13317. 11111 33333 33333 55555
  13318. 22222 22222 44444 44444
  13319. @end example
  13320. @end table
  13321. Numeric values are deprecated but are accepted for backward
  13322. compatibility reasons.
  13323. Default mode is @code{merge}.
  13324. @item flags
  13325. Specify flags influencing the filter process.
  13326. Available value for @var{flags} is:
  13327. @table @option
  13328. @item low_pass_filter, vlpf
  13329. Enable linear vertical low-pass filtering in the filter.
  13330. Vertical low-pass filtering is required when creating an interlaced
  13331. destination from a progressive source which contains high-frequency
  13332. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  13333. patterning.
  13334. @item complex_filter, cvlpf
  13335. Enable complex vertical low-pass filtering.
  13336. This will slightly less reduce interlace 'twitter' and Moire
  13337. patterning but better retain detail and subjective sharpness impression.
  13338. @end table
  13339. Vertical low-pass filtering can only be enabled for @option{mode}
  13340. @var{interleave_top} and @var{interleave_bottom}.
  13341. @end table
  13342. @section tmix
  13343. Mix successive video frames.
  13344. A description of the accepted options follows.
  13345. @table @option
  13346. @item frames
  13347. The number of successive frames to mix. If unspecified, it defaults to 3.
  13348. @item weights
  13349. Specify weight of each input video frame.
  13350. Each weight is separated by space. If number of weights is smaller than
  13351. number of @var{frames} last specified weight will be used for all remaining
  13352. unset weights.
  13353. @item scale
  13354. Specify scale, if it is set it will be multiplied with sum
  13355. of each weight multiplied with pixel values to give final destination
  13356. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13357. @end table
  13358. @subsection Examples
  13359. @itemize
  13360. @item
  13361. Average 7 successive frames:
  13362. @example
  13363. tmix=frames=7:weights="1 1 1 1 1 1 1"
  13364. @end example
  13365. @item
  13366. Apply simple temporal convolution:
  13367. @example
  13368. tmix=frames=3:weights="-1 3 -1"
  13369. @end example
  13370. @item
  13371. Similar as above but only showing temporal differences:
  13372. @example
  13373. tmix=frames=3:weights="-1 2 -1":scale=1
  13374. @end example
  13375. @end itemize
  13376. @anchor{tonemap}
  13377. @section tonemap
  13378. Tone map colors from different dynamic ranges.
  13379. This filter expects data in single precision floating point, as it needs to
  13380. operate on (and can output) out-of-range values. Another filter, such as
  13381. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  13382. The tonemapping algorithms implemented only work on linear light, so input
  13383. data should be linearized beforehand (and possibly correctly tagged).
  13384. @example
  13385. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  13386. @end example
  13387. @subsection Options
  13388. The filter accepts the following options.
  13389. @table @option
  13390. @item tonemap
  13391. Set the tone map algorithm to use.
  13392. Possible values are:
  13393. @table @var
  13394. @item none
  13395. Do not apply any tone map, only desaturate overbright pixels.
  13396. @item clip
  13397. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13398. in-range values, while distorting out-of-range values.
  13399. @item linear
  13400. Stretch the entire reference gamut to a linear multiple of the display.
  13401. @item gamma
  13402. Fit a logarithmic transfer between the tone curves.
  13403. @item reinhard
  13404. Preserve overall image brightness with a simple curve, using nonlinear
  13405. contrast, which results in flattening details and degrading color accuracy.
  13406. @item hable
  13407. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13408. of slightly darkening everything. Use it when detail preservation is more
  13409. important than color and brightness accuracy.
  13410. @item mobius
  13411. Smoothly map out-of-range values, while retaining contrast and colors for
  13412. in-range material as much as possible. Use it when color accuracy is more
  13413. important than detail preservation.
  13414. @end table
  13415. Default is none.
  13416. @item param
  13417. Tune the tone mapping algorithm.
  13418. This affects the following algorithms:
  13419. @table @var
  13420. @item none
  13421. Ignored.
  13422. @item linear
  13423. Specifies the scale factor to use while stretching.
  13424. Default to 1.0.
  13425. @item gamma
  13426. Specifies the exponent of the function.
  13427. Default to 1.8.
  13428. @item clip
  13429. Specify an extra linear coefficient to multiply into the signal before clipping.
  13430. Default to 1.0.
  13431. @item reinhard
  13432. Specify the local contrast coefficient at the display peak.
  13433. Default to 0.5, which means that in-gamut values will be about half as bright
  13434. as when clipping.
  13435. @item hable
  13436. Ignored.
  13437. @item mobius
  13438. Specify the transition point from linear to mobius transform. Every value
  13439. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13440. more accurate the result will be, at the cost of losing bright details.
  13441. Default to 0.3, which due to the steep initial slope still preserves in-range
  13442. colors fairly accurately.
  13443. @end table
  13444. @item desat
  13445. Apply desaturation for highlights that exceed this level of brightness. The
  13446. higher the parameter, the more color information will be preserved. This
  13447. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13448. (smoothly) turning into white instead. This makes images feel more natural,
  13449. at the cost of reducing information about out-of-range colors.
  13450. The default of 2.0 is somewhat conservative and will mostly just apply to
  13451. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13452. This option works only if the input frame has a supported color tag.
  13453. @item peak
  13454. Override signal/nominal/reference peak with this value. Useful when the
  13455. embedded peak information in display metadata is not reliable or when tone
  13456. mapping from a lower range to a higher range.
  13457. @end table
  13458. @section tpad
  13459. Temporarily pad video frames.
  13460. The filter accepts the following options:
  13461. @table @option
  13462. @item start
  13463. Specify number of delay frames before input video stream.
  13464. @item stop
  13465. Specify number of padding frames after input video stream.
  13466. Set to -1 to pad indefinitely.
  13467. @item start_mode
  13468. Set kind of frames added to beginning of stream.
  13469. Can be either @var{add} or @var{clone}.
  13470. With @var{add} frames of solid-color are added.
  13471. With @var{clone} frames are clones of first frame.
  13472. @item stop_mode
  13473. Set kind of frames added to end of stream.
  13474. Can be either @var{add} or @var{clone}.
  13475. With @var{add} frames of solid-color are added.
  13476. With @var{clone} frames are clones of last frame.
  13477. @item start_duration, stop_duration
  13478. Specify the duration of the start/stop delay. See
  13479. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13480. for the accepted syntax.
  13481. These options override @var{start} and @var{stop}.
  13482. @item color
  13483. Specify the color of the padded area. For the syntax of this option,
  13484. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13485. manual,ffmpeg-utils}.
  13486. The default value of @var{color} is "black".
  13487. @end table
  13488. @anchor{transpose}
  13489. @section transpose
  13490. Transpose rows with columns in the input video and optionally flip it.
  13491. It accepts the following parameters:
  13492. @table @option
  13493. @item dir
  13494. Specify the transposition direction.
  13495. Can assume the following values:
  13496. @table @samp
  13497. @item 0, 4, cclock_flip
  13498. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13499. @example
  13500. L.R L.l
  13501. . . -> . .
  13502. l.r R.r
  13503. @end example
  13504. @item 1, 5, clock
  13505. Rotate by 90 degrees clockwise, that is:
  13506. @example
  13507. L.R l.L
  13508. . . -> . .
  13509. l.r r.R
  13510. @end example
  13511. @item 2, 6, cclock
  13512. Rotate by 90 degrees counterclockwise, that is:
  13513. @example
  13514. L.R R.r
  13515. . . -> . .
  13516. l.r L.l
  13517. @end example
  13518. @item 3, 7, clock_flip
  13519. Rotate by 90 degrees clockwise and vertically flip, that is:
  13520. @example
  13521. L.R r.R
  13522. . . -> . .
  13523. l.r l.L
  13524. @end example
  13525. @end table
  13526. For values between 4-7, the transposition is only done if the input
  13527. video geometry is portrait and not landscape. These values are
  13528. deprecated, the @code{passthrough} option should be used instead.
  13529. Numerical values are deprecated, and should be dropped in favor of
  13530. symbolic constants.
  13531. @item passthrough
  13532. Do not apply the transposition if the input geometry matches the one
  13533. specified by the specified value. It accepts the following values:
  13534. @table @samp
  13535. @item none
  13536. Always apply transposition.
  13537. @item portrait
  13538. Preserve portrait geometry (when @var{height} >= @var{width}).
  13539. @item landscape
  13540. Preserve landscape geometry (when @var{width} >= @var{height}).
  13541. @end table
  13542. Default value is @code{none}.
  13543. @end table
  13544. For example to rotate by 90 degrees clockwise and preserve portrait
  13545. layout:
  13546. @example
  13547. transpose=dir=1:passthrough=portrait
  13548. @end example
  13549. The command above can also be specified as:
  13550. @example
  13551. transpose=1:portrait
  13552. @end example
  13553. @section transpose_npp
  13554. Transpose rows with columns in the input video and optionally flip it.
  13555. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13556. It accepts the following parameters:
  13557. @table @option
  13558. @item dir
  13559. Specify the transposition direction.
  13560. Can assume the following values:
  13561. @table @samp
  13562. @item cclock_flip
  13563. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13564. @item clock
  13565. Rotate by 90 degrees clockwise.
  13566. @item cclock
  13567. Rotate by 90 degrees counterclockwise.
  13568. @item clock_flip
  13569. Rotate by 90 degrees clockwise and vertically flip.
  13570. @end table
  13571. @item passthrough
  13572. Do not apply the transposition if the input geometry matches the one
  13573. specified by the specified value. It accepts the following values:
  13574. @table @samp
  13575. @item none
  13576. Always apply transposition. (default)
  13577. @item portrait
  13578. Preserve portrait geometry (when @var{height} >= @var{width}).
  13579. @item landscape
  13580. Preserve landscape geometry (when @var{width} >= @var{height}).
  13581. @end table
  13582. @end table
  13583. @section trim
  13584. Trim the input so that the output contains one continuous subpart of the input.
  13585. It accepts the following parameters:
  13586. @table @option
  13587. @item start
  13588. Specify the time of the start of the kept section, i.e. the frame with the
  13589. timestamp @var{start} will be the first frame in the output.
  13590. @item end
  13591. Specify the time of the first frame that will be dropped, i.e. the frame
  13592. immediately preceding the one with the timestamp @var{end} will be the last
  13593. frame in the output.
  13594. @item start_pts
  13595. This is the same as @var{start}, except this option sets the start timestamp
  13596. in timebase units instead of seconds.
  13597. @item end_pts
  13598. This is the same as @var{end}, except this option sets the end timestamp
  13599. in timebase units instead of seconds.
  13600. @item duration
  13601. The maximum duration of the output in seconds.
  13602. @item start_frame
  13603. The number of the first frame that should be passed to the output.
  13604. @item end_frame
  13605. The number of the first frame that should be dropped.
  13606. @end table
  13607. @option{start}, @option{end}, and @option{duration} are expressed as time
  13608. duration specifications; see
  13609. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13610. for the accepted syntax.
  13611. Note that the first two sets of the start/end options and the @option{duration}
  13612. option look at the frame timestamp, while the _frame variants simply count the
  13613. frames that pass through the filter. Also note that this filter does not modify
  13614. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13615. setpts filter after the trim filter.
  13616. If multiple start or end options are set, this filter tries to be greedy and
  13617. keep all the frames that match at least one of the specified constraints. To keep
  13618. only the part that matches all the constraints at once, chain multiple trim
  13619. filters.
  13620. The defaults are such that all the input is kept. So it is possible to set e.g.
  13621. just the end values to keep everything before the specified time.
  13622. Examples:
  13623. @itemize
  13624. @item
  13625. Drop everything except the second minute of input:
  13626. @example
  13627. ffmpeg -i INPUT -vf trim=60:120
  13628. @end example
  13629. @item
  13630. Keep only the first second:
  13631. @example
  13632. ffmpeg -i INPUT -vf trim=duration=1
  13633. @end example
  13634. @end itemize
  13635. @section unpremultiply
  13636. Apply alpha unpremultiply effect to input video stream using first plane
  13637. of second stream as alpha.
  13638. Both streams must have same dimensions and same pixel format.
  13639. The filter accepts the following option:
  13640. @table @option
  13641. @item planes
  13642. Set which planes will be processed, unprocessed planes will be copied.
  13643. By default value 0xf, all planes will be processed.
  13644. If the format has 1 or 2 components, then luma is bit 0.
  13645. If the format has 3 or 4 components:
  13646. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13647. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13648. If present, the alpha channel is always the last bit.
  13649. @item inplace
  13650. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13651. @end table
  13652. @anchor{unsharp}
  13653. @section unsharp
  13654. Sharpen or blur the input video.
  13655. It accepts the following parameters:
  13656. @table @option
  13657. @item luma_msize_x, lx
  13658. Set the luma matrix horizontal size. It must be an odd integer between
  13659. 3 and 23. The default value is 5.
  13660. @item luma_msize_y, ly
  13661. Set the luma matrix vertical size. It must be an odd integer between 3
  13662. and 23. The default value is 5.
  13663. @item luma_amount, la
  13664. Set the luma effect strength. It must be a floating point number, reasonable
  13665. values lay between -1.5 and 1.5.
  13666. Negative values will blur the input video, while positive values will
  13667. sharpen it, a value of zero will disable the effect.
  13668. Default value is 1.0.
  13669. @item chroma_msize_x, cx
  13670. Set the chroma matrix horizontal size. It must be an odd integer
  13671. between 3 and 23. The default value is 5.
  13672. @item chroma_msize_y, cy
  13673. Set the chroma matrix vertical size. It must be an odd integer
  13674. between 3 and 23. The default value is 5.
  13675. @item chroma_amount, ca
  13676. Set the chroma effect strength. It must be a floating point number, reasonable
  13677. values lay between -1.5 and 1.5.
  13678. Negative values will blur the input video, while positive values will
  13679. sharpen it, a value of zero will disable the effect.
  13680. Default value is 0.0.
  13681. @end table
  13682. All parameters are optional and default to the equivalent of the
  13683. string '5:5:1.0:5:5:0.0'.
  13684. @subsection Examples
  13685. @itemize
  13686. @item
  13687. Apply strong luma sharpen effect:
  13688. @example
  13689. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13690. @end example
  13691. @item
  13692. Apply a strong blur of both luma and chroma parameters:
  13693. @example
  13694. unsharp=7:7:-2:7:7:-2
  13695. @end example
  13696. @end itemize
  13697. @section uspp
  13698. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13699. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13700. shifts and average the results.
  13701. The way this differs from the behavior of spp is that uspp actually encodes &
  13702. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13703. DCT similar to MJPEG.
  13704. The filter accepts the following options:
  13705. @table @option
  13706. @item quality
  13707. Set quality. This option defines the number of levels for averaging. It accepts
  13708. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13709. effect. A value of @code{8} means the higher quality. For each increment of
  13710. that value the speed drops by a factor of approximately 2. Default value is
  13711. @code{3}.
  13712. @item qp
  13713. Force a constant quantization parameter. If not set, the filter will use the QP
  13714. from the video stream (if available).
  13715. @end table
  13716. @section v360
  13717. Convert 360 videos between various formats.
  13718. The filter accepts the following options:
  13719. @table @option
  13720. @item input
  13721. @item output
  13722. Set format of the input/output video.
  13723. Available formats:
  13724. @table @samp
  13725. @item e
  13726. @item equirect
  13727. Equirectangular projection.
  13728. @item c3x2
  13729. @item c6x1
  13730. @item c1x6
  13731. Cubemap with 3x2/6x1/1x6 layout.
  13732. Format specific options:
  13733. @table @option
  13734. @item in_pad
  13735. @item out_pad
  13736. Set padding proportion for the input/output cubemap. Values in decimals.
  13737. Example values:
  13738. @table @samp
  13739. @item 0
  13740. No padding.
  13741. @item 0.01
  13742. 1% of face is padding. For example, with 1920x1280 resolution face size would be 640x640 and padding would be 3 pixels from each side. (640 * 0.01 = 6 pixels)
  13743. @end table
  13744. Default value is @b{@samp{0}}.
  13745. @item fin_pad
  13746. @item fout_pad
  13747. Set fixed padding for the input/output cubemap. Values in pixels.
  13748. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  13749. @item in_forder
  13750. @item out_forder
  13751. Set order of faces for the input/output cubemap. Choose one direction for each position.
  13752. Designation of directions:
  13753. @table @samp
  13754. @item r
  13755. right
  13756. @item l
  13757. left
  13758. @item u
  13759. up
  13760. @item d
  13761. down
  13762. @item f
  13763. forward
  13764. @item b
  13765. back
  13766. @end table
  13767. Default value is @b{@samp{rludfb}}.
  13768. @item in_frot
  13769. @item out_frot
  13770. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  13771. Designation of angles:
  13772. @table @samp
  13773. @item 0
  13774. 0 degrees clockwise
  13775. @item 1
  13776. 90 degrees clockwise
  13777. @item 2
  13778. 180 degrees clockwise
  13779. @item 3
  13780. 270 degrees clockwise
  13781. @end table
  13782. Default value is @b{@samp{000000}}.
  13783. @end table
  13784. @item eac
  13785. Equi-Angular Cubemap.
  13786. @item flat
  13787. @item gnomonic
  13788. @item rectilinear
  13789. Regular video. @i{(output only)}
  13790. Format specific options:
  13791. @table @option
  13792. @item h_fov
  13793. @item v_fov
  13794. @item d_fov
  13795. Set horizontal/vertical/diagonal field of view. Values in degrees.
  13796. If diagonal field of view is set it overrides horizontal and vertical field of view.
  13797. @end table
  13798. @item dfisheye
  13799. Dual fisheye.
  13800. Format specific options:
  13801. @table @option
  13802. @item in_pad
  13803. @item out_pad
  13804. Set padding proportion. Values in decimals.
  13805. Example values:
  13806. @table @samp
  13807. @item 0
  13808. No padding.
  13809. @item 0.01
  13810. 1% padding.
  13811. @end table
  13812. Default value is @b{@samp{0}}.
  13813. @end table
  13814. @item barrel
  13815. @item fb
  13816. Facebook's 360 format.
  13817. @item sg
  13818. Stereographic format.
  13819. Format specific options:
  13820. @table @option
  13821. @item h_fov
  13822. @item v_fov
  13823. @item d_fov
  13824. Set horizontal/vertical/diagonal field of view. Values in degrees.
  13825. If diagonal field of view is set it overrides horizontal and vertical field of view.
  13826. @end table
  13827. @item mercator
  13828. Mercator format.
  13829. @item ball
  13830. Ball format, gives significant distortion toward the back.
  13831. @item hammer
  13832. Hammer-Aitoff map projection format.
  13833. @item sinusoidal
  13834. Sinusoidal map projection format.
  13835. @end table
  13836. @item interp
  13837. Set interpolation method.@*
  13838. @i{Note: more complex interpolation methods require much more memory to run.}
  13839. Available methods:
  13840. @table @samp
  13841. @item near
  13842. @item nearest
  13843. Nearest neighbour.
  13844. @item line
  13845. @item linear
  13846. Bilinear interpolation.
  13847. @item cube
  13848. @item cubic
  13849. Bicubic interpolation.
  13850. @item lanc
  13851. @item lanczos
  13852. Lanczos interpolation.
  13853. @end table
  13854. Default value is @b{@samp{line}}.
  13855. @item w
  13856. @item h
  13857. Set the output video resolution.
  13858. Default resolution depends on formats.
  13859. @item in_stereo
  13860. @item out_stereo
  13861. Set the input/output stereo format.
  13862. @table @samp
  13863. @item 2d
  13864. 2D mono
  13865. @item sbs
  13866. Side by side
  13867. @item tb
  13868. Top bottom
  13869. @end table
  13870. Default value is @b{@samp{2d}} for input and output format.
  13871. @item yaw
  13872. @item pitch
  13873. @item roll
  13874. Set rotation for the output video. Values in degrees.
  13875. @item rorder
  13876. Set rotation order for the output video. Choose one item for each position.
  13877. @table @samp
  13878. @item y, Y
  13879. yaw
  13880. @item p, P
  13881. pitch
  13882. @item r, R
  13883. roll
  13884. @end table
  13885. Default value is @b{@samp{ypr}}.
  13886. @item h_flip
  13887. @item v_flip
  13888. @item d_flip
  13889. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  13890. @item ih_flip
  13891. @item iv_flip
  13892. Set if input video is flipped horizontally/vertically. Boolean values.
  13893. @item in_trans
  13894. Set if input video is transposed. Boolean value, by default disabled.
  13895. @item out_trans
  13896. Set if output video needs to be transposed. Boolean value, by default disabled.
  13897. @end table
  13898. @subsection Examples
  13899. @itemize
  13900. @item
  13901. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  13902. @example
  13903. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  13904. @end example
  13905. @item
  13906. Extract back view of Equi-Angular Cubemap:
  13907. @example
  13908. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  13909. @end example
  13910. @item
  13911. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  13912. @example
  13913. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  13914. @end example
  13915. @end itemize
  13916. @section vaguedenoiser
  13917. Apply a wavelet based denoiser.
  13918. It transforms each frame from the video input into the wavelet domain,
  13919. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13920. the obtained coefficients. It does an inverse wavelet transform after.
  13921. Due to wavelet properties, it should give a nice smoothed result, and
  13922. reduced noise, without blurring picture features.
  13923. This filter accepts the following options:
  13924. @table @option
  13925. @item threshold
  13926. The filtering strength. The higher, the more filtered the video will be.
  13927. Hard thresholding can use a higher threshold than soft thresholding
  13928. before the video looks overfiltered. Default value is 2.
  13929. @item method
  13930. The filtering method the filter will use.
  13931. It accepts the following values:
  13932. @table @samp
  13933. @item hard
  13934. All values under the threshold will be zeroed.
  13935. @item soft
  13936. All values under the threshold will be zeroed. All values above will be
  13937. reduced by the threshold.
  13938. @item garrote
  13939. Scales or nullifies coefficients - intermediary between (more) soft and
  13940. (less) hard thresholding.
  13941. @end table
  13942. Default is garrote.
  13943. @item nsteps
  13944. Number of times, the wavelet will decompose the picture. Picture can't
  13945. be decomposed beyond a particular point (typically, 8 for a 640x480
  13946. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13947. @item percent
  13948. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13949. @item planes
  13950. A list of the planes to process. By default all planes are processed.
  13951. @end table
  13952. @section vectorscope
  13953. Display 2 color component values in the two dimensional graph (which is called
  13954. a vectorscope).
  13955. This filter accepts the following options:
  13956. @table @option
  13957. @item mode, m
  13958. Set vectorscope mode.
  13959. It accepts the following values:
  13960. @table @samp
  13961. @item gray
  13962. Gray values are displayed on graph, higher brightness means more pixels have
  13963. same component color value on location in graph. This is the default mode.
  13964. @item color
  13965. Gray values are displayed on graph. Surrounding pixels values which are not
  13966. present in video frame are drawn in gradient of 2 color components which are
  13967. set by option @code{x} and @code{y}. The 3rd color component is static.
  13968. @item color2
  13969. Actual color components values present in video frame are displayed on graph.
  13970. @item color3
  13971. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13972. on graph increases value of another color component, which is luminance by
  13973. default values of @code{x} and @code{y}.
  13974. @item color4
  13975. Actual colors present in video frame are displayed on graph. If two different
  13976. colors map to same position on graph then color with higher value of component
  13977. not present in graph is picked.
  13978. @item color5
  13979. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13980. component picked from radial gradient.
  13981. @end table
  13982. @item x
  13983. Set which color component will be represented on X-axis. Default is @code{1}.
  13984. @item y
  13985. Set which color component will be represented on Y-axis. Default is @code{2}.
  13986. @item intensity, i
  13987. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13988. of color component which represents frequency of (X, Y) location in graph.
  13989. @item envelope, e
  13990. @table @samp
  13991. @item none
  13992. No envelope, this is default.
  13993. @item instant
  13994. Instant envelope, even darkest single pixel will be clearly highlighted.
  13995. @item peak
  13996. Hold maximum and minimum values presented in graph over time. This way you
  13997. can still spot out of range values without constantly looking at vectorscope.
  13998. @item peak+instant
  13999. Peak and instant envelope combined together.
  14000. @end table
  14001. @item graticule, g
  14002. Set what kind of graticule to draw.
  14003. @table @samp
  14004. @item none
  14005. @item green
  14006. @item color
  14007. @end table
  14008. @item opacity, o
  14009. Set graticule opacity.
  14010. @item flags, f
  14011. Set graticule flags.
  14012. @table @samp
  14013. @item white
  14014. Draw graticule for white point.
  14015. @item black
  14016. Draw graticule for black point.
  14017. @item name
  14018. Draw color points short names.
  14019. @end table
  14020. @item bgopacity, b
  14021. Set background opacity.
  14022. @item lthreshold, l
  14023. Set low threshold for color component not represented on X or Y axis.
  14024. Values lower than this value will be ignored. Default is 0.
  14025. Note this value is multiplied with actual max possible value one pixel component
  14026. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  14027. is 0.1 * 255 = 25.
  14028. @item hthreshold, h
  14029. Set high threshold for color component not represented on X or Y axis.
  14030. Values higher than this value will be ignored. Default is 1.
  14031. Note this value is multiplied with actual max possible value one pixel component
  14032. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  14033. is 0.9 * 255 = 230.
  14034. @item colorspace, c
  14035. Set what kind of colorspace to use when drawing graticule.
  14036. @table @samp
  14037. @item auto
  14038. @item 601
  14039. @item 709
  14040. @end table
  14041. Default is auto.
  14042. @end table
  14043. @anchor{vidstabdetect}
  14044. @section vidstabdetect
  14045. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  14046. @ref{vidstabtransform} for pass 2.
  14047. This filter generates a file with relative translation and rotation
  14048. transform information about subsequent frames, which is then used by
  14049. the @ref{vidstabtransform} filter.
  14050. To enable compilation of this filter you need to configure FFmpeg with
  14051. @code{--enable-libvidstab}.
  14052. This filter accepts the following options:
  14053. @table @option
  14054. @item result
  14055. Set the path to the file used to write the transforms information.
  14056. Default value is @file{transforms.trf}.
  14057. @item shakiness
  14058. Set how shaky the video is and how quick the camera is. It accepts an
  14059. integer in the range 1-10, a value of 1 means little shakiness, a
  14060. value of 10 means strong shakiness. Default value is 5.
  14061. @item accuracy
  14062. Set the accuracy of the detection process. It must be a value in the
  14063. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  14064. accuracy. Default value is 15.
  14065. @item stepsize
  14066. Set stepsize of the search process. The region around minimum is
  14067. scanned with 1 pixel resolution. Default value is 6.
  14068. @item mincontrast
  14069. Set minimum contrast. Below this value a local measurement field is
  14070. discarded. Must be a floating point value in the range 0-1. Default
  14071. value is 0.3.
  14072. @item tripod
  14073. Set reference frame number for tripod mode.
  14074. If enabled, the motion of the frames is compared to a reference frame
  14075. in the filtered stream, identified by the specified number. The idea
  14076. is to compensate all movements in a more-or-less static scene and keep
  14077. the camera view absolutely still.
  14078. If set to 0, it is disabled. The frames are counted starting from 1.
  14079. @item show
  14080. Show fields and transforms in the resulting frames. It accepts an
  14081. integer in the range 0-2. Default value is 0, which disables any
  14082. visualization.
  14083. @end table
  14084. @subsection Examples
  14085. @itemize
  14086. @item
  14087. Use default values:
  14088. @example
  14089. vidstabdetect
  14090. @end example
  14091. @item
  14092. Analyze strongly shaky movie and put the results in file
  14093. @file{mytransforms.trf}:
  14094. @example
  14095. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  14096. @end example
  14097. @item
  14098. Visualize the result of internal transformations in the resulting
  14099. video:
  14100. @example
  14101. vidstabdetect=show=1
  14102. @end example
  14103. @item
  14104. Analyze a video with medium shakiness using @command{ffmpeg}:
  14105. @example
  14106. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  14107. @end example
  14108. @end itemize
  14109. @anchor{vidstabtransform}
  14110. @section vidstabtransform
  14111. Video stabilization/deshaking: pass 2 of 2,
  14112. see @ref{vidstabdetect} for pass 1.
  14113. Read a file with transform information for each frame and
  14114. apply/compensate them. Together with the @ref{vidstabdetect}
  14115. filter this can be used to deshake videos. See also
  14116. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  14117. the @ref{unsharp} filter, see below.
  14118. To enable compilation of this filter you need to configure FFmpeg with
  14119. @code{--enable-libvidstab}.
  14120. @subsection Options
  14121. @table @option
  14122. @item input
  14123. Set path to the file used to read the transforms. Default value is
  14124. @file{transforms.trf}.
  14125. @item smoothing
  14126. Set the number of frames (value*2 + 1) used for lowpass filtering the
  14127. camera movements. Default value is 10.
  14128. For example a number of 10 means that 21 frames are used (10 in the
  14129. past and 10 in the future) to smoothen the motion in the video. A
  14130. larger value leads to a smoother video, but limits the acceleration of
  14131. the camera (pan/tilt movements). 0 is a special case where a static
  14132. camera is simulated.
  14133. @item optalgo
  14134. Set the camera path optimization algorithm.
  14135. Accepted values are:
  14136. @table @samp
  14137. @item gauss
  14138. gaussian kernel low-pass filter on camera motion (default)
  14139. @item avg
  14140. averaging on transformations
  14141. @end table
  14142. @item maxshift
  14143. Set maximal number of pixels to translate frames. Default value is -1,
  14144. meaning no limit.
  14145. @item maxangle
  14146. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  14147. value is -1, meaning no limit.
  14148. @item crop
  14149. Specify how to deal with borders that may be visible due to movement
  14150. compensation.
  14151. Available values are:
  14152. @table @samp
  14153. @item keep
  14154. keep image information from previous frame (default)
  14155. @item black
  14156. fill the border black
  14157. @end table
  14158. @item invert
  14159. Invert transforms if set to 1. Default value is 0.
  14160. @item relative
  14161. Consider transforms as relative to previous frame if set to 1,
  14162. absolute if set to 0. Default value is 0.
  14163. @item zoom
  14164. Set percentage to zoom. A positive value will result in a zoom-in
  14165. effect, a negative value in a zoom-out effect. Default value is 0 (no
  14166. zoom).
  14167. @item optzoom
  14168. Set optimal zooming to avoid borders.
  14169. Accepted values are:
  14170. @table @samp
  14171. @item 0
  14172. disabled
  14173. @item 1
  14174. optimal static zoom value is determined (only very strong movements
  14175. will lead to visible borders) (default)
  14176. @item 2
  14177. optimal adaptive zoom value is determined (no borders will be
  14178. visible), see @option{zoomspeed}
  14179. @end table
  14180. Note that the value given at zoom is added to the one calculated here.
  14181. @item zoomspeed
  14182. Set percent to zoom maximally each frame (enabled when
  14183. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  14184. 0.25.
  14185. @item interpol
  14186. Specify type of interpolation.
  14187. Available values are:
  14188. @table @samp
  14189. @item no
  14190. no interpolation
  14191. @item linear
  14192. linear only horizontal
  14193. @item bilinear
  14194. linear in both directions (default)
  14195. @item bicubic
  14196. cubic in both directions (slow)
  14197. @end table
  14198. @item tripod
  14199. Enable virtual tripod mode if set to 1, which is equivalent to
  14200. @code{relative=0:smoothing=0}. Default value is 0.
  14201. Use also @code{tripod} option of @ref{vidstabdetect}.
  14202. @item debug
  14203. Increase log verbosity if set to 1. Also the detected global motions
  14204. are written to the temporary file @file{global_motions.trf}. Default
  14205. value is 0.
  14206. @end table
  14207. @subsection Examples
  14208. @itemize
  14209. @item
  14210. Use @command{ffmpeg} for a typical stabilization with default values:
  14211. @example
  14212. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  14213. @end example
  14214. Note the use of the @ref{unsharp} filter which is always recommended.
  14215. @item
  14216. Zoom in a bit more and load transform data from a given file:
  14217. @example
  14218. vidstabtransform=zoom=5:input="mytransforms.trf"
  14219. @end example
  14220. @item
  14221. Smoothen the video even more:
  14222. @example
  14223. vidstabtransform=smoothing=30
  14224. @end example
  14225. @end itemize
  14226. @section vflip
  14227. Flip the input video vertically.
  14228. For example, to vertically flip a video with @command{ffmpeg}:
  14229. @example
  14230. ffmpeg -i in.avi -vf "vflip" out.avi
  14231. @end example
  14232. @section vfrdet
  14233. Detect variable frame rate video.
  14234. This filter tries to detect if the input is variable or constant frame rate.
  14235. At end it will output number of frames detected as having variable delta pts,
  14236. and ones with constant delta pts.
  14237. If there was frames with variable delta, than it will also show min and max delta
  14238. encountered.
  14239. @section vibrance
  14240. Boost or alter saturation.
  14241. The filter accepts the following options:
  14242. @table @option
  14243. @item intensity
  14244. Set strength of boost if positive value or strength of alter if negative value.
  14245. Default is 0. Allowed range is from -2 to 2.
  14246. @item rbal
  14247. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  14248. @item gbal
  14249. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  14250. @item bbal
  14251. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  14252. @item rlum
  14253. Set the red luma coefficient.
  14254. @item glum
  14255. Set the green luma coefficient.
  14256. @item blum
  14257. Set the blue luma coefficient.
  14258. @item alternate
  14259. If @code{intensity} is negative and this is set to 1, colors will change,
  14260. otherwise colors will be less saturated, more towards gray.
  14261. @end table
  14262. @anchor{vignette}
  14263. @section vignette
  14264. Make or reverse a natural vignetting effect.
  14265. The filter accepts the following options:
  14266. @table @option
  14267. @item angle, a
  14268. Set lens angle expression as a number of radians.
  14269. The value is clipped in the @code{[0,PI/2]} range.
  14270. Default value: @code{"PI/5"}
  14271. @item x0
  14272. @item y0
  14273. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  14274. by default.
  14275. @item mode
  14276. Set forward/backward mode.
  14277. Available modes are:
  14278. @table @samp
  14279. @item forward
  14280. The larger the distance from the central point, the darker the image becomes.
  14281. @item backward
  14282. The larger the distance from the central point, the brighter the image becomes.
  14283. This can be used to reverse a vignette effect, though there is no automatic
  14284. detection to extract the lens @option{angle} and other settings (yet). It can
  14285. also be used to create a burning effect.
  14286. @end table
  14287. Default value is @samp{forward}.
  14288. @item eval
  14289. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  14290. It accepts the following values:
  14291. @table @samp
  14292. @item init
  14293. Evaluate expressions only once during the filter initialization.
  14294. @item frame
  14295. Evaluate expressions for each incoming frame. This is way slower than the
  14296. @samp{init} mode since it requires all the scalers to be re-computed, but it
  14297. allows advanced dynamic expressions.
  14298. @end table
  14299. Default value is @samp{init}.
  14300. @item dither
  14301. Set dithering to reduce the circular banding effects. Default is @code{1}
  14302. (enabled).
  14303. @item aspect
  14304. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  14305. Setting this value to the SAR of the input will make a rectangular vignetting
  14306. following the dimensions of the video.
  14307. Default is @code{1/1}.
  14308. @end table
  14309. @subsection Expressions
  14310. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  14311. following parameters.
  14312. @table @option
  14313. @item w
  14314. @item h
  14315. input width and height
  14316. @item n
  14317. the number of input frame, starting from 0
  14318. @item pts
  14319. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  14320. @var{TB} units, NAN if undefined
  14321. @item r
  14322. frame rate of the input video, NAN if the input frame rate is unknown
  14323. @item t
  14324. the PTS (Presentation TimeStamp) of the filtered video frame,
  14325. expressed in seconds, NAN if undefined
  14326. @item tb
  14327. time base of the input video
  14328. @end table
  14329. @subsection Examples
  14330. @itemize
  14331. @item
  14332. Apply simple strong vignetting effect:
  14333. @example
  14334. vignette=PI/4
  14335. @end example
  14336. @item
  14337. Make a flickering vignetting:
  14338. @example
  14339. vignette='PI/4+random(1)*PI/50':eval=frame
  14340. @end example
  14341. @end itemize
  14342. @section vmafmotion
  14343. Obtain the average vmaf motion score of a video.
  14344. It is one of the component filters of VMAF.
  14345. The obtained average motion score is printed through the logging system.
  14346. In the below example the input file @file{ref.mpg} is being processed and score
  14347. is computed.
  14348. @example
  14349. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  14350. @end example
  14351. @section vstack
  14352. Stack input videos vertically.
  14353. All streams must be of same pixel format and of same width.
  14354. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  14355. to create same output.
  14356. The filter accepts the following options:
  14357. @table @option
  14358. @item inputs
  14359. Set number of input streams. Default is 2.
  14360. @item shortest
  14361. If set to 1, force the output to terminate when the shortest input
  14362. terminates. Default value is 0.
  14363. @end table
  14364. @section w3fdif
  14365. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  14366. Deinterlacing Filter").
  14367. Based on the process described by Martin Weston for BBC R&D, and
  14368. implemented based on the de-interlace algorithm written by Jim
  14369. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  14370. uses filter coefficients calculated by BBC R&D.
  14371. This filter uses field-dominance information in frame to decide which
  14372. of each pair of fields to place first in the output.
  14373. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  14374. There are two sets of filter coefficients, so called "simple"
  14375. and "complex". Which set of filter coefficients is used can
  14376. be set by passing an optional parameter:
  14377. @table @option
  14378. @item filter
  14379. Set the interlacing filter coefficients. Accepts one of the following values:
  14380. @table @samp
  14381. @item simple
  14382. Simple filter coefficient set.
  14383. @item complex
  14384. More-complex filter coefficient set.
  14385. @end table
  14386. Default value is @samp{complex}.
  14387. @item deint
  14388. Specify which frames to deinterlace. Accepts one of the following values:
  14389. @table @samp
  14390. @item all
  14391. Deinterlace all frames,
  14392. @item interlaced
  14393. Only deinterlace frames marked as interlaced.
  14394. @end table
  14395. Default value is @samp{all}.
  14396. @end table
  14397. @section waveform
  14398. Video waveform monitor.
  14399. The waveform monitor plots color component intensity. By default luminance
  14400. only. Each column of the waveform corresponds to a column of pixels in the
  14401. source video.
  14402. It accepts the following options:
  14403. @table @option
  14404. @item mode, m
  14405. Can be either @code{row}, or @code{column}. Default is @code{column}.
  14406. In row mode, the graph on the left side represents color component value 0 and
  14407. the right side represents value = 255. In column mode, the top side represents
  14408. color component value = 0 and bottom side represents value = 255.
  14409. @item intensity, i
  14410. Set intensity. Smaller values are useful to find out how many values of the same
  14411. luminance are distributed across input rows/columns.
  14412. Default value is @code{0.04}. Allowed range is [0, 1].
  14413. @item mirror, r
  14414. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  14415. In mirrored mode, higher values will be represented on the left
  14416. side for @code{row} mode and at the top for @code{column} mode. Default is
  14417. @code{1} (mirrored).
  14418. @item display, d
  14419. Set display mode.
  14420. It accepts the following values:
  14421. @table @samp
  14422. @item overlay
  14423. Presents information identical to that in the @code{parade}, except
  14424. that the graphs representing color components are superimposed directly
  14425. over one another.
  14426. This display mode makes it easier to spot relative differences or similarities
  14427. in overlapping areas of the color components that are supposed to be identical,
  14428. such as neutral whites, grays, or blacks.
  14429. @item stack
  14430. Display separate graph for the color components side by side in
  14431. @code{row} mode or one below the other in @code{column} mode.
  14432. @item parade
  14433. Display separate graph for the color components side by side in
  14434. @code{column} mode or one below the other in @code{row} mode.
  14435. Using this display mode makes it easy to spot color casts in the highlights
  14436. and shadows of an image, by comparing the contours of the top and the bottom
  14437. graphs of each waveform. Since whites, grays, and blacks are characterized
  14438. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  14439. should display three waveforms of roughly equal width/height. If not, the
  14440. correction is easy to perform by making level adjustments the three waveforms.
  14441. @end table
  14442. Default is @code{stack}.
  14443. @item components, c
  14444. Set which color components to display. Default is 1, which means only luminance
  14445. or red color component if input is in RGB colorspace. If is set for example to
  14446. 7 it will display all 3 (if) available color components.
  14447. @item envelope, e
  14448. @table @samp
  14449. @item none
  14450. No envelope, this is default.
  14451. @item instant
  14452. Instant envelope, minimum and maximum values presented in graph will be easily
  14453. visible even with small @code{step} value.
  14454. @item peak
  14455. Hold minimum and maximum values presented in graph across time. This way you
  14456. can still spot out of range values without constantly looking at waveforms.
  14457. @item peak+instant
  14458. Peak and instant envelope combined together.
  14459. @end table
  14460. @item filter, f
  14461. @table @samp
  14462. @item lowpass
  14463. No filtering, this is default.
  14464. @item flat
  14465. Luma and chroma combined together.
  14466. @item aflat
  14467. Similar as above, but shows difference between blue and red chroma.
  14468. @item xflat
  14469. Similar as above, but use different colors.
  14470. @item chroma
  14471. Displays only chroma.
  14472. @item color
  14473. Displays actual color value on waveform.
  14474. @item acolor
  14475. Similar as above, but with luma showing frequency of chroma values.
  14476. @end table
  14477. @item graticule, g
  14478. Set which graticule to display.
  14479. @table @samp
  14480. @item none
  14481. Do not display graticule.
  14482. @item green
  14483. Display green graticule showing legal broadcast ranges.
  14484. @item orange
  14485. Display orange graticule showing legal broadcast ranges.
  14486. @end table
  14487. @item opacity, o
  14488. Set graticule opacity.
  14489. @item flags, fl
  14490. Set graticule flags.
  14491. @table @samp
  14492. @item numbers
  14493. Draw numbers above lines. By default enabled.
  14494. @item dots
  14495. Draw dots instead of lines.
  14496. @end table
  14497. @item scale, s
  14498. Set scale used for displaying graticule.
  14499. @table @samp
  14500. @item digital
  14501. @item millivolts
  14502. @item ire
  14503. @end table
  14504. Default is digital.
  14505. @item bgopacity, b
  14506. Set background opacity.
  14507. @end table
  14508. @section weave, doubleweave
  14509. The @code{weave} takes a field-based video input and join
  14510. each two sequential fields into single frame, producing a new double
  14511. height clip with half the frame rate and half the frame count.
  14512. The @code{doubleweave} works same as @code{weave} but without
  14513. halving frame rate and frame count.
  14514. It accepts the following option:
  14515. @table @option
  14516. @item first_field
  14517. Set first field. Available values are:
  14518. @table @samp
  14519. @item top, t
  14520. Set the frame as top-field-first.
  14521. @item bottom, b
  14522. Set the frame as bottom-field-first.
  14523. @end table
  14524. @end table
  14525. @subsection Examples
  14526. @itemize
  14527. @item
  14528. Interlace video using @ref{select} and @ref{separatefields} filter:
  14529. @example
  14530. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  14531. @end example
  14532. @end itemize
  14533. @section xbr
  14534. Apply the xBR high-quality magnification filter which is designed for pixel
  14535. art. It follows a set of edge-detection rules, see
  14536. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  14537. It accepts the following option:
  14538. @table @option
  14539. @item n
  14540. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  14541. @code{3xBR} and @code{4} for @code{4xBR}.
  14542. Default is @code{3}.
  14543. @end table
  14544. @section xmedian
  14545. Pick median pixels from several input videos.
  14546. The filter accepts the following options:
  14547. @table @option
  14548. @item inputs
  14549. Set number of inputs.
  14550. Default is 3. Allowed range is from 3 to 255.
  14551. If number of inputs is even number, than result will be mean value between two median values.
  14552. @item planes
  14553. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  14554. @end table
  14555. @section xstack
  14556. Stack video inputs into custom layout.
  14557. All streams must be of same pixel format.
  14558. The filter accepts the following options:
  14559. @table @option
  14560. @item inputs
  14561. Set number of input streams. Default is 2.
  14562. @item layout
  14563. Specify layout of inputs.
  14564. This option requires the desired layout configuration to be explicitly set by the user.
  14565. This sets position of each video input in output. Each input
  14566. is separated by '|'.
  14567. The first number represents the column, and the second number represents the row.
  14568. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  14569. where X is video input from which to take width or height.
  14570. Multiple values can be used when separated by '+'. In such
  14571. case values are summed together.
  14572. Note that if inputs are of different sizes gaps may appear, as not all of
  14573. the output video frame will be filled. Similarly, videos can overlap each
  14574. other if their position doesn't leave enough space for the full frame of
  14575. adjoining videos.
  14576. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  14577. a layout must be set by the user.
  14578. @item shortest
  14579. If set to 1, force the output to terminate when the shortest input
  14580. terminates. Default value is 0.
  14581. @end table
  14582. @subsection Examples
  14583. @itemize
  14584. @item
  14585. Display 4 inputs into 2x2 grid.
  14586. Layout:
  14587. @example
  14588. input1(0, 0) | input3(w0, 0)
  14589. input2(0, h0) | input4(w0, h0)
  14590. @end example
  14591. @example
  14592. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  14593. @end example
  14594. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14595. @item
  14596. Display 4 inputs into 1x4 grid.
  14597. Layout:
  14598. @example
  14599. input1(0, 0)
  14600. input2(0, h0)
  14601. input3(0, h0+h1)
  14602. input4(0, h0+h1+h2)
  14603. @end example
  14604. @example
  14605. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  14606. @end example
  14607. Note that if inputs are of different widths, unused space will appear.
  14608. @item
  14609. Display 9 inputs into 3x3 grid.
  14610. Layout:
  14611. @example
  14612. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  14613. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  14614. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  14615. @end example
  14616. @example
  14617. xstack=inputs=9:layout=0_0|0_h0|0_h0+h1|w0_0|w0_h0|w0_h0+h1|w0+w3_0|w0+w3_h0|w0+w3_h0+h1
  14618. @end example
  14619. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14620. @item
  14621. Display 16 inputs into 4x4 grid.
  14622. Layout:
  14623. @example
  14624. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  14625. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  14626. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  14627. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  14628. @end example
  14629. @example
  14630. xstack=inputs=16:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2|w0_0|w0_h0|w0_h0+h1|w0_h0+h1+h2|w0+w4_0|
  14631. w0+w4_h0|w0+w4_h0+h1|w0+w4_h0+h1+h2|w0+w4+w8_0|w0+w4+w8_h0|w0+w4+w8_h0+h1|w0+w4+w8_h0+h1+h2
  14632. @end example
  14633. Note that if inputs are of different sizes, gaps or overlaps may occur.
  14634. @end itemize
  14635. @anchor{yadif}
  14636. @section yadif
  14637. Deinterlace the input video ("yadif" means "yet another deinterlacing
  14638. filter").
  14639. It accepts the following parameters:
  14640. @table @option
  14641. @item mode
  14642. The interlacing mode to adopt. It accepts one of the following values:
  14643. @table @option
  14644. @item 0, send_frame
  14645. Output one frame for each frame.
  14646. @item 1, send_field
  14647. Output one frame for each field.
  14648. @item 2, send_frame_nospatial
  14649. Like @code{send_frame}, but it skips the spatial interlacing check.
  14650. @item 3, send_field_nospatial
  14651. Like @code{send_field}, but it skips the spatial interlacing check.
  14652. @end table
  14653. The default value is @code{send_frame}.
  14654. @item parity
  14655. The picture field parity assumed for the input interlaced video. It accepts one
  14656. of the following values:
  14657. @table @option
  14658. @item 0, tff
  14659. Assume the top field is first.
  14660. @item 1, bff
  14661. Assume the bottom field is first.
  14662. @item -1, auto
  14663. Enable automatic detection of field parity.
  14664. @end table
  14665. The default value is @code{auto}.
  14666. If the interlacing is unknown or the decoder does not export this information,
  14667. top field first will be assumed.
  14668. @item deint
  14669. Specify which frames to deinterlace. Accepts one of the following
  14670. values:
  14671. @table @option
  14672. @item 0, all
  14673. Deinterlace all frames.
  14674. @item 1, interlaced
  14675. Only deinterlace frames marked as interlaced.
  14676. @end table
  14677. The default value is @code{all}.
  14678. @end table
  14679. @section yadif_cuda
  14680. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14681. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14682. and/or nvenc.
  14683. It accepts the following parameters:
  14684. @table @option
  14685. @item mode
  14686. The interlacing mode to adopt. It accepts one of the following values:
  14687. @table @option
  14688. @item 0, send_frame
  14689. Output one frame for each frame.
  14690. @item 1, send_field
  14691. Output one frame for each field.
  14692. @item 2, send_frame_nospatial
  14693. Like @code{send_frame}, but it skips the spatial interlacing check.
  14694. @item 3, send_field_nospatial
  14695. Like @code{send_field}, but it skips the spatial interlacing check.
  14696. @end table
  14697. The default value is @code{send_frame}.
  14698. @item parity
  14699. The picture field parity assumed for the input interlaced video. It accepts one
  14700. of the following values:
  14701. @table @option
  14702. @item 0, tff
  14703. Assume the top field is first.
  14704. @item 1, bff
  14705. Assume the bottom field is first.
  14706. @item -1, auto
  14707. Enable automatic detection of field parity.
  14708. @end table
  14709. The default value is @code{auto}.
  14710. If the interlacing is unknown or the decoder does not export this information,
  14711. top field first will be assumed.
  14712. @item deint
  14713. Specify which frames to deinterlace. Accepts one of the following
  14714. values:
  14715. @table @option
  14716. @item 0, all
  14717. Deinterlace all frames.
  14718. @item 1, interlaced
  14719. Only deinterlace frames marked as interlaced.
  14720. @end table
  14721. The default value is @code{all}.
  14722. @end table
  14723. @section zoompan
  14724. Apply Zoom & Pan effect.
  14725. This filter accepts the following options:
  14726. @table @option
  14727. @item zoom, z
  14728. Set the zoom expression. Range is 1-10. Default is 1.
  14729. @item x
  14730. @item y
  14731. Set the x and y expression. Default is 0.
  14732. @item d
  14733. Set the duration expression in number of frames.
  14734. This sets for how many number of frames effect will last for
  14735. single input image.
  14736. @item s
  14737. Set the output image size, default is 'hd720'.
  14738. @item fps
  14739. Set the output frame rate, default is '25'.
  14740. @end table
  14741. Each expression can contain the following constants:
  14742. @table @option
  14743. @item in_w, iw
  14744. Input width.
  14745. @item in_h, ih
  14746. Input height.
  14747. @item out_w, ow
  14748. Output width.
  14749. @item out_h, oh
  14750. Output height.
  14751. @item in
  14752. Input frame count.
  14753. @item on
  14754. Output frame count.
  14755. @item x
  14756. @item y
  14757. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14758. for current input frame.
  14759. @item px
  14760. @item py
  14761. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14762. not yet such frame (first input frame).
  14763. @item zoom
  14764. Last calculated zoom from 'z' expression for current input frame.
  14765. @item pzoom
  14766. Last calculated zoom of last output frame of previous input frame.
  14767. @item duration
  14768. Number of output frames for current input frame. Calculated from 'd' expression
  14769. for each input frame.
  14770. @item pduration
  14771. number of output frames created for previous input frame
  14772. @item a
  14773. Rational number: input width / input height
  14774. @item sar
  14775. sample aspect ratio
  14776. @item dar
  14777. display aspect ratio
  14778. @end table
  14779. @subsection Examples
  14780. @itemize
  14781. @item
  14782. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14783. @example
  14784. 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
  14785. @end example
  14786. @item
  14787. Zoom-in up to 1.5 and pan always at center of picture:
  14788. @example
  14789. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14790. @end example
  14791. @item
  14792. Same as above but without pausing:
  14793. @example
  14794. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14795. @end example
  14796. @end itemize
  14797. @anchor{zscale}
  14798. @section zscale
  14799. Scale (resize) the input video, using the z.lib library:
  14800. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14801. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14802. The zscale filter forces the output display aspect ratio to be the same
  14803. as the input, by changing the output sample aspect ratio.
  14804. If the input image format is different from the format requested by
  14805. the next filter, the zscale filter will convert the input to the
  14806. requested format.
  14807. @subsection Options
  14808. The filter accepts the following options.
  14809. @table @option
  14810. @item width, w
  14811. @item height, h
  14812. Set the output video dimension expression. Default value is the input
  14813. dimension.
  14814. If the @var{width} or @var{w} value is 0, the input width is used for
  14815. the output. If the @var{height} or @var{h} value is 0, the input height
  14816. is used for the output.
  14817. If one and only one of the values is -n with n >= 1, the zscale filter
  14818. will use a value that maintains the aspect ratio of the input image,
  14819. calculated from the other specified dimension. After that it will,
  14820. however, make sure that the calculated dimension is divisible by n and
  14821. adjust the value if necessary.
  14822. If both values are -n with n >= 1, the behavior will be identical to
  14823. both values being set to 0 as previously detailed.
  14824. See below for the list of accepted constants for use in the dimension
  14825. expression.
  14826. @item size, s
  14827. Set the video size. For the syntax of this option, check the
  14828. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14829. @item dither, d
  14830. Set the dither type.
  14831. Possible values are:
  14832. @table @var
  14833. @item none
  14834. @item ordered
  14835. @item random
  14836. @item error_diffusion
  14837. @end table
  14838. Default is none.
  14839. @item filter, f
  14840. Set the resize filter type.
  14841. Possible values are:
  14842. @table @var
  14843. @item point
  14844. @item bilinear
  14845. @item bicubic
  14846. @item spline16
  14847. @item spline36
  14848. @item lanczos
  14849. @end table
  14850. Default is bilinear.
  14851. @item range, r
  14852. Set the color range.
  14853. Possible values are:
  14854. @table @var
  14855. @item input
  14856. @item limited
  14857. @item full
  14858. @end table
  14859. Default is same as input.
  14860. @item primaries, p
  14861. Set the color primaries.
  14862. Possible values are:
  14863. @table @var
  14864. @item input
  14865. @item 709
  14866. @item unspecified
  14867. @item 170m
  14868. @item 240m
  14869. @item 2020
  14870. @end table
  14871. Default is same as input.
  14872. @item transfer, t
  14873. Set the transfer characteristics.
  14874. Possible values are:
  14875. @table @var
  14876. @item input
  14877. @item 709
  14878. @item unspecified
  14879. @item 601
  14880. @item linear
  14881. @item 2020_10
  14882. @item 2020_12
  14883. @item smpte2084
  14884. @item iec61966-2-1
  14885. @item arib-std-b67
  14886. @end table
  14887. Default is same as input.
  14888. @item matrix, m
  14889. Set the colorspace matrix.
  14890. Possible value are:
  14891. @table @var
  14892. @item input
  14893. @item 709
  14894. @item unspecified
  14895. @item 470bg
  14896. @item 170m
  14897. @item 2020_ncl
  14898. @item 2020_cl
  14899. @end table
  14900. Default is same as input.
  14901. @item rangein, rin
  14902. Set the input color range.
  14903. Possible values are:
  14904. @table @var
  14905. @item input
  14906. @item limited
  14907. @item full
  14908. @end table
  14909. Default is same as input.
  14910. @item primariesin, pin
  14911. Set the input color primaries.
  14912. Possible values are:
  14913. @table @var
  14914. @item input
  14915. @item 709
  14916. @item unspecified
  14917. @item 170m
  14918. @item 240m
  14919. @item 2020
  14920. @end table
  14921. Default is same as input.
  14922. @item transferin, tin
  14923. Set the input transfer characteristics.
  14924. Possible values are:
  14925. @table @var
  14926. @item input
  14927. @item 709
  14928. @item unspecified
  14929. @item 601
  14930. @item linear
  14931. @item 2020_10
  14932. @item 2020_12
  14933. @end table
  14934. Default is same as input.
  14935. @item matrixin, min
  14936. Set the input colorspace matrix.
  14937. Possible value are:
  14938. @table @var
  14939. @item input
  14940. @item 709
  14941. @item unspecified
  14942. @item 470bg
  14943. @item 170m
  14944. @item 2020_ncl
  14945. @item 2020_cl
  14946. @end table
  14947. @item chromal, c
  14948. Set the output chroma location.
  14949. Possible values are:
  14950. @table @var
  14951. @item input
  14952. @item left
  14953. @item center
  14954. @item topleft
  14955. @item top
  14956. @item bottomleft
  14957. @item bottom
  14958. @end table
  14959. @item chromalin, cin
  14960. Set the input chroma location.
  14961. Possible values are:
  14962. @table @var
  14963. @item input
  14964. @item left
  14965. @item center
  14966. @item topleft
  14967. @item top
  14968. @item bottomleft
  14969. @item bottom
  14970. @end table
  14971. @item npl
  14972. Set the nominal peak luminance.
  14973. @end table
  14974. The values of the @option{w} and @option{h} options are expressions
  14975. containing the following constants:
  14976. @table @var
  14977. @item in_w
  14978. @item in_h
  14979. The input width and height
  14980. @item iw
  14981. @item ih
  14982. These are the same as @var{in_w} and @var{in_h}.
  14983. @item out_w
  14984. @item out_h
  14985. The output (scaled) width and height
  14986. @item ow
  14987. @item oh
  14988. These are the same as @var{out_w} and @var{out_h}
  14989. @item a
  14990. The same as @var{iw} / @var{ih}
  14991. @item sar
  14992. input sample aspect ratio
  14993. @item dar
  14994. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14995. @item hsub
  14996. @item vsub
  14997. horizontal and vertical input chroma subsample values. For example for the
  14998. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14999. @item ohsub
  15000. @item ovsub
  15001. horizontal and vertical output chroma subsample values. For example for the
  15002. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15003. @end table
  15004. @table @option
  15005. @end table
  15006. @c man end VIDEO FILTERS
  15007. @chapter OpenCL Video Filters
  15008. @c man begin OPENCL VIDEO FILTERS
  15009. Below is a description of the currently available OpenCL video filters.
  15010. To enable compilation of these filters you need to configure FFmpeg with
  15011. @code{--enable-opencl}.
  15012. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  15013. @table @option
  15014. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  15015. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  15016. given device parameters.
  15017. @item -filter_hw_device @var{name}
  15018. Pass the hardware device called @var{name} to all filters in any filter graph.
  15019. @end table
  15020. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  15021. @itemize
  15022. @item
  15023. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  15024. @example
  15025. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  15026. @end example
  15027. @end itemize
  15028. 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.
  15029. @section avgblur_opencl
  15030. Apply average blur filter.
  15031. The filter accepts the following options:
  15032. @table @option
  15033. @item sizeX
  15034. Set horizontal radius size.
  15035. Range is @code{[1, 1024]} and default value is @code{1}.
  15036. @item planes
  15037. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15038. @item sizeY
  15039. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  15040. @end table
  15041. @subsection Example
  15042. @itemize
  15043. @item
  15044. 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.
  15045. @example
  15046. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  15047. @end example
  15048. @end itemize
  15049. @section boxblur_opencl
  15050. Apply a boxblur algorithm to the input video.
  15051. It accepts the following parameters:
  15052. @table @option
  15053. @item luma_radius, lr
  15054. @item luma_power, lp
  15055. @item chroma_radius, cr
  15056. @item chroma_power, cp
  15057. @item alpha_radius, ar
  15058. @item alpha_power, ap
  15059. @end table
  15060. A description of the accepted options follows.
  15061. @table @option
  15062. @item luma_radius, lr
  15063. @item chroma_radius, cr
  15064. @item alpha_radius, ar
  15065. Set an expression for the box radius in pixels used for blurring the
  15066. corresponding input plane.
  15067. The radius value must be a non-negative number, and must not be
  15068. greater than the value of the expression @code{min(w,h)/2} for the
  15069. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  15070. planes.
  15071. Default value for @option{luma_radius} is "2". If not specified,
  15072. @option{chroma_radius} and @option{alpha_radius} default to the
  15073. corresponding value set for @option{luma_radius}.
  15074. The expressions can contain the following constants:
  15075. @table @option
  15076. @item w
  15077. @item h
  15078. The input width and height in pixels.
  15079. @item cw
  15080. @item ch
  15081. The input chroma image width and height in pixels.
  15082. @item hsub
  15083. @item vsub
  15084. The horizontal and vertical chroma subsample values. For example, for the
  15085. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  15086. @end table
  15087. @item luma_power, lp
  15088. @item chroma_power, cp
  15089. @item alpha_power, ap
  15090. Specify how many times the boxblur filter is applied to the
  15091. corresponding plane.
  15092. Default value for @option{luma_power} is 2. If not specified,
  15093. @option{chroma_power} and @option{alpha_power} default to the
  15094. corresponding value set for @option{luma_power}.
  15095. A value of 0 will disable the effect.
  15096. @end table
  15097. @subsection Examples
  15098. 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.
  15099. @itemize
  15100. @item
  15101. Apply a boxblur filter with the luma, chroma, and alpha radius
  15102. 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.
  15103. @example
  15104. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  15105. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  15106. @end example
  15107. @item
  15108. 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.
  15109. For the luma plane, a 2x2 box radius will be run once.
  15110. For the chroma plane, a 4x4 box radius will be run 5 times.
  15111. For the alpha plane, a 3x3 box radius will be run 7 times.
  15112. @example
  15113. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  15114. @end example
  15115. @end itemize
  15116. @section convolution_opencl
  15117. Apply convolution of 3x3, 5x5, 7x7 matrix.
  15118. The filter accepts the following options:
  15119. @table @option
  15120. @item 0m
  15121. @item 1m
  15122. @item 2m
  15123. @item 3m
  15124. Set matrix for each plane.
  15125. Matrix is sequence of 9, 25 or 49 signed numbers.
  15126. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  15127. @item 0rdiv
  15128. @item 1rdiv
  15129. @item 2rdiv
  15130. @item 3rdiv
  15131. Set multiplier for calculated value for each plane.
  15132. If unset or 0, it will be sum of all matrix elements.
  15133. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  15134. @item 0bias
  15135. @item 1bias
  15136. @item 2bias
  15137. @item 3bias
  15138. Set bias for each plane. This value is added to the result of the multiplication.
  15139. Useful for making the overall image brighter or darker.
  15140. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  15141. @end table
  15142. @subsection Examples
  15143. @itemize
  15144. @item
  15145. Apply sharpen:
  15146. @example
  15147. -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
  15148. @end example
  15149. @item
  15150. Apply blur:
  15151. @example
  15152. -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
  15153. @end example
  15154. @item
  15155. Apply edge enhance:
  15156. @example
  15157. -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
  15158. @end example
  15159. @item
  15160. Apply edge detect:
  15161. @example
  15162. -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
  15163. @end example
  15164. @item
  15165. Apply laplacian edge detector which includes diagonals:
  15166. @example
  15167. -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
  15168. @end example
  15169. @item
  15170. Apply emboss:
  15171. @example
  15172. -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
  15173. @end example
  15174. @end itemize
  15175. @section dilation_opencl
  15176. Apply dilation effect to the video.
  15177. This filter replaces the pixel by the local(3x3) maximum.
  15178. It accepts the following options:
  15179. @table @option
  15180. @item threshold0
  15181. @item threshold1
  15182. @item threshold2
  15183. @item threshold3
  15184. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15185. If @code{0}, plane will remain unchanged.
  15186. @item coordinates
  15187. Flag which specifies the pixel to refer to.
  15188. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15189. Flags to local 3x3 coordinates region centered on @code{x}:
  15190. 1 2 3
  15191. 4 x 5
  15192. 6 7 8
  15193. @end table
  15194. @subsection Example
  15195. @itemize
  15196. @item
  15197. 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.
  15198. @example
  15199. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15200. @end example
  15201. @end itemize
  15202. @section erosion_opencl
  15203. Apply erosion effect to the video.
  15204. This filter replaces the pixel by the local(3x3) minimum.
  15205. It accepts the following options:
  15206. @table @option
  15207. @item threshold0
  15208. @item threshold1
  15209. @item threshold2
  15210. @item threshold3
  15211. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  15212. If @code{0}, plane will remain unchanged.
  15213. @item coordinates
  15214. Flag which specifies the pixel to refer to.
  15215. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  15216. Flags to local 3x3 coordinates region centered on @code{x}:
  15217. 1 2 3
  15218. 4 x 5
  15219. 6 7 8
  15220. @end table
  15221. @subsection Example
  15222. @itemize
  15223. @item
  15224. 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.
  15225. @example
  15226. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  15227. @end example
  15228. @end itemize
  15229. @section colorkey_opencl
  15230. RGB colorspace color keying.
  15231. The filter accepts the following options:
  15232. @table @option
  15233. @item color
  15234. The color which will be replaced with transparency.
  15235. @item similarity
  15236. Similarity percentage with the key color.
  15237. 0.01 matches only the exact key color, while 1.0 matches everything.
  15238. @item blend
  15239. Blend percentage.
  15240. 0.0 makes pixels either fully transparent, or not transparent at all.
  15241. Higher values result in semi-transparent pixels, with a higher transparency
  15242. the more similar the pixels color is to the key color.
  15243. @end table
  15244. @subsection Examples
  15245. @itemize
  15246. @item
  15247. Make every semi-green pixel in the input transparent with some slight blending:
  15248. @example
  15249. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  15250. @end example
  15251. @end itemize
  15252. @section deshake_opencl
  15253. Feature-point based video stabilization filter.
  15254. The filter accepts the following options:
  15255. @table @option
  15256. @item tripod
  15257. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  15258. @item debug
  15259. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  15260. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  15261. Viewing point matches in the output video is only supported for RGB input.
  15262. Defaults to @code{0}.
  15263. @item adaptive_crop
  15264. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  15265. Defaults to @code{1}.
  15266. @item refine_features
  15267. Whether or not feature points should be refined at a sub-pixel level.
  15268. This can be turned off for a slight performance gain at the cost of precision.
  15269. Defaults to @code{1}.
  15270. @item smooth_strength
  15271. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  15272. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  15273. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  15274. Defaults to @code{0.0}.
  15275. @item smooth_window_multiplier
  15276. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  15277. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  15278. Acceptable values range from @code{0.1} to @code{10.0}.
  15279. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  15280. potentially improving smoothness, but also increase latency and memory usage.
  15281. Defaults to @code{2.0}.
  15282. @end table
  15283. @subsection Examples
  15284. @itemize
  15285. @item
  15286. Stabilize a video with a fixed, medium smoothing strength:
  15287. @example
  15288. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  15289. @end example
  15290. @item
  15291. Stabilize a video with debugging (both in console and in rendered video):
  15292. @example
  15293. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  15294. @end example
  15295. @end itemize
  15296. @section nlmeans_opencl
  15297. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  15298. @section overlay_opencl
  15299. Overlay one video on top of another.
  15300. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  15301. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  15302. The filter accepts the following options:
  15303. @table @option
  15304. @item x
  15305. Set the x coordinate of the overlaid video on the main video.
  15306. Default value is @code{0}.
  15307. @item y
  15308. Set the x coordinate of the overlaid video on the main video.
  15309. Default value is @code{0}.
  15310. @end table
  15311. @subsection Examples
  15312. @itemize
  15313. @item
  15314. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  15315. @example
  15316. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15317. @end example
  15318. @item
  15319. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  15320. @example
  15321. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  15322. @end example
  15323. @end itemize
  15324. @section prewitt_opencl
  15325. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  15326. The filter accepts the following option:
  15327. @table @option
  15328. @item planes
  15329. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15330. @item scale
  15331. Set value which will be multiplied with filtered result.
  15332. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15333. @item delta
  15334. Set value which will be added to filtered result.
  15335. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15336. @end table
  15337. @subsection Example
  15338. @itemize
  15339. @item
  15340. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  15341. @example
  15342. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15343. @end example
  15344. @end itemize
  15345. @section roberts_opencl
  15346. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  15347. The filter accepts the following option:
  15348. @table @option
  15349. @item planes
  15350. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15351. @item scale
  15352. Set value which will be multiplied with filtered result.
  15353. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15354. @item delta
  15355. Set value which will be added to filtered result.
  15356. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15357. @end table
  15358. @subsection Example
  15359. @itemize
  15360. @item
  15361. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  15362. @example
  15363. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15364. @end example
  15365. @end itemize
  15366. @section sobel_opencl
  15367. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  15368. The filter accepts the following option:
  15369. @table @option
  15370. @item planes
  15371. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  15372. @item scale
  15373. Set value which will be multiplied with filtered result.
  15374. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  15375. @item delta
  15376. Set value which will be added to filtered result.
  15377. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  15378. @end table
  15379. @subsection Example
  15380. @itemize
  15381. @item
  15382. Apply sobel operator with scale set to 2 and delta set to 10
  15383. @example
  15384. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  15385. @end example
  15386. @end itemize
  15387. @section tonemap_opencl
  15388. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  15389. It accepts the following parameters:
  15390. @table @option
  15391. @item tonemap
  15392. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  15393. @item param
  15394. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  15395. @item desat
  15396. Apply desaturation for highlights that exceed this level of brightness. The
  15397. higher the parameter, the more color information will be preserved. This
  15398. setting helps prevent unnaturally blown-out colors for super-highlights, by
  15399. (smoothly) turning into white instead. This makes images feel more natural,
  15400. at the cost of reducing information about out-of-range colors.
  15401. The default value is 0.5, and the algorithm here is a little different from
  15402. the cpu version tonemap currently. A setting of 0.0 disables this option.
  15403. @item threshold
  15404. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  15405. is used to detect whether the scene has changed or not. If the distance between
  15406. the current frame average brightness and the current running average exceeds
  15407. a threshold value, we would re-calculate scene average and peak brightness.
  15408. The default value is 0.2.
  15409. @item format
  15410. Specify the output pixel format.
  15411. Currently supported formats are:
  15412. @table @var
  15413. @item p010
  15414. @item nv12
  15415. @end table
  15416. @item range, r
  15417. Set the output color range.
  15418. Possible values are:
  15419. @table @var
  15420. @item tv/mpeg
  15421. @item pc/jpeg
  15422. @end table
  15423. Default is same as input.
  15424. @item primaries, p
  15425. Set the output color primaries.
  15426. Possible values are:
  15427. @table @var
  15428. @item bt709
  15429. @item bt2020
  15430. @end table
  15431. Default is same as input.
  15432. @item transfer, t
  15433. Set the output transfer characteristics.
  15434. Possible values are:
  15435. @table @var
  15436. @item bt709
  15437. @item bt2020
  15438. @end table
  15439. Default is bt709.
  15440. @item matrix, m
  15441. Set the output colorspace matrix.
  15442. Possible value are:
  15443. @table @var
  15444. @item bt709
  15445. @item bt2020
  15446. @end table
  15447. Default is same as input.
  15448. @end table
  15449. @subsection Example
  15450. @itemize
  15451. @item
  15452. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  15453. @example
  15454. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  15455. @end example
  15456. @end itemize
  15457. @section unsharp_opencl
  15458. Sharpen or blur the input video.
  15459. It accepts the following parameters:
  15460. @table @option
  15461. @item luma_msize_x, lx
  15462. Set the luma matrix horizontal size.
  15463. Range is @code{[1, 23]} and default value is @code{5}.
  15464. @item luma_msize_y, ly
  15465. Set the luma matrix vertical size.
  15466. Range is @code{[1, 23]} and default value is @code{5}.
  15467. @item luma_amount, la
  15468. Set the luma effect strength.
  15469. Range is @code{[-10, 10]} and default value is @code{1.0}.
  15470. Negative values will blur the input video, while positive values will
  15471. sharpen it, a value of zero will disable the effect.
  15472. @item chroma_msize_x, cx
  15473. Set the chroma matrix horizontal size.
  15474. Range is @code{[1, 23]} and default value is @code{5}.
  15475. @item chroma_msize_y, cy
  15476. Set the chroma matrix vertical size.
  15477. Range is @code{[1, 23]} and default value is @code{5}.
  15478. @item chroma_amount, ca
  15479. Set the chroma effect strength.
  15480. Range is @code{[-10, 10]} and default value is @code{0.0}.
  15481. Negative values will blur the input video, while positive values will
  15482. sharpen it, a value of zero will disable the effect.
  15483. @end table
  15484. All parameters are optional and default to the equivalent of the
  15485. string '5:5:1.0:5:5:0.0'.
  15486. @subsection Examples
  15487. @itemize
  15488. @item
  15489. Apply strong luma sharpen effect:
  15490. @example
  15491. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  15492. @end example
  15493. @item
  15494. Apply a strong blur of both luma and chroma parameters:
  15495. @example
  15496. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  15497. @end example
  15498. @end itemize
  15499. @c man end OPENCL VIDEO FILTERS
  15500. @chapter Video Sources
  15501. @c man begin VIDEO SOURCES
  15502. Below is a description of the currently available video sources.
  15503. @section buffer
  15504. Buffer video frames, and make them available to the filter chain.
  15505. This source is mainly intended for a programmatic use, in particular
  15506. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  15507. It accepts the following parameters:
  15508. @table @option
  15509. @item video_size
  15510. Specify the size (width and height) of the buffered video frames. For the
  15511. syntax of this option, check the
  15512. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15513. @item width
  15514. The input video width.
  15515. @item height
  15516. The input video height.
  15517. @item pix_fmt
  15518. A string representing the pixel format of the buffered video frames.
  15519. It may be a number corresponding to a pixel format, or a pixel format
  15520. name.
  15521. @item time_base
  15522. Specify the timebase assumed by the timestamps of the buffered frames.
  15523. @item frame_rate
  15524. Specify the frame rate expected for the video stream.
  15525. @item pixel_aspect, sar
  15526. The sample (pixel) aspect ratio of the input video.
  15527. @item sws_param
  15528. Specify the optional parameters to be used for the scale filter which
  15529. is automatically inserted when an input change is detected in the
  15530. input size or format.
  15531. @item hw_frames_ctx
  15532. When using a hardware pixel format, this should be a reference to an
  15533. AVHWFramesContext describing input frames.
  15534. @end table
  15535. For example:
  15536. @example
  15537. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  15538. @end example
  15539. will instruct the source to accept video frames with size 320x240 and
  15540. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  15541. square pixels (1:1 sample aspect ratio).
  15542. Since the pixel format with name "yuv410p" corresponds to the number 6
  15543. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  15544. this example corresponds to:
  15545. @example
  15546. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  15547. @end example
  15548. Alternatively, the options can be specified as a flat string, but this
  15549. syntax is deprecated:
  15550. @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}]
  15551. @section cellauto
  15552. Create a pattern generated by an elementary cellular automaton.
  15553. The initial state of the cellular automaton can be defined through the
  15554. @option{filename} and @option{pattern} options. If such options are
  15555. not specified an initial state is created randomly.
  15556. At each new frame a new row in the video is filled with the result of
  15557. the cellular automaton next generation. The behavior when the whole
  15558. frame is filled is defined by the @option{scroll} option.
  15559. This source accepts the following options:
  15560. @table @option
  15561. @item filename, f
  15562. Read the initial cellular automaton state, i.e. the starting row, from
  15563. the specified file.
  15564. In the file, each non-whitespace character is considered an alive
  15565. cell, a newline will terminate the row, and further characters in the
  15566. file will be ignored.
  15567. @item pattern, p
  15568. Read the initial cellular automaton state, i.e. the starting row, from
  15569. the specified string.
  15570. Each non-whitespace character in the string is considered an alive
  15571. cell, a newline will terminate the row, and further characters in the
  15572. string will be ignored.
  15573. @item rate, r
  15574. Set the video rate, that is the number of frames generated per second.
  15575. Default is 25.
  15576. @item random_fill_ratio, ratio
  15577. Set the random fill ratio for the initial cellular automaton row. It
  15578. is a floating point number value ranging from 0 to 1, defaults to
  15579. 1/PHI.
  15580. This option is ignored when a file or a pattern is specified.
  15581. @item random_seed, seed
  15582. Set the seed for filling randomly the initial row, must be an integer
  15583. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15584. set to -1, the filter will try to use a good random seed on a best
  15585. effort basis.
  15586. @item rule
  15587. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  15588. Default value is 110.
  15589. @item size, s
  15590. Set the size of the output video. For the syntax of this option, check the
  15591. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15592. If @option{filename} or @option{pattern} is specified, the size is set
  15593. by default to the width of the specified initial state row, and the
  15594. height is set to @var{width} * PHI.
  15595. If @option{size} is set, it must contain the width of the specified
  15596. pattern string, and the specified pattern will be centered in the
  15597. larger row.
  15598. If a filename or a pattern string is not specified, the size value
  15599. defaults to "320x518" (used for a randomly generated initial state).
  15600. @item scroll
  15601. If set to 1, scroll the output upward when all the rows in the output
  15602. have been already filled. If set to 0, the new generated row will be
  15603. written over the top row just after the bottom row is filled.
  15604. Defaults to 1.
  15605. @item start_full, full
  15606. If set to 1, completely fill the output with generated rows before
  15607. outputting the first frame.
  15608. This is the default behavior, for disabling set the value to 0.
  15609. @item stitch
  15610. If set to 1, stitch the left and right row edges together.
  15611. This is the default behavior, for disabling set the value to 0.
  15612. @end table
  15613. @subsection Examples
  15614. @itemize
  15615. @item
  15616. Read the initial state from @file{pattern}, and specify an output of
  15617. size 200x400.
  15618. @example
  15619. cellauto=f=pattern:s=200x400
  15620. @end example
  15621. @item
  15622. Generate a random initial row with a width of 200 cells, with a fill
  15623. ratio of 2/3:
  15624. @example
  15625. cellauto=ratio=2/3:s=200x200
  15626. @end example
  15627. @item
  15628. Create a pattern generated by rule 18 starting by a single alive cell
  15629. centered on an initial row with width 100:
  15630. @example
  15631. cellauto=p=@@:s=100x400:full=0:rule=18
  15632. @end example
  15633. @item
  15634. Specify a more elaborated initial pattern:
  15635. @example
  15636. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  15637. @end example
  15638. @end itemize
  15639. @anchor{coreimagesrc}
  15640. @section coreimagesrc
  15641. Video source generated on GPU using Apple's CoreImage API on OSX.
  15642. This video source is a specialized version of the @ref{coreimage} video filter.
  15643. Use a core image generator at the beginning of the applied filterchain to
  15644. generate the content.
  15645. The coreimagesrc video source accepts the following options:
  15646. @table @option
  15647. @item list_generators
  15648. List all available generators along with all their respective options as well as
  15649. possible minimum and maximum values along with the default values.
  15650. @example
  15651. list_generators=true
  15652. @end example
  15653. @item size, s
  15654. Specify the size of the sourced video. For the syntax of this option, check the
  15655. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15656. The default value is @code{320x240}.
  15657. @item rate, r
  15658. Specify the frame rate of the sourced video, as the number of frames
  15659. generated per second. It has to be a string in the format
  15660. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15661. number or a valid video frame rate abbreviation. The default value is
  15662. "25".
  15663. @item sar
  15664. Set the sample aspect ratio of the sourced video.
  15665. @item duration, d
  15666. Set the duration of the sourced video. See
  15667. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15668. for the accepted syntax.
  15669. If not specified, or the expressed duration is negative, the video is
  15670. supposed to be generated forever.
  15671. @end table
  15672. Additionally, all options of the @ref{coreimage} video filter are accepted.
  15673. A complete filterchain can be used for further processing of the
  15674. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  15675. and examples for details.
  15676. @subsection Examples
  15677. @itemize
  15678. @item
  15679. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  15680. given as complete and escaped command-line for Apple's standard bash shell:
  15681. @example
  15682. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  15683. @end example
  15684. This example is equivalent to the QRCode example of @ref{coreimage} without the
  15685. need for a nullsrc video source.
  15686. @end itemize
  15687. @section mandelbrot
  15688. Generate a Mandelbrot set fractal, and progressively zoom towards the
  15689. point specified with @var{start_x} and @var{start_y}.
  15690. This source accepts the following options:
  15691. @table @option
  15692. @item end_pts
  15693. Set the terminal pts value. Default value is 400.
  15694. @item end_scale
  15695. Set the terminal scale value.
  15696. Must be a floating point value. Default value is 0.3.
  15697. @item inner
  15698. Set the inner coloring mode, that is the algorithm used to draw the
  15699. Mandelbrot fractal internal region.
  15700. It shall assume one of the following values:
  15701. @table @option
  15702. @item black
  15703. Set black mode.
  15704. @item convergence
  15705. Show time until convergence.
  15706. @item mincol
  15707. Set color based on point closest to the origin of the iterations.
  15708. @item period
  15709. Set period mode.
  15710. @end table
  15711. Default value is @var{mincol}.
  15712. @item bailout
  15713. Set the bailout value. Default value is 10.0.
  15714. @item maxiter
  15715. Set the maximum of iterations performed by the rendering
  15716. algorithm. Default value is 7189.
  15717. @item outer
  15718. Set outer coloring mode.
  15719. It shall assume one of following values:
  15720. @table @option
  15721. @item iteration_count
  15722. Set iteration count mode.
  15723. @item normalized_iteration_count
  15724. set normalized iteration count mode.
  15725. @end table
  15726. Default value is @var{normalized_iteration_count}.
  15727. @item rate, r
  15728. Set frame rate, expressed as number of frames per second. Default
  15729. value is "25".
  15730. @item size, s
  15731. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15732. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15733. @item start_scale
  15734. Set the initial scale value. Default value is 3.0.
  15735. @item start_x
  15736. Set the initial x position. Must be a floating point value between
  15737. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15738. @item start_y
  15739. Set the initial y position. Must be a floating point value between
  15740. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15741. @end table
  15742. @section mptestsrc
  15743. Generate various test patterns, as generated by the MPlayer test filter.
  15744. The size of the generated video is fixed, and is 256x256.
  15745. This source is useful in particular for testing encoding features.
  15746. This source accepts the following options:
  15747. @table @option
  15748. @item rate, r
  15749. Specify the frame rate of the sourced video, as the number of frames
  15750. generated per second. It has to be a string in the format
  15751. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15752. number or a valid video frame rate abbreviation. The default value is
  15753. "25".
  15754. @item duration, d
  15755. Set the duration of the sourced video. See
  15756. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15757. for the accepted syntax.
  15758. If not specified, or the expressed duration is negative, the video is
  15759. supposed to be generated forever.
  15760. @item test, t
  15761. Set the number or the name of the test to perform. Supported tests are:
  15762. @table @option
  15763. @item dc_luma
  15764. @item dc_chroma
  15765. @item freq_luma
  15766. @item freq_chroma
  15767. @item amp_luma
  15768. @item amp_chroma
  15769. @item cbp
  15770. @item mv
  15771. @item ring1
  15772. @item ring2
  15773. @item all
  15774. @end table
  15775. Default value is "all", which will cycle through the list of all tests.
  15776. @end table
  15777. Some examples:
  15778. @example
  15779. mptestsrc=t=dc_luma
  15780. @end example
  15781. will generate a "dc_luma" test pattern.
  15782. @section frei0r_src
  15783. Provide a frei0r source.
  15784. To enable compilation of this filter you need to install the frei0r
  15785. header and configure FFmpeg with @code{--enable-frei0r}.
  15786. This source accepts the following parameters:
  15787. @table @option
  15788. @item size
  15789. The size of the video to generate. For the syntax of this option, check the
  15790. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15791. @item framerate
  15792. The framerate of the generated video. It may be a string of the form
  15793. @var{num}/@var{den} or a frame rate abbreviation.
  15794. @item filter_name
  15795. The name to the frei0r source to load. For more information regarding frei0r and
  15796. how to set the parameters, read the @ref{frei0r} section in the video filters
  15797. documentation.
  15798. @item filter_params
  15799. A '|'-separated list of parameters to pass to the frei0r source.
  15800. @end table
  15801. For example, to generate a frei0r partik0l source with size 200x200
  15802. and frame rate 10 which is overlaid on the overlay filter main input:
  15803. @example
  15804. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15805. @end example
  15806. @section life
  15807. Generate a life pattern.
  15808. This source is based on a generalization of John Conway's life game.
  15809. The sourced input represents a life grid, each pixel represents a cell
  15810. which can be in one of two possible states, alive or dead. Every cell
  15811. interacts with its eight neighbours, which are the cells that are
  15812. horizontally, vertically, or diagonally adjacent.
  15813. At each interaction the grid evolves according to the adopted rule,
  15814. which specifies the number of neighbor alive cells which will make a
  15815. cell stay alive or born. The @option{rule} option allows one to specify
  15816. the rule to adopt.
  15817. This source accepts the following options:
  15818. @table @option
  15819. @item filename, f
  15820. Set the file from which to read the initial grid state. In the file,
  15821. each non-whitespace character is considered an alive cell, and newline
  15822. is used to delimit the end of each row.
  15823. If this option is not specified, the initial grid is generated
  15824. randomly.
  15825. @item rate, r
  15826. Set the video rate, that is the number of frames generated per second.
  15827. Default is 25.
  15828. @item random_fill_ratio, ratio
  15829. Set the random fill ratio for the initial random grid. It is a
  15830. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15831. It is ignored when a file is specified.
  15832. @item random_seed, seed
  15833. Set the seed for filling the initial random grid, must be an integer
  15834. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15835. set to -1, the filter will try to use a good random seed on a best
  15836. effort basis.
  15837. @item rule
  15838. Set the life rule.
  15839. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15840. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15841. @var{NS} specifies the number of alive neighbor cells which make a
  15842. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15843. which make a dead cell to become alive (i.e. to "born").
  15844. "s" and "b" can be used in place of "S" and "B", respectively.
  15845. Alternatively a rule can be specified by an 18-bits integer. The 9
  15846. high order bits are used to encode the next cell state if it is alive
  15847. for each number of neighbor alive cells, the low order bits specify
  15848. the rule for "borning" new cells. Higher order bits encode for an
  15849. higher number of neighbor cells.
  15850. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15851. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15852. Default value is "S23/B3", which is the original Conway's game of life
  15853. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15854. cells, and will born a new cell if there are three alive cells around
  15855. a dead cell.
  15856. @item size, s
  15857. Set the size of the output video. For the syntax of this option, check the
  15858. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15859. If @option{filename} is specified, the size is set by default to the
  15860. same size of the input file. If @option{size} is set, it must contain
  15861. the size specified in the input file, and the initial grid defined in
  15862. that file is centered in the larger resulting area.
  15863. If a filename is not specified, the size value defaults to "320x240"
  15864. (used for a randomly generated initial grid).
  15865. @item stitch
  15866. If set to 1, stitch the left and right grid edges together, and the
  15867. top and bottom edges also. Defaults to 1.
  15868. @item mold
  15869. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15870. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15871. value from 0 to 255.
  15872. @item life_color
  15873. Set the color of living (or new born) cells.
  15874. @item death_color
  15875. Set the color of dead cells. If @option{mold} is set, this is the first color
  15876. used to represent a dead cell.
  15877. @item mold_color
  15878. Set mold color, for definitely dead and moldy cells.
  15879. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15880. ffmpeg-utils manual,ffmpeg-utils}.
  15881. @end table
  15882. @subsection Examples
  15883. @itemize
  15884. @item
  15885. Read a grid from @file{pattern}, and center it on a grid of size
  15886. 300x300 pixels:
  15887. @example
  15888. life=f=pattern:s=300x300
  15889. @end example
  15890. @item
  15891. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15892. @example
  15893. life=ratio=2/3:s=200x200
  15894. @end example
  15895. @item
  15896. Specify a custom rule for evolving a randomly generated grid:
  15897. @example
  15898. life=rule=S14/B34
  15899. @end example
  15900. @item
  15901. Full example with slow death effect (mold) using @command{ffplay}:
  15902. @example
  15903. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15904. @end example
  15905. @end itemize
  15906. @anchor{allrgb}
  15907. @anchor{allyuv}
  15908. @anchor{color}
  15909. @anchor{haldclutsrc}
  15910. @anchor{nullsrc}
  15911. @anchor{pal75bars}
  15912. @anchor{pal100bars}
  15913. @anchor{rgbtestsrc}
  15914. @anchor{smptebars}
  15915. @anchor{smptehdbars}
  15916. @anchor{testsrc}
  15917. @anchor{testsrc2}
  15918. @anchor{yuvtestsrc}
  15919. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15920. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15921. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15922. The @code{color} source provides an uniformly colored input.
  15923. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15924. @ref{haldclut} filter.
  15925. The @code{nullsrc} source returns unprocessed video frames. It is
  15926. mainly useful to be employed in analysis / debugging tools, or as the
  15927. source for filters which ignore the input data.
  15928. The @code{pal75bars} source generates a color bars pattern, based on
  15929. EBU PAL recommendations with 75% color levels.
  15930. The @code{pal100bars} source generates a color bars pattern, based on
  15931. EBU PAL recommendations with 100% color levels.
  15932. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15933. detecting RGB vs BGR issues. You should see a red, green and blue
  15934. stripe from top to bottom.
  15935. The @code{smptebars} source generates a color bars pattern, based on
  15936. the SMPTE Engineering Guideline EG 1-1990.
  15937. The @code{smptehdbars} source generates a color bars pattern, based on
  15938. the SMPTE RP 219-2002.
  15939. The @code{testsrc} source generates a test video pattern, showing a
  15940. color pattern, a scrolling gradient and a timestamp. This is mainly
  15941. intended for testing purposes.
  15942. The @code{testsrc2} source is similar to testsrc, but supports more
  15943. pixel formats instead of just @code{rgb24}. This allows using it as an
  15944. input for other tests without requiring a format conversion.
  15945. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15946. see a y, cb and cr stripe from top to bottom.
  15947. The sources accept the following parameters:
  15948. @table @option
  15949. @item level
  15950. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15951. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15952. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15953. coded on a @code{1/(N*N)} scale.
  15954. @item color, c
  15955. Specify the color of the source, only available in the @code{color}
  15956. source. For the syntax of this option, check the
  15957. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15958. @item size, s
  15959. Specify the size of the sourced video. For the syntax of this option, check the
  15960. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15961. The default value is @code{320x240}.
  15962. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15963. @code{haldclutsrc} filters.
  15964. @item rate, r
  15965. Specify the frame rate of the sourced video, as the number of frames
  15966. generated per second. It has to be a string in the format
  15967. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15968. number or a valid video frame rate abbreviation. The default value is
  15969. "25".
  15970. @item duration, d
  15971. Set the duration of the sourced video. See
  15972. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15973. for the accepted syntax.
  15974. If not specified, or the expressed duration is negative, the video is
  15975. supposed to be generated forever.
  15976. @item sar
  15977. Set the sample aspect ratio of the sourced video.
  15978. @item alpha
  15979. Specify the alpha (opacity) of the background, only available in the
  15980. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15981. 255 (fully opaque, the default).
  15982. @item decimals, n
  15983. Set the number of decimals to show in the timestamp, only available in the
  15984. @code{testsrc} source.
  15985. The displayed timestamp value will correspond to the original
  15986. timestamp value multiplied by the power of 10 of the specified
  15987. value. Default value is 0.
  15988. @end table
  15989. @subsection Examples
  15990. @itemize
  15991. @item
  15992. Generate a video with a duration of 5.3 seconds, with size
  15993. 176x144 and a frame rate of 10 frames per second:
  15994. @example
  15995. testsrc=duration=5.3:size=qcif:rate=10
  15996. @end example
  15997. @item
  15998. The following graph description will generate a red source
  15999. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  16000. frames per second:
  16001. @example
  16002. color=c=red@@0.2:s=qcif:r=10
  16003. @end example
  16004. @item
  16005. If the input content is to be ignored, @code{nullsrc} can be used. The
  16006. following command generates noise in the luminance plane by employing
  16007. the @code{geq} filter:
  16008. @example
  16009. nullsrc=s=256x256, geq=random(1)*255:128:128
  16010. @end example
  16011. @end itemize
  16012. @subsection Commands
  16013. The @code{color} source supports the following commands:
  16014. @table @option
  16015. @item c, color
  16016. Set the color of the created image. Accepts the same syntax of the
  16017. corresponding @option{color} option.
  16018. @end table
  16019. @section openclsrc
  16020. Generate video using an OpenCL program.
  16021. @table @option
  16022. @item source
  16023. OpenCL program source file.
  16024. @item kernel
  16025. Kernel name in program.
  16026. @item size, s
  16027. Size of frames to generate. This must be set.
  16028. @item format
  16029. Pixel format to use for the generated frames. This must be set.
  16030. @item rate, r
  16031. Number of frames generated every second. Default value is '25'.
  16032. @end table
  16033. For details of how the program loading works, see the @ref{program_opencl}
  16034. filter.
  16035. Example programs:
  16036. @itemize
  16037. @item
  16038. Generate a colour ramp by setting pixel values from the position of the pixel
  16039. in the output image. (Note that this will work with all pixel formats, but
  16040. the generated output will not be the same.)
  16041. @verbatim
  16042. __kernel void ramp(__write_only image2d_t dst,
  16043. unsigned int index)
  16044. {
  16045. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16046. float4 val;
  16047. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  16048. write_imagef(dst, loc, val);
  16049. }
  16050. @end verbatim
  16051. @item
  16052. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  16053. @verbatim
  16054. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  16055. unsigned int index)
  16056. {
  16057. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  16058. float4 value = 0.0f;
  16059. int x = loc.x + index;
  16060. int y = loc.y + index;
  16061. while (x > 0 || y > 0) {
  16062. if (x % 3 == 1 && y % 3 == 1) {
  16063. value = 1.0f;
  16064. break;
  16065. }
  16066. x /= 3;
  16067. y /= 3;
  16068. }
  16069. write_imagef(dst, loc, value);
  16070. }
  16071. @end verbatim
  16072. @end itemize
  16073. @section sierpinski
  16074. Generate a Sierpinksi carpet fractal, and randomly pan around.
  16075. This source accepts the following options:
  16076. @table @option
  16077. @item size, s
  16078. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  16079. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  16080. @item rate, r
  16081. Set frame rate, expressed as number of frames per second. Default
  16082. value is "25".
  16083. @item seed
  16084. Set seed which is used for random panning.
  16085. @item jump
  16086. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  16087. @end table
  16088. @c man end VIDEO SOURCES
  16089. @chapter Video Sinks
  16090. @c man begin VIDEO SINKS
  16091. Below is a description of the currently available video sinks.
  16092. @section buffersink
  16093. Buffer video frames, and make them available to the end of the filter
  16094. graph.
  16095. This sink is mainly intended for programmatic use, in particular
  16096. through the interface defined in @file{libavfilter/buffersink.h}
  16097. or the options system.
  16098. It accepts a pointer to an AVBufferSinkContext structure, which
  16099. defines the incoming buffers' formats, to be passed as the opaque
  16100. parameter to @code{avfilter_init_filter} for initialization.
  16101. @section nullsink
  16102. Null video sink: do absolutely nothing with the input video. It is
  16103. mainly useful as a template and for use in analysis / debugging
  16104. tools.
  16105. @c man end VIDEO SINKS
  16106. @chapter Multimedia Filters
  16107. @c man begin MULTIMEDIA FILTERS
  16108. Below is a description of the currently available multimedia filters.
  16109. @section abitscope
  16110. Convert input audio to a video output, displaying the audio bit scope.
  16111. The filter accepts the following options:
  16112. @table @option
  16113. @item rate, r
  16114. Set frame rate, expressed as number of frames per second. Default
  16115. value is "25".
  16116. @item size, s
  16117. Specify the video size for the output. For the syntax of this option, check the
  16118. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16119. Default value is @code{1024x256}.
  16120. @item colors
  16121. Specify list of colors separated by space or by '|' which will be used to
  16122. draw channels. Unrecognized or missing colors will be replaced
  16123. by white color.
  16124. @end table
  16125. @section ahistogram
  16126. Convert input audio to a video output, displaying the volume histogram.
  16127. The filter accepts the following options:
  16128. @table @option
  16129. @item dmode
  16130. Specify how histogram is calculated.
  16131. It accepts the following values:
  16132. @table @samp
  16133. @item single
  16134. Use single histogram for all channels.
  16135. @item separate
  16136. Use separate histogram for each channel.
  16137. @end table
  16138. Default is @code{single}.
  16139. @item rate, r
  16140. Set frame rate, expressed as number of frames per second. Default
  16141. value is "25".
  16142. @item size, s
  16143. Specify the video size for the output. For the syntax of this option, check the
  16144. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16145. Default value is @code{hd720}.
  16146. @item scale
  16147. Set display scale.
  16148. It accepts the following values:
  16149. @table @samp
  16150. @item log
  16151. logarithmic
  16152. @item sqrt
  16153. square root
  16154. @item cbrt
  16155. cubic root
  16156. @item lin
  16157. linear
  16158. @item rlog
  16159. reverse logarithmic
  16160. @end table
  16161. Default is @code{log}.
  16162. @item ascale
  16163. Set amplitude scale.
  16164. It accepts the following values:
  16165. @table @samp
  16166. @item log
  16167. logarithmic
  16168. @item lin
  16169. linear
  16170. @end table
  16171. Default is @code{log}.
  16172. @item acount
  16173. Set how much frames to accumulate in histogram.
  16174. Default is 1. Setting this to -1 accumulates all frames.
  16175. @item rheight
  16176. Set histogram ratio of window height.
  16177. @item slide
  16178. Set sonogram sliding.
  16179. It accepts the following values:
  16180. @table @samp
  16181. @item replace
  16182. replace old rows with new ones.
  16183. @item scroll
  16184. scroll from top to bottom.
  16185. @end table
  16186. Default is @code{replace}.
  16187. @end table
  16188. @section aphasemeter
  16189. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  16190. representing mean phase of current audio frame. A video output can also be produced and is
  16191. enabled by default. The audio is passed through as first output.
  16192. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  16193. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  16194. and @code{1} means channels are in phase.
  16195. The filter accepts the following options, all related to its video output:
  16196. @table @option
  16197. @item rate, r
  16198. Set the output frame rate. Default value is @code{25}.
  16199. @item size, s
  16200. Set the video size for the output. For the syntax of this option, check the
  16201. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16202. Default value is @code{800x400}.
  16203. @item rc
  16204. @item gc
  16205. @item bc
  16206. Specify the red, green, blue contrast. Default values are @code{2},
  16207. @code{7} and @code{1}.
  16208. Allowed range is @code{[0, 255]}.
  16209. @item mpc
  16210. Set color which will be used for drawing median phase. If color is
  16211. @code{none} which is default, no median phase value will be drawn.
  16212. @item video
  16213. Enable video output. Default is enabled.
  16214. @end table
  16215. @section avectorscope
  16216. Convert input audio to a video output, representing the audio vector
  16217. scope.
  16218. The filter is used to measure the difference between channels of stereo
  16219. audio stream. A monoaural signal, consisting of identical left and right
  16220. signal, results in straight vertical line. Any stereo separation is visible
  16221. as a deviation from this line, creating a Lissajous figure.
  16222. If the straight (or deviation from it) but horizontal line appears this
  16223. indicates that the left and right channels are out of phase.
  16224. The filter accepts the following options:
  16225. @table @option
  16226. @item mode, m
  16227. Set the vectorscope mode.
  16228. Available values are:
  16229. @table @samp
  16230. @item lissajous
  16231. Lissajous rotated by 45 degrees.
  16232. @item lissajous_xy
  16233. Same as above but not rotated.
  16234. @item polar
  16235. Shape resembling half of circle.
  16236. @end table
  16237. Default value is @samp{lissajous}.
  16238. @item size, s
  16239. Set the video size for the output. For the syntax of this option, check the
  16240. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16241. Default value is @code{400x400}.
  16242. @item rate, r
  16243. Set the output frame rate. Default value is @code{25}.
  16244. @item rc
  16245. @item gc
  16246. @item bc
  16247. @item ac
  16248. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  16249. @code{160}, @code{80} and @code{255}.
  16250. Allowed range is @code{[0, 255]}.
  16251. @item rf
  16252. @item gf
  16253. @item bf
  16254. @item af
  16255. Specify the red, green, blue and alpha fade. Default values are @code{15},
  16256. @code{10}, @code{5} and @code{5}.
  16257. Allowed range is @code{[0, 255]}.
  16258. @item zoom
  16259. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  16260. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  16261. @item draw
  16262. Set the vectorscope drawing mode.
  16263. Available values are:
  16264. @table @samp
  16265. @item dot
  16266. Draw dot for each sample.
  16267. @item line
  16268. Draw line between previous and current sample.
  16269. @end table
  16270. Default value is @samp{dot}.
  16271. @item scale
  16272. Specify amplitude scale of audio samples.
  16273. Available values are:
  16274. @table @samp
  16275. @item lin
  16276. Linear.
  16277. @item sqrt
  16278. Square root.
  16279. @item cbrt
  16280. Cubic root.
  16281. @item log
  16282. Logarithmic.
  16283. @end table
  16284. @item swap
  16285. Swap left channel axis with right channel axis.
  16286. @item mirror
  16287. Mirror axis.
  16288. @table @samp
  16289. @item none
  16290. No mirror.
  16291. @item x
  16292. Mirror only x axis.
  16293. @item y
  16294. Mirror only y axis.
  16295. @item xy
  16296. Mirror both axis.
  16297. @end table
  16298. @end table
  16299. @subsection Examples
  16300. @itemize
  16301. @item
  16302. Complete example using @command{ffplay}:
  16303. @example
  16304. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16305. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  16306. @end example
  16307. @end itemize
  16308. @section bench, abench
  16309. Benchmark part of a filtergraph.
  16310. The filter accepts the following options:
  16311. @table @option
  16312. @item action
  16313. Start or stop a timer.
  16314. Available values are:
  16315. @table @samp
  16316. @item start
  16317. Get the current time, set it as frame metadata (using the key
  16318. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  16319. @item stop
  16320. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  16321. the input frame metadata to get the time difference. Time difference, average,
  16322. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  16323. @code{min}) are then printed. The timestamps are expressed in seconds.
  16324. @end table
  16325. @end table
  16326. @subsection Examples
  16327. @itemize
  16328. @item
  16329. Benchmark @ref{selectivecolor} filter:
  16330. @example
  16331. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  16332. @end example
  16333. @end itemize
  16334. @section concat
  16335. Concatenate audio and video streams, joining them together one after the
  16336. other.
  16337. The filter works on segments of synchronized video and audio streams. All
  16338. segments must have the same number of streams of each type, and that will
  16339. also be the number of streams at output.
  16340. The filter accepts the following options:
  16341. @table @option
  16342. @item n
  16343. Set the number of segments. Default is 2.
  16344. @item v
  16345. Set the number of output video streams, that is also the number of video
  16346. streams in each segment. Default is 1.
  16347. @item a
  16348. Set the number of output audio streams, that is also the number of audio
  16349. streams in each segment. Default is 0.
  16350. @item unsafe
  16351. Activate unsafe mode: do not fail if segments have a different format.
  16352. @end table
  16353. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  16354. @var{a} audio outputs.
  16355. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  16356. segment, in the same order as the outputs, then the inputs for the second
  16357. segment, etc.
  16358. Related streams do not always have exactly the same duration, for various
  16359. reasons including codec frame size or sloppy authoring. For that reason,
  16360. related synchronized streams (e.g. a video and its audio track) should be
  16361. concatenated at once. The concat filter will use the duration of the longest
  16362. stream in each segment (except the last one), and if necessary pad shorter
  16363. audio streams with silence.
  16364. For this filter to work correctly, all segments must start at timestamp 0.
  16365. All corresponding streams must have the same parameters in all segments; the
  16366. filtering system will automatically select a common pixel format for video
  16367. streams, and a common sample format, sample rate and channel layout for
  16368. audio streams, but other settings, such as resolution, must be converted
  16369. explicitly by the user.
  16370. Different frame rates are acceptable but will result in variable frame rate
  16371. at output; be sure to configure the output file to handle it.
  16372. @subsection Examples
  16373. @itemize
  16374. @item
  16375. Concatenate an opening, an episode and an ending, all in bilingual version
  16376. (video in stream 0, audio in streams 1 and 2):
  16377. @example
  16378. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  16379. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  16380. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  16381. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  16382. @end example
  16383. @item
  16384. Concatenate two parts, handling audio and video separately, using the
  16385. (a)movie sources, and adjusting the resolution:
  16386. @example
  16387. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  16388. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  16389. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  16390. @end example
  16391. Note that a desync will happen at the stitch if the audio and video streams
  16392. do not have exactly the same duration in the first file.
  16393. @end itemize
  16394. @subsection Commands
  16395. This filter supports the following commands:
  16396. @table @option
  16397. @item next
  16398. Close the current segment and step to the next one
  16399. @end table
  16400. @section drawgraph, adrawgraph
  16401. Draw a graph using input video or audio metadata.
  16402. It accepts the following parameters:
  16403. @table @option
  16404. @item m1
  16405. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  16406. @item fg1
  16407. Set 1st foreground color expression.
  16408. @item m2
  16409. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  16410. @item fg2
  16411. Set 2nd foreground color expression.
  16412. @item m3
  16413. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  16414. @item fg3
  16415. Set 3rd foreground color expression.
  16416. @item m4
  16417. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  16418. @item fg4
  16419. Set 4th foreground color expression.
  16420. @item min
  16421. Set minimal value of metadata value.
  16422. @item max
  16423. Set maximal value of metadata value.
  16424. @item bg
  16425. Set graph background color. Default is white.
  16426. @item mode
  16427. Set graph mode.
  16428. Available values for mode is:
  16429. @table @samp
  16430. @item bar
  16431. @item dot
  16432. @item line
  16433. @end table
  16434. Default is @code{line}.
  16435. @item slide
  16436. Set slide mode.
  16437. Available values for slide is:
  16438. @table @samp
  16439. @item frame
  16440. Draw new frame when right border is reached.
  16441. @item replace
  16442. Replace old columns with new ones.
  16443. @item scroll
  16444. Scroll from right to left.
  16445. @item rscroll
  16446. Scroll from left to right.
  16447. @item picture
  16448. Draw single picture.
  16449. @end table
  16450. Default is @code{frame}.
  16451. @item size
  16452. Set size of graph video. For the syntax of this option, check the
  16453. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16454. The default value is @code{900x256}.
  16455. The foreground color expressions can use the following variables:
  16456. @table @option
  16457. @item MIN
  16458. Minimal value of metadata value.
  16459. @item MAX
  16460. Maximal value of metadata value.
  16461. @item VAL
  16462. Current metadata key value.
  16463. @end table
  16464. The color is defined as 0xAABBGGRR.
  16465. @end table
  16466. Example using metadata from @ref{signalstats} filter:
  16467. @example
  16468. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  16469. @end example
  16470. Example using metadata from @ref{ebur128} filter:
  16471. @example
  16472. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  16473. @end example
  16474. @anchor{ebur128}
  16475. @section ebur128
  16476. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  16477. level. By default, it logs a message at a frequency of 10Hz with the
  16478. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  16479. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  16480. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  16481. sample format is double-precision floating point. The input stream will be converted to
  16482. this specification, if needed. Users may need to insert aformat and/or aresample filters
  16483. after this filter to obtain the original parameters.
  16484. The filter also has a video output (see the @var{video} option) with a real
  16485. time graph to observe the loudness evolution. The graphic contains the logged
  16486. message mentioned above, so it is not printed anymore when this option is set,
  16487. unless the verbose logging is set. The main graphing area contains the
  16488. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  16489. the momentary loudness (400 milliseconds), but can optionally be configured
  16490. to instead display short-term loudness (see @var{gauge}).
  16491. The green area marks a +/- 1LU target range around the target loudness
  16492. (-23LUFS by default, unless modified through @var{target}).
  16493. More information about the Loudness Recommendation EBU R128 on
  16494. @url{http://tech.ebu.ch/loudness}.
  16495. The filter accepts the following options:
  16496. @table @option
  16497. @item video
  16498. Activate the video output. The audio stream is passed unchanged whether this
  16499. option is set or no. The video stream will be the first output stream if
  16500. activated. Default is @code{0}.
  16501. @item size
  16502. Set the video size. This option is for video only. For the syntax of this
  16503. option, check the
  16504. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16505. Default and minimum resolution is @code{640x480}.
  16506. @item meter
  16507. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  16508. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  16509. other integer value between this range is allowed.
  16510. @item metadata
  16511. Set metadata injection. If set to @code{1}, the audio input will be segmented
  16512. into 100ms output frames, each of them containing various loudness information
  16513. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  16514. Default is @code{0}.
  16515. @item framelog
  16516. Force the frame logging level.
  16517. Available values are:
  16518. @table @samp
  16519. @item info
  16520. information logging level
  16521. @item verbose
  16522. verbose logging level
  16523. @end table
  16524. By default, the logging level is set to @var{info}. If the @option{video} or
  16525. the @option{metadata} options are set, it switches to @var{verbose}.
  16526. @item peak
  16527. Set peak mode(s).
  16528. Available modes can be cumulated (the option is a @code{flag} type). Possible
  16529. values are:
  16530. @table @samp
  16531. @item none
  16532. Disable any peak mode (default).
  16533. @item sample
  16534. Enable sample-peak mode.
  16535. Simple peak mode looking for the higher sample value. It logs a message
  16536. for sample-peak (identified by @code{SPK}).
  16537. @item true
  16538. Enable true-peak mode.
  16539. If enabled, the peak lookup is done on an over-sampled version of the input
  16540. stream for better peak accuracy. It logs a message for true-peak.
  16541. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  16542. This mode requires a build with @code{libswresample}.
  16543. @end table
  16544. @item dualmono
  16545. Treat mono input files as "dual mono". If a mono file is intended for playback
  16546. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  16547. If set to @code{true}, this option will compensate for this effect.
  16548. Multi-channel input files are not affected by this option.
  16549. @item panlaw
  16550. Set a specific pan law to be used for the measurement of dual mono files.
  16551. This parameter is optional, and has a default value of -3.01dB.
  16552. @item target
  16553. Set a specific target level (in LUFS) used as relative zero in the visualization.
  16554. This parameter is optional and has a default value of -23LUFS as specified
  16555. by EBU R128. However, material published online may prefer a level of -16LUFS
  16556. (e.g. for use with podcasts or video platforms).
  16557. @item gauge
  16558. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  16559. @code{shortterm}. By default the momentary value will be used, but in certain
  16560. scenarios it may be more useful to observe the short term value instead (e.g.
  16561. live mixing).
  16562. @item scale
  16563. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  16564. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  16565. video output, not the summary or continuous log output.
  16566. @end table
  16567. @subsection Examples
  16568. @itemize
  16569. @item
  16570. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  16571. @example
  16572. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  16573. @end example
  16574. @item
  16575. Run an analysis with @command{ffmpeg}:
  16576. @example
  16577. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  16578. @end example
  16579. @end itemize
  16580. @section interleave, ainterleave
  16581. Temporally interleave frames from several inputs.
  16582. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  16583. These filters read frames from several inputs and send the oldest
  16584. queued frame to the output.
  16585. Input streams must have well defined, monotonically increasing frame
  16586. timestamp values.
  16587. In order to submit one frame to output, these filters need to enqueue
  16588. at least one frame for each input, so they cannot work in case one
  16589. input is not yet terminated and will not receive incoming frames.
  16590. For example consider the case when one input is a @code{select} filter
  16591. which always drops input frames. The @code{interleave} filter will keep
  16592. reading from that input, but it will never be able to send new frames
  16593. to output until the input sends an end-of-stream signal.
  16594. Also, depending on inputs synchronization, the filters will drop
  16595. frames in case one input receives more frames than the other ones, and
  16596. the queue is already filled.
  16597. These filters accept the following options:
  16598. @table @option
  16599. @item nb_inputs, n
  16600. Set the number of different inputs, it is 2 by default.
  16601. @end table
  16602. @subsection Examples
  16603. @itemize
  16604. @item
  16605. Interleave frames belonging to different streams using @command{ffmpeg}:
  16606. @example
  16607. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  16608. @end example
  16609. @item
  16610. Add flickering blur effect:
  16611. @example
  16612. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  16613. @end example
  16614. @end itemize
  16615. @section metadata, ametadata
  16616. Manipulate frame metadata.
  16617. This filter accepts the following options:
  16618. @table @option
  16619. @item mode
  16620. Set mode of operation of the filter.
  16621. Can be one of the following:
  16622. @table @samp
  16623. @item select
  16624. If both @code{value} and @code{key} is set, select frames
  16625. which have such metadata. If only @code{key} is set, select
  16626. every frame that has such key in metadata.
  16627. @item add
  16628. Add new metadata @code{key} and @code{value}. If key is already available
  16629. do nothing.
  16630. @item modify
  16631. Modify value of already present key.
  16632. @item delete
  16633. If @code{value} is set, delete only keys that have such value.
  16634. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  16635. the frame.
  16636. @item print
  16637. Print key and its value if metadata was found. If @code{key} is not set print all
  16638. metadata values available in frame.
  16639. @end table
  16640. @item key
  16641. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  16642. @item value
  16643. Set metadata value which will be used. This option is mandatory for
  16644. @code{modify} and @code{add} mode.
  16645. @item function
  16646. Which function to use when comparing metadata value and @code{value}.
  16647. Can be one of following:
  16648. @table @samp
  16649. @item same_str
  16650. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  16651. @item starts_with
  16652. Values are interpreted as strings, returns true if metadata value starts with
  16653. the @code{value} option string.
  16654. @item less
  16655. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  16656. @item equal
  16657. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  16658. @item greater
  16659. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  16660. @item expr
  16661. Values are interpreted as floats, returns true if expression from option @code{expr}
  16662. evaluates to true.
  16663. @item ends_with
  16664. Values are interpreted as strings, returns true if metadata value ends with
  16665. the @code{value} option string.
  16666. @end table
  16667. @item expr
  16668. Set expression which is used when @code{function} is set to @code{expr}.
  16669. The expression is evaluated through the eval API and can contain the following
  16670. constants:
  16671. @table @option
  16672. @item VALUE1
  16673. Float representation of @code{value} from metadata key.
  16674. @item VALUE2
  16675. Float representation of @code{value} as supplied by user in @code{value} option.
  16676. @end table
  16677. @item file
  16678. If specified in @code{print} mode, output is written to the named file. Instead of
  16679. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  16680. for standard output. If @code{file} option is not set, output is written to the log
  16681. with AV_LOG_INFO loglevel.
  16682. @end table
  16683. @subsection Examples
  16684. @itemize
  16685. @item
  16686. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  16687. between 0 and 1.
  16688. @example
  16689. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  16690. @end example
  16691. @item
  16692. Print silencedetect output to file @file{metadata.txt}.
  16693. @example
  16694. silencedetect,ametadata=mode=print:file=metadata.txt
  16695. @end example
  16696. @item
  16697. Direct all metadata to a pipe with file descriptor 4.
  16698. @example
  16699. metadata=mode=print:file='pipe\:4'
  16700. @end example
  16701. @end itemize
  16702. @section perms, aperms
  16703. Set read/write permissions for the output frames.
  16704. These filters are mainly aimed at developers to test direct path in the
  16705. following filter in the filtergraph.
  16706. The filters accept the following options:
  16707. @table @option
  16708. @item mode
  16709. Select the permissions mode.
  16710. It accepts the following values:
  16711. @table @samp
  16712. @item none
  16713. Do nothing. This is the default.
  16714. @item ro
  16715. Set all the output frames read-only.
  16716. @item rw
  16717. Set all the output frames directly writable.
  16718. @item toggle
  16719. Make the frame read-only if writable, and writable if read-only.
  16720. @item random
  16721. Set each output frame read-only or writable randomly.
  16722. @end table
  16723. @item seed
  16724. Set the seed for the @var{random} mode, must be an integer included between
  16725. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16726. @code{-1}, the filter will try to use a good random seed on a best effort
  16727. basis.
  16728. @end table
  16729. Note: in case of auto-inserted filter between the permission filter and the
  16730. following one, the permission might not be received as expected in that
  16731. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16732. perms/aperms filter can avoid this problem.
  16733. @section realtime, arealtime
  16734. Slow down filtering to match real time approximately.
  16735. These filters will pause the filtering for a variable amount of time to
  16736. match the output rate with the input timestamps.
  16737. They are similar to the @option{re} option to @code{ffmpeg}.
  16738. They accept the following options:
  16739. @table @option
  16740. @item limit
  16741. Time limit for the pauses. Any pause longer than that will be considered
  16742. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16743. @item speed
  16744. Speed factor for processing. The value must be a float larger than zero.
  16745. Values larger than 1.0 will result in faster than realtime processing,
  16746. smaller will slow processing down. The @var{limit} is automatically adapted
  16747. accordingly. Default is 1.0.
  16748. A processing speed faster than what is possible without these filters cannot
  16749. be achieved.
  16750. @end table
  16751. @anchor{select}
  16752. @section select, aselect
  16753. Select frames to pass in output.
  16754. This filter accepts the following options:
  16755. @table @option
  16756. @item expr, e
  16757. Set expression, which is evaluated for each input frame.
  16758. If the expression is evaluated to zero, the frame is discarded.
  16759. If the evaluation result is negative or NaN, the frame is sent to the
  16760. first output; otherwise it is sent to the output with index
  16761. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16762. For example a value of @code{1.2} corresponds to the output with index
  16763. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16764. @item outputs, n
  16765. Set the number of outputs. The output to which to send the selected
  16766. frame is based on the result of the evaluation. Default value is 1.
  16767. @end table
  16768. The expression can contain the following constants:
  16769. @table @option
  16770. @item n
  16771. The (sequential) number of the filtered frame, starting from 0.
  16772. @item selected_n
  16773. The (sequential) number of the selected frame, starting from 0.
  16774. @item prev_selected_n
  16775. The sequential number of the last selected frame. It's NAN if undefined.
  16776. @item TB
  16777. The timebase of the input timestamps.
  16778. @item pts
  16779. The PTS (Presentation TimeStamp) of the filtered video frame,
  16780. expressed in @var{TB} units. It's NAN if undefined.
  16781. @item t
  16782. The PTS of the filtered video frame,
  16783. expressed in seconds. It's NAN if undefined.
  16784. @item prev_pts
  16785. The PTS of the previously filtered video frame. It's NAN if undefined.
  16786. @item prev_selected_pts
  16787. The PTS of the last previously filtered video frame. It's NAN if undefined.
  16788. @item prev_selected_t
  16789. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  16790. @item start_pts
  16791. The PTS of the first video frame in the video. It's NAN if undefined.
  16792. @item start_t
  16793. The time of the first video frame in the video. It's NAN if undefined.
  16794. @item pict_type @emph{(video only)}
  16795. The type of the filtered frame. It can assume one of the following
  16796. values:
  16797. @table @option
  16798. @item I
  16799. @item P
  16800. @item B
  16801. @item S
  16802. @item SI
  16803. @item SP
  16804. @item BI
  16805. @end table
  16806. @item interlace_type @emph{(video only)}
  16807. The frame interlace type. It can assume one of the following values:
  16808. @table @option
  16809. @item PROGRESSIVE
  16810. The frame is progressive (not interlaced).
  16811. @item TOPFIRST
  16812. The frame is top-field-first.
  16813. @item BOTTOMFIRST
  16814. The frame is bottom-field-first.
  16815. @end table
  16816. @item consumed_sample_n @emph{(audio only)}
  16817. the number of selected samples before the current frame
  16818. @item samples_n @emph{(audio only)}
  16819. the number of samples in the current frame
  16820. @item sample_rate @emph{(audio only)}
  16821. the input sample rate
  16822. @item key
  16823. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16824. @item pos
  16825. the position in the file of the filtered frame, -1 if the information
  16826. is not available (e.g. for synthetic video)
  16827. @item scene @emph{(video only)}
  16828. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16829. probability for the current frame to introduce a new scene, while a higher
  16830. value means the current frame is more likely to be one (see the example below)
  16831. @item concatdec_select
  16832. The concat demuxer can select only part of a concat input file by setting an
  16833. inpoint and an outpoint, but the output packets may not be entirely contained
  16834. in the selected interval. By using this variable, it is possible to skip frames
  16835. generated by the concat demuxer which are not exactly contained in the selected
  16836. interval.
  16837. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16838. and the @var{lavf.concat.duration} packet metadata values which are also
  16839. present in the decoded frames.
  16840. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16841. start_time and either the duration metadata is missing or the frame pts is less
  16842. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16843. missing.
  16844. That basically means that an input frame is selected if its pts is within the
  16845. interval set by the concat demuxer.
  16846. @end table
  16847. The default value of the select expression is "1".
  16848. @subsection Examples
  16849. @itemize
  16850. @item
  16851. Select all frames in input:
  16852. @example
  16853. select
  16854. @end example
  16855. The example above is the same as:
  16856. @example
  16857. select=1
  16858. @end example
  16859. @item
  16860. Skip all frames:
  16861. @example
  16862. select=0
  16863. @end example
  16864. @item
  16865. Select only I-frames:
  16866. @example
  16867. select='eq(pict_type\,I)'
  16868. @end example
  16869. @item
  16870. Select one frame every 100:
  16871. @example
  16872. select='not(mod(n\,100))'
  16873. @end example
  16874. @item
  16875. Select only frames contained in the 10-20 time interval:
  16876. @example
  16877. select=between(t\,10\,20)
  16878. @end example
  16879. @item
  16880. Select only I-frames contained in the 10-20 time interval:
  16881. @example
  16882. select=between(t\,10\,20)*eq(pict_type\,I)
  16883. @end example
  16884. @item
  16885. Select frames with a minimum distance of 10 seconds:
  16886. @example
  16887. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16888. @end example
  16889. @item
  16890. Use aselect to select only audio frames with samples number > 100:
  16891. @example
  16892. aselect='gt(samples_n\,100)'
  16893. @end example
  16894. @item
  16895. Create a mosaic of the first scenes:
  16896. @example
  16897. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16898. @end example
  16899. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16900. choice.
  16901. @item
  16902. Send even and odd frames to separate outputs, and compose them:
  16903. @example
  16904. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16905. @end example
  16906. @item
  16907. Select useful frames from an ffconcat file which is using inpoints and
  16908. outpoints but where the source files are not intra frame only.
  16909. @example
  16910. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16911. @end example
  16912. @end itemize
  16913. @section sendcmd, asendcmd
  16914. Send commands to filters in the filtergraph.
  16915. These filters read commands to be sent to other filters in the
  16916. filtergraph.
  16917. @code{sendcmd} must be inserted between two video filters,
  16918. @code{asendcmd} must be inserted between two audio filters, but apart
  16919. from that they act the same way.
  16920. The specification of commands can be provided in the filter arguments
  16921. with the @var{commands} option, or in a file specified by the
  16922. @var{filename} option.
  16923. These filters accept the following options:
  16924. @table @option
  16925. @item commands, c
  16926. Set the commands to be read and sent to the other filters.
  16927. @item filename, f
  16928. Set the filename of the commands to be read and sent to the other
  16929. filters.
  16930. @end table
  16931. @subsection Commands syntax
  16932. A commands description consists of a sequence of interval
  16933. specifications, comprising a list of commands to be executed when a
  16934. particular event related to that interval occurs. The occurring event
  16935. is typically the current frame time entering or leaving a given time
  16936. interval.
  16937. An interval is specified by the following syntax:
  16938. @example
  16939. @var{START}[-@var{END}] @var{COMMANDS};
  16940. @end example
  16941. The time interval is specified by the @var{START} and @var{END} times.
  16942. @var{END} is optional and defaults to the maximum time.
  16943. The current frame time is considered within the specified interval if
  16944. it is included in the interval [@var{START}, @var{END}), that is when
  16945. the time is greater or equal to @var{START} and is lesser than
  16946. @var{END}.
  16947. @var{COMMANDS} consists of a sequence of one or more command
  16948. specifications, separated by ",", relating to that interval. The
  16949. syntax of a command specification is given by:
  16950. @example
  16951. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16952. @end example
  16953. @var{FLAGS} is optional and specifies the type of events relating to
  16954. the time interval which enable sending the specified command, and must
  16955. be a non-null sequence of identifier flags separated by "+" or "|" and
  16956. enclosed between "[" and "]".
  16957. The following flags are recognized:
  16958. @table @option
  16959. @item enter
  16960. The command is sent when the current frame timestamp enters the
  16961. specified interval. In other words, the command is sent when the
  16962. previous frame timestamp was not in the given interval, and the
  16963. current is.
  16964. @item leave
  16965. The command is sent when the current frame timestamp leaves the
  16966. specified interval. In other words, the command is sent when the
  16967. previous frame timestamp was in the given interval, and the
  16968. current is not.
  16969. @end table
  16970. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16971. assumed.
  16972. @var{TARGET} specifies the target of the command, usually the name of
  16973. the filter class or a specific filter instance name.
  16974. @var{COMMAND} specifies the name of the command for the target filter.
  16975. @var{ARG} is optional and specifies the optional list of argument for
  16976. the given @var{COMMAND}.
  16977. Between one interval specification and another, whitespaces, or
  16978. sequences of characters starting with @code{#} until the end of line,
  16979. are ignored and can be used to annotate comments.
  16980. A simplified BNF description of the commands specification syntax
  16981. follows:
  16982. @example
  16983. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16984. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16985. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16986. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16987. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16988. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16989. @end example
  16990. @subsection Examples
  16991. @itemize
  16992. @item
  16993. Specify audio tempo change at second 4:
  16994. @example
  16995. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16996. @end example
  16997. @item
  16998. Target a specific filter instance:
  16999. @example
  17000. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  17001. @end example
  17002. @item
  17003. Specify a list of drawtext and hue commands in a file.
  17004. @example
  17005. # show text in the interval 5-10
  17006. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  17007. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  17008. # desaturate the image in the interval 15-20
  17009. 15.0-20.0 [enter] hue s 0,
  17010. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  17011. [leave] hue s 1,
  17012. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  17013. # apply an exponential saturation fade-out effect, starting from time 25
  17014. 25 [enter] hue s exp(25-t)
  17015. @end example
  17016. A filtergraph allowing to read and process the above command list
  17017. stored in a file @file{test.cmd}, can be specified with:
  17018. @example
  17019. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  17020. @end example
  17021. @end itemize
  17022. @anchor{setpts}
  17023. @section setpts, asetpts
  17024. Change the PTS (presentation timestamp) of the input frames.
  17025. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  17026. This filter accepts the following options:
  17027. @table @option
  17028. @item expr
  17029. The expression which is evaluated for each frame to construct its timestamp.
  17030. @end table
  17031. The expression is evaluated through the eval API and can contain the following
  17032. constants:
  17033. @table @option
  17034. @item FRAME_RATE, FR
  17035. frame rate, only defined for constant frame-rate video
  17036. @item PTS
  17037. The presentation timestamp in input
  17038. @item N
  17039. The count of the input frame for video or the number of consumed samples,
  17040. not including the current frame for audio, starting from 0.
  17041. @item NB_CONSUMED_SAMPLES
  17042. The number of consumed samples, not including the current frame (only
  17043. audio)
  17044. @item NB_SAMPLES, S
  17045. The number of samples in the current frame (only audio)
  17046. @item SAMPLE_RATE, SR
  17047. The audio sample rate.
  17048. @item STARTPTS
  17049. The PTS of the first frame.
  17050. @item STARTT
  17051. the time in seconds of the first frame
  17052. @item INTERLACED
  17053. State whether the current frame is interlaced.
  17054. @item T
  17055. the time in seconds of the current frame
  17056. @item POS
  17057. original position in the file of the frame, or undefined if undefined
  17058. for the current frame
  17059. @item PREV_INPTS
  17060. The previous input PTS.
  17061. @item PREV_INT
  17062. previous input time in seconds
  17063. @item PREV_OUTPTS
  17064. The previous output PTS.
  17065. @item PREV_OUTT
  17066. previous output time in seconds
  17067. @item RTCTIME
  17068. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  17069. instead.
  17070. @item RTCSTART
  17071. The wallclock (RTC) time at the start of the movie in microseconds.
  17072. @item TB
  17073. The timebase of the input timestamps.
  17074. @end table
  17075. @subsection Examples
  17076. @itemize
  17077. @item
  17078. Start counting PTS from zero
  17079. @example
  17080. setpts=PTS-STARTPTS
  17081. @end example
  17082. @item
  17083. Apply fast motion effect:
  17084. @example
  17085. setpts=0.5*PTS
  17086. @end example
  17087. @item
  17088. Apply slow motion effect:
  17089. @example
  17090. setpts=2.0*PTS
  17091. @end example
  17092. @item
  17093. Set fixed rate of 25 frames per second:
  17094. @example
  17095. setpts=N/(25*TB)
  17096. @end example
  17097. @item
  17098. Set fixed rate 25 fps with some jitter:
  17099. @example
  17100. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  17101. @end example
  17102. @item
  17103. Apply an offset of 10 seconds to the input PTS:
  17104. @example
  17105. setpts=PTS+10/TB
  17106. @end example
  17107. @item
  17108. Generate timestamps from a "live source" and rebase onto the current timebase:
  17109. @example
  17110. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  17111. @end example
  17112. @item
  17113. Generate timestamps by counting samples:
  17114. @example
  17115. asetpts=N/SR/TB
  17116. @end example
  17117. @end itemize
  17118. @section setrange
  17119. Force color range for the output video frame.
  17120. The @code{setrange} filter marks the color range property for the
  17121. output frames. It does not change the input frame, but only sets the
  17122. corresponding property, which affects how the frame is treated by
  17123. following filters.
  17124. The filter accepts the following options:
  17125. @table @option
  17126. @item range
  17127. Available values are:
  17128. @table @samp
  17129. @item auto
  17130. Keep the same color range property.
  17131. @item unspecified, unknown
  17132. Set the color range as unspecified.
  17133. @item limited, tv, mpeg
  17134. Set the color range as limited.
  17135. @item full, pc, jpeg
  17136. Set the color range as full.
  17137. @end table
  17138. @end table
  17139. @section settb, asettb
  17140. Set the timebase to use for the output frames timestamps.
  17141. It is mainly useful for testing timebase configuration.
  17142. It accepts the following parameters:
  17143. @table @option
  17144. @item expr, tb
  17145. The expression which is evaluated into the output timebase.
  17146. @end table
  17147. The value for @option{tb} is an arithmetic expression representing a
  17148. rational. The expression can contain the constants "AVTB" (the default
  17149. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  17150. audio only). Default value is "intb".
  17151. @subsection Examples
  17152. @itemize
  17153. @item
  17154. Set the timebase to 1/25:
  17155. @example
  17156. settb=expr=1/25
  17157. @end example
  17158. @item
  17159. Set the timebase to 1/10:
  17160. @example
  17161. settb=expr=0.1
  17162. @end example
  17163. @item
  17164. Set the timebase to 1001/1000:
  17165. @example
  17166. settb=1+0.001
  17167. @end example
  17168. @item
  17169. Set the timebase to 2*intb:
  17170. @example
  17171. settb=2*intb
  17172. @end example
  17173. @item
  17174. Set the default timebase value:
  17175. @example
  17176. settb=AVTB
  17177. @end example
  17178. @end itemize
  17179. @section showcqt
  17180. Convert input audio to a video output representing frequency spectrum
  17181. logarithmically using Brown-Puckette constant Q transform algorithm with
  17182. direct frequency domain coefficient calculation (but the transform itself
  17183. is not really constant Q, instead the Q factor is actually variable/clamped),
  17184. with musical tone scale, from E0 to D#10.
  17185. The filter accepts the following options:
  17186. @table @option
  17187. @item size, s
  17188. Specify the video size for the output. It must be even. For the syntax of this option,
  17189. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17190. Default value is @code{1920x1080}.
  17191. @item fps, rate, r
  17192. Set the output frame rate. Default value is @code{25}.
  17193. @item bar_h
  17194. Set the bargraph height. It must be even. Default value is @code{-1} which
  17195. computes the bargraph height automatically.
  17196. @item axis_h
  17197. Set the axis height. It must be even. Default value is @code{-1} which computes
  17198. the axis height automatically.
  17199. @item sono_h
  17200. Set the sonogram height. It must be even. Default value is @code{-1} which
  17201. computes the sonogram height automatically.
  17202. @item fullhd
  17203. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  17204. instead. Default value is @code{1}.
  17205. @item sono_v, volume
  17206. Specify the sonogram volume expression. It can contain variables:
  17207. @table @option
  17208. @item bar_v
  17209. the @var{bar_v} evaluated expression
  17210. @item frequency, freq, f
  17211. the frequency where it is evaluated
  17212. @item timeclamp, tc
  17213. the value of @var{timeclamp} option
  17214. @end table
  17215. and functions:
  17216. @table @option
  17217. @item a_weighting(f)
  17218. A-weighting of equal loudness
  17219. @item b_weighting(f)
  17220. B-weighting of equal loudness
  17221. @item c_weighting(f)
  17222. C-weighting of equal loudness.
  17223. @end table
  17224. Default value is @code{16}.
  17225. @item bar_v, volume2
  17226. Specify the bargraph volume expression. It can contain variables:
  17227. @table @option
  17228. @item sono_v
  17229. the @var{sono_v} evaluated expression
  17230. @item frequency, freq, f
  17231. the frequency where it is evaluated
  17232. @item timeclamp, tc
  17233. the value of @var{timeclamp} option
  17234. @end table
  17235. and functions:
  17236. @table @option
  17237. @item a_weighting(f)
  17238. A-weighting of equal loudness
  17239. @item b_weighting(f)
  17240. B-weighting of equal loudness
  17241. @item c_weighting(f)
  17242. C-weighting of equal loudness.
  17243. @end table
  17244. Default value is @code{sono_v}.
  17245. @item sono_g, gamma
  17246. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  17247. higher gamma makes the spectrum having more range. Default value is @code{3}.
  17248. Acceptable range is @code{[1, 7]}.
  17249. @item bar_g, gamma2
  17250. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  17251. @code{[1, 7]}.
  17252. @item bar_t
  17253. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  17254. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  17255. @item timeclamp, tc
  17256. Specify the transform timeclamp. At low frequency, there is trade-off between
  17257. accuracy in time domain and frequency domain. If timeclamp is lower,
  17258. event in time domain is represented more accurately (such as fast bass drum),
  17259. otherwise event in frequency domain is represented more accurately
  17260. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  17261. @item attack
  17262. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  17263. limits future samples by applying asymmetric windowing in time domain, useful
  17264. when low latency is required. Accepted range is @code{[0, 1]}.
  17265. @item basefreq
  17266. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  17267. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  17268. @item endfreq
  17269. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  17270. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  17271. @item coeffclamp
  17272. This option is deprecated and ignored.
  17273. @item tlength
  17274. Specify the transform length in time domain. Use this option to control accuracy
  17275. trade-off between time domain and frequency domain at every frequency sample.
  17276. It can contain variables:
  17277. @table @option
  17278. @item frequency, freq, f
  17279. the frequency where it is evaluated
  17280. @item timeclamp, tc
  17281. the value of @var{timeclamp} option.
  17282. @end table
  17283. Default value is @code{384*tc/(384+tc*f)}.
  17284. @item count
  17285. Specify the transform count for every video frame. Default value is @code{6}.
  17286. Acceptable range is @code{[1, 30]}.
  17287. @item fcount
  17288. Specify the transform count for every single pixel. Default value is @code{0},
  17289. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  17290. @item fontfile
  17291. Specify font file for use with freetype to draw the axis. If not specified,
  17292. use embedded font. Note that drawing with font file or embedded font is not
  17293. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  17294. option instead.
  17295. @item font
  17296. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  17297. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  17298. escaping.
  17299. @item fontcolor
  17300. Specify font color expression. This is arithmetic expression that should return
  17301. integer value 0xRRGGBB. It can contain variables:
  17302. @table @option
  17303. @item frequency, freq, f
  17304. the frequency where it is evaluated
  17305. @item timeclamp, tc
  17306. the value of @var{timeclamp} option
  17307. @end table
  17308. and functions:
  17309. @table @option
  17310. @item midi(f)
  17311. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  17312. @item r(x), g(x), b(x)
  17313. red, green, and blue value of intensity x.
  17314. @end table
  17315. Default value is @code{st(0, (midi(f)-59.5)/12);
  17316. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  17317. r(1-ld(1)) + b(ld(1))}.
  17318. @item axisfile
  17319. Specify image file to draw the axis. This option override @var{fontfile} and
  17320. @var{fontcolor} option.
  17321. @item axis, text
  17322. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  17323. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  17324. Default value is @code{1}.
  17325. @item csp
  17326. Set colorspace. The accepted values are:
  17327. @table @samp
  17328. @item unspecified
  17329. Unspecified (default)
  17330. @item bt709
  17331. BT.709
  17332. @item fcc
  17333. FCC
  17334. @item bt470bg
  17335. BT.470BG or BT.601-6 625
  17336. @item smpte170m
  17337. SMPTE-170M or BT.601-6 525
  17338. @item smpte240m
  17339. SMPTE-240M
  17340. @item bt2020ncl
  17341. BT.2020 with non-constant luminance
  17342. @end table
  17343. @item cscheme
  17344. Set spectrogram color scheme. This is list of floating point values with format
  17345. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  17346. The default is @code{1|0.5|0|0|0.5|1}.
  17347. @end table
  17348. @subsection Examples
  17349. @itemize
  17350. @item
  17351. Playing audio while showing the spectrum:
  17352. @example
  17353. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  17354. @end example
  17355. @item
  17356. Same as above, but with frame rate 30 fps:
  17357. @example
  17358. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  17359. @end example
  17360. @item
  17361. Playing at 1280x720:
  17362. @example
  17363. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  17364. @end example
  17365. @item
  17366. Disable sonogram display:
  17367. @example
  17368. sono_h=0
  17369. @end example
  17370. @item
  17371. A1 and its harmonics: A1, A2, (near)E3, A3:
  17372. @example
  17373. 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),
  17374. asplit[a][out1]; [a] showcqt [out0]'
  17375. @end example
  17376. @item
  17377. Same as above, but with more accuracy in frequency domain:
  17378. @example
  17379. 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),
  17380. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  17381. @end example
  17382. @item
  17383. Custom volume:
  17384. @example
  17385. bar_v=10:sono_v=bar_v*a_weighting(f)
  17386. @end example
  17387. @item
  17388. Custom gamma, now spectrum is linear to the amplitude.
  17389. @example
  17390. bar_g=2:sono_g=2
  17391. @end example
  17392. @item
  17393. Custom tlength equation:
  17394. @example
  17395. 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)))'
  17396. @end example
  17397. @item
  17398. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  17399. @example
  17400. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  17401. @end example
  17402. @item
  17403. Custom font using fontconfig:
  17404. @example
  17405. font='Courier New,Monospace,mono|bold'
  17406. @end example
  17407. @item
  17408. Custom frequency range with custom axis using image file:
  17409. @example
  17410. axisfile=myaxis.png:basefreq=40:endfreq=10000
  17411. @end example
  17412. @end itemize
  17413. @section showfreqs
  17414. Convert input audio to video output representing the audio power spectrum.
  17415. Audio amplitude is on Y-axis while frequency is on X-axis.
  17416. The filter accepts the following options:
  17417. @table @option
  17418. @item size, s
  17419. Specify size of video. For the syntax of this option, check the
  17420. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17421. Default is @code{1024x512}.
  17422. @item mode
  17423. Set display mode.
  17424. This set how each frequency bin will be represented.
  17425. It accepts the following values:
  17426. @table @samp
  17427. @item line
  17428. @item bar
  17429. @item dot
  17430. @end table
  17431. Default is @code{bar}.
  17432. @item ascale
  17433. Set amplitude scale.
  17434. It accepts the following values:
  17435. @table @samp
  17436. @item lin
  17437. Linear scale.
  17438. @item sqrt
  17439. Square root scale.
  17440. @item cbrt
  17441. Cubic root scale.
  17442. @item log
  17443. Logarithmic scale.
  17444. @end table
  17445. Default is @code{log}.
  17446. @item fscale
  17447. Set frequency scale.
  17448. It accepts the following values:
  17449. @table @samp
  17450. @item lin
  17451. Linear scale.
  17452. @item log
  17453. Logarithmic scale.
  17454. @item rlog
  17455. Reverse logarithmic scale.
  17456. @end table
  17457. Default is @code{lin}.
  17458. @item win_size
  17459. Set window size. Allowed range is from 16 to 65536.
  17460. Default is @code{2048}
  17461. @item win_func
  17462. Set windowing function.
  17463. It accepts the following values:
  17464. @table @samp
  17465. @item rect
  17466. @item bartlett
  17467. @item hanning
  17468. @item hamming
  17469. @item blackman
  17470. @item welch
  17471. @item flattop
  17472. @item bharris
  17473. @item bnuttall
  17474. @item bhann
  17475. @item sine
  17476. @item nuttall
  17477. @item lanczos
  17478. @item gauss
  17479. @item tukey
  17480. @item dolph
  17481. @item cauchy
  17482. @item parzen
  17483. @item poisson
  17484. @item bohman
  17485. @end table
  17486. Default is @code{hanning}.
  17487. @item overlap
  17488. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17489. which means optimal overlap for selected window function will be picked.
  17490. @item averaging
  17491. Set time averaging. Setting this to 0 will display current maximal peaks.
  17492. Default is @code{1}, which means time averaging is disabled.
  17493. @item colors
  17494. Specify list of colors separated by space or by '|' which will be used to
  17495. draw channel frequencies. Unrecognized or missing colors will be replaced
  17496. by white color.
  17497. @item cmode
  17498. Set channel display mode.
  17499. It accepts the following values:
  17500. @table @samp
  17501. @item combined
  17502. @item separate
  17503. @end table
  17504. Default is @code{combined}.
  17505. @item minamp
  17506. Set minimum amplitude used in @code{log} amplitude scaler.
  17507. @end table
  17508. @section showspatial
  17509. Convert stereo input audio to a video output, representing the spatial relationship
  17510. between two channels.
  17511. The filter accepts the following options:
  17512. @table @option
  17513. @item size, s
  17514. Specify the video size for the output. For the syntax of this option, check the
  17515. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17516. Default value is @code{512x512}.
  17517. @item win_size
  17518. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  17519. @item win_func
  17520. Set window function.
  17521. It accepts the following values:
  17522. @table @samp
  17523. @item rect
  17524. @item bartlett
  17525. @item hann
  17526. @item hanning
  17527. @item hamming
  17528. @item blackman
  17529. @item welch
  17530. @item flattop
  17531. @item bharris
  17532. @item bnuttall
  17533. @item bhann
  17534. @item sine
  17535. @item nuttall
  17536. @item lanczos
  17537. @item gauss
  17538. @item tukey
  17539. @item dolph
  17540. @item cauchy
  17541. @item parzen
  17542. @item poisson
  17543. @item bohman
  17544. @end table
  17545. Default value is @code{hann}.
  17546. @item overlap
  17547. Set ratio of overlap window. Default value is @code{0.5}.
  17548. When value is @code{1} overlap is set to recommended size for specific
  17549. window function currently used.
  17550. @end table
  17551. @anchor{showspectrum}
  17552. @section showspectrum
  17553. Convert input audio to a video output, representing the audio frequency
  17554. spectrum.
  17555. The filter accepts the following options:
  17556. @table @option
  17557. @item size, s
  17558. Specify the video size for the output. For the syntax of this option, check the
  17559. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17560. Default value is @code{640x512}.
  17561. @item slide
  17562. Specify how the spectrum should slide along the window.
  17563. It accepts the following values:
  17564. @table @samp
  17565. @item replace
  17566. the samples start again on the left when they reach the right
  17567. @item scroll
  17568. the samples scroll from right to left
  17569. @item fullframe
  17570. frames are only produced when the samples reach the right
  17571. @item rscroll
  17572. the samples scroll from left to right
  17573. @end table
  17574. Default value is @code{replace}.
  17575. @item mode
  17576. Specify display mode.
  17577. It accepts the following values:
  17578. @table @samp
  17579. @item combined
  17580. all channels are displayed in the same row
  17581. @item separate
  17582. all channels are displayed in separate rows
  17583. @end table
  17584. Default value is @samp{combined}.
  17585. @item color
  17586. Specify display color mode.
  17587. It accepts the following values:
  17588. @table @samp
  17589. @item channel
  17590. each channel is displayed in a separate color
  17591. @item intensity
  17592. each channel is displayed using the same color scheme
  17593. @item rainbow
  17594. each channel is displayed using the rainbow color scheme
  17595. @item moreland
  17596. each channel is displayed using the moreland color scheme
  17597. @item nebulae
  17598. each channel is displayed using the nebulae color scheme
  17599. @item fire
  17600. each channel is displayed using the fire color scheme
  17601. @item fiery
  17602. each channel is displayed using the fiery color scheme
  17603. @item fruit
  17604. each channel is displayed using the fruit color scheme
  17605. @item cool
  17606. each channel is displayed using the cool color scheme
  17607. @item magma
  17608. each channel is displayed using the magma color scheme
  17609. @item green
  17610. each channel is displayed using the green color scheme
  17611. @item viridis
  17612. each channel is displayed using the viridis color scheme
  17613. @item plasma
  17614. each channel is displayed using the plasma color scheme
  17615. @item cividis
  17616. each channel is displayed using the cividis color scheme
  17617. @item terrain
  17618. each channel is displayed using the terrain color scheme
  17619. @end table
  17620. Default value is @samp{channel}.
  17621. @item scale
  17622. Specify scale used for calculating intensity color values.
  17623. It accepts the following values:
  17624. @table @samp
  17625. @item lin
  17626. linear
  17627. @item sqrt
  17628. square root, default
  17629. @item cbrt
  17630. cubic root
  17631. @item log
  17632. logarithmic
  17633. @item 4thrt
  17634. 4th root
  17635. @item 5thrt
  17636. 5th root
  17637. @end table
  17638. Default value is @samp{sqrt}.
  17639. @item fscale
  17640. Specify frequency scale.
  17641. It accepts the following values:
  17642. @table @samp
  17643. @item lin
  17644. linear
  17645. @item log
  17646. logarithmic
  17647. @end table
  17648. Default value is @samp{lin}.
  17649. @item saturation
  17650. Set saturation modifier for displayed colors. Negative values provide
  17651. alternative color scheme. @code{0} is no saturation at all.
  17652. Saturation must be in [-10.0, 10.0] range.
  17653. Default value is @code{1}.
  17654. @item win_func
  17655. Set window function.
  17656. It accepts the following values:
  17657. @table @samp
  17658. @item rect
  17659. @item bartlett
  17660. @item hann
  17661. @item hanning
  17662. @item hamming
  17663. @item blackman
  17664. @item welch
  17665. @item flattop
  17666. @item bharris
  17667. @item bnuttall
  17668. @item bhann
  17669. @item sine
  17670. @item nuttall
  17671. @item lanczos
  17672. @item gauss
  17673. @item tukey
  17674. @item dolph
  17675. @item cauchy
  17676. @item parzen
  17677. @item poisson
  17678. @item bohman
  17679. @end table
  17680. Default value is @code{hann}.
  17681. @item orientation
  17682. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17683. @code{horizontal}. Default is @code{vertical}.
  17684. @item overlap
  17685. Set ratio of overlap window. Default value is @code{0}.
  17686. When value is @code{1} overlap is set to recommended size for specific
  17687. window function currently used.
  17688. @item gain
  17689. Set scale gain for calculating intensity color values.
  17690. Default value is @code{1}.
  17691. @item data
  17692. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  17693. @item rotation
  17694. Set color rotation, must be in [-1.0, 1.0] range.
  17695. Default value is @code{0}.
  17696. @item start
  17697. Set start frequency from which to display spectrogram. Default is @code{0}.
  17698. @item stop
  17699. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17700. @item fps
  17701. Set upper frame rate limit. Default is @code{auto}, unlimited.
  17702. @item legend
  17703. Draw time and frequency axes and legends. Default is disabled.
  17704. @end table
  17705. The usage is very similar to the showwaves filter; see the examples in that
  17706. section.
  17707. @subsection Examples
  17708. @itemize
  17709. @item
  17710. Large window with logarithmic color scaling:
  17711. @example
  17712. showspectrum=s=1280x480:scale=log
  17713. @end example
  17714. @item
  17715. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  17716. @example
  17717. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  17718. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  17719. @end example
  17720. @end itemize
  17721. @section showspectrumpic
  17722. Convert input audio to a single video frame, representing the audio frequency
  17723. spectrum.
  17724. The filter accepts the following options:
  17725. @table @option
  17726. @item size, s
  17727. Specify the video size for the output. For the syntax of this option, check the
  17728. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17729. Default value is @code{4096x2048}.
  17730. @item mode
  17731. Specify display mode.
  17732. It accepts the following values:
  17733. @table @samp
  17734. @item combined
  17735. all channels are displayed in the same row
  17736. @item separate
  17737. all channels are displayed in separate rows
  17738. @end table
  17739. Default value is @samp{combined}.
  17740. @item color
  17741. Specify display color mode.
  17742. It accepts the following values:
  17743. @table @samp
  17744. @item channel
  17745. each channel is displayed in a separate color
  17746. @item intensity
  17747. each channel is displayed using the same color scheme
  17748. @item rainbow
  17749. each channel is displayed using the rainbow color scheme
  17750. @item moreland
  17751. each channel is displayed using the moreland color scheme
  17752. @item nebulae
  17753. each channel is displayed using the nebulae color scheme
  17754. @item fire
  17755. each channel is displayed using the fire color scheme
  17756. @item fiery
  17757. each channel is displayed using the fiery color scheme
  17758. @item fruit
  17759. each channel is displayed using the fruit color scheme
  17760. @item cool
  17761. each channel is displayed using the cool color scheme
  17762. @item magma
  17763. each channel is displayed using the magma color scheme
  17764. @item green
  17765. each channel is displayed using the green color scheme
  17766. @item viridis
  17767. each channel is displayed using the viridis color scheme
  17768. @item plasma
  17769. each channel is displayed using the plasma color scheme
  17770. @item cividis
  17771. each channel is displayed using the cividis color scheme
  17772. @item terrain
  17773. each channel is displayed using the terrain color scheme
  17774. @end table
  17775. Default value is @samp{intensity}.
  17776. @item scale
  17777. Specify scale used for calculating intensity color values.
  17778. It accepts the following values:
  17779. @table @samp
  17780. @item lin
  17781. linear
  17782. @item sqrt
  17783. square root, default
  17784. @item cbrt
  17785. cubic root
  17786. @item log
  17787. logarithmic
  17788. @item 4thrt
  17789. 4th root
  17790. @item 5thrt
  17791. 5th root
  17792. @end table
  17793. Default value is @samp{log}.
  17794. @item fscale
  17795. Specify frequency scale.
  17796. It accepts the following values:
  17797. @table @samp
  17798. @item lin
  17799. linear
  17800. @item log
  17801. logarithmic
  17802. @end table
  17803. Default value is @samp{lin}.
  17804. @item saturation
  17805. Set saturation modifier for displayed colors. Negative values provide
  17806. alternative color scheme. @code{0} is no saturation at all.
  17807. Saturation must be in [-10.0, 10.0] range.
  17808. Default value is @code{1}.
  17809. @item win_func
  17810. Set window function.
  17811. It accepts the following values:
  17812. @table @samp
  17813. @item rect
  17814. @item bartlett
  17815. @item hann
  17816. @item hanning
  17817. @item hamming
  17818. @item blackman
  17819. @item welch
  17820. @item flattop
  17821. @item bharris
  17822. @item bnuttall
  17823. @item bhann
  17824. @item sine
  17825. @item nuttall
  17826. @item lanczos
  17827. @item gauss
  17828. @item tukey
  17829. @item dolph
  17830. @item cauchy
  17831. @item parzen
  17832. @item poisson
  17833. @item bohman
  17834. @end table
  17835. Default value is @code{hann}.
  17836. @item orientation
  17837. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17838. @code{horizontal}. Default is @code{vertical}.
  17839. @item gain
  17840. Set scale gain for calculating intensity color values.
  17841. Default value is @code{1}.
  17842. @item legend
  17843. Draw time and frequency axes and legends. Default is enabled.
  17844. @item rotation
  17845. Set color rotation, must be in [-1.0, 1.0] range.
  17846. Default value is @code{0}.
  17847. @item start
  17848. Set start frequency from which to display spectrogram. Default is @code{0}.
  17849. @item stop
  17850. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17851. @end table
  17852. @subsection Examples
  17853. @itemize
  17854. @item
  17855. Extract an audio spectrogram of a whole audio track
  17856. in a 1024x1024 picture using @command{ffmpeg}:
  17857. @example
  17858. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  17859. @end example
  17860. @end itemize
  17861. @section showvolume
  17862. Convert input audio volume to a video output.
  17863. The filter accepts the following options:
  17864. @table @option
  17865. @item rate, r
  17866. Set video rate.
  17867. @item b
  17868. Set border width, allowed range is [0, 5]. Default is 1.
  17869. @item w
  17870. Set channel width, allowed range is [80, 8192]. Default is 400.
  17871. @item h
  17872. Set channel height, allowed range is [1, 900]. Default is 20.
  17873. @item f
  17874. Set fade, allowed range is [0, 1]. Default is 0.95.
  17875. @item c
  17876. Set volume color expression.
  17877. The expression can use the following variables:
  17878. @table @option
  17879. @item VOLUME
  17880. Current max volume of channel in dB.
  17881. @item PEAK
  17882. Current peak.
  17883. @item CHANNEL
  17884. Current channel number, starting from 0.
  17885. @end table
  17886. @item t
  17887. If set, displays channel names. Default is enabled.
  17888. @item v
  17889. If set, displays volume values. Default is enabled.
  17890. @item o
  17891. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  17892. default is @code{h}.
  17893. @item s
  17894. Set step size, allowed range is [0, 5]. Default is 0, which means
  17895. step is disabled.
  17896. @item p
  17897. Set background opacity, allowed range is [0, 1]. Default is 0.
  17898. @item m
  17899. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17900. default is @code{p}.
  17901. @item ds
  17902. Set display scale, can be linear: @code{lin} or log: @code{log},
  17903. default is @code{lin}.
  17904. @item dm
  17905. In second.
  17906. If set to > 0., display a line for the max level
  17907. in the previous seconds.
  17908. default is disabled: @code{0.}
  17909. @item dmc
  17910. The color of the max line. Use when @code{dm} option is set to > 0.
  17911. default is: @code{orange}
  17912. @end table
  17913. @section showwaves
  17914. Convert input audio to a video output, representing the samples waves.
  17915. The filter accepts the following options:
  17916. @table @option
  17917. @item size, s
  17918. Specify the video size for the output. For the syntax of this option, check the
  17919. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17920. Default value is @code{600x240}.
  17921. @item mode
  17922. Set display mode.
  17923. Available values are:
  17924. @table @samp
  17925. @item point
  17926. Draw a point for each sample.
  17927. @item line
  17928. Draw a vertical line for each sample.
  17929. @item p2p
  17930. Draw a point for each sample and a line between them.
  17931. @item cline
  17932. Draw a centered vertical line for each sample.
  17933. @end table
  17934. Default value is @code{point}.
  17935. @item n
  17936. Set the number of samples which are printed on the same column. A
  17937. larger value will decrease the frame rate. Must be a positive
  17938. integer. This option can be set only if the value for @var{rate}
  17939. is not explicitly specified.
  17940. @item rate, r
  17941. Set the (approximate) output frame rate. This is done by setting the
  17942. option @var{n}. Default value is "25".
  17943. @item split_channels
  17944. Set if channels should be drawn separately or overlap. Default value is 0.
  17945. @item colors
  17946. Set colors separated by '|' which are going to be used for drawing of each channel.
  17947. @item scale
  17948. Set amplitude scale.
  17949. Available values are:
  17950. @table @samp
  17951. @item lin
  17952. Linear.
  17953. @item log
  17954. Logarithmic.
  17955. @item sqrt
  17956. Square root.
  17957. @item cbrt
  17958. Cubic root.
  17959. @end table
  17960. Default is linear.
  17961. @item draw
  17962. Set the draw mode. This is mostly useful to set for high @var{n}.
  17963. Available values are:
  17964. @table @samp
  17965. @item scale
  17966. Scale pixel values for each drawn sample.
  17967. @item full
  17968. Draw every sample directly.
  17969. @end table
  17970. Default value is @code{scale}.
  17971. @end table
  17972. @subsection Examples
  17973. @itemize
  17974. @item
  17975. Output the input file audio and the corresponding video representation
  17976. at the same time:
  17977. @example
  17978. amovie=a.mp3,asplit[out0],showwaves[out1]
  17979. @end example
  17980. @item
  17981. Create a synthetic signal and show it with showwaves, forcing a
  17982. frame rate of 30 frames per second:
  17983. @example
  17984. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17985. @end example
  17986. @end itemize
  17987. @section showwavespic
  17988. Convert input audio to a single video frame, representing the samples waves.
  17989. The filter accepts the following options:
  17990. @table @option
  17991. @item size, s
  17992. Specify the video size for the output. For the syntax of this option, check the
  17993. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17994. Default value is @code{600x240}.
  17995. @item split_channels
  17996. Set if channels should be drawn separately or overlap. Default value is 0.
  17997. @item colors
  17998. Set colors separated by '|' which are going to be used for drawing of each channel.
  17999. @item scale
  18000. Set amplitude scale.
  18001. Available values are:
  18002. @table @samp
  18003. @item lin
  18004. Linear.
  18005. @item log
  18006. Logarithmic.
  18007. @item sqrt
  18008. Square root.
  18009. @item cbrt
  18010. Cubic root.
  18011. @end table
  18012. Default is linear.
  18013. @item draw
  18014. Set the draw mode.
  18015. Available values are:
  18016. @table @samp
  18017. @item scale
  18018. Scale pixel values for each drawn sample.
  18019. @item full
  18020. Draw every sample directly.
  18021. @end table
  18022. Default value is @code{scale}.
  18023. @end table
  18024. @subsection Examples
  18025. @itemize
  18026. @item
  18027. Extract a channel split representation of the wave form of a whole audio track
  18028. in a 1024x800 picture using @command{ffmpeg}:
  18029. @example
  18030. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  18031. @end example
  18032. @end itemize
  18033. @section sidedata, asidedata
  18034. Delete frame side data, or select frames based on it.
  18035. This filter accepts the following options:
  18036. @table @option
  18037. @item mode
  18038. Set mode of operation of the filter.
  18039. Can be one of the following:
  18040. @table @samp
  18041. @item select
  18042. Select every frame with side data of @code{type}.
  18043. @item delete
  18044. Delete side data of @code{type}. If @code{type} is not set, delete all side
  18045. data in the frame.
  18046. @end table
  18047. @item type
  18048. Set side data type used with all modes. Must be set for @code{select} mode. For
  18049. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  18050. in @file{libavutil/frame.h}. For example, to choose
  18051. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  18052. @end table
  18053. @section spectrumsynth
  18054. Sythesize audio from 2 input video spectrums, first input stream represents
  18055. magnitude across time and second represents phase across time.
  18056. The filter will transform from frequency domain as displayed in videos back
  18057. to time domain as presented in audio output.
  18058. This filter is primarily created for reversing processed @ref{showspectrum}
  18059. filter outputs, but can synthesize sound from other spectrograms too.
  18060. But in such case results are going to be poor if the phase data is not
  18061. available, because in such cases phase data need to be recreated, usually
  18062. it's just recreated from random noise.
  18063. For best results use gray only output (@code{channel} color mode in
  18064. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  18065. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  18066. @code{data} option. Inputs videos should generally use @code{fullframe}
  18067. slide mode as that saves resources needed for decoding video.
  18068. The filter accepts the following options:
  18069. @table @option
  18070. @item sample_rate
  18071. Specify sample rate of output audio, the sample rate of audio from which
  18072. spectrum was generated may differ.
  18073. @item channels
  18074. Set number of channels represented in input video spectrums.
  18075. @item scale
  18076. Set scale which was used when generating magnitude input spectrum.
  18077. Can be @code{lin} or @code{log}. Default is @code{log}.
  18078. @item slide
  18079. Set slide which was used when generating inputs spectrums.
  18080. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  18081. Default is @code{fullframe}.
  18082. @item win_func
  18083. Set window function used for resynthesis.
  18084. @item overlap
  18085. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  18086. which means optimal overlap for selected window function will be picked.
  18087. @item orientation
  18088. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  18089. Default is @code{vertical}.
  18090. @end table
  18091. @subsection Examples
  18092. @itemize
  18093. @item
  18094. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  18095. then resynthesize videos back to audio with spectrumsynth:
  18096. @example
  18097. 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
  18098. 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
  18099. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  18100. @end example
  18101. @end itemize
  18102. @section split, asplit
  18103. Split input into several identical outputs.
  18104. @code{asplit} works with audio input, @code{split} with video.
  18105. The filter accepts a single parameter which specifies the number of outputs. If
  18106. unspecified, it defaults to 2.
  18107. @subsection Examples
  18108. @itemize
  18109. @item
  18110. Create two separate outputs from the same input:
  18111. @example
  18112. [in] split [out0][out1]
  18113. @end example
  18114. @item
  18115. To create 3 or more outputs, you need to specify the number of
  18116. outputs, like in:
  18117. @example
  18118. [in] asplit=3 [out0][out1][out2]
  18119. @end example
  18120. @item
  18121. Create two separate outputs from the same input, one cropped and
  18122. one padded:
  18123. @example
  18124. [in] split [splitout1][splitout2];
  18125. [splitout1] crop=100:100:0:0 [cropout];
  18126. [splitout2] pad=200:200:100:100 [padout];
  18127. @end example
  18128. @item
  18129. Create 5 copies of the input audio with @command{ffmpeg}:
  18130. @example
  18131. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  18132. @end example
  18133. @end itemize
  18134. @section zmq, azmq
  18135. Receive commands sent through a libzmq client, and forward them to
  18136. filters in the filtergraph.
  18137. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  18138. must be inserted between two video filters, @code{azmq} between two
  18139. audio filters. Both are capable to send messages to any filter type.
  18140. To enable these filters you need to install the libzmq library and
  18141. headers and configure FFmpeg with @code{--enable-libzmq}.
  18142. For more information about libzmq see:
  18143. @url{http://www.zeromq.org/}
  18144. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  18145. receives messages sent through a network interface defined by the
  18146. @option{bind_address} (or the abbreviation "@option{b}") option.
  18147. Default value of this option is @file{tcp://localhost:5555}. You may
  18148. want to alter this value to your needs, but do not forget to escape any
  18149. ':' signs (see @ref{filtergraph escaping}).
  18150. The received message must be in the form:
  18151. @example
  18152. @var{TARGET} @var{COMMAND} [@var{ARG}]
  18153. @end example
  18154. @var{TARGET} specifies the target of the command, usually the name of
  18155. the filter class or a specific filter instance name. The default
  18156. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  18157. but you can override this by using the @samp{filter_name@@id} syntax
  18158. (see @ref{Filtergraph syntax}).
  18159. @var{COMMAND} specifies the name of the command for the target filter.
  18160. @var{ARG} is optional and specifies the optional argument list for the
  18161. given @var{COMMAND}.
  18162. Upon reception, the message is processed and the corresponding command
  18163. is injected into the filtergraph. Depending on the result, the filter
  18164. will send a reply to the client, adopting the format:
  18165. @example
  18166. @var{ERROR_CODE} @var{ERROR_REASON}
  18167. @var{MESSAGE}
  18168. @end example
  18169. @var{MESSAGE} is optional.
  18170. @subsection Examples
  18171. Look at @file{tools/zmqsend} for an example of a zmq client which can
  18172. be used to send commands processed by these filters.
  18173. Consider the following filtergraph generated by @command{ffplay}.
  18174. In this example the last overlay filter has an instance name. All other
  18175. filters will have default instance names.
  18176. @example
  18177. ffplay -dumpgraph 1 -f lavfi "
  18178. color=s=100x100:c=red [l];
  18179. color=s=100x100:c=blue [r];
  18180. nullsrc=s=200x100, zmq [bg];
  18181. [bg][l] overlay [bg+l];
  18182. [bg+l][r] overlay@@my=x=100 "
  18183. @end example
  18184. To change the color of the left side of the video, the following
  18185. command can be used:
  18186. @example
  18187. echo Parsed_color_0 c yellow | tools/zmqsend
  18188. @end example
  18189. To change the right side:
  18190. @example
  18191. echo Parsed_color_1 c pink | tools/zmqsend
  18192. @end example
  18193. To change the position of the right side:
  18194. @example
  18195. echo overlay@@my x 150 | tools/zmqsend
  18196. @end example
  18197. @c man end MULTIMEDIA FILTERS
  18198. @chapter Multimedia Sources
  18199. @c man begin MULTIMEDIA SOURCES
  18200. Below is a description of the currently available multimedia sources.
  18201. @section amovie
  18202. This is the same as @ref{movie} source, except it selects an audio
  18203. stream by default.
  18204. @anchor{movie}
  18205. @section movie
  18206. Read audio and/or video stream(s) from a movie container.
  18207. It accepts the following parameters:
  18208. @table @option
  18209. @item filename
  18210. The name of the resource to read (not necessarily a file; it can also be a
  18211. device or a stream accessed through some protocol).
  18212. @item format_name, f
  18213. Specifies the format assumed for the movie to read, and can be either
  18214. the name of a container or an input device. If not specified, the
  18215. format is guessed from @var{movie_name} or by probing.
  18216. @item seek_point, sp
  18217. Specifies the seek point in seconds. The frames will be output
  18218. starting from this seek point. The parameter is evaluated with
  18219. @code{av_strtod}, so the numerical value may be suffixed by an IS
  18220. postfix. The default value is "0".
  18221. @item streams, s
  18222. Specifies the streams to read. Several streams can be specified,
  18223. separated by "+". The source will then have as many outputs, in the
  18224. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  18225. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  18226. respectively the default (best suited) video and audio stream. Default
  18227. is "dv", or "da" if the filter is called as "amovie".
  18228. @item stream_index, si
  18229. Specifies the index of the video stream to read. If the value is -1,
  18230. the most suitable video stream will be automatically selected. The default
  18231. value is "-1". Deprecated. If the filter is called "amovie", it will select
  18232. audio instead of video.
  18233. @item loop
  18234. Specifies how many times to read the stream in sequence.
  18235. If the value is 0, the stream will be looped infinitely.
  18236. Default value is "1".
  18237. Note that when the movie is looped the source timestamps are not
  18238. changed, so it will generate non monotonically increasing timestamps.
  18239. @item discontinuity
  18240. Specifies the time difference between frames above which the point is
  18241. considered a timestamp discontinuity which is removed by adjusting the later
  18242. timestamps.
  18243. @end table
  18244. It allows overlaying a second video on top of the main input of
  18245. a filtergraph, as shown in this graph:
  18246. @example
  18247. input -----------> deltapts0 --> overlay --> output
  18248. ^
  18249. |
  18250. movie --> scale--> deltapts1 -------+
  18251. @end example
  18252. @subsection Examples
  18253. @itemize
  18254. @item
  18255. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  18256. on top of the input labelled "in":
  18257. @example
  18258. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18259. [in] setpts=PTS-STARTPTS [main];
  18260. [main][over] overlay=16:16 [out]
  18261. @end example
  18262. @item
  18263. Read from a video4linux2 device, and overlay it on top of the input
  18264. labelled "in":
  18265. @example
  18266. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  18267. [in] setpts=PTS-STARTPTS [main];
  18268. [main][over] overlay=16:16 [out]
  18269. @end example
  18270. @item
  18271. Read the first video stream and the audio stream with id 0x81 from
  18272. dvd.vob; the video is connected to the pad named "video" and the audio is
  18273. connected to the pad named "audio":
  18274. @example
  18275. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  18276. @end example
  18277. @end itemize
  18278. @subsection Commands
  18279. Both movie and amovie support the following commands:
  18280. @table @option
  18281. @item seek
  18282. Perform seek using "av_seek_frame".
  18283. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  18284. @itemize
  18285. @item
  18286. @var{stream_index}: If stream_index is -1, a default
  18287. stream is selected, and @var{timestamp} is automatically converted
  18288. from AV_TIME_BASE units to the stream specific time_base.
  18289. @item
  18290. @var{timestamp}: Timestamp in AVStream.time_base units
  18291. or, if no stream is specified, in AV_TIME_BASE units.
  18292. @item
  18293. @var{flags}: Flags which select direction and seeking mode.
  18294. @end itemize
  18295. @item get_duration
  18296. Get movie duration in AV_TIME_BASE units.
  18297. @end table
  18298. @c man end MULTIMEDIA SOURCES